Skip to content
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

esp32: workaround esptool linker sections limit #27070

Merged

Conversation

dcpleung
Copy link
Member

When converting ELF to a flashable image, the esptool can only
process up to 16 ELF sections. Zephyr has been happily grouping
similar objects into linker sections which can easily go over
esptool's limit. This patch consolidates the kernel, net, log,
and shell objects into their own sections.

Also remove the app_noinit section as no one is emitting
anything into that section, and it's not being used by other
arch/SoC/boards in Zephyr.

Fixes #20980

Signed-off-by: Daniel Leung [email protected]

@mahavirj
Copy link
Contributor

@dcpleung Probably this change breaks something in symbol placement, following test code which was otherwise functional was found to broken:

diff --git samples/hello_world/prj.conf samples/hello_world/prj.conf
index b2a4ba5910..a7dbfcaf98 100644
--- samples/hello_world/prj.conf
+++ samples/hello_world/prj.conf
@@ -1 +1,3 @@
 # nothing here
+CONFIG_HEAP_MEM_POOL_SIZE=65536
+CONFIG_HEAP_MEM_POOL_MIN_SIZE=32768
diff --git samples/hello_world/src/main.c samples/hello_world/src/main.c
index 6c5c8a27dc..3a2c6d3bdd 100644
--- samples/hello_world/src/main.c
+++ samples/hello_world/src/main.c
@@ -9,5 +9,6 @@
 
 void main(void)
 {
-       printk("Hello World! %s\n", CONFIG_BOARD);
+       volatile int *ptr = k_malloc(512);
+       printk("Hello World! %s %p\n", CONFIG_BOARD, ptr);
 }

Please have a look once.

Thanks.

When converting ELF to a flashable image, the esptool can only
process up to 16 ELF sections. Zephyr has been happily grouping
similar objects into linker sections which can easily go over
esptool's limit. This patch consolidates the kernel, net, log,
and shell objects into their own sections.

Also remove the app_noinit section as no one is emitting
anything into that section, and it's not being used by other
arch/SoC/boards in Zephyr.

Fixes zephyrproject-rtos#20980

Signed-off-by: Daniel Leung <[email protected]>
@dcpleung dcpleung force-pushed the esp32_linker_section_limit branch from a63a6fb to 0a684ef Compare August 11, 2020 18:06
@dcpleung
Copy link
Member Author

Uploaded a new version. This should fix the issue.

@mahavirj
Copy link
Contributor

Uploaded a new version. This should fix the issue.

Verified, it fixed the issue. Thanks.

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Oct 12, 2020
Copy link
Collaborator

@chrta chrta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am no specialist here, but i was able to flash and run simple sample applications on the esp32.

@andrewboie andrewboie merged commit 41967f9 into zephyrproject-rtos:master Oct 13, 2020
@dcpleung dcpleung deleted the esp32_linker_section_limit branch October 13, 2020 17:16
@dcpleung dcpleung removed the Stale label Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESP32 flash error with segment count error using esptool.py from esp-idf
5 participants