Skip to content

Commit cfb0a80

Browse files
Martinhoff-makerkartben
authored andcommitted
dts: arm: silabs: change siwg917 board ram start address
The first 1 KB is reserved for the NWP (Network Coprocessor). This change also resolves the null pointer error issue, as a .data or a _ramfunc might get the address 0x0. Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
1 parent 291c9f7 commit cfb0a80

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

dts/arm/silabs/siwg917.dtsi

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,28 @@
2727
};
2828
};
2929

30-
sram0: memory@0 {
30+
/* The first 1KB of SRAM is reserved for the NWP (Network Processor).
31+
* It also protects against null pointer exceptions.
32+
*/
33+
nwp_reserved: memory@0 {
34+
compatible = "zephyr,memory-region","mmio-sram";
35+
reg = <0x00000000 DT_SIZE_K(1)>;
36+
zephyr,memory-region = "NWP_RESERVED_RAM";
37+
};
38+
39+
sram0: memory@400 {
3140
compatible = "mmio-sram";
32-
/* siwx91x has 672kB of SRAM shared between the Cortex-M4
41+
/* siwx91x has 671kB of SRAM shared between the Cortex-M4
3342
* (Zephyr) and the NWP (Network Processor). 3 memory
3443
* configurations are
3544
* possible:
36-
* - 196kB
37-
* - 256kB
38-
* - 320kB
45+
* - 195kB
46+
* - 255kB
47+
* - 319kB
3948
* Less memory is allocated to Zephyr, more memory is allocated
4049
* to NWP, better are the WiFi and BLE performances.
4150
*/
42-
reg = <0x00000000 DT_SIZE_K(256)>;
51+
reg = <0x00000400 DT_SIZE_K(255)>;
4352
};
4453

4554
sram_dma1: memory-dma@24061c00 {

soc/silabs/silabs_siwx91x/siwg917/nwp.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
LOG_MODULE_REGISTER(siwx91x_nwp);
2424

25-
BUILD_ASSERT(DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(196) ||
26-
DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(256) ||
27-
DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(320));
25+
BUILD_ASSERT(DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(195) ||
26+
DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(255) ||
27+
DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(319));
2828

2929
int siwg91x_get_nwp_config(int wifi_oper_mode, sl_wifi_device_configuration_t *get_config)
3030
{
@@ -49,11 +49,12 @@ int siwg91x_get_nwp_config(int wifi_oper_mode, sl_wifi_device_configuration_t *g
4949

5050
__ASSERT(get_config, "get_config cannot be NULL");
5151

52-
if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(196)) {
52+
/* The size does not match exactly because 1 KB is reserved at the start of the RAM */
53+
if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(195)) {
5354
boot_config->ext_custom_feature_bit_map |= SL_SI91X_EXT_FEAT_480K_M4SS_192K;
54-
} else if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(256)) {
55+
} else if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(255)) {
5556
boot_config->ext_custom_feature_bit_map |= SL_SI91X_EXT_FEAT_416K_M4SS_256K;
56-
} else if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(320)) {
57+
} else if (DT_REG_SIZE(DT_CHOSEN(zephyr_sram)) == KB(319)) {
5758
boot_config->ext_custom_feature_bit_map |= SL_SI91X_EXT_FEAT_352K_M4SS_320K;
5859
} else {
5960
k_panic();

0 commit comments

Comments
 (0)