1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-05 12:42:22 +03:00

boards.txt generator (#3722)

+ generates boards.rst
+ generate and replace boards section in package.json
+ generate ldscripts
+ new debug option: OOM
+ new led menu for generic board
This commit is contained in:
david gauchard
2018-01-08 15:06:01 +01:00
committed by Develo
parent 4b319d9b0c
commit 28253c5bd3
8 changed files with 1772 additions and 155 deletions

View File

@ -32,13 +32,6 @@ void* _calloc_r(struct _reent* unused, size_t count, size_t size)
return calloc(count, size);
}
void* ICACHE_RAM_ATTR pvPortMalloc(size_t size, const char* file, int line)
{
(void) file;
(void) line;
return malloc(size);
}
void ICACHE_RAM_ATTR vPortFree(void *ptr, const char* file, int line)
{
(void) file;
@ -46,6 +39,100 @@ void ICACHE_RAM_ATTR vPortFree(void *ptr, const char* file, int line)
free(ptr);
}
#ifdef DEBUG_ESP_OOM
void* ICACHE_RAM_ATTR pvPortMalloc(size_t size, const char* file, int line)
{
return malloc_loc(size, file, line);
}
void* ICACHE_RAM_ATTR pvPortCalloc(size_t count, size_t size, const char* file, int line)
{
return calloc_loc(count, size, file, line);
}
void* ICACHE_RAM_ATTR pvPortRealloc(void *ptr, size_t size, const char* file, int line)
{
return realloc_loc(ptr, size, file, line);
}
void* ICACHE_RAM_ATTR pvPortZalloc(size_t size, const char* file, int line)
{
return calloc_loc(1, size, file, line);
}
#undef malloc
#undef calloc
#undef realloc
static const char oom_fmt[] ICACHE_RODATA_ATTR STORE_ATTR = ":oom(%d)@?\n";
static const char oom_fmt_1[] ICACHE_RODATA_ATTR STORE_ATTR = ":oom(%d)@";
static const char oom_fmt_2[] ICACHE_RODATA_ATTR STORE_ATTR = ":%d\n";
void* malloc (size_t s)
{
void* ret = umm_malloc(s);
if (!ret)
os_printf(oom_fmt, (int)s);
return ret;
}
void* calloc (size_t n, size_t s)
{
void* ret = umm_calloc(n, s);
if (!ret)
os_printf(oom_fmt, (int)s);
return ret;
}
void* realloc (void* p, size_t s)
{
void* ret = umm_realloc(p, s);
if (!ret)
os_printf(oom_fmt, (int)s);
return ret;
}
void print_loc (size_t s, const char* file, int line)
{
os_printf(oom_fmt_1, (int)s);
os_printf(file);
os_printf(oom_fmt_2, line);
}
void* malloc_loc (size_t s, const char* file, int line)
{
void* ret = umm_malloc(s);
if (!ret)
print_loc(s, file, line);
return ret;
}
void* calloc_loc (size_t n, size_t s, const char* file, int line)
{
void* ret = umm_calloc(n, s);
if (!ret)
print_loc(s, file, line);
return ret;
}
void* realloc_loc (void* p, size_t s, const char* file, int line)
{
void* ret = umm_realloc(p, s);
if (!ret)
print_loc(s, file, line);
return ret;
}
#else
void* ICACHE_RAM_ATTR pvPortMalloc(size_t size, const char* file, int line)
{
(void) file;
(void) line;
return malloc(size);
}
void* ICACHE_RAM_ATTR pvPortCalloc(size_t count, size_t size, const char* file, int line)
{
(void) file;
@ -67,6 +154,8 @@ void* ICACHE_RAM_ATTR pvPortZalloc(size_t size, const char* file, int line)
return calloc(1, size);
}
#endif // !defined(DEBUG_ESP_OOM)
size_t xPortGetFreeHeapSize(void)
{
return umm_free_heap_size();