From 606ccbceff0086f1b15969d9d7d40b415883a662 Mon Sep 17 00:00:00 2001 From: Martin Kojtal Date: Tue, 12 May 2020 15:56:12 +0100 Subject: [PATCH] Use cmsis gcc types instead of own This caused a conflict. As CMSIS update introduced low level init, lets use the types from CMSIS. We could potentionally use __cmsis_start but as I saw for some targets, the init routine is slightly different. So rather keep what we have in targets, and just use types already defined in CMSIS. --- .../device/startup_ADuCM3029.h | 4 -- .../device/startup_ADuCM4050.h | 4 -- .../TARGET_M2351/device/startup_M2351.c | 59 ++++++++----------- .../TARGET_M251/device/startup_M251.c | 23 +------- 4 files changed, 26 insertions(+), 64 deletions(-) diff --git a/targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.h b/targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.h index af684f4d15..d96d246bd4 100755 --- a/targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.h +++ b/targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.h @@ -91,10 +91,6 @@ extern uint32_t Load$$LR$$LR_IROM1$$Base[]; 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; 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 77a728fd42..2450681c6e 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 @@ -102,10 +102,6 @@ extern uint32_t Load$$LR$$LR_IROM1$$Base[]; 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; diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c b/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c index 91cf9ccf3a..f2a37ba714 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c @@ -464,52 +464,39 @@ void Reset_Handler_1(void) __iar_program_start(); #elif defined(__GNUC__) - /* Move (multiple) .data section(s) from ROM to RAM */ - { - /* Struct of copy table entry which must match linker script */ - typedef struct copy_table_entry_ { - uint32_t src; // Address to copy from - uint32_t dst; // Address to copy to - uint32_t size; // Copy size in bytes - } copy_table_entry; + /* Move (multiple) .data section(s) from ROM to RAM */ + { + copy_table_entry *copy_table_ind = (copy_table_entry *) &__copy_table_start__; + copy_table_entry *copy_table_end = (copy_table_entry *) &__copy_table_end__; - copy_table_entry *copy_table_ind = (copy_table_entry *) &__copy_table_start__; - copy_table_entry *copy_table_end = (copy_table_entry *) &__copy_table_end__; - - for (; copy_table_ind != copy_table_end; copy_table_ind ++) { - uint32_t *src_ind = (uint32_t *) copy_table_ind->src; - uint32_t *src_end = (uint32_t *) (copy_table_ind->src + copy_table_ind->size); - uint32_t *dst_ind = (uint32_t *) copy_table_ind->dst; - if (src_ind != dst_ind) { - for (; src_ind < src_end;) { - *dst_ind ++ = *src_ind ++; + for (; copy_table_ind != copy_table_end; copy_table_ind ++) { + uint32_t *src_ind = (uint32_t *) copy_table_ind->src; + uint32_t *src_end = (uint32_t *) (copy_table_ind->src + copy_table_ind->size); + uint32_t *dst_ind = (uint32_t *) copy_table_ind->dst; + if (src_ind != dst_ind) { + for (; src_ind < src_end;) { + *dst_ind ++ = *src_ind ++; + } } } } - } - /* Initialize (multiple) .bss sections to zero */ - { - /* Struct of zero table entry which must match linker script */ - typedef struct zero_table_entry_ { - uint32_t start; // Address to start zero'ing - uint32_t size; // Zero size in bytes - } zero_table_entry; + /* Initialize (multiple) .bss sections to zero */ + { + zero_table_entry *zero_table_ind = (zero_table_entry *) &__zero_table_start__; + zero_table_entry *zero_table_end = (zero_table_entry *) &__zero_table_end__; - zero_table_entry *zero_table_ind = (zero_table_entry *) &__zero_table_start__; - zero_table_entry *zero_table_end = (zero_table_entry *) &__zero_table_end__; + for (; zero_table_ind != zero_table_end; zero_table_ind ++) { + uint32_t *dst_ind = (uint32_t *) zero_table_ind->start; + uint32_t *dst_end = (uint32_t *) (zero_table_ind->start + zero_table_ind->size); - for (; zero_table_ind != zero_table_end; zero_table_ind ++) { - uint32_t *dst_ind = (uint32_t *) zero_table_ind->start; - uint32_t *dst_end = (uint32_t *) (zero_table_ind->start + zero_table_ind->size); - - for (; dst_ind < dst_end; ) { - *dst_ind ++ = 0; + for (; dst_ind < dst_end; ) { + *dst_ind ++ = 0; + } } } - } - _start(); + _start(); #endif diff --git a/targets/TARGET_NUVOTON/TARGET_M251/device/startup_M251.c b/targets/TARGET_NUVOTON/TARGET_M251/device/startup_M251.c index 662c23931d..e23820841e 100644 --- a/targets/TARGET_NUVOTON/TARGET_M251/device/startup_M251.c +++ b/targets/TARGET_NUVOTON/TARGET_M251/device/startup_M251.c @@ -61,10 +61,6 @@ extern void __main(void); void __iar_program_start(void); #elif defined(__GNUC__) extern uint32_t __StackTop; -extern uint32_t __copy_table_start__; -extern uint32_t __copy_table_end__; -extern uint32_t __zero_table_start__; -extern uint32_t __zero_table_end__; #if defined(TOOLCHAIN_GCC_ARM) extern void _start(void); @@ -284,20 +280,13 @@ void Reset_Handler(void) #elif defined(__GNUC__) /* Move (multiple) .data section(s) from ROM to RAM */ { - /* Struct of copy table entry which must match linker script */ - typedef struct copy_table_entry_ { - uint32_t src; // Address to copy from - uint32_t dst; // Address to copy to - uint32_t size; // Copy size in bytes - } copy_table_entry; - copy_table_entry *copy_table_ind = (copy_table_entry *) &__copy_table_start__; copy_table_entry *copy_table_end = (copy_table_entry *) &__copy_table_end__; for (; copy_table_ind != copy_table_end; copy_table_ind ++) { uint32_t *src_ind = (uint32_t *) copy_table_ind->src; - uint32_t *src_end = (uint32_t *) (copy_table_ind->src + copy_table_ind->size); - uint32_t *dst_ind = (uint32_t *) copy_table_ind->dst; + uint32_t *src_end = (uint32_t *) (copy_table_ind->src + copy_table_ind->wlen); + uint32_t *dst_ind = (uint32_t *) copy_table_ind->dest; if (src_ind != dst_ind) { for (; src_ind < src_end;) { *dst_ind ++ = *src_ind ++; @@ -308,18 +297,12 @@ void Reset_Handler(void) /* Initialize (multiple) .bss sections to zero */ { - /* Struct of zero table entry which must match linker script */ - typedef struct zero_table_entry_ { - uint32_t start; // Address to start zero'ing - uint32_t size; // Zero size in bytes - } zero_table_entry; - zero_table_entry *zero_table_ind = (zero_table_entry *) &__zero_table_start__; zero_table_entry *zero_table_end = (zero_table_entry *) &__zero_table_end__; for (; zero_table_ind != zero_table_end; zero_table_ind ++) { uint32_t *dst_ind = (uint32_t *) zero_table_ind->start; - uint32_t *dst_end = (uint32_t *) (zero_table_ind->start + zero_table_ind->size); + uint32_t *dst_end = (uint32_t *) (zero_table_ind->start + zero_table_ind->wlen); for (; dst_ind < dst_end; ) { *dst_ind ++ = 0;