Skip to content

Commit d5074a5

Browse files
PataterCharley Chu
authored andcommitted
psoc64: Add TF-M compatibility
The CY8CKIT_064B0S2_4343W target was added as a replacement for the prototype CY8CKIT_064S2_4343W target, but it is missing modifications added to CY8CKIT_064S2_4343W to enable it to work with TF-M. Make the CY8CKIT_064B0S2_4343W target TF-M compatible by addding flash and region definitions from TF-M and by updating the CY8CKIT_064B0S2_4343W linker script to create a flash image compatible with TF-M.
1 parent a6207ca commit d5074a5

File tree

8 files changed

+1222
-11
lines changed

8 files changed

+1222
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
#! armclang -E --target=arm-arm-none-eabi -x c -mcpu=cortex-m4
2+
; The first line specifies a preprocessor command that the linker invokes
3+
; to pass a scatter file through a C preprocessor.
4+
5+
;*******************************************************************************
6+
;* \file cyb06xxa_cm4_dual.sct
7+
;* \version 2.80
8+
;*
9+
;* Linker file for the ARMCC.
10+
;*
11+
;* The main purpose of the linker script is to describe how the sections in the
12+
;* input files should be mapped into the output file, and to control the memory
13+
;* layout of the output file.
14+
;*
15+
;* \note The entry point location is fixed and starts at 0x10000000. The valid
16+
;* application image should be placed there.
17+
;*
18+
;* \note The linker files included with the PDL template projects must be
19+
;* generic and handle all common use cases. Your project may not use every
20+
;* section defined in the linker files. In that case you may see the warnings
21+
;* during the build process: L6314W (no section matches pattern) and/or L6329W
22+
;* (pattern only matches removed unused sections). In your project, you can
23+
;* suppress the warning by passing the "--diag_suppress=L6314W,L6329W" option to
24+
;* the linker, simply comment out or remove the relevant code in the linker
25+
;* file.
26+
;*
27+
;*******************************************************************************
28+
;* \copyright
29+
;* Copyright 2016-2020 Cypress Semiconductor Corporation
30+
;* Copyright 2020 Arm Limited
31+
;* SPDX-License-Identifier: Apache-2.0
32+
;*
33+
;* Licensed under the Apache License, Version 2.0 (the "License");
34+
;* you may not use this file except in compliance with the License.
35+
;* You may obtain a copy of the License at
36+
;*
37+
;* http://www.apache.org/licenses/LICENSE-2.0
38+
;*
39+
;* Unless required by applicable law or agreed to in writing, software
40+
;* distributed under the License is distributed on an "AS IS" BASIS,
41+
;* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42+
;* See the License for the specific language governing permissions and
43+
;* limitations under the License.
44+
;******************************************************************************/
45+
46+
#include "../../../../partition/region_defs.h"
47+
48+
; By default, the COMPONENT_CM0P_SLEEP prebuilt image is used for the CM0p core.
49+
; More about CM0+ prebuilt images, see here:
50+
; https://github.com/cypresssemiconductorco/psoc6cm0p
51+
; The size of the Cortex-M0+ application flash image
52+
#define FLASH_CM0P_SIZE 0x10000
53+
54+
#if !defined(MBED_ROM_START)
55+
#define MBED_ROM_START NS_CODE_START
56+
#endif
57+
58+
;* MBED_APP_START is being used by the bootloader build script and
59+
;* will be calculate by the system. In case if MBED_APP_START address is
60+
;* customized by the bootloader config, the application image should not
61+
;* include CM0p prebuilt image.
62+
;*
63+
64+
#if !defined(MBED_APP_START)
65+
#define MBED_APP_START (MBED_ROM_START + FLASH_CM0P_SIZE)
66+
#endif
67+
68+
#if !defined(MBED_ROM_SIZE)
69+
#define MBED_ROM_SIZE NS_CODE_SIZE
70+
#endif
71+
72+
;* MBED_APP_SIZE is being used by the bootloader build script and
73+
;* will be calculate by the system.
74+
;*
75+
#if !defined(MBED_APP_SIZE)
76+
#define MBED_APP_SIZE (MBED_ROM_SIZE - FLASH_CM0P_SIZE)
77+
#endif
78+
79+
#if !defined(MBED_RAM_START)
80+
#define MBED_RAM_START NS_DATA_START
81+
#endif
82+
83+
#if !defined(MBED_RAM_SIZE)
84+
#define MBED_RAM_SIZE NS_DATA_SIZE
85+
#endif
86+
87+
#if !defined(MBED_BOOT_STACK_SIZE)
88+
#define MBED_BOOT_STACK_SIZE NS_MSP_STACK_SIZE
89+
#endif
90+
91+
; Shared memory area between Non-secure and Secure
92+
#define MBED_DATA_SHARED_SIZE NS_DATA_SHARED_SIZE
93+
94+
; The defines below describe the location and size of blocks of memory in the target.
95+
; Use these defines to specify the memory regions available for allocation.
96+
97+
; The following defines control RAM and flash memory allocation for the CM4 core.
98+
; You can change the memory allocation by editing RAM and Flash defines.
99+
; Note that 2 KB of RAM (at the end of the SRAM) are reserved for system use.
100+
; Using this memory region for other purposes will lead to unexpected behavior.
101+
; Your changes must be aligned with the corresponding defines for CM0+ core in 'xx_cm0plus.scat',
102+
; where 'xx' is the device group; for example, 'cyb06xx7_cm0plus.scat'.
103+
; RAM
104+
#define RAM_START MBED_RAM_START
105+
#define RAM_SIZE MBED_RAM_SIZE
106+
; Flash
107+
#define FLASH_START MBED_APP_START
108+
#define FLASH_SIZE MBED_APP_SIZE
109+
110+
; The following defines describe a 32K flash region used for EEPROM emulation.
111+
; This region can also be used as the general purpose flash.
112+
; You can assign sections to this memory region for only one of the cores.
113+
; Note some middleware (e.g. BLE, Emulated EEPROM) can place their data into this memory region.
114+
; Therefore, repurposing this memory region will prevent such middleware from operation.
115+
#define EM_EEPROM_START 0x14000000
116+
#define EM_EEPROM_SIZE 0x8000
117+
118+
; The following defines describe device specific memory regions and must not be changed.
119+
; Supervisory flash: User data
120+
#define SFLASH_USER_DATA_START 0x16000800
121+
#define SFLASH_USER_DATA_SIZE 0x00000800
122+
123+
; Supervisory flash: Normal Access Restrictions (NAR)
124+
#define SFLASH_NAR_START 0x16001A00
125+
#define SFLASH_NAR_SIZE 0x00000200
126+
127+
; Supervisory flash: Public Key
128+
#define SFLASH_PUBLIC_KEY_START 0x16005A00
129+
#define SFLASH_PUBLIC_KEY_SIZE 0x00000C00
130+
131+
; Supervisory flash: Table of Content # 2
132+
#define SFLASH_TOC_2_START 0x16007C00
133+
#define SFLASH_TOC_2_SIZE 0x00000200
134+
135+
; Supervisory flash: Table of Content # 2 Copy
136+
#define SFLASH_RTOC_2_START 0x16007E00
137+
#define SFLASH_RTOC_2_SIZE 0x00000200
138+
139+
; External memory
140+
#define XIP_START 0x18000000
141+
#define XIP_SIZE 0x08000000
142+
143+
; eFuse
144+
#define EFUSE_START 0x90700000
145+
#define EFUSE_SIZE 0x100000
146+
147+
148+
; Cortex-M0+ application flash image area
149+
LR_IROM (MBED_ROM_START + BOOT_HEADER_SIZE) (FLASH_CM0P_SIZE - BOOT_HEADER_SIZE)
150+
{
151+
.cy_m0p_image +0 FLASH_CM0P_SIZE
152+
{
153+
* (.cy_m0p_image)
154+
}
155+
}
156+
157+
; Cortex-M4 application flash area
158+
LR_IROM1 FLASH_START FLASH_SIZE
159+
{
160+
ER_FLASH_VECTORS +0
161+
{
162+
* (RESET, +FIRST)
163+
}
164+
165+
ER_FLASH_CODE +0 FIXED
166+
{
167+
* (InRoot$$Sections)
168+
* (+RO)
169+
}
170+
171+
ER_RAM_VECTORS RAM_START UNINIT
172+
{
173+
* (RESET_RAM, +FIRST)
174+
}
175+
176+
RW_RAM_DATA +0
177+
{
178+
* (.cy_ramfunc)
179+
* (+RW, +ZI)
180+
}
181+
182+
; Place variables in the section that should not be initialized during the
183+
; device startup.
184+
RW_IRAM1 +0 UNINIT
185+
{
186+
* (.noinit)
187+
}
188+
189+
; Application heap area (HEAP)
190+
ARM_LIB_HEAP +0 ALIGN 4 EMPTY RAM_START+RAM_SIZE-MBED_BOOT_STACK_SIZE-MBED_DATA_SHARED_SIZE-ImageLimit(RW_IRAM1)
191+
{
192+
}
193+
194+
; Stack region growing down
195+
ARM_LIB_STACK RAM_START+RAM_SIZE-MBED_DATA_SHARED_SIZE ALIGN 4 EMPTY -MBED_BOOT_STACK_SIZE
196+
{
197+
}
198+
199+
; Stack area overflowed within RAM
200+
ScatterAssert(ImageBase(ARM_LIB_STACK) + ImageLength(ARM_LIB_STACK) == RAM_START+RAM_SIZE-MBED_DATA_SHARED_SIZE)
201+
202+
; Shared region
203+
ARM_LIB_SHARED RAM_START+RAM_SIZE-MBED_DATA_SHARED_SIZE ALIGN 4 EMPTY MBED_DATA_SHARED_SIZE
204+
{
205+
}
206+
207+
; Shared area overflowed within RAM
208+
ScatterAssert(ImageBase(ARM_LIB_SHARED) + ImageLength(ARM_LIB_SHARED) == RAM_START+RAM_SIZE)
209+
210+
; Used for the digital signature of the secure application and the
211+
; Bootloader SDK application. The size of the section depends on the required
212+
; data size.
213+
.cy_app_signature (MBED_ROM_START + MBED_ROM_SIZE - 256) 256
214+
{
215+
* (.cy_app_signature)
216+
}
217+
}
218+
219+
220+
; Emulated EEPROM Flash area
221+
LR_EM_EEPROM EM_EEPROM_START EM_EEPROM_SIZE
222+
{
223+
.cy_em_eeprom +0
224+
{
225+
* (.cy_em_eeprom)
226+
}
227+
}
228+
229+
; Supervisory flash: User data
230+
LR_SFLASH_USER_DATA SFLASH_USER_DATA_START SFLASH_USER_DATA_SIZE
231+
{
232+
.cy_sflash_user_data +0
233+
{
234+
* (.cy_sflash_user_data)
235+
}
236+
}
237+
238+
; Supervisory flash: Normal Access Restrictions (NAR)
239+
LR_SFLASH_NAR SFLASH_NAR_START SFLASH_NAR_SIZE
240+
{
241+
.cy_sflash_nar +0
242+
{
243+
* (.cy_sflash_nar)
244+
}
245+
}
246+
247+
; Supervisory flash: Public Key
248+
LR_SFLASH_PUBLIC_KEY SFLASH_PUBLIC_KEY_START SFLASH_PUBLIC_KEY_SIZE
249+
{
250+
.cy_sflash_public_key +0
251+
{
252+
* (.cy_sflash_public_key)
253+
}
254+
}
255+
256+
; Supervisory flash: Table of Content # 2
257+
LR_SFLASH_TOC_2 SFLASH_TOC_2_START SFLASH_TOC_2_SIZE
258+
{
259+
.cy_toc_part2 +0
260+
{
261+
* (.cy_toc_part2)
262+
}
263+
}
264+
265+
; Supervisory flash: Table of Content # 2 Copy
266+
LR_SFLASH_RTOC_2 SFLASH_RTOC_2_START SFLASH_RTOC_2_SIZE
267+
{
268+
.cy_rtoc_part2 +0
269+
{
270+
* (.cy_rtoc_part2)
271+
}
272+
}
273+
274+
275+
; Places the code in the Execute in Place (XIP) section. See the smif driver documentation for details.
276+
LR_EROM XIP_START XIP_SIZE
277+
{
278+
.cy_xip +0
279+
{
280+
* (.cy_xip)
281+
}
282+
}
283+
284+
285+
; eFuse
286+
LR_EFUSE EFUSE_START EFUSE_SIZE
287+
{
288+
.cy_efuse +0
289+
{
290+
* (.cy_efuse)
291+
}
292+
}
293+
294+
295+
; The section is used for additional metadata (silicon revision, Silicon/JTAG ID, etc.) storage.
296+
CYMETA 0x90500000
297+
{
298+
.cymeta +0 { * (.cymeta) }
299+
}
300+
301+
/* The following symbols used by the cymcuelftool. */
302+
/* Flash */
303+
#define __cy_memory_0_start 0x10000000
304+
#define __cy_memory_0_length 0x00200000
305+
#define __cy_memory_0_row_size 0x200
306+
307+
/* Emulated EEPROM Flash area */
308+
#define __cy_memory_1_start 0x14000000
309+
#define __cy_memory_1_length 0x8000
310+
#define __cy_memory_1_row_size 0x200
311+
312+
/* Supervisory Flash */
313+
#define __cy_memory_2_start 0x16000000
314+
#define __cy_memory_2_length 0x8000
315+
#define __cy_memory_2_row_size 0x200
316+
317+
/* XIP */
318+
#define __cy_memory_3_start 0x18000000
319+
#define __cy_memory_3_length 0x08000000
320+
#define __cy_memory_3_row_size 0x200
321+
322+
/* eFuse */
323+
#define __cy_memory_4_start 0x90700000
324+
#define __cy_memory_4_length 0x100000
325+
#define __cy_memory_4_row_size 1
326+
327+
328+
/* [] END OF FILE */

0 commit comments

Comments
 (0)