Skip to content

Commit f553467

Browse files
author
Me No Dev
committed
add aligned wraps for pvPortMalloc and pvPortRealloc
1 parent bcfdfb6 commit f553467

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cores/esp8266/libc_replacements.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@
3939
#include "user_interface.h"
4040
#include "debug.h"
4141

42+
extern void *__real_pvPortMalloc(size_t xWantedSize, const char* file, int line);
43+
extern void *__wrap_pvPortMalloc(size_t xWantedSize, const char* file, int line){
44+
return __real_pvPortMalloc(((xWantedSize + 3) & ~((size_t)0x3)), file, line);
45+
}
46+
47+
extern void *__real_pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line);
48+
extern void *__wrap_pvPortRealloc(void* ptr, size_t xWantedSize, const char* file, int line){
49+
return __real_pvPortRealloc(ptr, ((xWantedSize + 3) & ~((size_t)0x3)), file, line);
50+
}
51+
4252
void* ICACHE_RAM_ATTR malloc(size_t size) {
4353
size = ((size + 3) & ~((size_t)0x3));
4454
return os_malloc(size);

platform.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implici
2727
compiler.S.cmd=xtensa-lx106-elf-gcc
2828
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls
2929

30-
compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy
30+
compiler.c.elf.flags=-g {compiler.warning_flags} -Os -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{build.flash_ld}" -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,register_chipv6_phy -Wl,-wrap,pvPortMalloc -Wl,-wrap,pvPortRealloc
3131

3232
compiler.c.elf.cmd=xtensa-lx106-elf-gcc
3333
compiler.c.elf.libs=-lm -lgcc -lhal -lphy -lpp -lnet80211 -llwip -lwpa -lcrypto -lmain -lwps -laxtls -lsmartconfig -lmesh

0 commit comments

Comments
 (0)