Skip to content

Commit b36147f

Browse files
author
deepikabhavnani
committed
ISR_Stack_start/size defines are not needed, use linker file defines
1 parent 9d1ce66 commit b36147f

File tree

4 files changed

+20
-48
lines changed

4 files changed

+20
-48
lines changed

platform/mbed_retarget.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -917,18 +917,12 @@ __asm(".global __use_no_semihosting\n\t");
917917
#pragma import(__use_two_region_memory)
918918
#endif
919919

920-
#if !defined(ISR_STACK_START)
921-
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
922-
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
923-
#define ISR_STACK_START Image$$ARM_LIB_STACK$$ZI$$Base
924-
#define ISR_STACK_SIZE Image$$ARM_LIB_STACK$$ZI$$Length
925-
#endif
926-
927920
#if !defined(HEAP_START)
928921
// Heap here is considered starting after ZI ends to Stack start
922+
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
929923
extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
930924
#define HEAP_START Image$$RW_IRAM1$$ZI$$Limit
931-
#define HEAP_SIZE ((uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START))
925+
#define HEAP_SIZE ((uint32_t)((uint32_t) Image$$ARM_LIB_STACK$$ZI$$Base - (uint32_t) HEAP_START))
932926
#endif
933927

934928
#define HEAP_LIMIT ((uint32_t)((uint32_t)HEAP_START + (uint32_t)HEAP_SIZE))

rtos/TARGET_CORTEX/TOOLCHAIN_ARM_STD/mbed_boot_arm_std.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,14 @@
2727
__value_in_regs struct __argc_argv __rt_lib_init(unsigned heapbase, unsigned heaptop);
2828
void _platform_post_stackheap_init(void);
2929

30-
#if !defined(ISR_STACK_START)
3130
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Base[];
3231
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Length[];
33-
#define ISR_STACK_START Image$$ARM_LIB_STACK$$ZI$$Base
34-
#define ISR_STACK_SIZE Image$$ARM_LIB_STACK$$ZI$$Length
35-
#endif
3632

3733
#if !defined(HEAP_START)
3834
// Heap here is considered starting after ZI ends to Stack start
3935
extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
4036
#define HEAP_START Image$$RW_IRAM1$$ZI$$Limit
41-
#define HEAP_SIZE ((uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START))
37+
#define HEAP_SIZE ((uint32_t)((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Base - (uint32_t)HEAP_START))
4238
#endif
4339

4440
/*
@@ -58,10 +54,10 @@ extern uint32_t Image$$RW_IRAM1$$ZI$$Limit[];
5854
*/
5955
void __rt_entry(void)
6056
{
61-
mbed_stack_isr_start = (unsigned char *)ISR_STACK_START;
62-
mbed_stack_isr_size = (uint32_t)ISR_STACK_SIZE;
63-
mbed_heap_start = (unsigned char *)HEAP_START;
64-
mbed_heap_size = (uint32_t)HEAP_SIZE;
57+
mbed_stack_isr_start = (unsigned char *) Image$$ARM_LIB_STACK$$ZI$$Base;
58+
mbed_stack_isr_size = (uint32_t) Image$$ARM_LIB_STACK$$ZI$$Length;
59+
mbed_heap_start = (unsigned char *) HEAP_START;
60+
mbed_heap_size = (uint32_t) HEAP_SIZE;
6561

6662
mbed_init();
6763

rtos/TARGET_CORTEX/mbed_boot.c

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,34 +40,18 @@
4040
* Memory layout notes:
4141
* ====================
4242
*
43-
* IAR Default Memory layout notes:
44-
* -Heap defined by "HEAP" region in .icf file
45-
* -Interrupt stack defined by "CSTACK" region in .icf file
46-
* -Value INITIAL_SP is ignored
47-
*
48-
* IAR Custom Memory layout notes:
49-
* -There is no custom layout available for IAR - everything must be defined in
50-
* the .icf file and use the default layout
51-
*
52-
*
53-
* GCC Default Memory layout notes:
54-
* -Block of memory from symbol __end__ to define INITIAL_SP used to setup interrupt
55-
* stack and heap in the function set_stack_heap()
56-
* -ISR_STACK_SIZE can be overridden to be larger or smaller
57-
*
58-
* GCC Custom Memory layout notes:
59-
* -Heap can be explicitly placed by defining both HEAP_START and HEAP_SIZE
60-
* -Interrupt stack can be explicitly placed by defining both ISR_STACK_START and ISR_STACK_SIZE
61-
*
62-
*
63-
* ARM Memory layout
64-
* -Block of memory from end of region "RW_IRAM1" to define INITIAL_SP used to setup interrupt
65-
* stack and heap in the function set_stack_heap()
66-
* -ISR_STACK_SIZE can be overridden to be larger or smaller
67-
*
68-
* ARM Custom Memory layout notes:
69-
* -Heap can be explicitly placed by defining both HEAP_START and HEAP_SIZE
70-
* -Interrupt stack can be explicitly placed by defining both ISR_STACK_START and ISR_STACK_SIZE
43+
* IAR Memory layout :
44+
* - Heap defined by "HEAP" region in .icf file
45+
* - Interrupt stack defined by "CSTACK" region in .icf file
46+
* - Value INITIAL_SP is ignored
47+
*
48+
* GCC Memory layout :
49+
* - Heap explicitly placed in linker script (*.ld file) and heap start (__end___) and heap end (__HeapLimit) should be defined in linker script
50+
* - Interrupt stack placed in linker script **.ld file) and stack start (__StackTop) and stack end (__StackLimit) should be defined in linker script
51+
*
52+
* ARM Memory layout :
53+
* - Heap can be explicitly placed by adding ARM_LIB_HEAP section in scatter file and defining both HEAP_START and HEAP_SIZE
54+
* - Interrupt stack placed in scatter files (*.sct) by adding ARM_LIB_STACK section
7155
*
7256
*/
7357

targets/TARGET_RENESAS/mbed_rtx.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424
extern uint32_t Image$$ARM_LIB_STACK$$Base[];
2525
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit[];
2626
extern uint32_t Image$$ARM_LIB_HEAP$$Base[];
27-
#define ISR_STACK_START Image$$ARM_LIB_STACK$$Base
28-
#define ISR_STACK_SIZE (uint32_t)((uint32_t)Image$$ARM_LIB_STACK$$ZI$$Limit - (uint32_t)Image$$ARM_LIB_STACK$$Base)
2927
#define INITIAL_SP Image$$ARM_LIB_STACK$$ZI$$Limit
3028
#define HEAP_START Image$$ARM_LIB_HEAP$$Base
31-
#define HEAP_SIZE (uint32_t)((uint32_t)ISR_STACK_START - (uint32_t)HEAP_START)
29+
#define HEAP_SIZE (uint32_t)((uint32_t) Image$$ARM_LIB_STACK$$Base - (uint32_t) HEAP_START)
3230
#elif defined(__GNUC__)
3331
#define INITIAL_SP (&__StackTop)
3432
#elif defined(__ICCARM__)

0 commit comments

Comments
 (0)