Skip to content

Commit 2f9042f

Browse files
author
Jamie Smith
authored
Fix build of CYTFM_064B0S2_4343W (#364)
* Fix build of CYTFM_064B0S2_4343W * Fix docstring
1 parent f0b9d65 commit 2f9042f

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

.github/workflows/test_building_multiple_executables.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ jobs:
1111
uses: actions/checkout@v3
1212

1313
- name: Install Python packages
14+
# Note: pip>=20.3 is needed to install dependencies of cysecuretools
1415
run: |
16+
python3 -m pip install --upgrade pip
1517
python3 -m pip install -r tools/requirements.txt
1618
1719
# Note: For this CI job we use MBED_CREATE_PYTHON_VENV=FALSE so that we can make sure

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYTFM_064B0S2_4343W/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ target_link_libraries(mbed-cytfm-064b0s2-4343w
5858
mbed-cytfm-064b0s2-4343w-cm4
5959
mbed-cytfm-064b0s2-4343w-bsp-design-modus
6060
mbed-psoc6
61+
mbed-psa
6162
)
6263

6364
target_compile_definitions(mbed-cytfm-064b0s2-4343w
@@ -70,7 +71,6 @@ target_compile_definitions(mbed-cytfm-064b0s2-4343w
7071
)
7172

7273
mbed_post_build_psoc6_sign_image(
73-
"tfm_s.hex"
7474
"CYTFM_064B0S2_4343W"
7575
"policy_multi_CM0_CM4_tfm.json"
7676
"multi_image"

targets/TARGET_Cypress/scripts/PSOC6.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,18 @@ def sign_image(toolchain, resourses, elf, binf, m0hex):
173173
toolchain.target.cm4_img_id,
174174
elf,
175175
binf,
176-
m0hexf
176+
m0hex
177177
)
178178

179179
def sign_hex(
180-
build_dir, m0hex_filename, target_name, policy, notification, boot_scheme,
180+
build_dir, m0hex_signed_intermediate, target_name, policy, notification, boot_scheme,
181181
cm0_img_id, cm4_img_id, elf, m4hex, m0hex
182182
):
183183
"""
184184
Adds signature to a binary file being built,
185185
using cysecuretools python package.
186186
:param build_dir: The build directory
187-
:param m0hex_filename: The file name of the Cortex-M0 hex
187+
:param m0hex_signed_intermediate: Path to store intermediate signed CM0 hex file at
188188
:param target_name: The name of the Mbed target
189189
:param policy: The path to the policy file
190190
:param notification: The object to output notification with
@@ -199,9 +199,8 @@ def sign_hex(
199199
# that need to be signed
200200

201201
if m0hex != '':
202-
m0hex_build = os.path.join(build_dir, m0hex_filename)
203-
copy2(m0hex, m0hex_build)
204-
m0hex = m0hex_build
202+
copy2(m0hex, m0hex_signed_intermediate)
203+
m0hex = m0hex_signed_intermediate
205204

206205
# Mapping from mbed target to cysecuretools target
207206
TARGET_MAPPING = {
@@ -327,7 +326,7 @@ def sign_action(args):
327326
"""Entry point for the "sign" CLI command."""
328327
sign_hex(
329328
args.build_dir,
330-
args.m0hex_filename,
329+
args.m0hex_signed_intermediate,
331330
args.target_name,
332331
args.policy_file_name,
333332
logging.getLogger(__name__),
@@ -369,7 +368,7 @@ def parse_args():
369368
"--build-dir", required=True, help="the build directory."
370369
)
371370
sign_subcommand.add_argument(
372-
"--m0hex-filename", required=True, help="the name of the HEX file."
371+
"--m0hex-signed-intermediate", required=True, help="Path to store intermediate signed CM0 hex file at."
373372
)
374373
sign_subcommand.add_argument(
375374
"--target-name", help="the Mbed target name."

targets/TARGET_Cypress/scripts/mbed_set_post_build_cypress.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ endmacro()
5454
# Sign a Cortex-M4 HEX with Cortex-M0 HEX.
5555
#
5656
macro(mbed_post_build_psoc6_sign_image
57-
m0hex_filename
5857
cypress_psoc6_target
5958
policy_file_name
6059
boot_scheme
@@ -70,7 +69,7 @@ macro(mbed_post_build_psoc6_sign_image
7069
${Python3_EXECUTABLE} ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PSOC6.py
7170
sign
7271
--build-dir ${CMAKE_BINARY_DIR}
73-
--m0hex-filename ${m0hex_filename}
72+
--m0hex-signed-intermediate $<TARGET_FILE_DIR:${target}>/$<TARGET_FILE_BASE_NAME:${target}>.cm0-signed-image.hex
7473
--target-name ${cypress_psoc6_target}
7574
--policy-file-name ${policy_file_name}
7675
--boot-scheme ${boot_scheme}

tools/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ lxml; sys_platform == 'darwin'
3333
# needed for signing secure images
3434
cryptography
3535
cbor
36+
cysecuretools~=6.0
3637

3738
# Needed for downloading CMSIS MCU descriptions
3839
cmsis-pack-manager~=0.5.0

0 commit comments

Comments
 (0)