Skip to content

Commit 7d0e735

Browse files
committed
doc polish
1 parent 94915f2 commit 7d0e735

File tree

7 files changed

+368
-199
lines changed

7 files changed

+368
-199
lines changed

IDE/VSCode/install.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ echo "Starting $0 from $(pwd -P)"
4646
# End common dir init
4747

4848
pwd
49-
exit 0
50-
51-
5249
git clone https://github.com/gojimmypi/wolfBoot.git
5350
cd wolfBoot
51+
git submodule update --init
5452

5553

5654
sudo apt-get update

README.md

Lines changed: 3 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# wolfBoot
1+
# wolfBoot
22

33
wolfSSL Secure Bootloader ([Home page](https://www.wolfssl.com/products/wolfboot/), [Manual](https://www.wolfssl.com/documentation/manuals/wolfboot/), [wolfBoot-examples](https://github.com/wolfSSL/wolfBoot-examples))
44

@@ -41,8 +41,6 @@ The bootloader consists of the following components:
4141

4242
## Requirements
4343

44-
### Linux
45-
4644
Ensure the proper toolchain is installed. See the [docs](./docs/README.md) for platform-specific details.
4745

4846
## Integrating wolfBoot in an existing project
@@ -125,192 +123,9 @@ cp config/examples/stm32h7.config .config
125123
make keytools
126124
make
127125
```
126+
## CMake
128127

129-
### CMake - Presets
130-
131-
This section explains how to build wolfBoot using CMake Presets.
132-
Presets let you keep repeatable build settings in a single JSON file ([CMakePresets.json](./CMakePresets.json)) so
133-
you can configure and build with short, memorable commands like:
134-
135-
```
136-
cmake --list-presets
137-
cmake --preset stm32l4
138-
cmake --build --preset stm32l4
139-
```
140-
141-
See the `WOLFBOOT_ROOT`/[config_defaults.cmake](./config_defaults.cmake) file.
142-
143-
#### Convert existing `.config` to CMake Presets
144-
145-
The [tools/scripts/config2presets.py](./tools/scripts/config2presets.py) script cam
146-
convert existing [config/examples](./config/examples) to CMake presets.
147-
148-
For example:
149-
150-
```python
151-
python3 ./tools/scripts/config2presets.py ./config/examples/stm32h7.config
152-
```
153-
154-
#### Tips & Gotchas
155-
156-
Out-of-source enforced: wolfBoot’s CMakeLists.txt blocks in-source builds;
157-
presets default to `build-${presetName}` anyway.
158-
159-
Toolchain auto-select: If `WOLFBOOT_TARGET` is not x86_64_efi or sim,
160-
CMAKE_TOOLCHAIN_FILE defaults to `cmake/toolchain_arm-none-eabi.cmake`.
161-
162-
Windows host tools: When HOST_CC is `cl.exe`, CMakeLists.txt creates a
163-
lightweight `unistd.h` shim and adjusts flags—no manual changes needed.
164-
165-
`$penv` vs `$env`: Use `$penv{VAR}` in environment to append to the existing
166-
process environment (keeps your PATH). `$env{VAR}` replaces it.
167-
168-
Visual Studio / VS Code: Both detect presets automatically;
169-
select the preset from the status bar or CMake menu, then build.
170-
171-
`--fresh`: Re-configure from scratch without deleting the build directory.
172-
173-
For further details, see the [cmake/README](./cmake/README.md)
174-
175-
### CMake - Read .config file
176-
177-
See [cmake/README](./cmake/README.md#build-with-cmake-using-config-files).
178-
179-
### CMake - Command-line Settings
180-
181-
To build using CMake, create a `build` directory and run `cmake` with the target platform as well as values for the partition
182-
size and address variables. To build the test-apps, run with `-DBUILD_TEST_APPS=yes`. To use the wolfCrypt-py keytools, run
183-
with `-DPYTHON_KEYTOOLS=yes`.
184-
185-
For example, to build for the stm32h7 platform:
186-
```
187-
$ mkdir build
188-
$ cd build
189-
$ cmake -DWOLFBOOT_TARGET=stm32h7 -DBUILD_TEST_APPS=yes -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x8020000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_SIZE=0xD0000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x80F0000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x81C0000 ..
190-
$ make
191-
```
192-
193-
The output should look something like:
194-
```
195-
Scanning dependencies of target keystore
196-
[ 2%] Building signing tool
197-
[ 4%] Building keygen tool
198-
[ 7%] Generating keystore.c and signing private key
199-
Keytype: ECC256
200-
Gen /home/user/wolfBoot/build/wolfboot_signing_private_key.der
201-
Generating key (type: ECC256)
202-
Associated key file: /home/user/wolfBoot/build/wolfboot_signing_private_key.der
203-
Key type : ECC256
204-
Public key slot: 0
205-
Done.
206-
[ 7%] Built target keystore
207-
Scanning dependencies of target public_key
208-
[ 9%] Building C object CMakeFiles/public_key.dir/keystore.c.o
209-
[ 11%] Linking C static library libpublic_key.a
210-
[ 14%] Built target public_key
211-
Scanning dependencies of target wolfboothal
212-
[ 16%] Building C object CMakeFiles/wolfboothal.dir/hal/stm32h7.c.o
213-
[ 19%] Linking C static library libwolfboothal.a
214-
[ 19%] Built target wolfboothal
215-
Scanning dependencies of target wolfcrypt
216-
[ 21%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/integer.c.o
217-
[ 23%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/tfm.c.o
218-
[ 26%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/ecc.c.o
219-
[ 28%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/memory.c.o
220-
[ 30%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/wc_port.c.o
221-
[ 33%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/wolfmath.c.o
222-
[ 35%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/hash.c.o
223-
[ 38%] Building C object lib/CMakeFiles/wolfcrypt.dir/wolfssl/wolfcrypt/src/sha256.c.o
224-
[ 40%] Linking C static library libwolfcrypt.a
225-
[ 40%] Built target wolfcrypt
226-
Scanning dependencies of target wolfboot
227-
[ 42%] Building C object CMakeFiles/wolfboot.dir/src/libwolfboot.c.o
228-
[ 45%] Linking C static library libwolfboot.a
229-
[ 45%] Built target wolfboot
230-
Scanning dependencies of target image
231-
[ 47%] Building C object test-app/CMakeFiles/image.dir/app_stm32h7.c.o
232-
[ 50%] Building C object test-app/CMakeFiles/image.dir/led.c.o
233-
[ 52%] Building C object test-app/CMakeFiles/image.dir/system.c.o
234-
[ 54%] Building C object test-app/CMakeFiles/image.dir/timer.c.o
235-
[ 57%] Building C object test-app/CMakeFiles/image.dir/startup_arm.c.o
236-
[ 59%] Linking C executable image
237-
[ 59%] Built target image
238-
Scanning dependencies of target image_signed
239-
[ 61%] Generating image.bin
240-
[ 64%] Signing image
241-
wolfBoot KeyTools (Compiled C version)
242-
wolfBoot version 10C0000
243-
Update type: Firmware
244-
Input image: /home/user/wolfBoot/build/test-app/image.bin
245-
Selected cipher: ECC256
246-
Selected hash : SHA256
247-
Public key: /home/user/wolfBoot/build/wolfboot_signing_private_key.der
248-
Output image: /home/user/wolfBoot/build/test-app/image_v1_signed.bin
249-
Target partition id : 1
250-
Calculating SHA256 digest...
251-
Signing the digest...
252-
Output image(s) successfully created.
253-
[ 64%] Built target image_signed
254-
Scanning dependencies of target image_outputs
255-
[ 66%] Generating image.size
256-
text data bss dec hex filename
257-
5284 108 44 5436 153c /home/user/wolfBoot/build/test-app/image
258-
[ 69%] Built target image_outputs
259-
Scanning dependencies of target wolfboot_stm32h7
260-
[ 71%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/string.c.o
261-
[ 73%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/image.c.o
262-
[ 76%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/loader.c.o
263-
[ 78%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/boot_arm.c.o
264-
[ 80%] Building C object test-app/CMakeFiles/wolfboot_stm32h7.dir/__/src/update_flash.c.o
265-
[ 83%] Linking C executable wolfboot_stm32h7
266-
[ 83%] Built target wolfboot_stm32h7
267-
Scanning dependencies of target binAssemble
268-
[ 85%] Generating bin-assemble tool
269-
[ 85%] Built target binAssemble
270-
Scanning dependencies of target image_boot
271-
[ 88%] Generating wolfboot_stm32h7.bin
272-
[ 90%] Signing image
273-
wolfBoot KeyTools (Compiled C version)
274-
wolfBoot version 10C0000
275-
Update type: Firmware
276-
Input image: /home/user/wolfBoot/build/test-app/image.bin
277-
Selected cipher: ECC256
278-
Selected hash : SHA256
279-
Public key: /home/user/wolfBoot/build/wolfboot_signing_private_key.der
280-
Output image: /home/user/wolfBoot/build/test-app/image_v1_signed.bin
281-
Target partition id : 1
282-
Calculating SHA256 digest...
283-
Signing the digest...
284-
Output image(s) successfully created.
285-
[ 92%] Assembling image factory image
286-
[ 95%] Built target image_boot
287-
Scanning dependencies of target wolfboot_stm32h7_outputs
288-
[ 97%] Generating wolfboot_stm32h7.size
289-
text data bss dec hex filename
290-
42172 0 76 42248 a508 /home/user/wolfBoot/build/test-app/wolfboot_stm32h7
291-
[100%] Built target wolfboot_stm32h7_outputs
292-
```
293-
294-
Signing and hashing algorithms can be specified with `-DSIGN=<alg>` and `-DHASH=<alg>`. To view additional
295-
options to configuring wolfBoot, add `-LAH` to your cmake command, along with the partition specifications.
296-
```
297-
$ cmake -DWOLFBOOT_TARGET=stm32h7 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x8020000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_SIZE=0xD0000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x80F0000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x81C0000 -LAH ..
298-
```
299-
300-
#### stm32f4
301-
```
302-
$ cmake -DWOLFBOOT_TARGET=stm32f4 -DWOLFBOOT_PARTITION_SIZE=0x20000 -DWOLFBOOT_SECTOR_SIZE=0x20000 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x08020000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x08040000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x08060000 ..
303-
```
304-
305-
#### stm32u5
306-
```
307-
$ cmake -DWOLFBOOT_TARGET=stm32u5 -DBUILD_TEST_APPS=yes -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x08100000 -DWOLFBOOT_SECTOR_SIZE=0x2000 -DWOLFBOOT_PARTITION_SIZE=0x20000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x817F000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x81FE000 -DNO_MPU=yes ..
308-
```
309-
310-
##### stm32l0
311-
```
312-
$ cmake -DWOLFBOOT_TARGET=stm32l0 -DWOLFBOOT_PARTITION_BOOT_ADDRESS=0x8000 -DWOLFBOOT_SECTOR_SIZE=0x1000 -DWOLFBOOT_PARTITION_SIZE=0x10000 -DWOLFBOOT_PARTITION_UPDATE_ADDRESS=0x18000 -DWOLFBOOT_PARTITION_SWAP_ADDRESS=0x28000 -DNVM_FLASH_WRITEONCE=yes ..
313-
```
128+
See [docs/CMake](./docs/CMake.md) and [cmake includes](./cmake/README.md).
314129

315130
## Troubleshooting
316131

cmake/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# wolfBoot Cmake
1+
# wolfBoot CMake
22

33
Review the [Keystore Docs](../docs/keystore.md) and [Signing Docs](../docs/Signing.md)
44
regarding backup and storage of the generated `src/keystore.c` file. This file
5-
is excluded from source in `.gitignore`).
5+
is excluded from source in `.gitignore`.
66

77
**Save to a safe place outside of the wolfBoot tree.**
88

@@ -25,7 +25,7 @@ set(FOUND_HAL_BASE false)
2525
set(USE_DOT_CONFIG false)
2626
```
2727

28-
## cmake Directory Overview
28+
## Relevant CMake Files
2929

3030
- [`WOLFBOOT_ROOT`/CMakeLists.txt](../CMakeLists.txt) - Top-level CMake entry that configures the wolfBoot build.
3131
Used to initialize the project, include cmake/wolfboot.cmake, set options, and define targets.
@@ -40,6 +40,8 @@ Centralizes toolchain paths, target names, build directories, and key cache vari
4040
Maps Visual Studio configurations (Debug, Release) to existing CMake presets.
4141
Controls IntelliSense, environment variables, and the preset shown in the VS CMake toolbar.
4242

43+
## This `cmake` Directory Overview
44+
4345
- [preset-examples/CMakeUserPresets.json.sample](./preset-examples/CMakeUserPresets.json.sample) - Example local overrides for user-specific paths and options. Copy to `CMakeUserPresets.json` in the `WOLFBOOT_ROOT` directory and customize. Not committed. Copy to `WOLFBOOT_ROOT` and remove the `.sample` suffix.
4446

4547
- [config_defaults.cmake](./config_defaults.cmake) - Default cache values and feature toggles used when presets or .config do not provide them.
@@ -73,7 +75,8 @@ Controls IntelliSense, environment variables, and the preset shown in the VS CMa
7375
- [downloads/stm32l4.cmake](./downloads/stm32l4.cmake) - STM32L4 fetch script for HAL and CMSIS.
7476

7577
- [`WOLFBOOT_ROOT`/.vs/VSWorkspaceSettings.json](../.vs/VSWorkspaceSettings.json) - Exclusion directories: Visual Studio tries to be "helpful" and open a solution file. This is undesired when opening a directory as a CMake project.
76-
---
78+
79+
----
7780

7881
### Build with cmake using `.config` files
7982

0 commit comments

Comments
 (0)