11## wolfBoot for Renesas RX72N
22
3- #define BSP_CFG_USTACK_BYTES (0x2000)
3+ ## 1. Overview
44
5- ```
6- MCU: Renesas RX72N
7- Board: RX72N/Envision Kit
8- IDE: e2Studio
9- Compiler: CCRX
10- FIT Module: r_flash_rx
5+ It demonstrates simple secure firmware update by wolfBoot. A sample application v1 is
6+ securely updated to v2. Both versions behave the same except displaying its version of v1 or v2.
7+ They are compiled by e2Studio and running on the target board.
118
9+ In this demo, you may download two versions of application binary file by Renesas Flash Programmer.
10+ You can download and excute wolfBoot by e2Studio debugger. Use a USB connection between PC and the
11+ board for the debugger and flash programmer.
1212
13- e2Studio Project:
14- wolfBoot IDE/Renesas/e2studio_CCRX/wolfBoot
15- Sample app IDE/Renesas/e2studio_CCRX/app_RenesasRX01
13+ ## 2. Components and Tools
1614
17- Other Tools:
18- - Key tool
19- Key generation tools/keytools/keygen
20- Signature tools/keytools/sign
21- Included in wolfBoot with source code
15+ | Item| Name/Version| Note|
16+ | :--| :--| :--|
17+ | Board| RX72N/Envision Kit||
18+ | MCU| Renesas RX72N| R5F572NNxFB|
19+ | IDE| e2studio 2022-07| Download from Renesas site|
20+ | Compiler| CCRX v3.04.00||
21+ | FIT Module|| Download from Renesas site|
22+ | Flash Writer| Renesas Flash Programmer v3| Download from Renesas site|
23+ | Key tools| keygen and sign| Included in wolfBoot|
24+ | rx-elf-objcopy| GCC for Renesas RX 8.3.0.202202-GNURX-ELF| Included in GCC for Renesas RX|
2225
23- - Flash Wirter
24- Renesas Flash Programmer v3
25- Download from Renesas site
2626
27- - Binary tool:
28- rx-elf-objcopy.exe
29- Included in GCC for Renesas RX
27+ FIT Module
28+ | Module| Version| Note|
29+ | :--| :--| :--|
30+ | r_bsp| v7.20| #define BSP_CFG_USTACK_BYTES (0x2000)|
31+ || key size uses rsa-3072, please sets to (0x3000)|
32+ | r_flash_rx| v4.90||
3033
3134
3235Flash Allocation:
36+ ```
3337+---------------------------+------------------------+-----+
3438| B |H| |H| | |
3539| o |e| Primary |e| Update |Swap |
@@ -38,13 +42,19 @@ Flash Allocation:
3842+---------------------------+------------------------+-----+
39430xffc00000: wolfBoot
40440xffc10000: Primary partition (Header)
41- 0xffc10100: Primary partition (Application image)
45+ 0xffc10100: Primary partition (Application image) /* When it uses IMAGE_HEADER_SIZE 256, e.g. ED25519, EC256, EC384 or EC512 */
46+ 0xffc10200: Primary partition (Application image) /* When it uses IMAGE_HEADER_SIZE 512, e.g. RSA2048, RSA3072 */
42470xffdf0000: Update partition (Header)
43480xffdf0100: Update partition (Application image)
44490xfffd0000: Swap sector
50+
4551```
4652
47- ### Decription
53+ Note : Depending on IMAGE_HEADER_SIZE, it needs to change the address of Power Reset vector by Linker section.
54+ Application default is set to 0xffc10200. It means that you need to change it when you use 256 IMAGE_HEADER_SIZE.
55+
56+
57+ ## 3. How to build and use
4858It has key tools running under the host environment such as Linux, Windows or MacOS.
4959For comiling the tools, follow the instruction described in the user manual.
5060
@@ -57,7 +67,7 @@ You can download and excute wolfBoot by e2Studio debugger. Use a USB connection
5767board for the debugger and flash programmer.
5868
5969
60- ### 1) Key generation
70+ ### 3-1 Key generation
6171
6272```
6373$ cd <wolfBoot>
@@ -74,12 +84,12 @@ key to the store.
7484You can specify various signature algorithms such as
7585
7686```
77- --ed25519 --ed448 --ecc256 --ecc384 --ecc521 --rsa2048 --rsa3072 --rsa4096
87+ --ed25519 --ed448 --ecc256 --ecc384 --ecc521 --rsa2048 --rsa3072
7888```
7989
80- ### 2) Compile wolfBoot
90+ ### 3-2 Compile wolfBoot
8191
82- Open project under IDE/Renesas/e2studio_CCRX /wolfBoot with e2Studio, and build the project.
92+ Open project under IDE/Renesas/e2studio/RX72N /wolfBoot with e2Studio, and build the project.
8393
8494Project properties are preset for the demo.
8595
@@ -88,12 +98,13 @@ Smart Configurator
8898Flash Driver: r_flash_rx
8999
90100Include Paths
91- "C:..\..\..\..\..\ IDE/Renesas/e2Studio_CCRX /include
92- "C:..\..\..\..\..\ wolfBoot\wolfboot /include"
93- "C:..\..\..\..\..\ wolfBoot\wolfboot\include"
101+ ../../include : <wolfBoot>/ IDE/Renesas/e2studio/RX72N /include
102+ ../../../../../../include : < wolfBoot> /include
103+ ../../../../../../lib/wolfssl/ : < wolfBoot>/lib/wolfssl
94104
95105Pre-Include
96- ../../../../../include/user_settings.h
106+ ../../include/user_settings.h : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include/user_settigs.h
107+ ../../include/target.h : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include/target.h
97108
98109Pre-defined Pre-processor Macro
99110__WOLFBOOT
@@ -106,9 +117,9 @@ WOLFBOOT_PARTION_INFO, PRINTF_ENABLED are for debug information about partitions
106117Eliminate them for operational use.
107118
108119
109- ### 3) Compile the sample application
120+ ### 3-4 Compile the sample application
110121
111- Open project under IDE/Renesas/e2studio_CCRX /app_RenesasRx01 with e2Studio, and build the project.
122+ Open project under IDE/Renesas/e2studio/RX72N /app_RenesasRx01 with e2Studio, and build the project.
112123
113124
114125Project properties are preset for the demo.
@@ -118,15 +129,15 @@ Smart Configurator
118129Flash Driver: r_flash_rx
119130
120131Include Paths
121- "C:..\..\..\..\..\IDE/Renesas/e2Studio_CCRX/include
122- "C:..\..\..\..\..\ wolfBoot\wolfboot/ include"
123- "C:..\..\..\..\..\ wolfBoot\wolfboot\ include"
132+ Include Paths
133+ ../../include : < wolfBoot>/IDE/Renesas/e2studio/RX72N/ include
134+ ../../../../../../include : < wolfBoot>/ include
124135
125136Pre-Include
126- ../../include/user_settings.h
127- ../../include/terget .h
137+ ../../include/user_settings.h : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include/user_settigs.h
138+ ../../include/target.h : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include/target .h
128139
129- Code Origin and entry point (PResetPRG) is "0xffc10100 " (See Section Viewer of Linker Section).
140+ Code Origin and entry point (PResetPRG) is "0xffc10200 " (See Section Viewer of Linker Section).
130141```
131142
132143app_RenesasRx01.x in ELF is gnerated under HardwareDebug. You can derive bair binary file
@@ -140,7 +151,7 @@ $ rx-elf-objcopy.exe -O binary\
140151 -R '$ADDR_C_FE7F5D70' -R EXCEPTVECT -R RESETVECT app_RenesasRx01.x app_RenesasRx01.bin
141152```
142153
143- ### 4) Generate Signature for app V1
154+ ### 3-5 Generate Signature for app V1
144155
145156"sign" command under tools/keytools benerates a signature for the binary with a specified version.
146157It generates a file contain a partition header and application image. The partition header
@@ -163,7 +174,7 @@ Signing the digest...
163174Output image(s) successfully created.
164175```
165176
166- ### 5) Download the app V1
177+ ### 3-6 Download the app V1
167178
168179You can convert the binary file to hex format and download it to the board by Flash Programmer.
169180The partition starts at "0xffc10000".
@@ -173,7 +184,7 @@ $ rx-elf-objcopy.exe -I binary -O srec --change-addresses=0xffc10000 app_Renesas
173184```
174185
175186
176- ### 6) Execute inital boot
187+ ### 3-7 Execute inital boot
177188
178189Now, you can download and start wolfBoot program by e2Studio debugger.
179190After starting the program, you can see the partition information as follows.
@@ -182,28 +193,31 @@ application V1.
182193
183194
184195```
196+ | ------------------------------------------------------------------- |
197+ | Renesas RX User Application in BOOT partition started by wolfBoot |
198+ | ------------------------------------------------------------------- |
199+
200+
185201=== Boot Partition[ffc10000] ===
186202Magic: WOLF
187203Version: 01
188204Status: ff
189- Tail Mgc: ����
190-
205+ Tail Mgc: ????
191206
192207=== Update Partition[ffdf0000] ===
193- Magic: ����
194- Version: ff
208+ Magic: WOLF
209+ Version: 02
195210Status: ff
196- Tail Mgc: ����
197-
198- | ------------------------------------------------------------------- |
199- | Renesas RX User Application in BOOT partition started by wolfBoot |
200- | ------------------------------------------------------------------- |
211+ Tail Mgc: ????
201212
202213Current Firmware Version: 1
203- Hit any key to update the firmware.
214+ Hit any key to call wolfBoot_success the firmware.
204215```
205- The application calls wolfBoot_success() to set boot partition
206- state and wait for any key. if you re-start the boot program at this moment,
216+
217+ After hitting any key, the application calls wolfBoot_success() to set boot partition
218+ state and wait for any key again.
219+
220+ if you re-start the boot program at this moment,
207221after checking the integlity and authenticity, it jumps to the application.
208222You can see the state is Success("00").
209223
@@ -213,9 +227,17 @@ Magic: WOLF
213227Version: 01
214228Status: 00
215229Tail Mgc: BOOT
230+
231+ === Update Partition[ffdf0000] ===
232+ Magic: WOLF
233+ Version: 02
234+ Status: ff
235+ Tail Mgc: ????
236+
237+ Hit any key to update the firmware.
216238```
217239
218- ### 7) Generate Signed app V2 and download it
240+ ### 3-8 Generate Signed app V2 and download it
219241
220242Similar to V1, you can signe and generate a binary of V2. The update partition starts at "0xffdf0000".
221243You can download it by the flash programmer.
@@ -227,7 +249,7 @@ rx-elf-objcopy.exe -I binary -O srec --change-addresses=0xffdf0000 app_RenesasRx
227249```
228250
229251
230- ### 8) Re-boot and secure update to V2
252+ ### 3-9 Re-boot and secure update to V2
231253
232254Now the image is downloaded but note that the partition status is not changed yet.
233255When it is re-boot, it checks integlity and authenticity of V1 and initiate V1 as in
@@ -240,6 +262,7 @@ step 6.
240262
241263Current Firmware Version: 1
242264Hit any key to update the firmware.
265+ Firmware Update is triggered
243266```
244267
245268After you see the message, hit any key so that the application calls
@@ -261,13 +284,20 @@ information.
261284| Renesas RX User Application in BOOT partition started by wolfBoot |
262285| ------------------------------------------------------------------- |
263286
264- Current Firmware Version: 2
265- Hit any key to update the firmware.
266- ```
267-
268- Not the application behavior is almost identical but the Version is "2" this time.
269287
288+ === Boot Partition[ffc10000] ===
289+ Magic: WOLF
290+ Version: 02
291+ Status: 10
292+ Tail Mgc: BOOT
270293
294+ === Update Partition[ffdf0000] ===
295+ Magic: WOLF
296+ Version: 01
297+ Status: ff
298+ Tail Mgc: ????
271299
272- ## Creating an application project from scratch
300+ Current Firmware Version: 2
301+ ```
273302
303+ Not the application behavior is almost identical but the Version is "2" this time.
0 commit comments