From 2ae17def5293452efe255df2b104e0bf2b04f56f Mon Sep 17 00:00:00 2001 From: danicampora Date: Sat, 14 Mar 2015 09:51:46 +0100 Subject: [PATCH] cc3200: Clean up linker scripts and startup file. --- cc3200/application.lds | 9 +---- cc3200/bootmgr/bootmgr.lds | 6 +-- cc3200/hal/startup_gcc.c | 76 ++++++++++++++++++-------------------- cc3200/util/gccollect.h | 1 - 4 files changed, 39 insertions(+), 53 deletions(-) diff --git a/cc3200/application.lds b/cc3200/application.lds index 162988da99..5418471fb2 100644 --- a/cc3200/application.lds +++ b/cc3200/application.lds @@ -46,8 +46,6 @@ SECTIONS . = ALIGN(8); } > SRAMB - _ertos_heap = ORIGIN(SRAMB) + LENGTH(SRAMB); - .text : { _text = .; @@ -65,13 +63,8 @@ SECTIONS __exidx_end = .; _etext = .; } > SRAM - - __init_data = .; - - /* used by the start-up to initialize data */ - _sidata = LOADADDR(.data); - .data : AT(__init_data) + .data : { . = ALIGN(8); _data = .; diff --git a/cc3200/bootmgr/bootmgr.lds b/cc3200/bootmgr/bootmgr.lds index e9d44d3c96..36d5da233d 100644 --- a/cc3200/bootmgr/bootmgr.lds +++ b/cc3200/bootmgr/bootmgr.lds @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -__stack_size__ = 1024; +__stack_size__ = 1024; MEMORY { @@ -53,9 +53,7 @@ SECTIONS _etext = .; } > SRAM - __init_data = .; - - .data : AT(__init_data) + .data : { _data = .; *(.data*) diff --git a/cc3200/hal/startup_gcc.c b/cc3200/hal/startup_gcc.c index 5dff9ffda4..e173e8fdaf 100644 --- a/cc3200/hal/startup_gcc.c +++ b/cc3200/hal/startup_gcc.c @@ -53,14 +53,15 @@ extern uint32_t _edata; extern uint32_t _bss; extern uint32_t _ebss; extern uint32_t _estack; -extern uint32_t __init_data; //***************************************************************************** // // Forward declaration of the default fault handlers. // //***************************************************************************** +#ifndef BOOTLOADER __attribute__ ((section (".boot"))) +#endif void ResetISR(void); #ifdef DEBUG static void NmiSR(void) __attribute__( ( naked ) ); @@ -213,45 +214,38 @@ void (* const g_pfnVectors[256])(void) = void ResetISR(void) { #if defined(DEBUG) && !defined(BOOTLOADER) - // - // Fill the main stack with a known value so that - // we can measure the main stack high water mark - // - __asm volatile - ( - "ldr r0, =_stack \n" - "ldr r1, =_estack \n" - "mov r2, #0x55555555 \n" - ".thumb_func \n" - "fill_loop: \n" - "cmp r0, r1 \n" - "it lt \n" - "strlt r2, [r0], #4 \n" - "blt fill_loop \n" - ); + { + // + // Fill the main stack with a known value so that + // we can measure the main stack high water mark + // + __asm volatile + ( + "ldr r0, =_stack \n" + "ldr r1, =_estack \n" + "mov r2, #0x55555555 \n" + ".thumb_func \n" + "fill_loop: \n" + "cmp r0, r1 \n" + "it lt \n" + "strlt r2, [r0], #4 \n" + "blt fill_loop \n" + ); + } #endif - // Get the initial stack pointer location from the vector table - // and write this value to the msp register - __asm volatile - ( - "ldr r0, =_text \n" - "ldr r0, [r0] \n" - "msr msp, r0 \n" - ); + { + // Get the initial stack pointer location from the vector table + // and write this value to the msp register + __asm volatile + ( + "ldr r0, =_text \n" + "ldr r0, [r0] \n" + "msr msp, r0 \n" + ); + } { - uint32_t *pui32Src, *pui32Dest; - - // - // Copy the data segment initializers - // - pui32Src = &__init_data; - for(pui32Dest = &_data; pui32Dest < &_edata; ) - { - *pui32Dest++ = *pui32Src++; - } - // // Zero fill the bss segment. // @@ -269,10 +263,12 @@ void ResetISR(void) ); } - // - // Call the application's entry point. - // - main(); + { + // + // Call the application's entry point. + // + main(); + } } #ifdef DEBUG diff --git a/cc3200/util/gccollect.h b/cc3200/util/gccollect.h index b8b6502cb2..24cd60288e 100644 --- a/cc3200/util/gccollect.h +++ b/cc3200/util/gccollect.h @@ -27,7 +27,6 @@ // variables defining memory layout extern uint32_t _etext; -extern uint32_t _sidata; extern uint32_t _data; extern uint32_t _edata; extern uint32_t _boot;