Skip to content

Commit 8e170cc

Browse files
author
Cruz Monrreal
authored
Merge pull request #6925 from TomoYamanaka/feature-flashiap_bootloader
Support Flash iAP and Bootloader for GR-PEACH and GR-LYCHEE
2 parents bb74def + 72fd8ca commit 8e170cc

File tree

26 files changed

+1663
-49
lines changed

26 files changed

+1663
-49
lines changed

platform/mbed_application.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121

2222
#if MBED_APPLICATION_SUPPORT
2323

24+
#if defined(__CORTEX_A9)
25+
26+
void mbed_start_application(uintptr_t address)
27+
{
28+
((void(*)())address)();
29+
}
30+
31+
#else
32+
2433
static void powerdown_nvic(void);
2534
static void powerdown_scb(uint32_t vtor);
2635
static void start_new_application(void *sp, void *pc);
@@ -144,4 +153,6 @@ void start_new_application(void *sp, void *pc)
144153

145154
#endif
146155

156+
#endif
157+
147158
#endif /* MBED_APPLICATION_SUPPORT */

platform/mbed_application.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include<stdint.h>
2121

2222
#if defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__CORTEX_M7)\
23-
|| defined(__CORTEX_M23)
23+
|| defined(__CORTEX_M23) || defined(__CORTEX_A9)
2424
#define MBED_APPLICATION_SUPPORT 1
2525
#else
2626
#define MBED_APPLICATION_SUPPORT 0

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

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,50 @@
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)
3451

35-
RW_DATA 0x20020000
52+
RAM_CODE 0x20020000
53+
{ * (RAM_CODE) } ; Application RAM_CODE
54+
55+
RW_DATA +0 ALIGN 0x4
3656
{ * (+RW) } ; Application RW data (.data)
3757

3858
RW_IRAM1 +0 ALIGN 0x10

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: 48 additions & 9 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)
@@ -105,6 +125,9 @@ SECTIONS
105125
LONG (__etext2)
106126
LONG (__nc_data_start)
107127
LONG (__nc_data_end - __nc_data_start)
128+
LONG (LOADADDR(.ram_code))
129+
LONG (ADDR(.ram_code))
130+
LONG (SIZEOF(.ram_code))
108131
__copy_table_end__ = .;
109132
} > SFLASH
110133

@@ -119,15 +142,31 @@ SECTIONS
119142
__zero_table_end__ = .;
120143
} > SFLASH
121144

122-
__etext = .;
123-
145+
.ram_code : ALIGN( 0x4 ) {
146+
__ram_code_load = .;
147+
__ram_code_start = LOADADDR(.ram_code) + ( __ram_code_load - ADDR(.ram_code) );
148+
149+
*(RAM_CODE)
150+
151+
*(RAM_CONST)
152+
153+
. = ALIGN( 0x4 );
154+
__ram_code_end = LOADADDR(.ram_code) + ( . - ADDR(.ram_code) );
155+
} > RAM AT > SFLASH
156+
157+
Load$$SEC_RAM_CODE$$Base = LOADADDR(.ram_code);
158+
Image$$SEC_RAM_CODE$$Base = ADDR(.ram_code);
159+
Load$$SEC_RAM_CODE$$Length = SIZEOF(.ram_code);
160+
124161
.ttb :
125162
{
126163
Image$$TTB$$ZI$$Base = .;
127164
. += 0x00004000;
128165
Image$$TTB$$ZI$$Limit = .;
129166
} > L_TTB
130167

168+
__etext = Load$$SEC_RAM_CODE$$Base + SIZEOF(.ram_code);
169+
131170
.data : AT (__etext)
132171
{
133172
Image$$RW_DATA$$Base = .;

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;

0 commit comments

Comments
 (0)