Skip to content

Commit 8c6272d

Browse files
committed
Completed Windows/IAR example, removed extra files
1 parent 7e64524 commit 8c6272d

29 files changed

Lines changed: 5568 additions & 4154 deletions

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,8 @@ config/*.ld
8484
.vs
8585
*.filters
8686
*.user
87+
88+
# IAR files not under version control
89+
IDE/IAR/settings
90+
IDE/IAR/*.ewt
91+

IDE/IAR/README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# wolfBoot demo application for IAR EWARM
2+
3+
Instruction to compile and test under MS Windows.
4+
5+
6+
## Target platform
7+
8+
This example application has been configured to work on STM32F4.
9+
10+
wolfBoot is stored and executed at the beginning of the flash (0x08000000), while the signed
11+
application image starts at address 0x08020000.
12+
13+
14+
15+
## Workspace
16+
17+
The workspace [wolfboot-test-app.eww](./wolfboot-test-app.eww) contains two projects:
18+
- wolfBoot
19+
- wolfBoot-test-app
20+
21+
Each project will compile into a separate binary, the two binaries can be uploaded to the target using
22+
ST-Link utilities (e.g. [STSW-LINK004](https://www.st.com/en/development-tools/stsw-link004.html)) as explained below.
23+
24+
## Instructions
25+
26+
### Creating the keys
27+
28+
This step is required to compile the bootloader.
29+
30+
Open a command line terminal in the [IAR](./) directory. Execute the following script:
31+
32+
```
33+
generate_key.bat
34+
35+
```
36+
37+
The script will generate a keypair. The file `ecc256.der` in the root of the repository contains the private key that will be used
38+
to sign valid firmware images. The file `src/ecc256_pub_key.c` now contains the public key that the bootloader embeds in its codebase
39+
to use it later to verify the image.
40+
41+
42+
### Compiling and linking the images
43+
44+
Now both projects (wolfboot and wolfboot-test-app) can be compiled and linked.
45+
The two resulting images will be placed in the output directory `Debug/Exe`:
46+
- wolfboot.bin
47+
- wolfboot-test-app.bin
48+
49+
### Signing the firmware image
50+
51+
The test application (main firmware) must be now tagged with a version number and signed. This is done by the script `sign_test_app.bat`.
52+
53+
The script requires one numeric argument that is used as the version tag for the signed image. Running it with version "1":
54+
55+
```
56+
sign_test_app.bat 1
57+
```
58+
59+
Will create a new file named `wolfboot-test-app_v1_signed.bin`, which will be placed in the output directory `Debug/Exe`.
60+
61+
62+
### Uploading the binary images to the target
63+
64+
Using the ST-LINK Utility, perform the following steps:
65+
66+
1. Erase the entire flash memory
67+
68+
![Erase flash](../../docs/png/windows_erase.png)
69+
70+
*Erase the entire flash memory before uploading the binary files*
71+
72+
73+
2. Upload `wolfboot.bin` to addess 0x08000000
74+
75+
![Upload bootloader](../../docs/png/windows_upload_1.png)
76+
77+
78+
3. Upload `wolfboot-test-app_v1_signed.bin` to address 0x08020000. Ensure that the flag "Skip Flash Erase" is active.
79+
80+
![Upload firmware](../../docs/png/windows_upload_2.png)
81+
82+
83+
### Verify that the system is up and running
84+
85+
If you are using a STM32F407-discovery board, a red LED will turn on upon application boot.
86+
87+
88+

IDE/IAR/generate_key.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
keytools\keygen.exe --ecc256 ..\..\src\ecc256_pub_key.c
2+
mv ecc256.der ..\..\

IDE/IAR/keytools/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Pre-compiled Key management tools for windows (64bit)
2+
3+
Full sources available in the [keytools](../../../tools/keytools) directory in this repository.

IDE/IAR/keytools/keygen.exe

745 KB
Binary file not shown.

IDE/IAR/keytools/sign.exe

747 KB
Binary file not shown.

0 commit comments

Comments
 (0)