diff --git a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c index 3c06ae2b24..c9ff9816e0 100755 --- a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c +++ b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c @@ -6,7 +6,7 @@ * @date: $Date: $ *----------------------------------------------------------------------------- * -Copyright (c) 2010-2017 Analog Devices, Inc. +Copyright (c) 2010-2018 Analog Devices, Inc. All rights reserved. @@ -45,19 +45,22 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *****************************************************************************/ #ifdef __ARMCC_VERSION -#include #include #endif #include #include #include +/*---------------------------------------------------------------------------- + External function Declaration + *----------------------------------------------------------------------------*/ +extern void SramInit(void); + /*---------------------------------------------------------------------------- Checksum options *----------------------------------------------------------------------------*/ -#if defined (__ARMCC_VERSION) -__attribute__((section(".ARM.__at_0x000001A0"))) -#elif defined(__ICCARM__) + +#if defined(__ICCARM__) __root #endif const uint32_t SECTION_PLACE(blank_checksum[],".checksum") = @@ -65,12 +68,6 @@ const uint32_t SECTION_PLACE(blank_checksum[],".checksum") = BLANKX60,BLANKX600 }; - -/*---------------------------------------------------------------------------- - External function Declaration - *----------------------------------------------------------------------------*/ -extern void SramInit(void); - /*---------------------------------------------------------------------------- Exception / Interrupt Handler *----------------------------------------------------------------------------*/ diff --git a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.h b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.h index d148540763..77a728fd42 100755 --- a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.h +++ b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.h @@ -7,7 +7,7 @@ * @date: $Date: $ *----------------------------------------------------------------------------- * -Copyright (c) 2010-2017 Analog Devices, Inc. +Copyright (c) 2010-2018 Analog Devices, Inc. All rights reserved. @@ -63,6 +63,9 @@ RESET_EXCPT_HNDLR #include #define VECTOR_SECTION ".vectors" +/* IVT typedefs. */ +typedef void( *pFunc )( void ); + #ifdef __ARMCC_VERSION void Default_Handler(void); #define SECTION_NAME(sectionname) __attribute__((section(sectionname))) @@ -71,6 +74,9 @@ void Default_Handler(void); #define RESET_EXCPT_HNDLR __main #define COMPILER_NAME "ARMCC" #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__) /* * IAR MISRA C 2004 error suppressions: @@ -89,17 +95,20 @@ void Default_Handler(void); #define RESET_EXCPT_HNDLR __iar_program_start #define COMPILER_NAME "ICCARM" #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__) -extern unsigned __etext; -extern unsigned __data_start__; -extern unsigned __data_end__; -extern unsigned __copy_table_start__; -extern unsigned __copy_table_end__; -extern unsigned __zero_table_start__; -extern unsigned __zero_table_end__; -extern unsigned __bss_start__; -extern unsigned __bss_end__; -extern unsigned __StackTop; +extern uint32_t __etext; +extern uint32_t __data_start__; +extern uint32_t __data_end__; +extern uint32_t __copy_table_start__; +extern uint32_t __copy_table_end__; +extern uint32_t __zero_table_start__; +extern uint32_t __zero_table_end__; +extern uint32_t __bss_start__; +extern uint32_t __bss_end__; +extern uint32_t __StackTop; void Default_Handler(void); /*---------------------------------------------------------------------------- External References @@ -112,18 +121,21 @@ extern int __START(void) __attribute__((noreturn)); /* main entry point */ #define RESET_EXCPT_HNDLR __START #endif #ifndef __STACK_SIZE -#define __STACK_SIZE 0x00000400 +#define __STACK_SIZE 0x00000400 #endif #if !defined(__HEAP_SIZE) || (__HEAP_SIZE <= 0) -#define __HEAP_SIZE 0x00000C00 +#define __HEAP_SIZE 0x00000C00 #endif #define SECTION_NAME(sectionname) __attribute__ ((section(sectionname))) #define SECTION_PLACE(def,sectionname) def __attribute__ ((section(sectionname))) #define IVT_NAME __Vectors #define COMPILER_NAME "GNUC" #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 #endif // __GNUC__ + #define LASTCRCPAGE 0 #define BLANKX4 0xFFFFFFFF #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 void RESET_EXCPT_HNDLR(void); void Reset_Handler(void); -/* IVT typedefs. */ -typedef void( *pFunc )( void ); #define ADUCM4050_VECTORS \ /* Configure Initial Stack Pointer, using linker-generated symbols */\ diff --git a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_ARM_STD/ADuCM4050.sct b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_ARM_STD/ADuCM4050.sct index 0f7791ae5e..0cc6ed3835 100755 --- a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_ARM_STD/ADuCM4050.sct +++ b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_ARM_STD/ADuCM4050.sct @@ -1,9 +1,10 @@ +#! armcc -E ;****************************************************************************** ; File: ADuCM4050.sct ; Scatter loading file for Analog Devices ADuCM4050 processor ; ; Copyright (c) 2011 - 2014 ARM LIMITED -; Copyright (c) 2016 - 2017 Analog Devices, Inc. +; Copyright (c) 2016 - 2018 Analog Devices, Inc. ; ; All rights reserved. ; 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 ; POSSIBILITY OF SUCH DAMAGE. ;****************************************************************************** -LR_IROM1 0x00000000 0x0007F000 { - FLASH0 0x00000000 0x00000800 { +#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 + +#define ADUCM_VECTOR_SIZE 0x1A0 + +LR_IROM1 MBED_APP_START MBED_APP_SIZE { + FLASH0 MBED_APP_START ADUCM_VECTOR_SIZE { *(.vectors, +First) - *(.checksum) } - ER_IROM1 AlignExpr(ImageLimit(FLASH0), 16) 0x0007E800 { - ; load address = execution address + FLASH1 (MBED_APP_START + ADUCM_VECTOR_SIZE) (ADUCM_SECTOR_SIZE - ADUCM_VECTOR_SIZE) { + *(.checksum, +Last) + } + + ER_IROM1 (MBED_APP_START + ADUCM_SECTOR_SIZE) (MBED_APP_SIZE - ADUCM_SECTOR_SIZE) { *(InRoot$$Sections) *(+RO) } diff --git a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld index 2ead54a157..4da717f2c6 100755 --- a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld +++ b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld @@ -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 * 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. */ MEMORY { /* The first 0x800 bytes of flash */ - FLASH0 (rx) : ORIGIN = 0x00000000, LENGTH = 0x800 - /* The remaining bytes of flash minus 4KB Protected Key Storage */ - FLASH (rx) : ORIGIN = 0x00000800, LENGTH = 512k - 4k - 0x800 + FLASH0 (rx) : ORIGIN = MBED_APP_START, LENGTH = ADUCM_SECTOR_SIZE + /* The rest of the flash */ + FLASH (rx) : ORIGIN = MBED_APP_START + ADUCM_SECTOR_SIZE, LENGTH = MBED_APP_SIZE - ADUCM_SECTOR_SIZE /* SRAM bank 0 */ DSRAM_A (rwx) : ORIGIN = 0x20000200, LENGTH = 32k - 0x200 /* SRAM bank 3+4+5+6+7 */ @@ -76,13 +86,6 @@ SECTIONS KEEP(*(.checksum)) } > FLASH0 - .security_options : - { - . = ALIGN(4); - KEEP(*(.security_options)) - . = ALIGN(4); - } > FLASH0 - .text : { *(.text*) diff --git a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_IAR/ADuCM4050.icf b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_IAR/ADuCM4050.icf index 318ad52023..1956e65b47 100755 --- a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_IAR/ADuCM4050.icf +++ b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_IAR/ADuCM4050.icf @@ -3,7 +3,7 @@ * ILINK Configuration File for Analog Devices ADuCM4050 processor * * Copyright (c) 2011 - 2014 ARM LIMITED -* Copyright (c) 2016 - 2017 Analog Devices, Inc. +* Copyright (c) 2016 - 2018 Analog Devices, Inc. * * All rights reserved. * 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 * 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 region ROM_PAGE0_INTVEC = mem:[from 0x00000000 size 0x000001A0]; -define region ROM_PAGE0_CHECKSUM = mem:[from 0x000001A0 size 0x00000660]; -define region ROM_REGION = mem:[from 0x00000800 size 506K]; +define region ROM_PAGE0_INTVEC = mem:[from MBED_APP_START size ADUCM_VECTOR_SIZE]; +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 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_bank2_region = mem:[from 0x20000200 size 0x00007E00] | mem:[from 0x20048000 size 0x00010000]; diff --git a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/cmsis_nvic.h b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/cmsis_nvic.h index 3a866a5d72..6c242dfa07 100755 --- a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/cmsis_nvic.h +++ b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/cmsis_nvic.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010-2017 Analog Devices, Inc. + * Copyright (c) 2010-2018 Analog Devices, Inc. * * All rights reserved. * @@ -48,7 +48,6 @@ #define NVIC_NUM_VECTORS (NVIC_USER_IRQ_OFFSET + NVIC_USER_IRQ_NUMBER) #define NVIC_RAM_VECTOR_ADDRESS 0x20000000 -#define NVIC_FLASH_VECTOR_ADDRESS 0x0 #ifdef __cplusplus extern "C" { diff --git a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/flash_api.c b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/flash_api.c index 2779c4cb5a..c29cdb8255 100755 --- a/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/flash_api.c +++ b/targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/flash_api.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010-2017 Analog Devices, Inc. + * Copyright (c) 2010-2018 Analog Devices, Inc. * * All rights reserved. * @@ -66,7 +66,7 @@ static const flash_algo_t flash_algo_config = { .erase_sector = 0x00000057, .program_page = 0x0000007F, .static_base = 0x0000013C, - .algo_blob = FLASH_ALGO + .algo_blob = (uint32_t *)FLASH_ALGO }; static const sector_info_t sectors_info[] = {