Skip to content

Commit

Permalink
soc: silabs: siwx917: support flash code-partition
Browse files Browse the repository at this point in the history
A specific section of the flash on the SiWx917 is reserved for the
Network co-processor (nwp). This zone needs to be delimited in order to
not overwrite it. We then need to use "code-partition" to provide Zephyr
the application code flash location.

Signed-off-by: Martin Hoff <[email protected]>
  • Loading branch information
Martinhoff-maker committed Nov 14, 2024
1 parent 33169fe commit 4a274c8
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
20 changes: 20 additions & 0 deletions boards/silabs/radio_boards/siwx917_rb4338a/siwx917_rb4338a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

chosen {
zephyr,sram = &sram0;
zephyr,code-partition = &slot0_partition;
zephyr,console = &ulpuart0;
zephyr,shell-uart = &ulpuart0;
zephyr,bt-hci = &bt_hci_silabs_siwx917;
Expand Down Expand Up @@ -96,3 +97,22 @@
};
};
};

&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

// NWP (Network Processor) partition (do not overwrite)
nwp_firmware_partition: partition@0 {
label = "nwp_firmware";
reg = <0x0000000 DT_SIZE_K(8)>;
};

slot0_partition: partition@2000 {
label = "slot0";
reg = <0x0002000 DT_SIZE_K(2048-8)>;
};
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_PINCTRL=y
CONFIG_SIWX917_FLASH_MODE_COMMON=y
CONFIG_USE_DT_CODE_PARTITION=y
4 changes: 2 additions & 2 deletions dts/arm/silabs/siwg917.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
#address-cells = <1>;
#size-cells = <1>;

flash0: flash@8202000 {
flash0: flash@8200000 {
compatible = "soc-nv-flash";
reg = <0x8202000 DT_SIZE_K(2040)>;
reg = <0x8200000 DT_SIZE_K(2048)>;
write-block-size = <1>;
erase-block-size = <4096>;
};
Expand Down
5 changes: 4 additions & 1 deletion soc/silabs/silabs_siwx917/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

add_subdirectory(siwg917)

# Necessary to not overwrite NWP Firmware
math(EXPR FLASH_LOAD_ADDRESS "(${CONFIG_FLASH_BASE_ADDRESS}) + (${CONFIG_FLASH_LOAD_OFFSET})")

set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/siwx917_isp_prepare.py
--rom_addr ${CONFIG_FLASH_BASE_ADDRESS}
--rom_addr ${FLASH_LOAD_ADDRESS}
${KERNEL_BIN_NAME}
${KERNEL_BIN_NAME}.rps
)

0 comments on commit 4a274c8

Please sign in to comment.