Skip to content

Commit 662d9c7

Browse files
srcnertkartben
authored andcommitted
soc: ambiq: apollo3x: Flash-controller reconfigured for mcuboot
Due to Apollo3's internal bootloader, zephyr build is not able to create correct flash address on linker.cmd while using mcuboot. The PR configures flash-controller start address to solve this problem. Test board: rakwireless/rak11720 Test project: samples/subsys/mgmt/mcumgr/smp_svr Signed-off-by: Sercan Erat <[email protected]>
1 parent 9edca5e commit 662d9c7

File tree

4 files changed

+66
-10
lines changed

4 files changed

+66
-10
lines changed

boards/ambiq/apollo3_evb/apollo3_evb.dts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <ambiq/ambiq_apollo3_blue.dtsi>
33

44
#include "apollo3_evb-pinctrl.dtsi"
5+
#include <zephyr/dt-bindings/input/input-event-codes.h>
56

67
/ {
78
model = "Ambiq Apollo3 Blue evaluation board";
@@ -13,9 +14,11 @@
1314
zephyr,flash = &flash0;
1415
zephyr,console = &uart0;
1516
zephyr,shell-uart = &uart0;
17+
zephyr,uart-mcumgr = &uart0;
1618
zephyr,uart-pipe = &uart0;
1719
zephyr,flash-controller = &flash;
1820
zephyr,bt_hci = &bt_hci_apollo;
21+
zephyr,code-partition = &slot0_partition;
1922
};
2023

2124
aliases {
@@ -25,6 +28,8 @@
2528
led2 = &led2;
2629
sw0 = &button0;
2730
sw1 = &button1;
31+
bootloader-led0 = &led0;
32+
mcuboot-led0 = &led0;
2833
};
2934

3035
leds {
@@ -56,14 +61,17 @@
5661
button0: button_0 {
5762
gpios = <&gpio0_31 16 GPIO_ACTIVE_LOW>;
5863
label = "BTN0";
64+
zephyr,code = <INPUT_KEY_0>;
5965
};
6066
button1: button_1 {
6167
gpios = <&gpio0_31 18 GPIO_ACTIVE_LOW>;
6268
label = "BTN1";
69+
zephyr,code = <INPUT_KEY_1>;
6370
};
6471
button2: button_2 {
6572
gpios = <&gpio0_31 19 GPIO_ACTIVE_LOW>;
6673
label = "BTN2";
74+
zephyr,code = <INPUT_KEY_2>;
6775
};
6876
};
6977
};
@@ -77,10 +85,28 @@
7785
#address-cells = <1>;
7886
#size-cells = <1>;
7987

80-
/* Set 16KB of storage at the end of the 976KB of flash */
81-
storage_partition: partition@f0000 {
88+
internal_boot_partition: partition@0 {
89+
label = "internal_bootloader";
90+
reg = <0x00000000 0xc000>;
91+
};
92+
93+
boot_partition: partition@c000 {
94+
label = "mcuboot";
95+
reg = <0x0000c000 0xc000>;
96+
};
97+
slot0_partition: partition@18000 {
98+
label = "image-0";
99+
reg = <0x00018000 0x72000>;
100+
};
101+
slot1_partition: partition@8a000 {
102+
label = "image-1";
103+
reg = <0x0008a000 0x72000>;
104+
};
105+
106+
/* Set 16KB of storage at the end of the 1024KB of flash */
107+
storage_partition: partition@fc000 {
82108
label = "storage";
83-
reg = <0x000f0000 0x4000>;
109+
reg = <0x000fc000 0x4000>;
84110
};
85111
};
86112
};

boards/rakwireless/rak11720/rak11720.dts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <ambiq/ambiq_apollo3_blue.dtsi>
99
#include <zephyr/dt-bindings/lora/sx126x.h>
1010
#include "rak11720_apollo3-pinctrl.dtsi"
11+
#include <zephyr/dt-bindings/input/input-event-codes.h>
1112

1213
/ {
1314
model = "RAKwireless RAK11720 WisBlock LPWAN Module";
@@ -19,16 +20,20 @@
1920
zephyr,flash = &flash0;
2021
zephyr,console = &uart0;
2122
zephyr,shell-uart = &uart0;
23+
zephyr,uart-mcumgr = &uart0;
2224
zephyr,uart-pipe = &uart0;
2325
zephyr,flash-controller = &flash;
2426
zephyr,bt_hci = &bt_hci_apollo;
27+
zephyr,code-partition = &slot0_partition;
2528
};
2629

2730
aliases {
2831
watchdog0 = &wdt0;
2932
led0 = &blue_led;
3033
led1 = &green_led;
3134
lora0 = &lora;
35+
bootloader-led0 = &blue_led;
36+
mcuboot-led0 = &blue_led;
3237
};
3338

3439
leds {
@@ -53,10 +58,28 @@
5358
#address-cells = <1>;
5459
#size-cells = <1>;
5560

56-
/* Set 16KB of storage at the end of the 976KB of flash */
57-
storage_partition: partition@f0000 {
61+
internal_boot_partition: partition@0 {
62+
label = "internal_bootloader";
63+
reg = <0x00000000 0xc000>;
64+
};
65+
66+
boot_partition: partition@c000 {
67+
label = "mcuboot";
68+
reg = <0x0000c000 0xc000>;
69+
};
70+
slot0_partition: partition@18000 {
71+
label = "image-0";
72+
reg = <0x00018000 0x72000>;
73+
};
74+
slot1_partition: partition@8a000 {
75+
label = "image-1";
76+
reg = <0x0008a000 0x72000>;
77+
};
78+
79+
/* Set 16KB of storage at the end of the 1024KB of flash */
80+
storage_partition: partition@fc000 {
5881
label = "storage";
59-
reg = <0x000f0000 0x4000>;
82+
reg = <0x000fc000 0x4000>;
6083
};
6184
};
6285
};

dts/arm/ambiq/ambiq_apollo3_blue.dtsi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@
7676
soc {
7777
compatible = "ambiq,apollo3-blue", "ambiq,apollo3x", "simple-bus";
7878

79-
flash: flash-controller@c000 {
79+
flash: flash-controller@0 {
8080
compatible = "ambiq,flash-controller";
81-
reg = <0x0000c000 0xf4000>;
81+
reg = <0x00000000 0x100000>;
8282

8383
#address-cells = <1>;
8484
#size-cells = <1>;
8585

8686
/* Flash region */
87-
flash0: flash@c000 {
87+
flash0: flash@0 {
8888
compatible = "soc-nv-flash";
89-
reg = <0x0000c000 0xf4000>;
89+
reg = <0x00000000 0x100000>;
9090
};
9191
};
9292

soc/ambiq/apollo3x/Kconfig.defconfig.apollo3_blue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,11 @@ config BT_HCI_ACL_FLOW_CONTROL
3737

3838
endif # BT
3939

40+
if !BOOTLOADER_MCUBOOT
41+
42+
config FLASH_LOAD_OFFSET
43+
default 0xc000
44+
45+
endif # !BOOTLOADER_MCUBOOT
46+
4047
endif # SOC_APOLLO3_BLUE

0 commit comments

Comments
 (0)