#if defined(TEST_TARGET_vstd) #include #include #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