diff --git a/drivers/serial/uart_esp32.c b/drivers/serial/uart_esp32.c index a43e3b54a54..e289f1b8c45 100644 --- a/drivers/serial/uart_esp32.c +++ b/drivers/serial/uart_esp32.c @@ -20,6 +20,7 @@ #include #include #include +#include /* @@ -141,7 +142,7 @@ static int uart_esp32_poll_in(const struct device *dev, unsigned char *p_char) return 0; } -static void uart_esp32_poll_out(const struct device *dev, +static IRAM_ATTR void uart_esp32_poll_out(const struct device *dev, unsigned char c) { /* Wait for space in FIFO */ @@ -443,7 +444,7 @@ void uart_esp32_isr(const struct device *dev) #endif /* CONFIG_UART_INTERRUPT_DRIVEN */ -static const struct uart_driver_api uart_esp32_api = { +static const DRAM_ATTR struct uart_driver_api uart_esp32_api = { .poll_in = uart_esp32_poll_in, .poll_out = uart_esp32_poll_out, .err_check = uart_esp32_err_check, @@ -495,7 +496,7 @@ static const struct uart_driver_api uart_esp32_api = { #endif #define ESP32_UART_INIT(idx) \ ESP32_UART_IRQ_HANDLER_DECL(idx); \ -static const struct uart_esp32_config uart_esp32_cfg_port_##idx = { \ +static const DRAM_ATTR struct uart_esp32_config uart_esp32_cfg_port_##idx = { \ .dev_conf = { \ .base = \ (uint8_t *)DT_INST_REG_ADDR(idx), \ diff --git a/soc/xtensa/esp32/linker.ld b/soc/xtensa/esp32/linker.ld index bccdf64b827..f71ea8f2fb3 100644 --- a/soc/xtensa/esp32/linker.ld +++ b/soc/xtensa/esp32/linker.ld @@ -59,6 +59,7 @@ PROVIDE ( esp32_rom_ets_delay_us = ets_delay_us ); /* __udivdi3 is exported using assignment, which declares strong symbols */ __udivdi3 = 0x4000cff8; +__umoddi3 = 0x4000d280; MEMORY { @@ -257,6 +258,7 @@ _net_buf_pool_list = _esp_net_buf_pool_list; * when flash cache is disabled */ *libarch__xtensa__core.a:(.rodata .rodata.*) *libkernel.a:fatal.*(.rodata .rodata.*) + *libzephyr.a:cbprintf_complete*(.rodata .rodata.*) KEEP(*(.jcr)) *(.dram1 .dram1.*) _data_end = ABSOLUTE(.); @@ -370,6 +372,9 @@ __shell_root_cmds_end = __esp_shell_root_cmds_end; *libzephyr.a:log_noos.*(.literal .text .literal.* .text.*) *libzephyr.a:xtensa_sys_timer.*(.literal .text .literal.* .text.*) *libzephyr.a:log_core.*(.literal .text .literal.* .text.*) + *libzephyr.a:cbprintf_complete.*(.literal .text .literal.* .text.*) + *libzephyr.a:printk.*(.literal.printk .literal.vprintk .literal.char_out .text.printk .text.vprintk .text.char_out) + *libzephyr.a:uart_console.*(.literal.console_out .text.console_out) *liblib__libc__minimal.a:string.*(.literal .text .literal.* .text.*) *libgcov.a:(.literal .text .literal.* .text.*) *libnet80211.a:( .wifi0iram .wifi0iram.*) diff --git a/soc/xtensa/esp32/soc.c b/soc/xtensa/esp32/soc.c index 31b4c63e637..74b5dff7d29 100644 --- a/soc/xtensa/esp32/soc.c +++ b/soc/xtensa/esp32/soc.c @@ -102,7 +102,7 @@ void __attribute__((section(".iram1"))) __start(void) } /* Boot-time static default printk handler, possibly to be overridden later. */ -int arch_printk_char_out(int c) +int IRAM_ATTR arch_printk_char_out(int c) { if (c == '\n') { esp32_rom_uart_tx_one_char('\r');