-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
elf2image: Use map file instead of xtensa-lx106-elf-nm #24
Comments
@pfalcon If I'm not mistaken, you are the one who implemented the magic required to generate rom images? |
Well, if you look at that code, call_user_start is a special, magic function, the real start address (aka entry point) to which the vendor bootloader jumps to start the app. So, it's not recommended to get rid of the standard implementation of that function (you may need to pull it in explicitly using appropriate linker switch). And if you did get rid of it, and are sure you're right with that, that I suggest to just call you own entrypoint (or its wrap) such to avoid confusion. (I myself would love to get rid of all that vendor mess and have just normal "main", but as you know, there's rather long way to that, so if we can't do it right, let's stick to vendor's stuff, and not invent something 3rd yet). |
@pfalcon I know that and I did NOT get rid of call_user_start, it's there. The problem is that after stripping the elf file is missing symbol information. e.g. call_user_start is there, but you can't find it by symbol name. |
Ah, I see. I'd still wonder why --gc-sections removes symbols information - symbols are not in a section, it is separate structure in ELF file, right? But if you say it does, then well, something needs to be done for sure. I'd suggest starting with ability to override entry point address - "make_image" already takes --entrypoint, there it's required param, "elf2image" can take it optional, as override. Then look if it's possible to have sed one-liner to extract it from a map file, if not, add optional ability to parse map file to esptool indeed. My 2 cents ;-). |
If what I remember about ELF format, symbols are stored in .symtab/.dynsym sections. Since they are not referenced by any code in the actual firmware (why should they?) they get ditched by -gc-sections, which looks kind of sane and expected. |
See #24 which touches this somehow. |
I think this is fixed since a0c18ea, now that the entry point is read from the ELF. I'm able to compile esp-open-rtos images with -ffunction-sections/-gc-sections, and also different entry point names, and it all seems happy. So I'm closing this for now, please reopen if you think there's still an issue here. |
* Update version to v4.6 * Update version to v4.7-dev * fix(ESP32-S3): Correct RTC WDT registers to fix resets during flashing * Update version to v4.6.1 * Update version to v4.7-dev * docs: add explanation for flash_id example to avoid confusion * docs(boot-log): fix list formatting * docs: add c2, c6 and h2 as build targets * fix(compressed upload): Accept short data blocks with only Adler-32 bytes --------- Co-authored-by: radim.karnis <radim.karnis@espressif.com> Co-authored-by: Peter Dragun <peter.dragun@espressif.com>
* Tasmota changes * v4.5.3 * Release of Tasmota esptool v4.6.1 (#23) * Update version to v4.6 * Update version to v4.7-dev * fix(ESP32-S3): Correct RTC WDT registers to fix resets during flashing * Update version to v4.6.1 --------- Co-authored-by: radim.karnis <radim.karnis@espressif.com> * v4.6.1 * Upstream updates (#24) * Update version to v4.6 * Update version to v4.7-dev * fix(ESP32-S3): Correct RTC WDT registers to fix resets during flashing * Update version to v4.6.1 * Update version to v4.7-dev * docs: add explanation for flash_id example to avoid confusion * docs(boot-log): fix list formatting * docs: add c2, c6 and h2 as build targets * fix(compressed upload): Accept short data blocks with only Adler-32 bytes --------- Co-authored-by: radim.karnis <radim.karnis@espressif.com> Co-authored-by: Peter Dragun <peter.dragun@espressif.com> * pyinstaller==5.13.2 * Update package.json * Latest PyInstaller * Update package.json * Reset s3 out of flash mode * fix(testloadram): Windows assertion error * docs(advanced-topics): Fixed strapping pin for Automatic Bootloader section * s3 CDC reboot Fix / rm intelhex * Merge upstream (#32) * fix(testloadram): Windows assertion error * docs(advanced-topics): Fixed strapping pin for Automatic Bootloader section --------- Co-authored-by: Jakub Kocka <jakub.kocka@espressif.com> * Update test_esptool.py --------- Co-authored-by: radim.karnis <radim.karnis@espressif.com> Co-authored-by: Peter Dragun <peter.dragun@espressif.com> Co-authored-by: Jakub Kocka <jakub.kocka@espressif.com>
The current elf2image implementation uses xtensa-lx106-elf-nm. However if we compile the binary with -ffunction-sections/-fdata-sections and do -gc-sections to strip unused functions from the resulting binary we'll end up with this error message:
Proposed solution: Link with -Wl,-Map=$(IMAGENAME).map
and pass either the whole mapfile or the just the call_user_start address to esptool.
The text was updated successfully, but these errors were encountered: