Skip to content

Commit 94c13c5

Browse files
committed
Support Bootloader for GR-PEACH and GR-LYCHEE
The mainly changes is below: - Update scatter file, linker file for bootloader support - Update the file for RZ/A1 serial flash boot loader - Add "device name" and "bootloader_supported" in targets.json
1 parent 18a8eac commit 94c13c5

File tree

11 files changed

+145
-35
lines changed

11 files changed

+145
-35
lines changed

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_GR_LYCHEE/device/TOOLCHAIN_ARM_STD/MBRZA1LU.sct

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,42 @@
99

1010
#include "mem_RZ_A1LU.h"
1111

12+
#if !defined(MBED_APP_START)
13+
#define MBED_APP_START 0x18000000
14+
#endif
15+
16+
#if !defined(MBED_APP_SIZE)
17+
#define MBED_APP_SIZE 0x800000
18+
#endif
19+
1220
LOAD_TTB __TTB_BASE __TTB_SIZE ; Page 0 of On-Chip Data Retention RAM
1321
{
1422
TTB +0 EMPTY 0x4000
1523
{ } ; Level-1 Translation Table for MMU
1624
}
1725

18-
SFLASH __ROM_BASE __ROM_SIZE ; load region size_region
26+
SFLASH MBED_APP_START MBED_APP_SIZE ; load region size_region
1927
{
20-
BOOT_LOADER_BEGIN __ROM_BASE FIXED
28+
#if (MBED_APP_START == 0x18000000)
29+
BOOT_LOADER_BEGIN MBED_APP_START FIXED
2130
{
2231
* (BOOT_LOADER)
2332
}
2433

25-
VECTORS __VECTOR_BASE FIXED
34+
VECTORS (MBED_APP_START + 0x4000) FIXED
35+
{
36+
* (RESET, +FIRST) ; Vector table and other startup code
37+
* (InRoot$$Sections) ; All (library) code that must be in a root region
38+
* (+RO-CODE) ; Application RO code (.text)
39+
}
40+
#else
41+
VECTORS MBED_APP_START FIXED
2642
{
2743
* (RESET, +FIRST) ; Vector table and other startup code
2844
* (InRoot$$Sections) ; All (library) code that must be in a root region
2945
* (+RO-CODE) ; Application RO code (.text)
3046
}
47+
#endif
3148

3249
RO_DATA +0
3350
{ * (+RO-DATA) } ; Application RO data (.constdata)

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_GR_LYCHEE/device/TOOLCHAIN_ARM_STD/mem_RZ_A1LU.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
// <o1> ROM Size (in Bytes) <0x0-0xFFFFFFFF:8>
4343
// </h>
4444
*----------------------------------------------------------------------------*/
45-
#define __ROM_BASE 0x18000000
46-
#define __ROM_SIZE 0x08000000
47-
48-
#define __VECTOR_BASE 0x18004000
4945

5046
/*--------------------- RAM Configuration -----------------------------------
5147
*----------------------------------------------------------------------------*/

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_GR_LYCHEE/device/TOOLCHAIN_GCC_ARM/RZA1LU.ld

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
/* Linker script for mbed RZ_A1LU */
22

33
/* Linker script to configure memory regions. */
4+
5+
#if !defined(MBED_APP_START)
6+
#define MBED_APP_START 0x18000000
7+
#endif
8+
9+
#if !defined(MBED_APP_SIZE)
10+
#define MBED_APP_SIZE 0x800000
11+
#endif
12+
13+
#define BOOT_LOADER_ADDR (MBED_APP_START)
14+
#if (MBED_APP_START == 0x18000000)
15+
#define BOOT_LOADER_SIZE (0x00004000)
16+
#else
17+
#define BOOT_LOADER_SIZE (0x00000000)
18+
#endif
19+
20+
#define SFLASH_ADDR (MBED_APP_START + BOOT_LOADER_SIZE)
21+
#define SFLASH_SIZE (MBED_APP_SIZE - BOOT_LOADER_SIZE)
22+
423
MEMORY
524
{
6-
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x02000000
7-
BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000
8-
SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000
9-
L_TTB (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
10-
RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x001E0000
11-
RAM_NC (rwx) : ORIGIN = 0x20200000, LENGTH = 0x00100000
25+
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x02000000
26+
BOOT_LOADER (rx) : ORIGIN = BOOT_LOADER_ADDR, LENGTH = BOOT_LOADER_SIZE
27+
SFLASH (rx) : ORIGIN = SFLASH_ADDR, LENGTH = SFLASH_SIZE
28+
L_TTB (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
29+
RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x001E0000
30+
RAM_NC (rwx) : ORIGIN = 0x20200000, LENGTH = 0x00100000
1231
}
1332

1433
/* Linker script to place sections and symbol values. Should be used together
@@ -41,17 +60,18 @@ ENTRY(Reset_Handler)
4160

4261
SECTIONS
4362
{
63+
#if (MBED_APP_START == 0x18000000)
4464
.boot :
4565
{
4666
KEEP(*(.boot_loader))
4767
} > BOOT_LOADER
68+
#endif
4869

4970
.text :
5071
{
5172

5273
Image$$VECTORS$$Base = .;
5374
* (RESET)
54-
. += 0x00000400;
5575

5676
KEEP(*(.isr_vector))
5777
*(SVC_TABLE)

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_GR_LYCHEE/device/TOOLCHAIN_IAR/MBRZA1LU.icf

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22
/*-Editor annotation file-*/
33
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
44
/*-Specials-*/
5-
define symbol __ICFEDIT_intvec_start__ = 0x18004000;
5+
if (!isdefinedsymbol(MBED_APP_START)) {
6+
define symbol MBED_APP_START = 0x18000000;
7+
}
8+
if (MBED_APP_START == 0x18000000) {
9+
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START + 0x4000;
10+
} else {
11+
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
12+
}
13+
if (!isdefinedsymbol(MBED_APP_SIZE)) {
14+
define symbol MBED_APP_SIZE = 0x800000;
15+
}
616
/*-Memory Regions-*/
7-
define symbol __ICFEDIT_region_ROM_start__ = 0x18000000;
8-
define symbol __ICFEDIT_region_ROM_end__ = 0x187FFFFF;
17+
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
18+
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
919
define symbol __ICFEDIT_region_TTB_start__ = 0x20000000;
1020
define symbol __ICFEDIT_region_TTB_end__ = 0x2001FFFF;
1121
define symbol __ICFEDIT_region_RAM_start__ = 0x20020000;

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_GR_LYCHEE/device/mbed_sf_boot.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
* $Date:: $
2727
* @brief RZ_A1 serial flash boot loader
2828
******************************************************************************/
29+
#if !defined(APPLICATION_ADDR)
30+
#define APPLICATION_ADDR 0x18000000
31+
#endif
32+
33+
#if (APPLICATION_ADDR != 0x18000000)
34+
const char * boot_loader = (char *)0x18000000;
35+
36+
#else /* (APPLICATION_ADDR == 0x18000000) */
37+
2938
#if defined (__CC_ARM)
3039
#pragma arm section rodata = "BOOT_LOADER"
3140
const char boot_loader[] __attribute__((used)) =
@@ -825,3 +834,4 @@ const char boot_loader[] __attribute__ ((section(".boot_loader"), used)) =
825834
#pragma arm section
826835
#endif
827836

837+
#endif /* APPLICATION_ADDR */

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_RZ_A1H/device/TOOLCHAIN_ARM_STD/MBRZA1H.sct

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,42 @@
99

1010
#include "mem_RZ_A1H.h"
1111

12+
#if !defined(MBED_APP_START)
13+
#define MBED_APP_START 0x18000000
14+
#endif
15+
16+
#if !defined(MBED_APP_SIZE)
17+
#define MBED_APP_SIZE 0x800000
18+
#endif
19+
1220
LOAD_TTB __TTB_BASE __TTB_SIZE ; Page 0 of On-Chip Data Retention RAM
1321
{
1422
TTB +0 EMPTY 0x4000
1523
{ } ; Level-1 Translation Table for MMU
1624
}
1725

18-
SFLASH __ROM_BASE __ROM_SIZE ; load region size_region
26+
SFLASH MBED_APP_START MBED_APP_SIZE ; load region size_region
1927
{
20-
BOOT_LOADER_BEGIN __ROM_BASE FIXED
28+
#if (MBED_APP_START == 0x18000000)
29+
BOOT_LOADER_BEGIN MBED_APP_START FIXED
2130
{
2231
* (BOOT_LOADER)
2332
}
2433

25-
VECTORS __VECTOR_BASE FIXED
34+
VECTORS (MBED_APP_START + 0x4000) FIXED
35+
{
36+
* (RESET, +FIRST) ; Vector table and other startup code
37+
* (InRoot$$Sections) ; All (library) code that must be in a root region
38+
* (+RO-CODE) ; Application RO code (.text)
39+
}
40+
#else
41+
VECTORS MBED_APP_START FIXED
2642
{
2743
* (RESET, +FIRST) ; Vector table and other startup code
2844
* (InRoot$$Sections) ; All (library) code that must be in a root region
2945
* (+RO-CODE) ; Application RO code (.text)
3046
}
47+
#endif
3148

3249
RO_DATA +0
3350
{ * (+RO-DATA) } ; Application RO data (.constdata)

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_RZ_A1H/device/TOOLCHAIN_ARM_STD/mem_RZ_A1H.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
// <o1> ROM Size (in Bytes) <0x0-0xFFFFFFFF:8>
4343
// </h>
4444
*----------------------------------------------------------------------------*/
45-
#define __ROM_BASE 0x18000000
46-
#define __ROM_SIZE 0x08000000
47-
48-
#define __VECTOR_BASE 0x18004000
4945

5046
/*--------------------- RAM Configuration -----------------------------------
5147
*----------------------------------------------------------------------------*/

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_RZ_A1H/device/TOOLCHAIN_GCC_ARM/RZA1H.ld

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
/* Linker script for mbed RZ_A1H */
22

33
/* Linker script to configure memory regions. */
4+
5+
#if !defined(MBED_APP_START)
6+
#define MBED_APP_START 0x18000000
7+
#endif
8+
9+
#if !defined(MBED_APP_SIZE)
10+
#define MBED_APP_SIZE 0x800000
11+
#endif
12+
13+
#define BOOT_LOADER_ADDR (MBED_APP_START)
14+
#if (MBED_APP_START == 0x18000000)
15+
#define BOOT_LOADER_SIZE (0x00004000)
16+
#else
17+
#define BOOT_LOADER_SIZE (0x00000000)
18+
#endif
19+
20+
#define SFLASH_ADDR (MBED_APP_START + BOOT_LOADER_SIZE)
21+
#define SFLASH_SIZE (MBED_APP_SIZE - BOOT_LOADER_SIZE)
22+
423
MEMORY
524
{
6-
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x02000000
7-
BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000
8-
SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000
9-
L_TTB (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
10-
RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x008E0000
11-
RAM_NC (rwx) : ORIGIN = 0x20900000, LENGTH = 0x00100000
25+
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x02000000
26+
BOOT_LOADER (rx) : ORIGIN = BOOT_LOADER_ADDR, LENGTH = BOOT_LOADER_SIZE
27+
SFLASH (rx) : ORIGIN = SFLASH_ADDR, LENGTH = SFLASH_SIZE
28+
L_TTB (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
29+
RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x008E0000
30+
RAM_NC (rwx) : ORIGIN = 0x20900000, LENGTH = 0x00100000
1231
}
1332

1433
/* Linker script to place sections and symbol values. Should be used together
@@ -41,17 +60,18 @@ ENTRY(Reset_Handler)
4160

4261
SECTIONS
4362
{
63+
#if (MBED_APP_START == 0x18000000)
4464
.boot :
4565
{
4666
KEEP(*(.boot_loader))
4767
} > BOOT_LOADER
68+
#endif
4869

4970
.text :
5071
{
5172

5273
Image$$VECTORS$$Base = .;
5374
* (RESET)
54-
. += 0x00000400;
5575

5676
KEEP(*(.isr_vector))
5777
*(SVC_TABLE)

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_RZ_A1H/device/TOOLCHAIN_IAR/MBRZA1H.icf

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22
/*-Editor annotation file-*/
33
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
44
/*-Specials-*/
5-
define symbol __ICFEDIT_intvec_start__ = 0x18004000;
5+
if (!isdefinedsymbol(MBED_APP_START)) {
6+
define symbol MBED_APP_START = 0x18000000;
7+
}
8+
if (MBED_APP_START == 0x18000000) {
9+
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START + 0x4000;
10+
} else {
11+
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
12+
}
13+
if (!isdefinedsymbol(MBED_APP_SIZE)) {
14+
define symbol MBED_APP_SIZE = 0x800000;
15+
}
616
/*-Memory Regions-*/
7-
define symbol __ICFEDIT_region_ROM_start__ = 0x18000000;
8-
define symbol __ICFEDIT_region_ROM_end__ = 0x187FFFFF;
17+
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
18+
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
919
define symbol __ICFEDIT_region_TTB_start__ = 0x20000000;
1020
define symbol __ICFEDIT_region_TTB_end__ = 0x2001FFFF;
1121
define symbol __ICFEDIT_region_RAM_start__ = 0x20020000;

targets/TARGET_RENESAS/TARGET_RZ_A1XX/TARGET_RZ_A1H/device/mbed_sf_boot.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
* $Date:: $
2727
* @brief RZ_A1 serial flash boot loader
2828
******************************************************************************/
29+
#if !defined(APPLICATION_ADDR)
30+
#define APPLICATION_ADDR 0x18000000
31+
#endif
32+
33+
#if (APPLICATION_ADDR != 0x18000000)
34+
const char * boot_loader = (char *)0x18000000;
35+
36+
#else /* (APPLICATION_ADDR == 0x18000000) */
37+
2938
#if defined (__CC_ARM)
3039
#pragma arm section rodata = "BOOT_LOADER"
3140
const char boot_loader[] __attribute__((used)) =
@@ -826,3 +835,4 @@ const char boot_loader[] __attribute__ ((section(".boot_loader"), used)) =
826835
#pragma arm section
827836
#endif
828837

838+
#endif /* APPLICATION_ADDR */

targets/targets.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2845,7 +2845,9 @@
28452845
"supported_form_factors": ["ARDUINO"],
28462846
"extra_labels_add": ["RZA1H", "MBRZA1H", "RZ_A1_EMAC"],
28472847
"device_has_add": ["EMAC", "FLASH"],
2848-
"release_versions": ["2", "5"]
2848+
"release_versions": ["2", "5"],
2849+
"device_name": "R7S72100",
2850+
"bootloader_supported": true
28492851
},
28502852
"VK_RZ_A1H": {
28512853
"inherits": ["RZ_A1XX"],
@@ -2861,6 +2863,8 @@
28612863
"device_has_remove": ["ETHERNET"],
28622864
"features_remove": ["LWIP"],
28632865
"release_versions": ["2", "5"],
2866+
"device_name": "R7S72103",
2867+
"bootloader_supported": true,
28642868
"overrides": {
28652869
"network-default-interface-type": null
28662870
}

0 commit comments

Comments
 (0)