build: uf2: Flexible UF2 offset selection.
UF2 offset configurable to be either flash base reg + offset, or simply the flash bare reg if the offset is configured to be ignored. Signed-off-by: Peter Johanson <peter@peterjohanson.com>
This commit is contained in:
parent
3266e82055
commit
3f3320713c
|
@ -1454,12 +1454,27 @@ if(CONFIG_BUILD_OUTPUT_BIN)
|
|||
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}")
|
||||
else()
|
||||
set(flash_addr "${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"
|
||||
OUTPUT_FORMAT HEXADECIMAL
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND
|
||||
post_build_commands
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/uf2conv.py
|
||||
-c
|
||||
-f ${CONFIG_BUILD_OUTPUT_UF2_FAMILY_ID}
|
||||
-b ${CONFIG_FLASH_LOAD_OFFSET}
|
||||
-b ${flash_addr}
|
||||
-o ${KERNEL_UF2_NAME}
|
||||
${KERNEL_BIN_NAME}
|
||||
)
|
||||
|
|
|
@ -486,6 +486,14 @@ config BUILD_OUTPUT_UF2_FAMILY_ID
|
|||
name string. If the SoC in use is known by UF2, the Family ID will
|
||||
be pre-filled with the known value.
|
||||
|
||||
config BUILD_OUTPUT_UF2_USE_FLASH_BASE
|
||||
bool
|
||||
default n
|
||||
|
||||
config BUILD_OUTPUT_UF2_USE_FLASH_OFFSET
|
||||
bool
|
||||
default n
|
||||
|
||||
endif # BUILD_OUTPUT_UF2
|
||||
|
||||
config BUILD_OUTPUT_STRIPPED
|
||||
|
|
Loading…
Reference in New Issue