Skip to content

Commit 2c8be47

Browse files
committed
Revert "Use cmsis gcc types instead of own"
This reverts commit 606ccbc.
1 parent d04b403 commit 2c8be47

File tree

4 files changed

+65
-27
lines changed

4 files changed

+65
-27
lines changed

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ extern uint32_t Load$$LR$$LR_IROM1$$Base[];
9191
extern unsigned __etext;
9292
extern unsigned __data_start__;
9393
extern unsigned __data_end__;
94+
extern unsigned __copy_table_start__;
95+
extern unsigned __copy_table_end__;
96+
extern unsigned __zero_table_start__;
97+
extern unsigned __zero_table_end__;
9498
extern unsigned __bss_start__;
9599
extern unsigned __bss_end__;
96100
extern unsigned __StackTop;

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ extern uint32_t Load$$LR$$LR_IROM1$$Base[];
102102
extern uint32_t __etext;
103103
extern uint32_t __data_start__;
104104
extern uint32_t __data_end__;
105+
extern uint32_t __copy_table_start__;
106+
extern uint32_t __copy_table_end__;
107+
extern uint32_t __zero_table_start__;
108+
extern uint32_t __zero_table_end__;
105109
extern uint32_t __bss_start__;
106110
extern uint32_t __bss_end__;
107111
extern uint32_t __StackTop;

targets/TARGET_NUVOTON/TARGET_M2351/device/startup_M2351.c

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -464,39 +464,52 @@ void Reset_Handler_1(void)
464464
__iar_program_start();
465465

