4 years, 7 months ago.

Recommended Workflow for CM33

I'd like to evaluate the TF-M implementation running on MBED OS on the NXP LPC55S69. Does MBED Studio have any support for building / debugging of multi-project images that make us of the trust zone? Or would I be better off using a 3rd party IDE (LPCXpresso, or Keil) and importing the MBED TF-M project ?

2 Answers

4 years, 6 months ago.

Hi, Desmond

I defined TFM_CORE_DEBUG as you advised in the mbed-os/tools/psa/tfm/mbed_app.json file. I see that the macro is defined in the mbed_config.h file.

However, I do not see any output of the secure world on my minicom (connected to USB port).

Is there anything else I need to enable or do to get the output from the secure world?

Hi Tobias,

I think this target didn't finish the serial porting yet, looking into target.json here.

https://github.com/ARMmbed/mbed-os/blob/699372421a3b388fe568e9be85b1a985749a438f/targets/targets.json#L2144

It doesn't have SERIAL defined, so I guess that's why the message is not shown.

Regards, Desmond

posted by Desmond Chen 15 Nov 2019
4 years, 7 months ago.

Hi Dan,

We have a draft porting guide for TF-M integration to Mbed OS, hope this helps.

https://github.com/ARMmbed/mbed-os/blob/master/components/TARGET_PSA/TARGET_TFM/tf-m-integration.md

Regards, Desmond

Hi Desmond,

I've looked at the porting guide but it doesn't offer much help in terms of the actual workflow. Since I'm using one of the support MCUs (LPC55S69) I assume porting wont be necessary.

However, what I'm not sure about is how to build a basic project with the the PSA services. Right now I tried to do something like this with the Blinky sample:

$ mbed compile -t ARMC6 -m LPC55S69_NS

$ mbed compile -t ARMC6 -m LPC55S69_S

However, I'm getting some build issues (see below) so it seems this is not correct. Here are some of my more specific questions:

1. What are the steps to build a basic hello_world application with PSA services?

2. After building, how can one merge, load, debug these binaries?

3. How is the delineation between what runs on the secure / non-secure core defined?

4. Is the system meant to boot into the secure or non-secure space.

Regards, Dan

Output log from compiling for secure target:

Error: L6200E: Symbol PendSV_Handler multiply defined (by BUILD/LPC55S69_S/ARMC6/mbed-os/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_M33/irq_armv8mml.o and BUILD/LPC55S69_S/ARMC6/mbed-os/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/ipc/tfm_arch_v8m.o).

Error: L6200E: Symbol SVC_Handler multiply defined (by BUILD/LPC55S69_S/ARMC6/mbed-os/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/TOOLCHAIN_ARM/TARGET_M33/irq_armv8mml.o and BUILD/LPC55S69_S/ARMC6/mbed-os/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/secure_fw/core/tfm_handler.o).

posted by Dan B 28 Oct 2019

Hi Dan,

Please try the following instructions

  • cd mbed-os
  • python tools/psa/release.py -m LPC55S69_S -t ARMC6
  • cd ..
  • mbed compile -t ARM -m LPC55S69_NS
posted by Desmond Chen 29 Oct 2019

Hi Desmond,

1. Thanks, that seems to compile successfully at least. Can you point me to where I would have found that python command? Maybe there's other information that would be useful.

2. Can you let me know what the correct way to enable TFM_CORE_DEBUG is? Should I be adding this to mbed-os/components/TARGET_PSA/TARGET_TFM/mbed_lib.json or is there a better place? Also, I see printf isn't properly defined ( #define printf(...) )

posted by Dan B 29 Oct 2019

Hi Dan,

Sorry we don't have a more formal documentation for that, you can refer here for what release.py does.

You can add "macro": ["TFM_CORE_DEBUG"] in mbed_app.json

posted by Desmond Chen 30 Oct 2019

Thanks for the help so far Desmond. I'm trying to debug this application now using Keil so I can verify the correct function of the SPM but am getting a linker error when I export to Keil. Is this a known issue or do you have any suggestions on where to look?

warning: L6312W: Empty execution region description for region rw_iram1

error: L6236E: No section matches selector - no section to be FIRST/LAST.

Also, can you tell me what the correct way to export both projects is? Right now I'm using the below- is this correct?

mbed export - -ide uvision6 - -target LPC55S69_NS

mbed export - -ide uvision6 - -target LPC55S69_S

posted by Dan B 01 Nov 2019