cpu/esp_common: fix bootloop on ESP8266

(cherry picked from commit 6c4f0da7a76d874054493bf30980fb331d330497)
This commit is contained in:
Marian Buschsieweke 2021-07-13 20:48:01 +02:00
parent efd80adc84
commit a20bd7cba6
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F
2 changed files with 3 additions and 3 deletions

View File

@ -88,7 +88,7 @@ LINKFLAGS += -nostdlib -Wl,-gc-sections -Wl,-static
ifeq (,$(filter esp_idf_heap,$(USEMODULE)))
# use the wrapper functions for calloc to add correct overflow detection missing
# in the newlib's version.
LINKFLAGS += -Wl,-wrap=calloc
LINKFLAGS += -Wl,-wrap=_calloc_r
endif
# LINKFLAGS += -Wl,--verbose

View File

@ -289,7 +289,7 @@ void* IRAM_ATTR __wrap__calloc_r(struct _reent *r, size_t count, size_t size)
#else /* MODULE_ESP_IDF_HEAP */
void *__wrap_calloc(size_t nmemb, size_t size)
void* IRAM_ATTR __wrap__calloc_r(struct _reent *r, size_t nmemb, size_t size)
{
/* The xtensa support has not yet upstreamed to newlib. Hence, the fixed
* calloc implementation of newlib >= 4.0.0 is not available to the ESP
@ -299,7 +299,7 @@ void *__wrap_calloc(size_t nmemb, size_t size)
return NULL;
}
void *res = malloc(total_size);
void *res = _malloc_r(r, total_size);
if (res) {
memset(res, 0, total_size);