From 2b0ff329d6f80f666e56dd9be10db255f1a03c38 Mon Sep 17 00:00:00 2001 From: Chris Snow Date: Sat, 30 Sep 2017 18:39:11 +0100 Subject: [PATCH] Simplify CRP placement. --- targets/TARGET_NXP/TARGET_LPC176X/device/CRP.c | 8 +------- .../device/TOOLCHAIN_ARM_MICRO/LPC1768.sct | 14 ++++++++++---- .../device/TOOLCHAIN_ARM_STD/LPC1768.sct | 14 ++++++++++---- .../device/TOOLCHAIN_IAR/LPC17xx.icf | 6 +++--- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/targets/TARGET_NXP/TARGET_LPC176X/device/CRP.c b/targets/TARGET_NXP/TARGET_LPC176X/device/CRP.c index 5b80b4dcb3..f2ae329670 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/device/CRP.c +++ b/targets/TARGET_NXP/TARGET_LPC176X/device/CRP.c @@ -51,10 +51,4 @@ performed on the device. #define CRP CRP_NONE #endif -#if defined (__ICCARM__) - __root const long CRP_Key@APPLICATION_ADDR + 0x000002FC = CRP; -#elif defined (__ARMCC_VERSION) - const long CRP_Key __attribute__((used)) __attribute__((at(APPLICATION_ADDR+0x000002FC))) = CRP; -#elif defined (__GNUC__) - const long CRP_Key __attribute__((used)) __attribute__((section(".CRPSection"))) = CRP; -#endif +MBED_SECTION(".CRPSection") MBED_USED const long CRP_Key = CRP; diff --git a/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_ARM_MICRO/LPC1768.sct b/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_ARM_MICRO/LPC1768.sct index 2999e8081d..44d51132a1 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_ARM_MICRO/LPC1768.sct +++ b/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_ARM_MICRO/LPC1768.sct @@ -9,10 +9,16 @@ #endif LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region - ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address - *.o (RESET, +First) - *(InRoot$$Sections) - .ANY (+RO) + ER_IROM0 MBED_APP_START 0x2FC { ; load address = execution address + *.o (RESET, +First) + .ANY (+RO) + } + ER_CRP (MBED_APP_START + 0x2FC) FIXED 4 { + *.o (.CRPSection) + } + ER_IROM1 (MBED_APP_START + (0x2FC + 4)) FIXED (MBED_APP_SIZE - (0x2FC + 4)) { + *(InRoot$$Sections) + .ANY (+RO) } ; 8_byte_aligned(49 vect * 4 bytes) = 8_byte_aligned(0xC4) = 0xC8 ; 32KB (RAM size) - 0xC8 (NIVT) - 32 (topmost 32 bytes used by IAP functions) = 0x7F18 diff --git a/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_ARM_STD/LPC1768.sct b/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_ARM_STD/LPC1768.sct index 42f4a76492..f56aae7389 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_ARM_STD/LPC1768.sct +++ b/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_ARM_STD/LPC1768.sct @@ -9,10 +9,16 @@ #endif LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region - ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address - *.o (RESET, +First) - *(InRoot$$Sections) - .ANY (+RO) + ER_IROM0 MBED_APP_START 0x2FC { ; load address = execution address + *.o (RESET, +First) + .ANY (+RO) + } + ER_CRP (MBED_APP_START + 0x2FC) FIXED 4 { + *.o (.CRPSection) + } + ER_IROM1 (MBED_APP_START + (0x2FC + 4)) FIXED (MBED_APP_SIZE - (0x2FC + 4)) { + *(InRoot$$Sections) + .ANY (+RO) } ; 8_byte_aligned(49 vect * 4 bytes) = 8_byte_aligned(0xC4) = 0xC8 ; 32KB (RAM size) - 0xC8 (NIVT) - 32 (topmost 32 bytes used by IAP functions) = 0x7F18 diff --git a/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_IAR/LPC17xx.icf b/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_IAR/LPC17xx.icf index 6051abd55a..0cea4b47c7 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_IAR/LPC17xx.icf +++ b/targets/TARGET_NXP/TARGET_LPC176X/device/TOOLCHAIN_IAR/LPC17xx.icf @@ -19,8 +19,8 @@ define symbol __ICFEDIT_size_cstack__ = 0x1000; define symbol __ICFEDIT_size_heap__ = 0x2000; /**** End of ICF editor section. ###ICF###*/ -define symbol __CRP_start__ = 0x000002FC; -define symbol __CRP_end__ = 0x000002FF; +define symbol __CRP_start__ = MBED_APP_START + 0x000002FC; +define symbol __CRP_end__ = MBED_APP_START + 0x000002FF; define symbol __RAM1_start__ = 0x2007C000; define symbol __RAM1_end__ = 0x20083FFF; @@ -43,5 +43,5 @@ place in ROM_region { readonly }; place in RAM_region { readwrite, block HEAP, block CSTACK }; -place in CRP_region { section .crp }; +place in CRP_region { section .CRPSection }; place in RAM1_region { section .ethusbram };