|
| 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 | + |
| 69 | + |
| 70 | +*Erase the entire flash memory before uploading the binary files* |
| 71 | + |
| 72 | + |
| 73 | + 2. Upload `wolfboot.bin` to addess 0x08000000 |
| 74 | + |
| 75 | + |
| 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 | + |
| 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 | + |
0 commit comments