soc: it8xxx2: linker: Move serial library to RAM to enhance performance

Place serial library in ILM. This can improve performance.

test:
Print the message 10000 times with 1ms sleep interval to compare the
time difference before and after adding RAM code on the it82002bw evb.

                         RAM code size    save time
original:                1954 bytes
libdrivers__serial.a:   +2282 bytes      -226ms

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
This commit is contained in:
Tim Lin 2024-06-24 11:52:03 +08:00 committed by Anas Nashif
commit c5cf53b690
2 changed files with 45 additions and 1 deletions

View file

@ -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

View file

@ -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 <zephyr/linker/kobject-text.ld>
@ -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