Skip to content

Commit 471f0ab

Browse files
vmedcyArto Kinnunen
authored andcommitted
PSOC6: use prebuilt CM0+ C arrays instead of HEX images
Replace the prebuilt CM0+ HEX images with C files that provide the variable cy_m0p_image placed to the combined ELF image with linker script. This simplifies build flow of PSoC 6 application and improves compatibility with IDE export targets. It is still possible to use the custom prebuilt HEX images for PSA targets that remove CM0P_SLEEP label and specify the `hex_filename` in targets.json. Linker scripts are compatible with both scenarios.
1 parent 4a5e732 commit 471f0ab

File tree

31 files changed

+279
-888
lines changed

31 files changed

+279
-888
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/TOOLCHAIN_ARM/cy8c6xxa_cm4_dual.sct

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
;******************************************************************************/
4444

4545
#if !defined(MBED_ROM_START)
46-
#define MBED_ROM_START 0x10002000
46+
#define MBED_ROM_START 0x10000000
4747
#endif
4848

4949
;* MBED_APP_START is being used by the bootloader build script and
@@ -55,7 +55,7 @@
5555
#endif
5656

5757
#if !defined(MBED_ROM_SIZE)
58-
#define MBED_ROM_SIZE 0x001FE000
58+
#define MBED_ROM_SIZE 0x00200000
5959
#endif
6060

6161
;* MBED_APP_SIZE is being used by the bootloader build script and
@@ -133,8 +133,26 @@
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 0x2000
138+
#define FLASH_CM0P_START FLASH_START
136139

137-
LR_IROM1 FLASH_START FLASH_SIZE
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+
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+
154+
; Cortex-M4 application image
155+
LR_IROM1 FLASH_CM4_START FLASH_CM4_SIZE
138156
{
139157
ER_FLASH_VECTORS +0
140158
{

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/TOOLCHAIN_GCC_ARM/cy8c6xxa_cm4_dual.ld

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ GROUP(-lgcc -lc -lnosys)
4141
ENTRY(Reset_Handler)
4242

4343
#if !defined(MBED_ROM_START)
44-
#define MBED_ROM_START 0x10002000
44+
#define MBED_ROM_START 0x10000000
4545
#endif
4646

4747
/* MBED_APP_START is being used by the bootloader build script and
@@ -53,7 +53,7 @@ ENTRY(Reset_Handler)
5353
#endif
5454

5555
#if !defined(MBED_ROM_SIZE)
56-
#define MBED_ROM_SIZE 0x001FE000
56+
#define MBED_ROM_SIZE 0x00200000
5757
#endif
5858

5959
/* MBED_APP_SIZE is being used by the bootloader build script and
@@ -118,6 +118,13 @@ 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 = 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+
121128
/* Library configurations */
122129
GROUP(libgcc.a libc.a libm.a libnosys.a)
123130

@@ -157,7 +164,17 @@ GROUP(libgcc.a libc.a libm.a libnosys.a)
157164

158165
SECTIONS
159166
{
160-
.text :
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+
176+
/* Cortex-M4 application image */
177+
.text FLASH_CM4_START :
161178
{
162179
. = ALIGN(4);
163180
__Vectors = . ;

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/TOOLCHAIN_IAR/cy8c6xxa_cm4_dual.icf

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
4343

4444
if (!isdefinedsymbol(MBED_ROM_START)) {
45-
define symbol MBED_ROM_START = 0x10002000;
45+
define symbol MBED_ROM_START = 0x10000000;
4646
}
4747

4848
/* MBED_APP_START is being used by the bootloader build script and
@@ -54,7 +54,7 @@ if (!isdefinedsymbol(MBED_APP_START)) {
5454
}
5555

5656
if (!isdefinedsymbol(MBED_ROM_SIZE)) {
57-
define symbol MBED_ROM_SIZE = 0x001FE000;
57+
define symbol MBED_ROM_SIZE = 0x00200000;
5858
}
5959

6060
/* MBED_APP_SIZE is being used by the bootloader build script and
@@ -161,6 +161,9 @@ if (!isdefinedsymbol(__HEAP_SIZE)) {
161161
}
162162
/**** End of ICF editor section. ###ICF###*/
163163

164+
/* Size of the Cortex-M0+ application image */
165+
define symbol FLASH_CM0P_SIZE = 0x2000;
166+
164167
define memory mem with size = 4G;
165168
define region IROM1_region = mem:[from __ICFEDIT_region_IROM1_start__ to __ICFEDIT_region_IROM1_end__];
166169
define region IROM2_region = mem:[from __ICFEDIT_region_IROM2_start__ to __ICFEDIT_region_IROM2_end__];
@@ -182,6 +185,7 @@ define block RAM with fixed order {block RAM_DATA, block RAM_OTHER, block RAM_NO
182185
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
183186
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
184187

188+
define block CM0P_RO with size = FLASH_CM0P_SIZE { readonly section .cy_m0p_image };
185189
define block RO {first section .intvec, readonly};
186190

187191
/*-Initializations-*/
@@ -190,8 +194,11 @@ do not initialize { section .noinit, section .intvec_ram };
190194

191195
/*-Placement-*/
192196

193-
/* Flash */
194-
place at start of IROM1_region { block RO };
197+
/* Flash - Cortex-M0+ application image */
198+
place at start of IROM1_region { block CM0P_RO };
199+
200+
/* Flash - Cortex-M4 application image */
201+
place in IROM1_region { block RO };
195202
".cy_app_signature" : place at address (__ICFEDIT_region_IROM1_end__ - 0x200) { section .cy_app_signature };
196203

197204
/* Emulated EEPROM Flash area */
@@ -228,7 +235,8 @@ place at end of IRAM1_region { block CSTACK };
228235
".cymeta" : place at address mem : 0x90500000 { readonly section .cymeta };
229236

230237

231-
keep { section .cy_app_signature,
238+
keep { section .cy_m0p_image,
239+
section .cy_app_signature,
232240
section .cy_em_eeprom,
233241
section .cy_sflash_user_data,
234242
section .cy_sflash_nar,

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/hex/LICENSE.txt

Lines changed: 0 additions & 51 deletions
This file was deleted.

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/hex/README.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT_062_4343W/device/hex/psoc6_02_cm0p_sleep.hex

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)