ISR_Stack_start/size defines are not needed, use linker file defines

pull/9571/head
deepikabhavnani 2019-02-10 17:17:17 -06:00
parent 9d1ce66b14
commit b36147fbe9
4 changed files with 18 additions and 46 deletions

View File

@ -917,18 +917,12 @@ __asm(".global __use_no_semihosting\n\t");
#pragma import(__use_two_region_memory) #pragma import(__use_two_region_memory)
#endif #endif
#if !defined(ISR_STACK_START)
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
#define ISR_STACK_START Image$$ARM_LIB_STACK$$ZI$$Base
#define ISR_STACK_SIZE Image$$ARM_LIB_STACK$$ZI$$Length
#endif
#if !defined(HEAP_START) #if !defined(HEAP_START)
// Heap here is considered starting after ZI ends to Stack start // Heap here is considered starting after ZI ends to Stack start
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[]; extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
#define HEAP_START Image$$RW_IRAM1$$ZI$$Limit #define HEAP_START Image$$RW_IRAM1$$ZI$$Limit
#define HEAP_SIZE ((uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START)) #define HEAP_SIZE ((uint32_t)((uint32_t) Image$$ARM_LIB_STACK$$ZI$$Base - (uint32_t) HEAP_START))
#endif #endif
#define HEAP_LIMIT ((uint32_t)((uint32_t)HEAP_START + (uint32_t)HEAP_SIZE)) #define HEAP_LIMIT ((uint32_t)((uint32_t)HEAP_START + (uint32_t)HEAP_SIZE))

View File

@ -27,18 +27,14 @@
__value_in_regs struct __argc_argv __rt_lib_init(unsigned heapbase, unsigned heaptop); __value_in_regs struct __argc_argv __rt_lib_init(unsigned heapbase, unsigned heaptop);
void _platform_post_stackheap_init(void); void _platform_post_stackheap_init(void);
#if !defined(ISR_STACK_START)
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[]; extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[]; extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
#define ISR_STACK_START Image$$ARM_LIB_STACK$$ZI$$Base
#define ISR_STACK_SIZE Image$$ARM_LIB_STACK$$ZI$$Length
#endif
#if !defined(HEAP_START) #if !defined(HEAP_START)
// Heap here is considered starting after ZI ends to Stack start // Heap here is considered starting after ZI ends to Stack start
extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[]; extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
#define HEAP_START Image$$RW_IRAM1$$ZI$$Limit #define HEAP_START Image$$RW_IRAM1$$ZI$$Limit
#define HEAP_SIZE ((uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START)) #define HEAP_SIZE ((uint32_t)((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Base - (uint32_t)HEAP_START))
#endif #endif
/* /*
@ -58,8 +54,8 @@ extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
*/ */
void __rt_entry(void) void __rt_entry(void)
{ {
mbed_stack_isr_start = (unsigned char *)ISR_STACK_START; mbed_stack_isr_start = (unsigned char *) Image$$ARM_LIB_STACK$$ZI$$Base;
mbed_stack_isr_size = (uint32_t)ISR_STACK_SIZE; mbed_stack_isr_size = (uint32_t) Image$$ARM_LIB_STACK$$ZI$$Length;
mbed_heap_start = (unsigned char *) HEAP_START; mbed_heap_start = (unsigned char *) HEAP_START;
mbed_heap_size = (uint32_t) HEAP_SIZE; mbed_heap_size = (uint32_t) HEAP_SIZE;

View File

@ -40,34 +40,18 @@
* Memory layout notes: * Memory layout notes:
* ==================== * ====================
* *
* IAR Default Memory layout notes: * IAR Memory layout :
* - Heap defined by "HEAP" region in .icf file * - Heap defined by "HEAP" region in .icf file
* - Interrupt stack defined by "CSTACK" region in .icf file * - Interrupt stack defined by "CSTACK" region in .icf file
* - Value INITIAL_SP is ignored * - Value INITIAL_SP is ignored
* *
* IAR Custom Memory layout notes: * GCC Memory layout :
* -There is no custom layout available for IAR - everything must be defined in * - Heap explicitly placed in linker script (*.ld file) and heap start (__end___) and heap end (__HeapLimit) should be defined in linker script
* the .icf file and use the default layout * - Interrupt stack placed in linker script **.ld file) and stack start (__StackTop) and stack end (__StackLimit) should be defined in linker script
* *
* * ARM Memory layout :
* GCC Default Memory layout notes: * - Heap can be explicitly placed by adding ARM_LIB_HEAP section in scatter file and defining both HEAP_START and HEAP_SIZE
* -Block of memory from symbol __end__ to define INITIAL_SP used to setup interrupt * - Interrupt stack placed in scatter files (*.sct) by adding ARM_LIB_STACK section
* stack and heap in the function set_stack_heap()
* -ISR_STACK_SIZE can be overridden to be larger or smaller
*
* GCC Custom Memory layout notes:
* -Heap can be explicitly placed by defining both HEAP_START and HEAP_SIZE
* -Interrupt stack can be explicitly placed by defining both ISR_STACK_START and ISR_STACK_SIZE
*
*
* ARM Memory layout
* -Block of memory from end of region "RW_IRAM1" to define INITIAL_SP used to setup interrupt
* stack and heap in the function set_stack_heap()
* -ISR_STACK_SIZE can be overridden to be larger or smaller
*
* ARM Custom Memory layout notes:
* -Heap can be explicitly placed by defining both HEAP_START and HEAP_SIZE
* -Interrupt stack can be explicitly placed by defining both ISR_STACK_START and ISR_STACK_SIZE
* *
*/ */

View File

@ -24,11 +24,9 @@
extern uint32_t Image$$ARM_LIB_STACK$$Base[]; extern uint32_t Image$$ARM_LIB_STACK$$Base[];
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit[]; extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit[];
extern uint32_t Image$$ARM_LIB_HEAP$$Base[]; extern uint32_t Image$$ARM_LIB_HEAP$$Base[];
#define ISR_STACK_START Image$$ARM_LIB_STACK$$Base
#define ISR_STACK_SIZE (uint32_t)((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Limit - (uint32_t)Image$$ARM_LIB_STACK$$Base)
#define INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit #define INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
#define HEAP_START Image$$ARM_LIB_HEAP$$Base #define HEAP_START Image$$ARM_LIB_HEAP$$Base
#define HEAP_SIZE (uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START) #define HEAP_SIZE (uint32_t)((uint32_t) Image$$ARM_LIB_STACK$$Base - (uint32_t) HEAP_START)
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define INITIAL_SP (&__StackTop) #define INITIAL_SP (&__StackTop)
#elif defined(__ICCARM__) #elif defined(__ICCARM__)