diff --git a/soc/ite/ec/it8xxx2/Kconfig b/soc/ite/ec/it8xxx2/Kconfig index 38b92c9c6b8..2dfe2d5afc9 100644 --- a/soc/ite/ec/it8xxx2/Kconfig +++ b/soc/ite/ec/it8xxx2/Kconfig @@ -183,6 +183,20 @@ config SOC_IT8XXX2_EXCEPTIONS_IN_RAM Flash. This can significantly improve performance when under I-cache pressure. +config SOC_IT8XXX2_LIBRARY_TO_RAM + bool + help + If this is selected it means that there is a library that needs to be excluded + from the text section. + +config SOC_IT8XXX2_SERIAL_IN_RAM + bool "Place serial handling code in RAM" + select SOC_IT8XXX2_USE_ILM + select SOC_IT8XXX2_LIBRARY_TO_RAM + help + Place serial handling (Include uart_ns16550.c and uart_ite_it8xxx2.c) code + in ILM. This can improve performance. + config SOC_IT8XXX2_SHA256_HW_ACCELERATE bool "HW SHA256 calculation" help diff --git a/soc/ite/ec/it8xxx2/linker.ld b/soc/ite/ec/it8xxx2/linker.ld index a40c97dc3f2..0c4e3d483dd 100644 --- a/soc/ite/ec/it8xxx2/linker.ld +++ b/soc/ite/ec/it8xxx2/linker.ld @@ -165,9 +165,34 @@ SECTIONS KEEP(*(".openocd_debug.*")) __text_region_start = .; - +#ifndef CONFIG_SOC_IT8XXX2_LIBRARY_TO_RAM *(.text) *(".text.*") +#endif + +#ifdef CONFIG_SOC_IT8XXX2_LIBRARY_TO_RAM + *(EXCLUDE_FILE ( +#endif +#ifdef CONFIG_SOC_IT8XXX2_SERIAL_IN_RAM + *libdrivers__serial.a:* +#endif +#ifdef CONFIG_SOC_IT8XXX2_LIBRARY_TO_RAM + ) + .text + ) +#endif + +#ifdef CONFIG_SOC_IT8XXX2_LIBRARY_TO_RAM + *(EXCLUDE_FILE ( +#endif +#ifdef CONFIG_SOC_IT8XXX2_SERIAL_IN_RAM + *libdrivers__serial.a:* +#endif +#ifdef CONFIG_SOC_IT8XXX2_LIBRARY_TO_RAM + ) + .text.* + ) +#endif *(.gnu.linkonce.t.*) #include @@ -189,6 +214,11 @@ SECTIONS #ifdef CONFIG_SOC_IT8XXX2_EXCEPTIONS_IN_RAM KEEP(*(".exception.entry.*")) *(".exception.other.*") +#endif +#ifdef CONFIG_SOC_IT8XXX2_SERIAL_IN_RAM + *libdrivers__serial.a:*(.text .text.*) + *libdrivers__serial.a:*(.rodata .rodata.*) + *libdrivers__serial.a:*(.srodata .srodata.*) #endif __ilm_flash_end = .; /* ILM mapping is always a multiple of 4k size; ensure following