Skip to content

Commit b499fd5

Browse files
Update mbed-os and mcuboot, add NUCLEO_L452RE_P support
1 parent 241db77 commit b499fd5

File tree

5 files changed

+39
-9
lines changed

5 files changed

+39
-9
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
url = https://github.com/mbed-ce/mbed-os.git
44
[submodule "mcuboot"]
55
path = mcuboot
6-
url = https://github.com/multiplemonomials/mcuboot.git
6+
url = https://github.com/zhiyong-ft/mcuboot.git

CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@ cmake_policy(VERSION 3.19)
33

44
set(MBED_APP_JSON_PATH mbed_app.json5)
55

6-
include(mbed-os/tools/cmake/app.cmake)
6+
include(mbed-os/tools/cmake/mbed_toolchain_setup.cmake)
77

88
# Make sure that the build system generates both bin and hex files, regardless of
99
# target settings.
1010
set(MBED_OUTPUT_EXT "" CACHE STRING "" FORCE)
1111

12-
add_subdirectory(mbed-os)
12+
project(mbed-mcuboot-demo-app
13+
LANGUAGES C CXX ASM
14+
VERSION 1.0.0)
15+
16+
include(mbed_project_setup)
1317

14-
project(mbed-mcuboot-demo-app VERSION 1.0.0)
18+
add_subdirectory(mbed-os)
1519

1620
# Compile mcuboot sources
1721
add_subdirectory(mcuboot/boot/bootutil)
1822
add_subdirectory(mcuboot/boot/mbed)
1923

2024
add_executable(SimpleApp SimpleApp.cpp secondary_bd.cpp)
2125
target_link_libraries(SimpleApp
22-
mbed-baremetal
26+
mbed-os
2327
mbed-storage
2428
mbed-mcuboot)
2529
mbed_set_post_build(SimpleApp)
@@ -40,5 +44,3 @@ mcuboot_generate_update_image(UpdaterApp)
4044
# See here for more details on this: https://gareus.org/wiki/embedding_resources_in_executables
4145
target_link_options(UpdaterApp PRIVATE -Wl,-b,binary,SimpleApp-update-image.bin -Wl,-b,elf32-littlearm)
4246
add_dependencies(UpdaterApp SimpleApp) # Ensure SimpleApp gets built before UpdaterApp
43-
44-
mbed_finalize_build()

mbed-os

Submodule mbed-os updated 200 files

mbed_app.json5

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"*": {
2525
"mcuboot.bootloader-build": 0,
2626
"target.c_lib": "small",
27+
"target.application-profile": "full",
2728
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_DEBUG",
2829
"mbed-trace.enable": true,
2930

@@ -140,6 +141,33 @@
140141
"mcuboot.scratch-address": "0x081E0000",
141142
"mcuboot.scratch-size": "0x20000"
142143

144+
},
145+
146+
"NUCLEO_L452RE_P": {
147+
// Configure bootloader to live in the first 128k of flash
148+
"target.memory_bank_config": {
149+
"IROM1": {
150+
"start": 0x08021000, // mcuboot.primary-slot-address + mcuboot.header-size
151+
"size": 0x2E000 // mcuboot.slot-size - mcuboot.header-size
152+
}
153+
},
154+
155+
// Sector size is 2k, make the scratch region use the last 8k of flash so it uses 4 sectors
156+
"mcuboot.scratch-address": 0x0807E000,
157+
"mcuboot.scratch-size": 0x2000,
158+
159+
// Primary and secondary slot need to fit in the remaining 376k of flash (512k total - 128k - 8k)
160+
"mcuboot.slot-size": 0x2F000, // 188kiB
161+
162+
// Primary slot starts right after the bootloader
163+
"mcuboot.primary-slot-address": 0x08020000,
164+
165+
"mcuboot.max-img-sectors": 94, // 94 flash sectors per slot
166+
"mcuboot.flash-block-size": 8, // Flash program size is 8
167+
168+
// Since STM32 nucleo boards have no external block device, keep everything in the MCU flash.
169+
"app.secondary-slot-in-flash": true,
170+
"app.secondary-slot-flash-start-addr": 0x0804F000 // primary-slot-address + slot-size
143171
}
144172
},
145173
}

mcuboot

Submodule mcuboot updated 82 files

0 commit comments

Comments
 (0)