466466
#elif defined(__GNUC__)
467-
/* Move (multiple) .data section(s) from ROM to RAM */
468-
{
469-
copy_table_entry *copy_table_ind = (copy_table_entry *) &__copy_table_start__;
470-
copy_table_entry *copy_table_end = (copy_table_entry *) &__copy_table_end__;
471-
472-
for (; copy_table_ind != copy_table_end; copy_table_ind ++) {
473-
uint32_t *src_ind = (uint32_t *) copy_table_ind->src;
474-
uint32_t *src_end = (uint32_t *) (copy_table_ind->src + copy_table_ind->size);
475-
uint32_t *dst_ind = (uint32_t *) copy_table_ind->dst;
476-
if (src_ind != dst_ind) {
477-
for (; src_ind < src_end;) {
478-
*dst_ind ++ = *src_ind ++;
479-
}
467+
/* Move (multiple) .data section(s) from ROM to RAM */
468+
{
469+
/* Struct of copy table entry which must match linker script */
470+
typedef struct copy_table_entry_ {
471+
uint32_t src; // Address to copy from
472+
uint32_t dst; // Address to copy to
473+
uint32_t size; // Copy size in bytes
474+
} copy_table_entry;
475+
476+
copy_table_entry *copy_table_ind = (copy_table_entry *) &__copy_table_start__;
477+
copy_table_entry *copy_table_end = (copy_table_entry *) &__copy_table_end__;
478+
479+
for (; copy_table_ind != copy_table_end; copy_table_ind ++) {
480+
uint32_t *src_ind = (uint32_t *) copy_table_ind->src;
481+
uint32_t *src_end = (uint32_t *) (copy_table_ind->src + copy_table_ind->size);
482+
uint32_t *dst_ind = (uint32_t *) copy_table_ind->dst;
483+
if (src_ind != dst_ind) {
484+
for (; src_ind < src_end;) {
485+
*dst_ind ++ = *src_ind ++;
480486
}
481487
}
482488
}
489+
}
483490

484-
/* Initialize (multiple) .bss sections to zero */
485-
{
486-
zero_table_entry *zero_table_ind = (zero_table_entry *) &__zero_table_start__;
487-
zero_table_entry *zero_table_end = (zero_table_entry *) &__zero_table_end__;
491+
/* Initialize (multiple) .bss sections to zero */
492+
{
493+
/* Struct of zero table entry which must match linker script */
494+
typedef struct zero_table_entry_ {
495+
uint32_t start; // Address to start zero'ing
496+
uint32_t size; // Zero size in bytes
497+
} zero_table_entry;
488498

489-
for (; zero_table_ind != zero_table_end; zero_table_ind ++) {
490-
uint32_t *dst_ind = (uint32_t *) zero_table_ind->start;
491-
uint32_t *dst_end = (uint32_t *) (zero_table_ind->start + zero_table_ind->size);
499+
zero_table_entry *zero_table_ind = (zero_table_entry *) &__zero_table_start__;
500+
zero_table_entry *zero_table_end = (zero_table_entry *) &__zero_table_end__;
492501

493-
for (; dst_ind < dst_end; ) {
494-
*dst_ind ++ = 0;
495-
}
502+
for (; zero_table_ind != zero_table_end; zero_table_ind ++) {
503+
uint32_t *dst_ind = (uint32_t *) zero_table_ind->start;
504+
uint32_t *dst_end = (uint32_t *) (zero_table_ind->start + zero_table_ind->size);
505+
506+
for (; dst_ind < dst_end; ) {
507+
*dst_ind ++ = 0;
496508
}
497509
}
510+
}
498511

499-
_start();
512+
_start();
500513

501514
#endif
502515

targets/TARGET_NUVOTON/TARGET_M251/device/startup_M251.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ extern void __main(void);
6161
void __iar_program_start(void);
6262
#elif defined(__GNUC__)
6363
extern uint32_t __StackTop;
64+
extern uint32_t __copy_table_start__;
65+
extern uint32_t __copy_table_end__;
66+
extern uint32_t __zero_table_start__;
67+
extern uint32_t __zero_table_end__;
6468

6569
#if defined(TOOLCHAIN_GCC_ARM)
6670
extern void _start(void);
@@ -280,13 +284,20 @@ void Reset_Handler(void)
280284
#elif defined(__GNUC__)
281285
/* Move (multiple) .data section(s) from ROM to RAM */
282286
{
287+
/* Struct of copy table entry which must match linker script */
288+
typedef struct copy_table_entry_ {
289+
uint32_t src; // Address to copy from
290+
uint32_t dst; // Address to copy to
291+
uint32_t size; // Copy size in bytes
292+
} copy_table_entry;
293+
283294
copy_table_entry *copy_table_ind = (copy_table_entry *) &__copy_table_start__;
284295
copy_table_entry *copy_table_end = (copy_table_entry *) &__copy_table_end__;
285296

286297
for (; copy_table_ind != copy_table_end; copy_table_ind ++) {
287298
uint32_t *src_ind = (uint32_t *) copy_table_ind->src;
288-
uint32_t *src_end = (uint32_t *) (copy_table_ind->src + copy_table_ind->wlen);
289-
uint32_t *dst_ind = (uint32_t *) copy_table_ind->dest;
299+
uint32_t *src_end = (uint32_t *) (copy_table_ind->src + copy_table_ind->size);
300+
uint32_t *dst_ind = (uint32_t *) copy_table_ind->dst;
290301
if (src_ind != dst_ind) {
291302
for (; src_ind < src_end;) {
292303
*dst_ind ++ = *src_ind ++;
@@ -297,12 +308,18 @@ void Reset_Handler(void)
297308

298309
/* Initialize (multiple) .bss sections to zero */
299310
{
311+
/* Struct of zero table entry which must match linker script */
312+
typedef struct zero_table_entry_ {
313+
uint32_t start; // Address to start zero'ing
314+
uint32_t size; // Zero size in bytes
315+
} zero_table_entry;
316+
300317
zero_table_entry *zero_table_ind = (zero_table_entry *) &__zero_table_start__;
301318
zero_table_entry *zero_table_end = (zero_table_entry *) &__zero_table_end__;
302319

303320
for (; zero_table_ind != zero_table_end; zero_table_ind ++) {
304321
uint32_t *dst_ind = (uint32_t *) zero_table_ind->start;
305-
uint32_t *dst_end = (uint32_t *) (zero_table_ind->start + zero_table_ind->wlen);
322+
uint32_t *dst_end = (uint32_t *) (zero_table_ind->start + zero_table_ind->size);
306323

307324
for (; dst_ind < dst_end; ) {
308325
*dst_ind ++ = 0;

0 commit comments

Comments
 (0)