cc3200: Clean up linker scripts and startup file.

This commit is contained in:
danicampora 2015-03-14 09:51:46 +01:00
parent 09721e2314
commit 2ae17def52
4 changed files with 39 additions and 53 deletions

View File

@ -46,8 +46,6 @@ SECTIONS
. = ALIGN(8); . = ALIGN(8);
} > SRAMB } > SRAMB
_ertos_heap = ORIGIN(SRAMB) + LENGTH(SRAMB);
.text : .text :
{ {
_text = .; _text = .;
@ -65,13 +63,8 @@ SECTIONS
__exidx_end = .; __exidx_end = .;
_etext = .; _etext = .;
} > SRAM } > SRAM
__init_data = .;
/* used by the start-up to initialize data */
_sidata = LOADADDR(.data);
.data : AT(__init_data) .data :
{ {
. = ALIGN(8); . = ALIGN(8);
_data = .; _data = .;

View File

@ -24,7 +24,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
__stack_size__ = 1024; __stack_size__ = 1024;
MEMORY MEMORY
{ {
@ -53,9 +53,7 @@ SECTIONS
_etext = .; _etext = .;
} > SRAM } > SRAM
__init_data = .; .data :
.data : AT(__init_data)
{ {
_data = .; _data = .;
*(.data*) *(.data*)

View File

@ -53,14 +53,15 @@ extern uint32_t _edata;
extern uint32_t _bss; extern uint32_t _bss;
extern uint32_t _ebss; extern uint32_t _ebss;
extern uint32_t _estack; extern uint32_t _estack;
extern uint32_t __init_data;
//***************************************************************************** //*****************************************************************************
// //
// Forward declaration of the default fault handlers. // Forward declaration of the default fault handlers.
// //
//***************************************************************************** //*****************************************************************************
#ifndef BOOTLOADER
__attribute__ ((section (".boot"))) __attribute__ ((section (".boot")))
#endif
void ResetISR(void); void ResetISR(void);
#ifdef DEBUG #ifdef DEBUG
static void NmiSR(void) __attribute__( ( naked ) ); static void NmiSR(void) __attribute__( ( naked ) );
@ -213,45 +214,38 @@ void (* const g_pfnVectors[256])(void) =
void ResetISR(void) void ResetISR(void)
{ {
#if defined(DEBUG) && !defined(BOOTLOADER) #if defined(DEBUG) && !defined(BOOTLOADER)
// {
// Fill the main stack with a known value so that //
// we can measure the main stack high water mark // Fill the main stack with a known value so that
// // we can measure the main stack high water mark
__asm volatile //
( __asm volatile
"ldr r0, =_stack \n" (
"ldr r1, =_estack \n" "ldr r0, =_stack \n"
"mov r2, #0x55555555 \n" "ldr r1, =_estack \n"
".thumb_func \n" "mov r2, #0x55555555 \n"
"fill_loop: \n" ".thumb_func \n"
"cmp r0, r1 \n" "fill_loop: \n"
"it lt \n" "cmp r0, r1 \n"
"strlt r2, [r0], #4 \n" "it lt \n"
"blt fill_loop \n" "strlt r2, [r0], #4 \n"
); "blt fill_loop \n"
);
}
#endif #endif
// Get the initial stack pointer location from the vector table {
// and write this value to the msp register // Get the initial stack pointer location from the vector table
__asm volatile // and write this value to the msp register
( __asm volatile
"ldr r0, =_text \n" (
"ldr r0, [r0] \n" "ldr r0, =_text \n"
"msr msp, r0 \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. // Zero fill the bss segment.
// //
@ -269,10 +263,12 @@ void ResetISR(void)
); );
} }
// {
// Call the application's entry point. //
// // Call the application's entry point.
main(); //
main();
}
} }
#ifdef DEBUG #ifdef DEBUG

View File

@ -27,7 +27,6 @@
// variables defining memory layout // variables defining memory layout
extern uint32_t _etext; extern uint32_t _etext;
extern uint32_t _sidata;
extern uint32_t _data; extern uint32_t _data;
extern uint32_t _edata; extern uint32_t _edata;
extern uint32_t _boot; extern uint32_t _boot;