From 6a4a164b54062347fc8498b8ba157aa4b4393ada Mon Sep 17 00:00:00 2001 From: Tim Lin Date: Mon, 1 Jul 2024 17:37:05 +0800 Subject: [PATCH] soc: it8xxx2: linker: Move zephyr library to RAM to enhance performance Place zephyr 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 libzephyr.a: +16974 bytes -608ms Signed-off-by: Tim Lin --- soc/ite/ec/it8xxx2/Kconfig | 7 +++++++ soc/ite/ec/it8xxx2/linker.ld | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/soc/ite/ec/it8xxx2/Kconfig b/soc/ite/ec/it8xxx2/Kconfig index 6ddf099d026..74d16b92756 100644 --- a/soc/ite/ec/it8xxx2/Kconfig +++ b/soc/ite/ec/it8xxx2/Kconfig @@ -204,6 +204,13 @@ config SOC_IT8XXX2_KERNEL_IN_RAM help Place kernel handling code in ILM. This can significantly improve performance. +config SOC_IT8XXX2_ZEPHYR_IN_RAM + bool "Place zephyr handling code in RAM" + select SOC_IT8XXX2_USE_ILM + select SOC_IT8XXX2_LIBRARY_TO_RAM + help + Place zephyr handling code in ILM. This can significantly 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 6f1577a7930..b5b0f686d73 100644 --- a/soc/ite/ec/it8xxx2/linker.ld +++ b/soc/ite/ec/it8xxx2/linker.ld @@ -179,6 +179,9 @@ SECTIONS #ifdef CONFIG_SOC_IT8XXX2_KERNEL_IN_RAM *libkernel.a:* #endif +#ifdef CONFIG_SOC_IT8XXX2_ZEPHYR_IN_RAM + *libzephyr.a:* +#endif #ifdef CONFIG_SOC_IT8XXX2_LIBRARY_TO_RAM ) .text @@ -194,6 +197,9 @@ SECTIONS #ifdef CONFIG_SOC_IT8XXX2_KERNEL_IN_RAM *libkernel.a:* #endif +#ifdef CONFIG_SOC_IT8XXX2_ZEPHYR_IN_RAM + *libzephyr.a:* +#endif #ifdef CONFIG_SOC_IT8XXX2_LIBRARY_TO_RAM ) .text.* @@ -230,6 +236,11 @@ SECTIONS *libkernel.a:*(.text .text.*) *libkernel.a:*(.rodata .rodata.*) *libkernel.a:*(.srodata .srodata.*) +#endif +#ifdef CONFIG_SOC_IT8XXX2_ZEPHYR_IN_RAM + *libzephyr.a:*(.text .text.*) + *libzephyr.a:*(.rodata .rodata.*) + *libzephyr.a:*(.srodata .srodata.*) #endif __ilm_flash_end = .; /* ILM mapping is always a multiple of 4k size; ensure following