mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-26 03:10:32 +08:00

fix(esp8266): If MEMLEAK_DEBUG is defined, create an alternate function called `.._trace` that for each of `pvPortMalloc`, `pvPortZalloc`, `pvPortCalloc` and `vPortFree`. The original function delegates to this new tracing function but uses NULL and 0 for the file and line number. This ensures that the pvPortMalloc exists as a symbol that can be used by the binary blobs without any problems. Example output from earlier usage: ~~~ --------Show Malloc-------- F:ppT L:512 malloc 2064 @ 0x3ffefd08 F:pmT L:256 malloc 1040 @ 0x3fff0518 F:tiT L:512 malloc 2064 @ 0x3fff0928 F:uiT L:640 malloc 2576 @ 0x3fff1138 F:IDLE L:176 malloc 720 @ 0x3fff1b48 F:Tmr Svc L:512 malloc 2064 @ 0x3fff1e18 ~~~ fix(lwip): Remove declarations of `pvPortMalloc()` and family. This fixes some of the issues in espressif/ESP8266_RTOS_SDK#189 but some of the example applications fails. Not ready for merge but comments on my approach will be appreciated.
The newlib version has been updated to "2.2.0" and supply two version C libraries to user. One is "libc.a" which functions have more features base on stand C, another is "libc_nano.c" which functions have less function.
You can choose the one you needed by menuconfig:
Component config --->
newlib --- >
newlib level(XXXX)
( ) normal
( ) nano
The normal "libc" has position argument, "long long" type data and float data transformation at function printf/scanf and so on. So it should cost more stack and heap, the test data as following:
Object | Origin newlib | New newlib | New newlib nano | ||||||||||
Start heap/byte | 53000 | Start heap/byte | 49184 | Start heap/byte | 51824 | ||||||||
Fucntion | Stack/byte | Heap/byte | Heap cost/byte | Stack/byte | Heap/byte | Heap cost/byte | Stack/byte | Heap/byte | Heap cost/byte | ||||
isalnum | 96 | 53000 | 0 | 80 | 49184 | 0 | 80 | 51824 | 0 | ||||
isalpha | 80 | 53000 | 0 | 64 | 49184 | 0 | 64 | 51824 | 0 | ||||
isspace | 80 | 53000 | 0 | 64 | 49184 | 0 | 64 | 51824 | 0 | ||||
atoi | 160 | 53000 | 0 | 144 | 49184 | 0 | 144 | 51824 | 0 | ||||
strtol | 144 | 53000 | 0 | 128 | 49184 | 0 | 128 | 51824 | 0 | ||||
atof | 224 | 53000 | 0 | 208 | 49184 | 0 | 208 | 51824 | 0 | ||||
atoff | 224 | 53000 | 0 | 208 | 49184 | 0 | 208 | 51824 | 0 | ||||
strtod | 208 | 53000 | 0 | 192 | 49184 | 0 | 192 | 51824 | 0 | ||||
strtof | 208 | 53000 | 0 | 192 | 49184 | 0 | 192 | 51824 | 0 | ||||
asprintf | 880 | 52616 | 384 | 1200 | 48800 | 384 | 608 | 51632 | 192 | ||||
sscanf | 1552 | 53000 | 0 | 2032 | 49184 | 0 | 1120 | 51824 | 0 | ||||
gmtime | 944 | 52616 | 384 | 1040 | 48576 | 608 | 1296 | 51512 | 312 | ||||
localtime | 160 | 53000 | 0 | 288 | 49184 | 0 | 288 | 51824 | 0 | ||||
mktime | 320 | 53000 | 0 | 448 | 49184 | 0 | 448 | 51824 | 0 | ||||
asctime | 768 | 52488 | 480 | 1264 | 48528 | 656 | 752 | 51464 | 360 | ||||
settimeofday | 336 | 53000 | 0 | 320 | 49184 | 0 | 320 | 51824 | 0 | ||||
gettimeofday | 480 | 53000 | 0 | 464 | 49184 | 0 | 464 | 51824 | 0 | ||||
localtime_r | 304 | 53000 | 0 | 432 | 49184 | 0 | 432 | 51824 | 0 | ||||
asprintf(64bit) | 752 | 52424 | 576 | 1136 | 48336 | 848 | 608 | 51272 | 552 | ||||
sscanf(64bit) | 1056 | 53000 | 0 | 1376 | 49184 | 0 | 1040 | 51824 | 0 |