varch/test/test_vstd.c
2024-11-16 13:36:54 +08:00

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