Hi,
I noticed that memset function is being resolved even when I do not link against libraries in newlib component (https://github.com/espressif/esp-idf/tr ... nts/newlib). Even with "-nostdlib" option it is linking against libs located in toolchain (xtensa-esp32-elf/xtensa-esp32-elf/lib/esp32-psram/).
Which libraries should we use and why?
newlib vs glibc
Re: newlib vs glibc
The library in the toolchain is also newlib, not glibc. It's linking memset probably because of memset = 0x400xxxxx in the ROM LD script.
Re: newlib vs glibc
Which version should we use then / what is the difference? libc.a in toolchain takes 5.0 MB, in ESP-IDF 5.7 MB (both SPIRAM compatible versions)
memset is provided in esp32.rom.spiram_incompatible_fns.ld script but I am not using this script.
With "-nostdlib -mlongcalls -mfix-esp32-psram-cache-issue -g -Og -ggdb -Wall -Werror -Wl,--cref,-Map,bootloader.map -lc" memset is linked against toolchain libc.
With "-nostdlib -mlongcalls -mfix-esp32-psram-cache-issue -g -Og -ggdb -Wall -Werror -Wl,--cref,-Map,bootloader.map -L idf/components/newlib/lib -lc" memset is linked against ESP-IDF libc.
memset is provided in esp32.rom.spiram_incompatible_fns.ld script but I am not using this script.
With "-nostdlib -mlongcalls -mfix-esp32-psram-cache-issue -g -Og -ggdb -Wall -Werror -Wl,--cref,-Map,bootloader.map -lc" memset is linked against toolchain libc.
With "-nostdlib -mlongcalls -mfix-esp32-psram-cache-issue -g -Og -ggdb -Wall -Werror -Wl,--cref,-Map,bootloader.map -L idf/components/newlib/lib -lc" memset is linked against ESP-IDF libc.
Re: newlib vs glibc
There were a few changes done to the newlib version included into ESP-IDF, which were not propagated to newlib packaged with the toolchain.michprev wrote:Which version should we use then / what is the difference? libc.a in toolchain takes 5.0 MB, in ESP-IDF 5.7 MB (both SPIRAM compatible versions)
For the most part, changes have to do with adding some functions which were not included, and removing some other functions which were included. You can see the list on this page:
https://github.com/espressif/esp-idf/co ... newlib/lib
We're doing some cleanup to the way we build GCC and newlib, this will introduce cleaner and more consistent results. All newlib and GCC patches will be published in Github repositories, and crosstool-NG will be configured to pull newlib and GCC from these repositories. IDF will have an option of building newlib from source.
This makes sense. "-nostdlib" tells the linker to empty the implict list of linked libraries, but "-lc" later tells it to link against libc.a, which it finds, since no other paths are provided, in the toolchain directory.michprev wrote: memset is provided in esp32.rom.spiram_incompatible_fns.ld script but I am not using this script.
With "-nostdlib -mlongcalls -mfix-esp32-psram-cache-issue -g -Og -ggdb -Wall -Werror -Wl,--cref,-Map,bootloader.map -lc" memset is linked against toolchain libc.
This makes sense in the same way as above, except now you supply a new search path for libraries, so libc.a gets found there.michprev wrote: With "-nostdlib -mlongcalls -mfix-esp32-psram-cache-issue -g -Og -ggdb -Wall -Werror -Wl,--cref,-Map,bootloader.map -L idf/components/newlib/lib -lc" memset is linked against ESP-IDF libc.
Re: newlib vs glibc
Perfect! Thank you very much.
Who is online
Users browsing this forum: No registered users and 99 guests