Skip to content

Commit 9d4a697

Browse files
committed
Updated linker scripts and startup file for ARM - fixes tests-mbedmicro-rtos-mbed-heap_and_stack failure on ARM compiler.
1 parent 4db392c commit 9d4a697

File tree

4 files changed

+57
-40
lines changed

4 files changed

+57
-40
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CPROTO_064_SB/device/TARGET_MCU_PSOC6_M4/TOOLCHAIN_ARM/cyb06xx7_cm4_dual.sct

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@
6767
#endif
6868

6969
#if !defined(MBED_RAM_START)
70-
#define MBED_RAM_START 0x08002000
70+
#define MBED_RAM_START 0x08000000
7171
#endif
7272

7373
#if !defined(MBED_RAM_SIZE)
74-
#define MBED_RAM_SIZE 0x0001E000
74+
#define MBED_RAM_SIZE 0x00020000
7575
#endif
7676

7777
#if !defined(MBED_BOOT_STACK_SIZE)
@@ -133,24 +133,10 @@
133133
#define EFUSE_START 0x90700000
134134
#define EFUSE_SIZE 0x100000
135135

136-
; Size and start address of the Cortex-M0+ application image
137-
#define FLASH_CM0P_SIZE 0x40000
138-
#define FLASH_CM0P_START (FLASH_START + FLASH_SIZE - FLASH_CM0P_SIZE)
139-
140136
; Size and start address of the Cortex-M4 application image
141-
#define FLASH_CM4_SIZE (FLASH_SIZE - FLASH_CM0P_SIZE)
137+
#define FLASH_CM4_SIZE FLASH_SIZE
142138
#define FLASH_CM4_START FLASH_START
143139

144-
145-
; Cortex-M0+ application image
146-
LR_IROM FLASH_CM0P_START FLASH_CM0P_SIZE
147-
{
148-
.cy_m0p_image +0 FLASH_CM0P_SIZE
149-
{
150-
* (.cy_m0p_image)
151-
}
152-
}
153-
154140
; Cortex-M4 application image
155141
LR_IROM1 FLASH_CM4_START FLASH_CM4_SIZE
156142
{
@@ -184,13 +170,15 @@ LR_IROM1 FLASH_CM4_START FLASH_CM4_SIZE
184170
}
185171

186172
; Application heap area (HEAP)
187-
ARM_LIB_HEAP +0 EMPTY ((RAM_START+RAM_SIZE)-AlignExpr(ImageLimit(RW_IRAM1), 8)-STACK_SIZE)
173+
ARM_LIB_HEAP +0
188174
{
175+
* (HEAP)
189176
}
190177

191178
; Stack region growing down
192-
ARM_LIB_STACK (RAM_START+RAM_SIZE) EMPTY -STACK_SIZE
179+
ARM_LIB_STACK RAM_START+RAM_SIZE -STACK_SIZE
193180
{
181+
* (STACK)
194182
}
195183

196184
; Used for the digital signature of the secure application and the

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CPROTO_064_SB/device/TARGET_MCU_PSOC6_M4/TOOLCHAIN_ARM/startup_psoc6_01_cm4.S

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,36 @@
2323
; * limitations under the License.
2424
; */
2525

26+
;/*
27+
;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
28+
;*/
29+
30+
; <h> Stack Configuration
31+
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
32+
; </h>
33+
IF :DEF:__STACK_SIZE
34+
Stack_Size EQU __STACK_SIZE
35+
ELSE
36+
Stack_Size EQU 0x00000400
37+
ENDIF
38+
AREA STACK, NOINIT, READWRITE, ALIGN=3
39+
Stack_Mem SPACE Stack_Size
40+
__initial_sp
41+
42+
; <h> Heap Configuration
43+
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
44+
; </h>
45+
IF :DEF:__HEAP_SIZE
46+
Heap_Size EQU __HEAP_SIZE
47+
ELSE
48+
Heap_Size EQU 0x00000400
49+
ENDIF
50+
AREA HEAP, NOINIT, READWRITE, ALIGN=3
51+
__heap_base
52+
Heap_Mem SPACE Heap_Size
53+
__heap_limit
54+
55+
2656
PRESERVE8
2757
THUMB
2858

