build: uf2: set offset when building RAM images
Follow ROMABLE_REGION from include/.../arm/cortex_m/scripts/linker.ld This enables UF2 images to be created for RAM-only apps on RP2350. Signed-off-by: Dmitrii Sharshakov <d3dx12.xx@gmail.com>
This commit is contained in:
committed by
Benjamin Cabé
parent
c3595fdebe
commit
8433c491b2
@@ -1872,26 +1872,39 @@ endif()
|
||||
|
||||
if(CONFIG_BUILD_OUTPUT_BIN AND CONFIG_BUILD_OUTPUT_UF2)
|
||||
if(CONFIG_BUILD_OUTPUT_UF2_USE_FLASH_BASE)
|
||||
set(flash_addr "${CONFIG_FLASH_BASE_ADDRESS}")
|
||||
set(code_address "${CONFIG_FLASH_BASE_ADDRESS}")
|
||||
else()
|
||||
set(flash_addr "${CONFIG_FLASH_LOAD_OFFSET}")
|
||||
set(code_address "${CONFIG_FLASH_LOAD_OFFSET}")
|
||||
endif()
|
||||
|
||||
if(CONFIG_BUILD_OUTPUT_UF2_USE_FLASH_OFFSET)
|
||||
# Note, the `+ 0` in formula below avoids errors in cases where a Kconfig
|
||||
# variable is undefined and thus expands to nothing.
|
||||
math(EXPR flash_addr
|
||||
"${flash_addr} + ${CONFIG_FLASH_LOAD_OFFSET} + 0"
|
||||
math(EXPR code_address
|
||||
"${code_address} + ${CONFIG_FLASH_LOAD_OFFSET} + 0"
|
||||
OUTPUT_FORMAT HEXADECIMAL
|
||||
)
|
||||
endif()
|
||||
|
||||
# No-XIP images (such as ones for RP2350 with CONFIG_XIP=n)
|
||||
# are typically loaded to RAM
|
||||
if(NOT CONFIG_XIP)
|
||||
if(CONFIG_BUILD_OUTPUT_ADJUST_LMA)
|
||||
math(EXPR code_address
|
||||
"${CONFIG_SRAM_BASE_ADDRESS} + ${CONFIG_BUILD_OUTPUT_ADJUST_LMA} + 0"
|
||||
OUTPUT_FORMAT HEXADECIMAL
|
||||
)
|
||||
else()
|
||||
set(code_address "${CONFIG_SRAM_BASE_ADDRESS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND
|
||||
post_build_commands
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/build/uf2conv.py
|
||||
-c
|
||||
-f ${CONFIG_BUILD_OUTPUT_UF2_FAMILY_ID}
|
||||
-b ${flash_addr}
|
||||
-b ${code_address}
|
||||
-o ${KERNEL_UF2_NAME}
|
||||
${KERNEL_BIN_NAME}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user