lwmem/dev/main.cpp

40 lines
817 B
C++
Raw Normal View History

2022-01-08 16:12:49 +01:00
#include <iostream>
2022-09-01 19:05:40 +02:00
#include <stdint.h>
#include <string.h>
2023-11-20 21:32:57 +01:00
#include "lwmem/lwmem.h"
#include "lwmem/lwmem.hpp"
2022-01-08 15:43:57 +01:00
extern "C" void lwmem_test_run(void);
extern "C" void lwmem_test_simple_run(void);
2022-01-08 15:43:57 +01:00
extern "C" void lwmem_test_memory_structure(void);
extern "C" void lwmem_test_region(void);
2025-01-04 23:05:09 +01:00
extern "C" void lwmem_test_available_mem(void);
2022-01-08 15:43:57 +01:00
2022-01-14 23:07:44 +01:00
/* Setup manager */
static Lwmem::LwmemLight<1024> manager;
2022-01-08 15:43:57 +01:00
int
main(void) {
2025-01-04 23:05:09 +01:00
lwmem_test_available_mem();
return 0;
lwmem_test_region();
return 0;
2024-10-09 15:49:23 +02:00
#if LWMEM_CFG_FULL
2022-01-14 23:07:44 +01:00
lwmem_test_memory_structure();
2022-01-08 15:43:57 +01:00
//lwmem_test_run();
#else
lwmem_test_simple_run();
#endif
2022-01-08 15:43:57 +01:00
#if 1
2022-01-14 23:07:44 +01:00
/* Test C++ code */
2022-01-08 15:43:57 +01:00
void* ret = manager.malloc(123);
2022-01-08 16:12:49 +01:00
std::cout << ret << std::endl;
2024-10-09 15:49:23 +02:00
#if LWMEM_CFG_FULL
2022-01-08 15:43:57 +01:00
manager.free(ret);
2024-10-09 15:49:23 +02:00
#endif /* LWMEM_CFG_FULL */
#endif
2022-01-08 15:43:57 +01:00
return 0;
}