Skip to content

Commit 6805486

Browse files
authored
Merge pull request #11354 from kyle-cypress/pr/pdl-linker-script
Update linker scripts based on latest PDL 1.3
2 parents ea582f3 + bf00ebe commit 6805486

File tree

26 files changed

+329
-294
lines changed

26 files changed

+329
-294
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/TOOLCHAIN_ARM/cy8c6xx7_cm4_dual.sct

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
;*******************************************************************************
66
;* \file cy8c6xx7_cm4_dual.sct
7-
;* \version 2.50
7+
;* \version 2.60
88
;*
99
;* Linker file for the ARMCC.
1010
;*
@@ -42,28 +42,32 @@
4242
;* limitations under the License.
4343
;******************************************************************************/
4444

45+
; Size of the Cortex-M0+ application flash image
46+
#define FLASH_CM0P_SIZE 0x2000
47+
4548
#if !defined(MBED_ROM_START)
4649
#define MBED_ROM_START 0x10000000
4750
#endif
4851

4952
;* MBED_APP_START is being used by the bootloader build script and
50-
;* will be calculate by the system. Without bootloader the MBED_APP_START
51-
;* is equal to MBED_ROM_START
53+
;* will be calculate by the system. In case if MBED_APP_START address is
54+
;* customized by the bootloader config, the application image should not
55+
;* include CM0p prebuilt image.
5256
;*
57+
5358
#if !defined(MBED_APP_START)
54-
#define MBED_APP_START MBED_ROM_START
59+
#define MBED_APP_START (MBED_ROM_START + FLASH_CM0P_SIZE)
5560
#endif
5661

5762
#if !defined(MBED_ROM_SIZE)
5863
#define MBED_ROM_SIZE 0x00100000
5964
#endif
6065

6166
;* MBED_APP_SIZE is being used by the bootloader build script and
62-
;* will be calculate by the system. Without bootloader the MBED_APP_SIZE
63-
;* is equal to MBED_ROM_SIZE
67+
;* will be calculate by the system.
6468
;*
6569
#if !defined(MBED_APP_SIZE)
66-
#define MBED_APP_SIZE MBED_ROM_SIZE
70+
#define MBED_APP_SIZE (MBED_ROM_SIZE - FLASH_CM0P_SIZE)
6771
#endif
6872

6973
#if !defined(MBED_RAM_START)
@@ -78,6 +82,7 @@
7882
#define MBED_BOOT_STACK_SIZE 0x400
7983
#endif
8084

85+
; Size of the stack section at the end of CM4 SRAM
8186
#define STACK_SIZE MBED_BOOT_STACK_SIZE
8287

8388
; The defines below describe the location and size of blocks of memory in the target.
@@ -133,26 +138,18 @@
133138
#define EFUSE_START 0x90700000
134139
#define EFUSE_SIZE 0x100000
135140

136-
; Size and start address of the Cortex-M0+ application image
137-
#define FLASH_CM0P_SIZE 0x2000
138-
#define FLASH_CM0P_START FLASH_START
139-
140-
; Size and start address of the Cortex-M4 application image
141-
#define FLASH_CM4_SIZE (FLASH_SIZE - FLASH_CM0P_SIZE)
142-
#define FLASH_CM4_START (FLASH_CM0P_START + FLASH_CM0P_SIZE)
143-
144141

145-
; Cortex-M0+ application image
146-
LR_IROM FLASH_CM0P_START FLASH_CM0P_SIZE
142+
; Cortex-M0+ application flash image area
143+
LR_IROM MBED_ROM_START FLASH_CM0P_SIZE
147144
{
148145
.cy_m0p_image +0 FLASH_CM0P_SIZE
149146
{
150147
* (.cy_m0p_image)
151148
}
152149
}
153150

154-
; Cortex-M4 application image
155-
LR_IROM1 FLASH_CM4_START FLASH_CM4_SIZE
151+
; Cortex-M4 application flash area
152+
LR_IROM1 FLASH_START FLASH_SIZE
156153
{
157154
ER_FLASH_VECTORS +0
158155
{
@@ -198,7 +195,7 @@ LR_IROM1 FLASH_CM4_START FLASH_CM4_SIZE
198195
; Used for the digital signature of the secure application and the
199196
; Bootloader SDK application. The size of the section depends on the required
200197
; data size.
201-
.cy_app_signature (FLASH_START + FLASH_SIZE - 256) 256
198+
.cy_app_signature (MBED_ROM_START + MBED_ROM_SIZE - 256) 256
202199
{
203200
* (.cy_app_signature)
204201
}

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/TOOLCHAIN_GCC_ARM/cy8c6xx7_cm4_dual.ld

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/***************************************************************************//**
22
* \file cy8c6xx7_cm4_dual.ld
3-
* \version 2.50
3+
* \version 2.60
44
*
55
* Linker file for the GNU C compiler.
66
*
@@ -40,28 +40,31 @@ SEARCH_DIR(.)
4040
GROUP(-lgcc -lc -lnosys)
4141
ENTRY(Reset_Handler)
4242

43+
/* Size of the Cortex-M0+ application image at the start of FLASH */
44+
FLASH_CM0P_SIZE = 0x2000;
45+
4346
#if !defined(MBED_ROM_START)
4447
#define MBED_ROM_START 0x10000000
4548
#endif
4649

47-
/* MBED_APP_START is being used by the bootloader build script and
48-
* will be calculate by the system. Without bootloader the MBED_APP_START
49-
* is equal to MBED_ROM_START
50+
/* MBED_APP_START is being used by the bootloader build script and
51+
* will be calculate by the system. In case if MBED_APP_START address is
52+
* customized by the bootloader config, the application image should not
53+
* include CM0p prebuilt image.
5054
*/
5155
#if !defined(MBED_APP_START)
52-
#define MBED_APP_START MBED_ROM_START
56+
#define MBED_APP_START (MBED_ROM_START + FLASH_CM0P_SIZE)
5357
#endif
5458

5559
#if !defined(MBED_ROM_SIZE)
5660
#define MBED_ROM_SIZE 0x00100000
5761
#endif
5862

5963
/* MBED_APP_SIZE is being used by the bootloader build script and
60-
* will be calculate by the system. Without bootloader the MBED_APP_SIZE
61-
* is equal to MBED_ROM_SIZE
64+
* will be calculate by the system.
6265
*/
6366
#if !defined(MBED_APP_SIZE)
64-
#define MBED_APP_SIZE MBED_ROM_SIZE
67+
#define MBED_APP_SIZE (MBED_ROM_SIZE - FLASH_CM0P_SIZE)
6568
#endif
6669

6770
#if !defined(MBED_RAM_START)
@@ -76,6 +79,7 @@ ENTRY(Reset_Handler)
7679
#define MBED_BOOT_STACK_SIZE 0x400
7780
#endif
7881

82+
/* Size of the stack section at the end of CM4 SRAM */
7983
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8084

8185
/* Force symbol to be entered in the output file as an undefined symbol. Doing
@@ -99,6 +103,7 @@ MEMORY
99103
* where 'xx' is the device group; for example, 'cy8c6xx7_cm0plus.ld'.
100104
*/
101105
ram (rwx) : ORIGIN = MBED_RAM_START, LENGTH = MBED_RAM_SIZE
106+
cm0p_image (rx) : ORIGIN = MBED_ROM_START, LENGTH = FLASH_CM0P_SIZE
102107
flash (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
103108

104109
/* This is a 32K flash region used for EEPROM emulation. This region can also be used as the general purpose flash.
@@ -118,13 +123,6 @@ MEMORY
118123
efuse (r) : ORIGIN = 0x90700000, LENGTH = 0x100000 /* 1 MB */
119124
}
120125

121-
/* Size and start address of the Cortex-M0+ application image */
122-
FLASH_CM0P_SIZE = 0x2000;
123-
FLASH_CM0P_START = ORIGIN(flash);
124-
/* Size and start address of the Cortex-M4 application image */
125-
FLASH_CM4_SIZE = LENGTH(flash) - FLASH_CM0P_SIZE;
126-
FLASH_CM4_START = FLASH_CM0P_START + FLASH_CM0P_SIZE;
127-
128126
/* Library configurations */
129127
GROUP(libgcc.a libc.a libm.a libnosys.a)
130128

@@ -164,17 +162,17 @@ GROUP(libgcc.a libc.a libm.a libnosys.a)
164162

165163
SECTIONS
166164
{
167-
/* Cortex-M0+ application image */
168-
.cy_m0p_image FLASH_CM0P_START :
165+
/* Cortex-M0+ application flash image area */
166+
.cy_m0p_image ORIGIN(cm0p_image) :
169167
{
170168
. = ALIGN(4);
171169
__cy_m0p_code_start = . ;
172170
KEEP(*(.cy_m0p_image))
173171
__cy_m0p_code_end = . ;
174-
} > flash
172+
} > cm0p_image
175173

176-
/* Cortex-M4 application image */
177-
.text FLASH_CM4_START :
174+
/* Cortex-M4 application flash area */
175+
.text ORIGIN(flash) :
178176
{
179177
. = ALIGN(4);
180178
__Vectors = . ;
@@ -290,7 +288,6 @@ SECTIONS
290288
KEEP(*(.init_array))
291289
PROVIDE_HIDDEN (__init_array_end = .);
292290

293-
294291
. = ALIGN(4);
295292
/* finit data */
296293
PROVIDE_HIDDEN (__fini_array_start = .);
@@ -351,7 +348,7 @@ SECTIONS
351348
__HeapLimit = .;
352349
} > ram
353350

354-
351+
355352
/* Set stack top to end of RAM, and stack limit move down by
356353
* size of stack_dummy section */
357354
__StackTop = ORIGIN(ram) + LENGTH(ram);
@@ -404,7 +401,7 @@ SECTIONS
404401
KEEP(*(.cy_toc_part2))
405402
} > sflash_toc_2
406403

407-
404+
408405
/* Supervisory Flash: Table of Content # 2 Copy */
409406
.cy_rtoc_part2 :
410407
{

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/TOOLCHAIN_IAR/cy8c6xx7_cm4_dual.icf

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/***************************************************************************//**
22
* \file cy8c6xx7_cm4_dual.icf
3-
* \version 2.50
3+
* \version 2.60
44
*
55
* Linker file for the IAR compiler.
66
*
@@ -41,28 +41,31 @@
4141
/*-Specials-*/
4242
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
4343

44+
/* Size of the Cortex-M0+ application image */
45+
define symbol FLASH_CM0P_SIZE = 0x2000;
46+
4447
if (!isdefinedsymbol(MBED_ROM_START)) {
4548
define symbol MBED_ROM_START = 0x10000000;
4649
}
4750

48-
/* MBED_APP_START is being used by the bootloader build script and
49-
* will be calculate by the system. Without bootloader the MBED_APP_START
50-
* is equal to MBED_ROM_START
51+
/* MBED_APP_START is being used by the bootloader build script and
52+
* will be calculate by the system. In case if MBED_APP_START address is
53+
* customized by the bootloader config, the application image should not
54+
* include CM0p prebuilt image.
5155
*/
5256
if (!isdefinedsymbol(MBED_APP_START)) {
53-
define symbol MBED_APP_START = MBED_ROM_START;
57+
define symbol MBED_APP_START = (MBED_ROM_START + FLASH_CM0P_SIZE);
5458
}
5559

5660
if (!isdefinedsymbol(MBED_ROM_SIZE)) {
5761
define symbol MBED_ROM_SIZE = 0x00100000;
5862
}
5963

6064
/* MBED_APP_SIZE is being used by the bootloader build script and
61-
* will be calculate by the system. Without bootloader the MBED_APP_SIZE
62-
* is equal to MBED_ROM_SIZE
65+
* will be calculate by the system.
6366
*/
6467
if (!isdefinedsymbol(MBED_APP_SIZE)) {
65-
define symbol MBED_APP_SIZE = MBED_ROM_SIZE;
68+
define symbol MBED_APP_SIZE = (MBED_ROM_SIZE - FLASH_CM0P_SIZE);
6669
}
6770

6871
if (!isdefinedsymbol(MBED_RAM_START)) {
@@ -74,9 +77,16 @@ if (!isdefinedsymbol(MBED_RAM_SIZE)) {
7477
}
7578

7679
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
77-
define symbol MBED_BOOT_STACK_SIZE = 0x400;
80+
81+
if (!isdefinedsymbol(__STACK_SIZE)) {
82+
define symbol MBED_BOOT_STACK_SIZE = 0x0400;
83+
} else {
84+
define symbol MBED_BOOT_STACK_SIZE = __STACK_SIZE;
85+
}
7886
}
7987

88+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
89+
8090
/* The symbols below define the location and size of blocks of memory in the target.
8191
* Use these symbols to specify the memory regions available for allocation.
8292
*/
@@ -92,6 +102,9 @@ if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
92102
define symbol __ICFEDIT_region_IRAM1_start__ = MBED_RAM_START;
93103
define symbol __ICFEDIT_region_IRAM1_end__ = (MBED_RAM_START + MBED_RAM_SIZE);
94104
/* Flash */
105+
define symbol __ICFEDIT_region_IROM0_start__ = MBED_ROM_START;
106+
define symbol __ICFEDIT_region_IROM0_end__ = (MBED_ROM_START + FLASH_CM0P_SIZE);
107+
95108
define symbol __ICFEDIT_region_IROM1_start__ = MBED_APP_START;
96109
define symbol __ICFEDIT_region_IROM1_end__ = (MBED_APP_START + MBED_APP_SIZE);
97110

@@ -148,24 +161,16 @@ define symbol __ICFEDIT_region_ERAM2_end__ = 0x0;
148161
define symbol __ICFEDIT_region_ERAM3_start__ = 0x0;
149162
define symbol __ICFEDIT_region_ERAM3_end__ = 0x0;
150163
/*-Sizes-*/
151-
if (!isdefinedsymbol(__STACK_SIZE)) {
152-
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
153-
} else {
154-
define symbol __ICFEDIT_size_cstack__ = __STACK_SIZE;
155-
}
156-
157164
/* Defines the minimum heap size. The actual heap size will be expanded to the end of the stack region */
158165
if (!isdefinedsymbol(__HEAP_SIZE)) {
159-
define symbol __ICFEDIT_size_heap__ = 0x400;
166+
define symbol __ICFEDIT_size_heap__ = 0x0400;
160167
} else {
161168
define symbol __ICFEDIT_size_heap__ = __HEAP_SIZE;
162169
}
163170
/**** End of ICF editor section. ###ICF###*/
164171

165-
/* Size of the Cortex-M0+ application image */
166-
define symbol FLASH_CM0P_SIZE = 0x2000;
167-
168172
define memory mem with size = 4G;
173+
define region IROM0_region = mem:[from __ICFEDIT_region_IROM0_start__ to __ICFEDIT_region_IROM0_end__];
169174
define region IROM1_region = mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__];
170175
define region IROM2_region = mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
171176
define region IROM3_region = mem:[from __ICFEDIT_region_IROM3_start__ to __ICFEDIT_region_IROM3_end__];
@@ -196,10 +201,12 @@ do not initialize { section .noinit, section .intvec_ram };
196201
/*-Placement-*/
197202

198203
/* Flash - Cortex-M0+ application image */
199-
place at start of IROM1_region { block CM0P_RO };
204+
place at start of IROM0_region { block CM0P_RO };
205+
206+
/* Flash - Cortex-M4 application */
207+
place at start of IROM1_region { block RO };
200208

201-
/* Flash - Cortex-M4 application image */
202-
place in IROM1_region { block RO };
209+
/* Used for the digital signature of the secure application and the Bootloader SDK application. */
203210
".cy_app_signature" : place at address (__ICFEDIT_region_IROM1_end__ - 0x200) { section .cy_app_signature };
204211

205212
/* Emulated EEPROM Flash area */

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/system_psoc6.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/***************************************************************************//**
22
* \file system_psoc6.h
3-
* \version 2.50
3+
* \version 2.60
44
*
55
* \brief Device system header file.
66
*
@@ -320,6 +320,11 @@
320320
* <th>Reason for Change</th>
321321
* </tr>
322322
* <tr>
323+
* <td>2.60</td>
324+
* <td>Updated linker scripts.</td>
325+
* <td>Provided support for new devices, updated usage of CM0p prebuilt image.</td>
326+
* </tr>
327+
* <tr>
323328
* <td>2.50</td>
324329
* <td>Updated assembler files, C files, linker scripts.</td>
325330
* <td>Dynamic allocated HEAP size for Arm Compiler 6, IAR 8.</td>

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_BLE/device/system_psoc6_cm4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/***************************************************************************//**
22
* \file system_psoc6_cm4.c
3-
* \version 2.50
3+
* \version 2.60
44
*
55
* The device system-source file.
66
*

0 commit comments

Comments
 (0)