@@ -33,9 +63,7 @@
3363
EXPORT __Vectors_End
3464
EXPORT __Vectors_Size
3565

36-
IMPORT |Image$$ARM_LIB_STACK$$Base|
37-
__Vectors DCD |Image$$ARM_LIB_STACK$$Base| ; Top of Stack
38-
66+
__Vectors DCD __initial_sp ; Top of Stack
3967
DCD Reset_Handler ; Reset Handler
4068

4169
DCD 0x0000000D ; NMI Handler located at ROM code
@@ -635,7 +663,20 @@ pass_interrupt_dacs_IRQHandler
635663

636664

637665
; User Initial Stack & Heap
638-
IMPORT __use_two_region_memory
666+
667+
IF :DEF:__MICROLIB
668+
669+
EXPORT __initial_sp
670+
EXPORT __heap_base
671+
EXPORT __heap_limit
672+
673+
ELSE
674+
675+
IMPORT __use_two_region_memory
676+
677+
ALIGN
678+
679+
ENDIF
639680

640681
END
641682

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CPROTO_064_SB/device/TARGET_MCU_PSOC6_M4/TOOLCHAIN_GCC_ARM/cyb06xx7_cm4_dual.ld

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ ENTRY(Reset_Handler)
6565
#endif
6666

6767
#if !defined(MBED_RAM_START)
68-
#define MBED_RAM_START 0x08002000
68+
#define MBED_RAM_START 0x08000000
6969
#endif
7070

7171
#if !defined(MBED_RAM_SIZE)
72-
#define MBED_RAM_SIZE 0x0001E000
72+
#define MBED_RAM_SIZE 0x00020000
7373
#endif
7474

7575
#if !defined(MBED_BOOT_STACK_SIZE)
@@ -118,11 +118,8 @@ MEMORY
118118
efuse (r) : ORIGIN = 0x90700000, LENGTH = 0x100000 /* 1 MB */
119119
}
120120

121-
/* Size and start address of the Cortex-M0+ application image */
122-
FLASH_CM0P_SIZE = 0x40000;
123-
FLASH_CM0P_START = ORIGIN(flash) + LENGTH(flash) - FLASH_CM0P_SIZE;
124121
/* Size and start address of the Cortex-M4 application image */
125-
FLASH_CM4_SIZE = LENGTH(flash) - FLASH_CM0P_SIZE;
122+
FLASH_CM4_SIZE = LENGTH(flash);
126123
FLASH_CM4_START = ORIGIN(flash);
127124

128125
/* Library configurations */
@@ -164,15 +161,6 @@ GROUP(libgcc.a libc.a libm.a libnosys.a)
164161

165162
SECTIONS
166163
{
167-
/* Cortex-M0+ application image */
168-
.cy_m0p_image FLASH_CM0P_START :
169-
{
170-
. = ALIGN(4);
171-
__cy_m0p_code_start = . ;
172-
KEEP(*(.cy_m0p_image))
173-
__cy_m0p_code_end = . ;
174-
} > flash
175-
176164
/* Cortex-M4 application image */
177165
.text FLASH_CM4_START :
178166
{

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CPROTO_064_SB/device/TARGET_MCU_PSOC6_M4/TOOLCHAIN_IAR/cyb06xx7_cm4_dual.icf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ if (!isdefinedsymbol(MBED_APP_SIZE)) {
6666
}
6767

6868
if (!isdefinedsymbol(MBED_RAM_START)) {
69-
define symbol MBED_RAM_START = 0x08002000;
69+
define symbol MBED_RAM_START = 0x08000000;
7070
}
7171

7272
if (!isdefinedsymbol(MBED_RAM_SIZE)) {
73-
define symbol MBED_RAM_SIZE = 0x0001E000;
73+
define symbol MBED_RAM_SIZE = 0x00020000;
7474
}
7575

7676
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {

0 commit comments

Comments
 (0)