Skip to content

Instantly share code, notes, and snippets.

@petejohanson
Created October 19, 2022 03:49
Show Gist options
  • Save petejohanson/9619b47c80b60a39d32321392edca67f to your computer and use it in GitHub Desktop.
Save petejohanson/9619b47c80b60a39d32321392edca67f to your computer and use it in GitHub Desktop.
ESP32 Zephyr + ZMK linker fixes
diff --git a/scripts/west_commands/runners/esp32.py b/scripts/west_commands/runners/esp32.py
index e2f7a3c3c7..605e36c5fb 100644
--- a/scripts/west_commands/runners/esp32.py
+++ b/scripts/west_commands/runners/esp32.py
@@ -93,7 +93,7 @@ class Esp32BinaryRunner(ZephyrBinaryRunner):
def do_run(self, command, **kwargs):
self.require(self.espidf)
- cmd_flash = [self.espidf, '--chip', 'auto']
+ cmd_flash = [self.espidf, '--chip', 'auto', '--no-stub']
if self.device is not None:
cmd_flash.extend(['--port', self.device])
cmd_flash.extend(['--baud', self.baud])
diff --git a/soc/riscv/esp32c3/linker.ld b/soc/riscv/esp32c3/linker.ld
index 5284374c7c..a4a402b0a2 100644
--- a/soc/riscv/esp32c3/linker.ld
+++ b/soc/riscv/esp32c3/linker.ld
@@ -183,6 +183,11 @@ SECTIONS
KEEP(*(SORT(.shell_root_cmd_*)));
__esp_shell_root_cmds_end = .;
+/* Located in generated directory. This file is populated by the
+ * zephyr_linker_sources() Cmake function.
+ */
+#include <snippets-rodata.ld>
+
. = ALIGN(4);
*(EXCLUDE_FILE (*libkernel.a:fatal.* *libkernel.a:init.* *libzephyr.a:cbprintf_complete* *libzephyr.a:log_core.* *libzephyr.a:log_backend_uart.* *libzephyr.a:log_output.* *libzephyr.a:loader.* *libdrivers__flash.a:flash_esp32.* *libdrivers__serial.a:uart_esp32.*) .rodata)
*(EXCLUDE_FILE (*libkernel.a:fatal.* *libkernel.a:init.* *libzephyr.a:cbprintf_complete* *libzephyr.a:log_core.* *libzephyr.a:log_backend_uart.* *libzephyr.a:log_output.* *libzephyr.a:loader.* *libdrivers__flash.a:flash_esp32.* *libdrivers__serial.a:uart_esp32.*) .rodata.*)
@@ -352,6 +357,12 @@ SECTIONS
*(.noinit)
*(.noinit.*)
. = ALIGN(4);
+
+/* Located in generated directory. This file is populated by the
+ * zephyr_linker_sources() Cmake function.
+ */
+#include <snippets-noinit.ld>
+
} GROUP_LINK_IN(RAMABLE_REGION)
.dram0.data :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment