Skip to content

Commit 030073d

Browse files
kojo1danielinux
authored andcommitted
Add TSIP
1 parent 81fb762 commit 030073d

14 files changed

Lines changed: 770 additions & 48 deletions

File tree

IDE/Renesas/e2studio_CCRX/Readme.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
## wolfBoot for Renesas RX72N
22

3+
#define BSP_CFG_USTACK_BYTES (0x2000)
4+
35
```
46
MCU: Renesas RX72N
57
Board: RX72N/Envision Kit
68
IDE: e2Studio
79
Compiler: CCRX
810
FIT Module: r_flash_rx
911
10-
Optional:
11-
Flash Wirter: Renesas Flash Programmer v3
1212
1313
e2Studio Project:
1414
wolfBoot IDE/Renesas/e2studio_CCRX/wolfBoot
1515
Sample app IDE/Renesas/e2studio_CCRX/app_RenesasRX01
1616
17-
Key tool:
18-
Key generation tools/keytools/keygen
19-
Signature tools/keytools/sign
17+
Other Tools:
18+
- Key tool
19+
Key generation tools/keytools/keygen
20+
Signature tools/keytools/sign
21+
Included in wolfBoot with source code
22+
23+
- Flash Wirter
24+
Renesas Flash Programmer v3
25+
Download from Renesas site
26+
27+
- Binary tool:
28+
rx-elf-objcopy.exe
29+
Included in GCC for Renesas RX
30+
2031
2132
Flash Allocation:
2233
+---------------------------+------------------------+-----+
@@ -49,13 +60,14 @@ board for the debugger and flash programmer.
4960
### 1) Key generation
5061

5162
```
63+
$ cd <wolfBoot>
5264
$ export PATH:$PATH:<wolfBoot>/tools/keytools
53-
$ keygen --ed255519 -g ./pri-ed25519.der
65+
$ keygen --ecc256 -g ./pri-ecc256.der
5466
```
5567

56-
It generates a pair of private and public key with -g option. The private
57-
key is stored in the specified file. The public key is stored in a key store
58-
as a C source code soo that it can be compiled and linked with wolfBoot.
68+
It generates a pair of private and public key with -g option. The private key is stored
69+
in the specified file. The public key is stored in a key store as a C source code
70+
in "src/keystore.c" soo that it can be compiled and linked with wolfBoot.
5971
If you have an existing key pair, you can use -i option to import the pablic
6072
key to the store.
6173

@@ -111,7 +123,8 @@ Include Paths
111123
"C:..\..\..\..\..\wolfBoot\wolfboot\include"
112124
113125
Pre-Include
114-
../../../../../include/user_settings.h
126+
../../include/user_settings.h
127+
../../include/terget.h
115128
116129
Code Origin and entry point (PResetPRG) is "0xffc10100" (See Section Viewer of Linker Section).
117130
```
@@ -135,15 +148,14 @@ contain generated signature and other control fields. Output file name is made u
135148
the input file name and version like app_RenesasRx01_v1.0_signed.bin.
136149

137150
```
138-
$ sign --ed25519 app_RenesasRx01.bin ../../../../../pri-ed25519.der 1.0
139-
ed25519.der 1.0
151+
$ sign --ecc256 app_RenesasRx01.bin ../../../../../pri-ecc256.der 1.0 ecc256.der 1.0
140152
wolfBoot KeyTools (Compiled C version)
141153
wolfBoot version 10B0000
142154
Update type: Firmware
143155
Input image: app_RenesasRx.bin
144-
Selected cipher: ED25519
156+
Selected cipher: ECC256
145157
Selected hash : SHA256
146-
Public key: ed25519.der
158+
Public key: ecc256.der
147159
Output image: app_RenesasRx_v1.0_signed.bin
148160
Target partition id : 1
149161
Calculating SHA256 digest...
@@ -210,7 +222,7 @@ You can download it by the flash programmer.
210222

211223

212224
```
213-
$ sign --ed25519 app_RenesasRx01.bin ../../../../../pri-ed25519.der 2.0
225+
$ sign --ecc256 app_RenesasRx01.bin ../../../../../pri-ecc256.der 2.0
214226
rx-elf-objcopy.exe -I binary -O srec --change-addresses=0xffdf0000 app_RenesasRx01_v2.0_signed.bin app_RenesasRx01_v2.0_signed.hex
215227
```
216228

@@ -235,7 +247,7 @@ wolfBoot_update_trigger() whcih changes the partition status and triggers
235247
updating the firmware.
236248

237249
Since this is just a trigger, the application can continue the process.
238-
In the demo application it outputs a message "Update Triggered" and enters
250+
In the demo application it outputs a message "Firmware Update is triggered" and enters
239251
a infinit loop of nop.
240252

241253
Now you can re-boot it by start wolfBoot by e2Studion debugger. The boot
@@ -255,3 +267,7 @@ Hit any key to update the firmware.
255267

256268
Not the application behavior is almost identical but the Version is "2" this time.
257269

270+
271+
272+
## Creating an application project from scratch
273+

IDE/Renesas/e2studio_CCRX/app_RenesasRX01/.cproject

Lines changed: 189 additions & 0 deletions
Large diffs are not rendered by default.

IDE/Renesas/e2studio_CCRX/app_RenesasRX01/src/app_RenesasRX01.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
static void printPart(uint8_t *part)
3232
{
33-
#ifdef WOLFBOOT_PARTION_VERBOS
33+
#ifdef WOLFBOOT_DEBUG_PARTION
3434
uint32_t *v;
3535
int i;
3636
#endif
@@ -47,23 +47,13 @@ static void printPart(uint8_t *part)
4747
magic = part + WOLFBOOT_PARTITION_SIZE - sizeof(uint32_t);
4848
printf("Tail Mgc: %c%c%c%c\n", magic[0], magic[1], magic[2], magic[3]);
4949

50-
#ifdef PARTIION_VERBOS
50+
#ifdef WOLFBOOT_DEBUG_PARTION
5151
v = (uint32_t *)part;
5252
for(i = 0; i < 0x100/4; i++) {
5353
if(i % 4 == 0)
5454
print("\n%08x: ", (uint32_t)v+i*4);
5555
print("%08x ", v[i]);
5656
}
57-
58-
print("\n\nImage:");
59-
60-
for( ; i < 0x100/4 + 16; i++) {
61-
if(i % 4 == 0)
62-
print("\n%08x: ", (uint32_t)v+i*4);
63-
print("%08x ", v[i]);
64-
}
65-
66-
print("\n\n");
6757
#endif
6858

6959
}
@@ -74,7 +64,7 @@ static void printPartitions(void)
7464
printf("\n=== Boot Partition[%08x] ===\n", WOLFBOOT_PARTITION_BOOT_ADDRESS);
7565
printPart((uint8_t*)WOLFBOOT_PARTITION_BOOT_ADDRESS);
7666
printf("\n=== Update Partition[%08x] ===\n", WOLFBOOT_PARTITION_UPDATE_ADDRESS);
77-
printPart((uint8_t*)WOLFBOOT_PARTITION_UPDATE_ADDRESS);
67+
//printPart((uint8_t*)WOLFBOOT_PARTITION_UPDATE_ADDRESS);
7868
}
7969

8070

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/* target.h
2+
*
3+
* User configurable build-time options for bootloader and application offsets
4+
*
5+
* target.h is automatically generated using the template in target.h.in by running
6+
* "make config".
7+
*
8+
* Copyright (C) 2021 wolfSSL Inc.
9+
*
10+
* This file is part of wolfBoot.
11+
*
12+
* wolfBoot is free software; you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation; either version 2 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* wolfBoot is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License
23+
* along with this program; if not, write to the Free Software
24+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
25+
*/
26+
27+
#ifndef H_TARGETS_TARGET_
28+
#define H_TARGETS_TARGET_
29+
30+
#ifndef WOLFBOOT_NO_PARTITIONS
31+
# define WOLFBOOT_FIXED_PARTITIONS
32+
#endif
33+
34+
#define WOLFBOOT_FLASH_ADDR 0xffc00000
35+
#define WOLFBOOT_FLASH_SIZE (0x100000000 - WOLFBOOT_FLASH_ADDR)
36+
37+
#if defined(WOLFBOOT_RENESAS_TSIP)
38+
39+
#define WOLFBOOT_BOOT_SIZE 0x50000
40+
#define WOLFBOOT_RX_EXCVECT 0x10000
41+
#define WOLFBOOT_SECTOR_SIZE 0x20000
42+
43+
#define WOLFBOOT_PARTITION_SIZE\
44+
((WOLFBOOT_FLASH_SIZE - WOLFBOOT_BOOT_SIZE -\
45+
WOLFBOOT_RX_EXCVECT - WOLFBOOT_SECTOR_SIZE) / 2)
46+
47+
#define WOLFBOOT_PARTITION_BOOT_ADDRESS\
48+
(WOLFBOOT_FLASH_ADDR + WOLFBOOT_BOOT_SIZE)
49+
#define WOLFBOOT_PARTITION_UPDATE_ADDRESS\
50+
(WOLFBOOT_PARTITION_BOOT_ADDRESS + WOLFBOOT_PARTITION_SIZE)
51+
#define WOLFBOOT_PARTITION_SWAP_ADDRESS\
52+
(WOLFBOOT_PARTITION_UPDATE_ADDRESS + WOLFBOOT_PARTITION_SIZE)
53+
54+
#elif defined(WOLFBOOT_DUALBOOT)
55+
56+
#define WOLFBOOT_BOOT_SIZE 0x10000
57+
#define WOLFBOOT_RX_EXCVECT 0x10000
58+
#define WOLFBOOT_SECTOR_SIZE 0x0
59+
60+
#define WOLFBOOT_PARTITION_SIZE WOLFBOOT_FLASH_SIZE/2 - WOLFBOOT_BOOT_SIZE
61+
62+
#define WOLFBOOT_PARTITION_BOOT_ADDRESS\
63+
(WOLFBOOT_FLASH_ADDR + WOLFBOOT_BOOT_SIZE)
64+
#define WOLFBOOT_PARTITION_UPDATE_ADDRESS\
65+
(WOLFBOOT_FLASH_ADDR + WOLFBOOT_FLASH_SIZE/2 + WOLFBOOT_BOOT_SIZE)
66+
67+
#define WOLFBOOT_PARTITION_SWAP_ADDRESS 0x0
68+
69+
#else
70+
#define WOLFBOOT_BOOT_SIZE 0x10000
71+
#define WOLFBOOT_RX_EXCVECT 0x10000
72+
#define WOLFBOOT_SECTOR_SIZE 0x20000
73+
74+
#define WOLFBOOT_PARTITION_SIZE\
75+
((WOLFBOOT_FLASH_SIZE - WOLFBOOT_BOOT_SIZE -\
76+
WOLFBOOT_RX_EXCVECT - WOLFBOOT_SECTOR_SIZE) / 2)
77+
78+
#define WOLFBOOT_PARTITION_BOOT_ADDRESS\
79+
(WOLFBOOT_FLASH_ADDR + WOLFBOOT_BOOT_SIZE)
80+
#define WOLFBOOT_PARTITION_UPDATE_ADDRESS\
81+
(WOLFBOOT_PARTITION_BOOT_ADDRESS + WOLFBOOT_PARTITION_SIZE)
82+
#define WOLFBOOT_PARTITION_SWAP_ADDRESS\
83+
(WOLFBOOT_PARTITION_UPDATE_ADDRESS + WOLFBOOT_PARTITION_SIZE)
84+
#endif
85+
86+
#endif /* !H_TARGETS_TARGET_ */

0 commit comments

Comments
 (0)