Skip to content

Conversation

RuibinChang
Copy link
Contributor

Because CONFIG_LTO default is y,
CONFIG_SOC_IT8XXX2_SERIAL_IN_RAM=y
CONFIG_SOC_IT8XXX2_KERNEL_IN_RAM=y
CONFIG_SOC_IT8XXX2_ZEPHYR_IN_RAM=y
These three configs are not effective.

So I add a warning if we enable CONFIG_LTO and put code to EC ram at the same time.

Because CONFIG_LTO default is y,
CONFIG_SOC_IT8XXX2_SERIAL_IN_RAM=y
CONFIG_SOC_IT8XXX2_KERNEL_IN_RAM=y
CONFIG_SOC_IT8XXX2_ZEPHYR_IN_RAM=y
These three configs are not effective.

So I add a warning if we enable CONFIG_LTO and put code to EC ram
at the same time.

Signed-off-by: Ruibin Chang <[email protected]>
Copy link

@keith-zephyr
Copy link
Contributor

Can you explain why CONFIG_LTO and moving these drivers into RAM cannot be used at the same time?

@RuibinChang
Copy link
Contributor Author

Can you explain why CONFIG_LTO and moving these drivers into RAM cannot be used at the same time?

In upstream ilm.c, we would copy text section from __ilm_flash_start ~ __ilm_flash_end to __ilm_ram_start ~ __ilm_ram_end (ilm_ram section ), so we can run ram code for better performance.

In downstream linker.ld, we arrange libdrivers__serial, libkernel and libzephyr within __ilm_flash_start/end, if CONFIG_LTO=n, we can see those three .object in our assign region for each functions and text length, but after CONFIG_LTO=y, those three .object in our assign region don't have any bytes, which means nothing will be copied to ilm_ram section.

Below are build with
CONFIG_LTO=y:


                0x80035000                        __ilm_flash_start = .
...
 .exception.other.__soc_handle_irq
                0x80035b64        0x6 zephyr/libzephyr.a(soc_irq.S.obj)
                0x80035b64                __soc_handle_irq
 *libdrivers__serial.a:*(SORT_BY_ALIGNMENT(.text) SORT_BY_ALIGNMENT(.text.*))
 *libdrivers__serial.a:*(SORT_BY_ALIGNMENT(.rodata) SORT_BY_ALIGNMENT(.rodata.*))
 *libdrivers__serial.a:*(SORT_BY_ALIGNMENT(.srodata) SORT_BY_ALIGNMENT(.srodata.*))
 *libkernel.a:*(SORT_BY_ALIGNMENT(.text) SORT_BY_ALIGNMENT(.text.*))
 *libkernel.a:*(SORT_BY_ALIGNMENT(.rodata) SORT_BY_ALIGNMENT(.rodata.*))
 *libkernel.a:*(SORT_BY_ALIGNMENT(.srodata) SORT_BY_ALIGNMENT(.srodata.*))
 *libzephyr.a:*(SORT_BY_ALIGNMENT(.text) SORT_BY_ALIGNMENT(.text.*))
 *libzephyr.a:*(SORT_BY_ALIGNMENT(.rodata) SORT_BY_ALIGNMENT(.rodata.*))
 *libzephyr.a:*(SORT_BY_ALIGNMENT(.srodata) SORT_BY_ALIGNMENT(.srodata.*))
                0x80035b6a                        __ilm_flash_end = .

CONFIG_LTO=n:

                0x80030000                        __ilm_flash_start = .
...
.exception.other.__soc_handle_irq
                0x80030cc8        0x6 zephyr/libzephyr.a(soc_irq.S.obj)
                0x80030cc8                __soc_handle_irq
 *libdrivers__serial.a:*(SORT_BY_ALIGNMENT(.text) SORT_BY_ALIGNMENT(.text.*))
 .text.z_impl_gpio_pin_interrupt_configure
                0x80030cce      0x12c zephyr/drivers/serial/libdrivers__serial.a(uart_ite_it8xxx2.c.obj)
 .text.uart1_wui_isr
                0x80030dfa       0x4a zephyr/drivers/serial/libdrivers__serial.a(uart_ite_it8xxx2.c.obj)
                0x80030dfa                uart1_wui_isr
 .text.uart2_wui_isr
                0x80030e44        0x4 zephyr/drivers/serial/libdrivers__serial.a(uart_ite_it8xxx2.c.obj)
                0x80030e44                uart2_wui_isr
...
                0x8003cc0b                        __ilm_flash_end = .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants