ARMmbed / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
4.67k stars 2.97k forks source link

CY8CKIT064B0S2_4343W: Missing policy file for post build operation #14231

Closed hugueskamba closed 3 years ago

hugueskamba commented 3 years ago

Description of defect

The CY8CKIT064B0S2_4343W Mbed target does not successfully build as the post build operation cannot complete. Signing the image requires a policy file (policy_single_CM0_CM4.json) which is currently missing from the repository.

Target(s) affected by this defect ?

CY8CKIT064B0S2_4343W

Toolchain(s) (name and version) displaying this defect ?

ARM or GCC_ARM

What version of Mbed-os are you using (tag or sha) ?

mbed-os-6.7.0

What version(s) of tools are you using. List all that apply (E.g. mbed-cli)

$ mbed-cli --version
1.10.5

How is this defect reproduced ?

Run the following command: mbed compile -t ARM -m CY8CKIT064B0S2_4343W

Result:

...
Compile [100.0%]: cy_usbfs_dev_drv_io_dma.c
Link: mbed-os-example-blinky
[Warning] @0,0: L3912W: Option 'legacyalign' is deprecated.
Elf2Bin: mbed-os-example-blinky
Post-Build: mbed-os-example-blinky
M0 core image file found: ./mbed-os/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT064B0S2_4343W/device/COMPONENT_CM4/hex/psoc6_02_cm0p_secure.hex.
Policy file /path/to/mbed-os-example-blinky/policy_single_CM0_CM4.json not found. Aborting.
[ERROR] Required policy file not found.
[mbed] ERROR: "/usr/local/opt/python@3.9/bin/python3.9" returned error.
       Code: 1
       Path: "/path/to/mbed-os-example-blinky"
       Command: "/usr/local/opt/python@3.9/bin/python3.9 -u /path/to/mbed-os-example-blinky/mbed-os/tools/make.py -t ARM -m CY8CKIT064B0S2_4343W --source . --build ./BUILD/CY8CKIT064B0S2_4343W/ARM"
       Tip: You could retry the last command with "-v" flag for verbose output
ciarmcom commented 3 years ago

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-3387

0xc0170 commented 3 years ago

cc @ARMmbed/team-cypress

Patater commented 3 years ago

We are currently implementing new CI for testing CMake-based builds. I recall we had to do something in CI to make this file present.

@jamesbeyond How did we get this target building in our other CI before?

jamesbeyond commented 3 years ago

We are currently implementing new CI for testing CMake-based builds. I recall we had to do something in CI to make this file present.

@jamesbeyond How did we get this target building in our other CI before?

Build tool complains file is missing, it is because unlike other mbed targets, some cypress targets will require some extra steps to generate the policy and key files before it start builds, the required steps are:

The required targets are:

Patater commented 3 years ago

I see two options that'd help this UX:

  1. Run these commands automatically from CMake if the files are missing, printing a message explaining both why and what we are doing
  2. If the files are missing when building for these targets, display an error message describing the commands to run in order to get the build working
hugueskamba commented 3 years ago

@jamesbeyond I did:

  1. cd targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT064B0S2_4343W/
  2. cysecuretools -t cy8ckit-064b0s2-4343w init
  3. cysecuretools -t cy8ckit-064b0s2-4343w create-keys

Here are the policy files generated:

user at HOST in /path/to/mbed-os/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT064B0S2_4343W on master [!]
$ l policy/
total 64
drwxr-xr-x   6 user  1399503260   192B 23 Feb 18:10 .
drwxr-xr-x  15 user  1399503260   480B 23 Feb 18:11 ..
-rw-r--r--   1 user  1399503260   5.4K 23 Feb 18:10 policy_multi_CM0_CM4_smif_swap.json
-rw-r--r--   1 user  1399503260   5.4K 23 Feb 18:10 policy_multi_CM0_CM4_swap.json
-rw-r--r--   1 user  1399503260   5.2K 23 Feb 18:10 policy_single_CM0_CM4_smif_swap.json
-rw-r--r--   1 user  1399503260   5.2K 23 Feb 18:10 policy_single_CM0_CM4_swap.json

The file policy_single_CM0_CM4.json is still missing

ifyall commented 3 years ago

@hugueskamba, what version of cysecuretools are you running when using those commands? Thanks, Ian

RaymondNgun commented 3 years ago

@hugueskamba, please install cysecuretools 2.1.0 e.g. pip install cysecuretools==2.1.0

hugueskamba commented 3 years ago

@hugueskamba, what version of cysecuretools are you running when using those commands? Thanks, Ian

Hi, This is the version I am currently running:

$ cysecuretools version

Package:
    CySecureTools: 3.0.0
    CyBootloader: 
        PSoC64 1M: 2.0.0.3257
        PSoC64 2M: 2.0.0.3345
        PSoC64 512K: 2.0.0.3257
hugueskamba commented 3 years ago

@hugueskamba, please install cysecuretools 2.1.0 e.g. pip install cysecuretools==2.1.0

With version 2.1.0

I get the following files:

$ l policy/
-rw-r--r--   1 user  1399503260   4.9K 23 Feb 21:11 policy_multi_CM0_CM4.json
-rw-r--r--   1 user  1399503260   4.9K 23 Feb 21:11 policy_multi_CM0_CM4_smif.json
-rw-r--r--   1 user  1399503260   4.7K 23 Feb 21:11 policy_single_CM0_CM4.json
-rw-r--r--   1 user  1399503260   4.7K 23 Feb 21:11 policy_single_CM0_CM4_smif.json

Thanks

hugueskamba commented 3 years ago

@jamesbeyond will you be adding the extra steps in the CI to fix the CMake test build failure?

hugueskamba commented 3 years ago

The CI is now configuring the environment correctly to build artefacts for the board.