Skip to content

Support Flash iAP and Bootloader for GR-PEACH and GR-LYCHEE #6925

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions platform/mbed_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@

#if MBED_APPLICATION_SUPPORT

#if defined(__CORTEX_A9)

void mbed_start_application(uintptr_t address)
{
((void(*)())address)();
}

#else

static void powerdown_nvic(void);
static void powerdown_scb(uint32_t vtor);
static void start_new_application(void *sp, void *pc);
Expand Down Expand Up @@ -144,4 +153,6 @@ void start_new_application(void *sp, void *pc)

#endif

#endif

#endif /* MBED_APPLICATION_SUPPORT */
2 changes: 1 addition & 1 deletion platform/mbed_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include<stdint.h>

#if defined(__CORTEX_M3) || defined(__CORTEX_M4) || defined(__CORTEX_M7)\
|| defined(__CORTEX_M23)
|| defined(__CORTEX_M23) || defined(__CORTEX_A9)
#define MBED_APPLICATION_SUPPORT 1
#else
#define MBED_APPLICATION_SUPPORT 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,50 @@

#include "mem_RZ_A1LU.h"

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x18000000
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x800000
#endif

LOAD_TTB __TTB_BASE __TTB_SIZE ; Page 0 of On-Chip Data Retention RAM
{
TTB +0 EMPTY 0x4000
{ } ; Level-1 Translation Table for MMU
}

SFLASH __ROM_BASE __ROM_SIZE ; load region size_region
SFLASH MBED_APP_START MBED_APP_SIZE ; load region size_region
{
BOOT_LOADER_BEGIN __ROM_BASE FIXED
#if (MBED_APP_START == 0x18000000)
BOOT_LOADER_BEGIN MBED_APP_START FIXED
{
* (BOOT_LOADER)
}

VECTORS __VECTOR_BASE FIXED
VECTORS (MBED_APP_START + 0x4000) FIXED
{
* (RESET, +FIRST) ; Vector table and other startup code
* (InRoot$$Sections) ; All (library) code that must be in a root region
* (+RO-CODE) ; Application RO code (.text)
}
#else
VECTORS MBED_APP_START FIXED
{
* (RESET, +FIRST) ; Vector table and other startup code
* (InRoot$$Sections) ; All (library) code that must be in a root region
* (+RO-CODE) ; Application RO code (.text)
}
#endif

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

RW_DATA 0x20020000
RAM_CODE 0x20020000
{ * (RAM_CODE) } ; Application RAM_CODE

RW_DATA +0 ALIGN 0x4
{ * (+RW) } ; Application RW data (.data)

RW_IRAM1 +0 ALIGN 0x10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
// <o1> ROM Size (in Bytes) <0x0-0xFFFFFFFF:8>
// </h>
*----------------------------------------------------------------------------*/
#define __ROM_BASE 0x18000000
#define __ROM_SIZE 0x08000000

#define __VECTOR_BASE 0x18004000

/*--------------------- RAM Configuration -----------------------------------
*----------------------------------------------------------------------------*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
/* Linker script for mbed RZ_A1LU */

/* Linker script to configure memory regions. */

#if !defined(MBED_APP_START)
#define MBED_APP_START 0x18000000
#endif

#if !defined(MBED_APP_SIZE)
#define MBED_APP_SIZE 0x800000
#endif

#define BOOT_LOADER_ADDR (MBED_APP_START)
#if (MBED_APP_START == 0x18000000)
#define BOOT_LOADER_SIZE (0x00004000)
#else
#define BOOT_LOADER_SIZE (0x00000000)
#endif

#define SFLASH_ADDR (MBED_APP_START + BOOT_LOADER_SIZE)
#define SFLASH_SIZE (MBED_APP_SIZE - BOOT_LOADER_SIZE)

MEMORY
{
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x02000000
BOOT_LOADER (rx) : ORIGIN = 0x18000000, LENGTH = 0x00004000
SFLASH (rx) : ORIGIN = 0x18004000, LENGTH = 0x07FFC000
L_TTB (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x001E0000
RAM_NC (rwx) : ORIGIN = 0x20200000, LENGTH = 0x00100000
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x02000000
BOOT_LOADER (rx) : ORIGIN = BOOT_LOADER_ADDR, LENGTH = BOOT_LOADER_SIZE
SFLASH (rx) : ORIGIN = SFLASH_ADDR, LENGTH = SFLASH_SIZE
L_TTB (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
RAM (rwx) : ORIGIN = 0x20020000, LENGTH = 0x001E0000
RAM_NC (rwx) : ORIGIN = 0x20200000, LENGTH = 0x00100000
}

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

SECTIONS
{
#if (MBED_APP_START == 0x18000000)
.boot :
{
KEEP(*(.boot_loader))
} > BOOT_LOADER
#endif

.text :
{

Image$$VECTORS$$Base = .;
* (RESET)
. += 0x00000400;

KEEP(*(.isr_vector))
*(SVC_TABLE)
Expand Down Expand Up @@ -105,6 +125,9 @@ SECTIONS
LONG (__etext2)
LONG (__nc_data_start)
LONG (__nc_data_end - __nc_data_start)
LONG (LOADADDR(.ram_code))
LONG (ADDR(.ram_code))
LONG (SIZEOF(.ram_code))
__copy_table_end__ = .;
} > SFLASH

Expand All @@ -119,15 +142,31 @@ SECTIONS
__zero_table_end__ = .;
} > SFLASH

__etext = .;

.ram_code : ALIGN( 0x4 ) {
__ram_code_load = .;
__ram_code_start = LOADADDR(.ram_code) + ( __ram_code_load - ADDR(.ram_code) );

*(RAM_CODE)

*(RAM_CONST)

. = ALIGN( 0x4 );
__ram_code_end = LOADADDR(.ram_code) + ( . - ADDR(.ram_code) );
} > RAM AT > SFLASH

Load$$SEC_RAM_CODE$$Base = LOADADDR(.ram_code);
Image$$SEC_RAM_CODE$$Base = ADDR(.ram_code);
Load$$SEC_RAM_CODE$$Length = SIZEOF(.ram_code);

.ttb :
{
Image$$TTB$$ZI$$Base = .;
. += 0x00004000;
Image$$TTB$$ZI$$Limit = .;
} > L_TTB

__etext = Load$$SEC_RAM_CODE$$Base + SIZEOF(.ram_code);

.data : AT (__etext)
{
Image$$RW_DATA$$Base = .;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x18004000;
if (!isdefinedsymbol(MBED_APP_START)) {
define symbol MBED_APP_START = 0x18000000;
}
if (MBED_APP_START == 0x18000000) {
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START + 0x4000;
} else {
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
}
if (!isdefinedsymbol(MBED_APP_SIZE)) {
define symbol MBED_APP_SIZE = 0x800000;
}
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x18000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x187FFFFF;
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
define symbol __ICFEDIT_region_TTB_start__ = 0x20000000;
define symbol __ICFEDIT_region_TTB_end__ = 0x2001FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20020000;
Expand Down
Loading