mirror of https://github.com/ARMmbed/mbed-os.git
EV_COG_AD4050LZ: Rework linker scripts to support bootloader
- fix compiler warning message of flash_api.c - fix compiler warning message of startup_ADuCM4050.c - eliminate absolute address of ROM tables - add MBED_APP_START and MBED_APP_SIZE to linker scriptspull/6690/head
parent
42d77ecd13
commit
beb6a38009
|
@ -6,7 +6,7 @@
|
||||||
* @date: $Date: $
|
* @date: $Date: $
|
||||||
*-----------------------------------------------------------------------------
|
*-----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
Copyright (c) 2010-2017 Analog Devices, Inc.
|
Copyright (c) 2010-2018 Analog Devices, Inc.
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -45,19 +45,22 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifdef __ARMCC_VERSION
|
#ifdef __ARMCC_VERSION
|
||||||
#include <stdint.h>
|
|
||||||
#include <rt_misc.h>
|
#include <rt_misc.h>
|
||||||
#endif
|
#endif
|
||||||
#include <cmsis.h>
|
#include <cmsis.h>
|
||||||
#include <startup_ADuCM4050.h>
|
#include <startup_ADuCM4050.h>
|
||||||
#include <mbed_rtx.h>
|
#include <mbed_rtx.h>
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
External function Declaration
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
extern void SramInit(void);
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Checksum options
|
Checksum options
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
#if defined (__ARMCC_VERSION)
|
|
||||||
__attribute__((section(".ARM.__at_0x000001A0")))
|
#if defined(__ICCARM__)
|
||||||
#elif defined(__ICCARM__)
|
|
||||||
__root
|
__root
|
||||||
#endif
|
#endif
|
||||||
const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
|
const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
|
||||||
|
@ -65,12 +68,6 @@ const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
|
||||||
BLANKX60,BLANKX600
|
BLANKX60,BLANKX600
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
|
||||||
External function Declaration
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
extern void SramInit(void);
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
Exception / Interrupt Handler
|
Exception / Interrupt Handler
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* @date: $Date: $
|
* @date: $Date: $
|
||||||
*-----------------------------------------------------------------------------
|
*-----------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
Copyright (c) 2010-2017 Analog Devices, Inc.
|
Copyright (c) 2010-2018 Analog Devices, Inc.
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -63,6 +63,9 @@ RESET_EXCPT_HNDLR
|
||||||
|
|
||||||
#include <adi_types.h>
|
#include <adi_types.h>
|
||||||
#define VECTOR_SECTION ".vectors"
|
#define VECTOR_SECTION ".vectors"
|
||||||
|
/* IVT typedefs. */
|
||||||
|
typedef void( *pFunc )( void );
|
||||||
|
|
||||||
#ifdef __ARMCC_VERSION
|
#ifdef __ARMCC_VERSION
|
||||||
void Default_Handler(void);
|
void Default_Handler(void);
|
||||||
#define SECTION_NAME(sectionname) __attribute__((section(sectionname)))
|
#define SECTION_NAME(sectionname) __attribute__((section(sectionname)))
|
||||||
|
@ -71,6 +74,9 @@ void Default_Handler(void);
|
||||||
#define RESET_EXCPT_HNDLR __main
|
#define RESET_EXCPT_HNDLR __main
|
||||||
#define COMPILER_NAME "ARMCC"
|
#define COMPILER_NAME "ARMCC"
|
||||||
#define WEAK_FUNCTION(x) void x (void) __attribute__((weak, alias("Default_Handler")));
|
#define WEAK_FUNCTION(x) void x (void) __attribute__((weak, alias("Default_Handler")));
|
||||||
|
extern uint32_t Load$$LR$$LR_IROM1$$Base[];
|
||||||
|
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)Load$$LR$$LR_IROM1$$Base)
|
||||||
|
|
||||||
#elif defined(__ICCARM__)
|
#elif defined(__ICCARM__)
|
||||||
/*
|
/*
|
||||||
* IAR MISRA C 2004 error suppressions:
|
* IAR MISRA C 2004 error suppressions:
|
||||||
|
@ -89,17 +95,20 @@ void Default_Handler(void);
|
||||||
#define RESET_EXCPT_HNDLR __iar_program_start
|
#define RESET_EXCPT_HNDLR __iar_program_start
|
||||||
#define COMPILER_NAME "ICCARM"
|
#define COMPILER_NAME "ICCARM"
|
||||||
#define WEAK_FUNCTION(x) WEAK_FUNC ( void x (void)) { while(1){} }
|
#define WEAK_FUNCTION(x) WEAK_FUNC ( void x (void)) { while(1){} }
|
||||||
|
#pragma section=VECTOR_SECTION
|
||||||
|
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)__section_begin(VECTOR_SECTION))
|
||||||
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
extern unsigned __etext;
|
extern uint32_t __etext;
|
||||||
extern unsigned __data_start__;
|
extern uint32_t __data_start__;
|
||||||
extern unsigned __data_end__;
|
extern uint32_t __data_end__;
|
||||||
extern unsigned __copy_table_start__;
|
extern uint32_t __copy_table_start__;
|
||||||
extern unsigned __copy_table_end__;
|
extern uint32_t __copy_table_end__;
|
||||||
extern unsigned __zero_table_start__;
|
extern uint32_t __zero_table_start__;
|
||||||
extern unsigned __zero_table_end__;
|
extern uint32_t __zero_table_end__;
|
||||||
extern unsigned __bss_start__;
|
extern uint32_t __bss_start__;
|
||||||
extern unsigned __bss_end__;
|
extern uint32_t __bss_end__;
|
||||||
extern unsigned __StackTop;
|
extern uint32_t __StackTop;
|
||||||
void Default_Handler(void);
|
void Default_Handler(void);
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
External References
|
External References
|
||||||
|
@ -112,18 +121,21 @@ extern int __START(void) __attribute__((noreturn)); /* main entry point */
|
||||||
#define RESET_EXCPT_HNDLR __START
|
#define RESET_EXCPT_HNDLR __START
|
||||||
#endif
|
#endif
|
||||||
#ifndef __STACK_SIZE
|
#ifndef __STACK_SIZE
|
||||||
#define __STACK_SIZE 0x00000400
|
#define __STACK_SIZE 0x00000400
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__HEAP_SIZE) || (__HEAP_SIZE <= 0)
|
#if !defined(__HEAP_SIZE) || (__HEAP_SIZE <= 0)
|
||||||
#define __HEAP_SIZE 0x00000C00
|
#define __HEAP_SIZE 0x00000C00
|
||||||
#endif
|
#endif
|
||||||
#define SECTION_NAME(sectionname) __attribute__ ((section(sectionname)))
|
#define SECTION_NAME(sectionname) __attribute__ ((section(sectionname)))
|
||||||
#define SECTION_PLACE(def,sectionname) def __attribute__ ((section(sectionname)))
|
#define SECTION_PLACE(def,sectionname) def __attribute__ ((section(sectionname)))
|
||||||
#define IVT_NAME __Vectors
|
#define IVT_NAME __Vectors
|
||||||
#define COMPILER_NAME "GNUC"
|
#define COMPILER_NAME "GNUC"
|
||||||
#define WEAK_FUNCTION(x) void x (void) __attribute__ ((weak, alias("Default_Handler")));
|
#define WEAK_FUNCTION(x) void x (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
extern const pFunc IVT_NAME[];
|
||||||
|
#define NVIC_FLASH_VECTOR_ADDRESS ((uint32_t)IVT_NAME)
|
||||||
#define __STARTUP_CLEAR_BSS_MULTIPLE
|
#define __STARTUP_CLEAR_BSS_MULTIPLE
|
||||||
#endif // __GNUC__
|
#endif // __GNUC__
|
||||||
|
|
||||||
#define LASTCRCPAGE 0
|
#define LASTCRCPAGE 0
|
||||||
#define BLANKX4 0xFFFFFFFF
|
#define BLANKX4 0xFFFFFFFF
|
||||||
#define BLANKX20 BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4
|
#define BLANKX20 BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4,BLANKX4
|
||||||
|
@ -132,8 +144,6 @@ extern int __START(void) __attribute__((noreturn)); /* main entry point */
|
||||||
#define BLANKX60 BLANKX20,BLANKX20,BLANKX20
|
#define BLANKX60 BLANKX20,BLANKX20,BLANKX20
|
||||||
void RESET_EXCPT_HNDLR(void);
|
void RESET_EXCPT_HNDLR(void);
|
||||||
void Reset_Handler(void);
|
void Reset_Handler(void);
|
||||||
/* IVT typedefs. */
|
|
||||||
typedef void( *pFunc )( void );
|
|
||||||
|
|
||||||
#define ADUCM4050_VECTORS \
|
#define ADUCM4050_VECTORS \
|
||||||
/* Configure Initial Stack Pointer, using linker-generated symbols */\
|
/* Configure Initial Stack Pointer, using linker-generated symbols */\
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
#! armcc -E
|
||||||
;******************************************************************************
|
;******************************************************************************
|
||||||
; File: ADuCM4050.sct
|
; File: ADuCM4050.sct
|
||||||
; Scatter loading file for Analog Devices ADuCM4050 processor
|
; Scatter loading file for Analog Devices ADuCM4050 processor
|
||||||
;
|
;
|
||||||
; Copyright (c) 2011 - 2014 ARM LIMITED
|
; Copyright (c) 2011 - 2014 ARM LIMITED
|
||||||
; Copyright (c) 2016 - 2017 Analog Devices, Inc.
|
; Copyright (c) 2016 - 2018 Analog Devices, Inc.
|
||||||
;
|
;
|
||||||
; All rights reserved.
|
; All rights reserved.
|
||||||
; Redistribution and use in source and binary forms, with or without
|
; Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -29,14 +30,28 @@
|
||||||
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
; POSSIBILITY OF SUCH DAMAGE.
|
; POSSIBILITY OF SUCH DAMAGE.
|
||||||
;******************************************************************************
|
;******************************************************************************
|
||||||
LR_IROM1 0x00000000 0x0007F000 {
|
#if !defined(MBED_APP_START)
|
||||||
FLASH0 0x00000000 0x00000800 {
|
#define MBED_APP_START 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_APP_SIZE)
|
||||||
|
#define MBED_APP_SIZE 0x7F000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ADUCM_SECTOR_SIZE 0x800
|
||||||
|
|
||||||
|
#define ADUCM_VECTOR_SIZE 0x1A0
|
||||||
|
|
||||||
|
LR_IROM1 MBED_APP_START MBED_APP_SIZE {
|
||||||
|
FLASH0 MBED_APP_START ADUCM_VECTOR_SIZE {
|
||||||
*(.vectors, +First)
|
*(.vectors, +First)
|
||||||
*(.checksum)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ER_IROM1 AlignExpr(ImageLimit(FLASH0), 16) 0x0007E800 {
|
FLASH1 (MBED_APP_START + ADUCM_VECTOR_SIZE) (ADUCM_SECTOR_SIZE - ADUCM_VECTOR_SIZE) {
|
||||||
; load address = execution address
|
*(.checksum, +Last)
|
||||||
|
}
|
||||||
|
|
||||||
|
ER_IROM1 (MBED_APP_START + ADUCM_SECTOR_SIZE) (MBED_APP_SIZE - ADUCM_SECTOR_SIZE) {
|
||||||
*(InRoot$$Sections)
|
*(InRoot$$Sections)
|
||||||
*(+RO)
|
*(+RO)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,27 @@
|
||||||
/*
|
/*
|
||||||
* Portions Copyright (c) 2016 Analog Devices, Inc.
|
* Portions Copyright (c) 2016 - 2018 Analog Devices, Inc.
|
||||||
*
|
*
|
||||||
* Based on Device/ARM/ARMCM4/Source/GCC/gcc_arm.ld file in
|
* Based on Device/ARM/ARMCM4/Source/GCC/gcc_arm.ld file in
|
||||||
* ARM.CMSIS.4.5.0.pack.
|
* ARM.CMSIS.4.5.0.pack.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if !defined(MBED_APP_START)
|
||||||
|
#define MBED_APP_START 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MBED_APP_SIZE)
|
||||||
|
#define MBED_APP_SIZE 0x7F000
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ADUCM_SECTOR_SIZE 0x800
|
||||||
|
|
||||||
/* Linker script to configure memory regions. */
|
/* Linker script to configure memory regions. */
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
/* The first 0x800 bytes of flash */
|
/* The first 0x800 bytes of flash */
|
||||||
FLASH0 (rx) : ORIGIN = 0x00000000, LENGTH = 0x800
|
FLASH0 (rx) : ORIGIN = MBED_APP_START, LENGTH = ADUCM_SECTOR_SIZE
|
||||||
/* The remaining bytes of flash minus 4KB Protected Key Storage */
|
/* The rest of the flash */
|
||||||
FLASH (rx) : ORIGIN = 0x00000800, LENGTH = 512k - 4k - 0x800
|
FLASH (rx) : ORIGIN = MBED_APP_START + ADUCM_SECTOR_SIZE, LENGTH = MBED_APP_SIZE - ADUCM_SECTOR_SIZE
|
||||||
/* SRAM bank 0 */
|
/* SRAM bank 0 */
|
||||||
DSRAM_A (rwx) : ORIGIN = 0x20000200, LENGTH = 32k - 0x200
|
DSRAM_A (rwx) : ORIGIN = 0x20000200, LENGTH = 32k - 0x200
|
||||||
/* SRAM bank 3+4+5+6+7 */
|
/* SRAM bank 3+4+5+6+7 */
|
||||||
|
@ -76,13 +86,6 @@ SECTIONS
|
||||||
KEEP(*(.checksum))
|
KEEP(*(.checksum))
|
||||||
} > FLASH0
|
} > FLASH0
|
||||||
|
|
||||||
.security_options :
|
|
||||||
{
|
|
||||||
. = ALIGN(4);
|
|
||||||
KEEP(*(.security_options))
|
|
||||||
. = ALIGN(4);
|
|
||||||
} > FLASH0
|
|
||||||
|
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
*(.text*)
|
*(.text*)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* ILINK Configuration File for Analog Devices ADuCM4050 processor
|
* ILINK Configuration File for Analog Devices ADuCM4050 processor
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 - 2014 ARM LIMITED
|
* Copyright (c) 2011 - 2014 ARM LIMITED
|
||||||
* Copyright (c) 2016 - 2017 Analog Devices, Inc.
|
* Copyright (c) 2016 - 2018 Analog Devices, Inc.
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -29,10 +29,23 @@
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
if (!isdefinedsymbol(MBED_APP_START)) {
|
||||||
|
define symbol MBED_APP_START = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isdefinedsymbol(MBED_APP_SIZE)) {
|
||||||
|
define symbol MBED_APP_SIZE = 0x7F000;
|
||||||
|
}
|
||||||
|
|
||||||
|
define symbol ADUCM_SECTOR_SIZE = 0x800;
|
||||||
|
|
||||||
|
define symbol ADUCM_VECTOR_SIZE = 0x1A0;
|
||||||
|
|
||||||
define memory mem with size = 4G;
|
define memory mem with size = 4G;
|
||||||
define region ROM_PAGE0_INTVEC = mem:[from 0x00000000 size 0x000001A0];
|
define region ROM_PAGE0_INTVEC = mem:[from MBED_APP_START size ADUCM_VECTOR_SIZE];
|
||||||
define region ROM_PAGE0_CHECKSUM = mem:[from 0x000001A0 size 0x00000660];
|
define region ROM_PAGE0_CHECKSUM = mem:[from MBED_APP_START+ADUCM_VECTOR_SIZE size ADUCM_SECTOR_SIZE-ADUCM_VECTOR_SIZE];
|
||||||
define region ROM_REGION = mem:[from 0x00000800 size 506K];
|
define region ROM_REGION = mem:[from MBED_APP_START+ADUCM_SECTOR_SIZE size MBED_APP_SIZE-ADUCM_SECTOR_SIZE];
|
||||||
define region RAM_bank1_region = mem:[from 0x20040000 size 0x00008000];
|
define region RAM_bank1_region = mem:[from 0x20040000 size 0x00008000];
|
||||||
define region RAM_bank2_region = mem:[from 0x20000200 size 0x00007E00]
|
define region RAM_bank2_region = mem:[from 0x20000200 size 0x00007E00]
|
||||||
| mem:[from 0x20048000 size 0x00010000];
|
| mem:[from 0x20048000 size 0x00010000];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010-2017 Analog Devices, Inc.
|
* Copyright (c) 2010-2018 Analog Devices, Inc.
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,6 @@
|
||||||
#define NVIC_NUM_VECTORS (NVIC_USER_IRQ_OFFSET + NVIC_USER_IRQ_NUMBER)
|
#define NVIC_NUM_VECTORS (NVIC_USER_IRQ_OFFSET + NVIC_USER_IRQ_NUMBER)
|
||||||
|
|
||||||
#define NVIC_RAM_VECTOR_ADDRESS 0x20000000
|
#define NVIC_RAM_VECTOR_ADDRESS 0x20000000
|
||||||
#define NVIC_FLASH_VECTOR_ADDRESS 0x0
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010-2017 Analog Devices, Inc.
|
* Copyright (c) 2010-2018 Analog Devices, Inc.
|
||||||
*
|
*
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -66,7 +66,7 @@ static const flash_algo_t flash_algo_config = {
|
||||||
.erase_sector = 0x00000057,
|
.erase_sector = 0x00000057,
|
||||||
.program_page = 0x0000007F,
|
.program_page = 0x0000007F,
|
||||||
.static_base = 0x0000013C,
|
.static_base = 0x0000013C,
|
||||||
.algo_blob = FLASH_ALGO
|
.algo_blob = (uint32_t *)FLASH_ALGO
|
||||||
};
|
};
|
||||||
|
|
||||||
static const sector_info_t sectors_info[] = {
|
static const sector_info_t sectors_info[] = {
|
||||||
|
|
Loading…
Reference in New Issue