Skip to content
Commit e5d14c68 authored by Grzegorz Swiderski's avatar Grzegorz Swiderski Committed by Carles Cufí
Browse files

riscv: linker: Fallback to Kconfig when defining ROM region



With `CONFIG_XIP=y`, this linker script would derive the ROM region from
the chosen `zephyr,flash` DT node with "soc-nv-flash" or "jedec,spi-nor"
as its compatible. If the node was absent or had a different compatible,
then linking would fail with:

    undefined symbol `ROM_BASE' referenced in expression

Fix this by using `CONFIG_FLASH_BASE_ADDRESS` and `CONFIG_FLASH_SIZE`
for ROM base and size respectively. The existing DT logic is preserved
for compatibility with out-of-tree boards, so the flash Kconfigs serve
as a mere fallback.

In addition, use `CONFIG_FLASH_LOAD_OFFSET` and `CONFIG_FLASH_LOAD_SIZE`
if defined, to align with some other architectures' linker scripts. For
the existing in-tree RISC-V boards, this should not make a difference.

The alternative would've been making sure that all boards and SoCs have
the relevant Kconfigs set, and only using those in the linker script.
The downside is that `CONFIG_FLASH_SIZE` is given in units of 1 KiB,
while some existing boards - hifive1_revb, sparkfun_red_v_things_plus -
have more granular flash sizes, which would've been rounded down.

Signed-off-by: default avatarGrzegorz Swiderski <grzegorz.swiderski@nordicsemi.no>
parent 5903c7a6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment