mirror of
https://gitee.com/Lamdonn/varch.git
synced 2025-12-08 01:36:42 +08:00
50 lines
782 B
C
50 lines
782 B
C
|
|
#if defined(TEST_TARGET_vstd)
|
|
#include <varch/vstdlib.h>
|
|
#include <varch/vmem.h>
|
|
#else
|
|
#include "init.h"
|
|
#include "vstdlib.h"
|
|
#include "vmem.h"
|
|
#endif
|
|
|
|
extern int printf (const char *__format, ...);
|
|
|
|
static int test(int argc, char *argv[])
|
|
{
|
|
uint8_t *p;
|
|
|
|
printf("used %d\r\n", vmem_used());
|
|
|
|
p = v_malloc(2048);
|
|
if (!p)
|
|
{
|
|
printf("malloc fail!\r\n");
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
printf("malloc success!\r\n");
|
|
}
|
|
|
|
printf("used %d\r\n", vmem_used());
|
|
|
|
v_free(p);
|
|
|
|
printf("used %d\r\n", vmem_used());
|
|
|
|
return 0;
|
|
}
|
|
|
|
#if defined(TEST_TARGET_vstd)
|
|
int main(int argc, char *argv[])
|
|
{
|
|
return test(argc, argv);
|
|
}
|
|
#else
|
|
void test_vstd(void)
|
|
{
|
|
command_export("vstd", test);
|
|
}
|
|
init_export_app(test_vstd);
|
|
#endif |