Skip to content

Conversation

@theotherjimmy
Copy link
Contributor

@theotherjimmy theotherjimmy commented Sep 1, 2021

NOTE: This includes, and depends on #38149. ATM, this means that the last 2 commits in the history are added by this PR. Rebased onto current main.

This adds a new target, mps3_an547_nonsecure, that builds TF-M as the Secure world firmware and Zephyr as the Non-secure world firmware.

@github-actions
Copy link

github-actions bot commented Sep 1, 2021

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
mbedtls zephyrproject-rtos/mbedtls@5765cb7 (master) zephyrproject-rtos/mbedtls#29 zephyrproject-rtos/mbedtls#29/files
mcuboot zephyrproject-rtos/mcuboot@70bfbd2 (main) zephyrproject-rtos/mcuboot#60 zephyrproject-rtos/mcuboot#60/files
openthread zephyrproject-rtos/openthread@5d70654 zephyrproject-rtos/openthread#50 zephyrproject-rtos/openthread#50/files
trusted-firmware-m zephyrproject-rtos/trusted-firmware-m@c74be38 (master) zephyrproject-rtos/trusted-firmware-m#60 zephyrproject-rtos/trusted-firmware-m#60/files

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@stephanosio stephanosio marked this pull request as draft September 2, 2021 10:08
@microbuilder microbuilder added this to the v3.0.0 milestone Sep 28, 2021
@theotherjimmy theotherjimmy marked this pull request as ready for review October 13, 2021 19:56
@theotherjimmy
Copy link
Contributor Author

Thanks for the review @microbuilder. I have addressed both issues and would like another review.

@microbuilder
Copy link
Member

microbuilder commented Oct 26, 2021

@theotherjimmy Were you testing this on QEMU or the FVP image? I tried to run this on Qemu 6.1.0, but get the following (using the instructions for QEMU vs. FVP here: https://docs.zephyrproject.org/latest/boards/arm/mps3_an547/doc/index.html#fvp-usage):

$ west build -p auto -b mps3_an547_ns zephyr/samples/tfm_integration/psa_crypto/ -DEMU_PLATFORM=qemu -t run
...
[118/119] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       31712 B       384 KB      8.06%
            SRAM:       11144 B         2 MB      0.53%
        IDT_LIST:          0 GB         2 KB      0.00%
[118/119] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: cortex-m55
qemu-system-arm: warning: nic lan9118.0 has no peer
qemu: fatal: Lockup: can't escalate 3 to HardFault (current priority -1)

R00=00000000 R01=00000000 R02=00000000 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=ffffffe0 R14=fffffff9 R15=00000000
XPSR=00000003 ---- A S handler
s00=00000000 s01=00000000 d00=0000000000000000
s02=00000000 s03=00000000 d01=0000000000000000
s04=00000000 s05=00000000 d02=0000000000000000
s06=00000000 s07=00000000 d03=0000000000000000
s08=00000000 s09=00000000 d04=0000000000000000
s10=00000000 s11=00000000 d05=0000000000000000
s12=00000000 s13=00000000 d06=0000000000000000
s14=00000000 s15=00000000 d07=0000000000000000
s16=00000000 s17=00000000 d08=0000000000000000
s18=00000000 s19=00000000 d09=0000000000000000
s20=00000000 s21=00000000 d10=0000000000000000
s22=00000000 s23=00000000 d11=0000000000000000
s24=00000000 s25=00000000 d12=0000000000000000
s26=00000000 s27=00000000 d13=0000000000000000
s28=00000000 s29=00000000 d14=00/bin/sh: line 1: 44952 Abort trap: 6           /usr/local/bin/qemu-system-arm -cpu cortex-m55 -machine mps3-an547 -nographic -vga none -net none -pidfile qemu.pid -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -icount shift=7,align=off,sleep=off -rtc clock=vm -kernel /Users/kevin/Linaro/zephyr/build/zephyr/zephyr.elf
FAILED: zephyr/CMakeFiles/run /Users/kevin/Linaro/zephyr/build/zephyr/CMakeFiles/run 
cd /Users/kevin/Linaro/zephyr/build && /usr/local/bin/qemu-system-arm -cpu cortex-m55 -machine mps3-an547 -nographic -vga none -net none -pidfile qemu.pid -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -icount shift=7,align=off,sleep=off -rtc clock=vm -kernel /Users/kevin/Linaro/zephyr/build/zephyr/zephyr.elf
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /Users/kevin/Linaro/zephyr/build --target run

@theotherjimmy
Copy link
Contributor Author

I get that as well, through west. It's trying to boot zephyr.elf without a merged trusted-firmware, which does not work.

@theotherjimmy theotherjimmy force-pushed the qemu-mps3-an547 branch 2 times, most recently from 5d6fdae to ebb076b Compare October 27, 2021 00:29
@microbuilder microbuilder self-requested a review November 1, 2021 12:34
@theotherjimmy theotherjimmy force-pushed the qemu-mps3-an547 branch 6 times, most recently from 0fc5277 to 47e38fc Compare November 22, 2021 19:02
… mode

This includes a new device tree, new target yaml and new target
defconfig

Signed-off-by: Jimmy Brisson <[email protected]>
Zephyr will try to run the `zephyr.elf` file by default. This is
problematic for any `..._ns` target, as they all need to boot through
[mcuboot and] TF-M. They simply hardfault without the rest of their
system image.

This corrects the `west build -t run ...` for the `mps3_an547_ns`
board, as it now has special treatment.

Signed-off-by: Jimmy Brisson <[email protected]>
Documented both secure-only and nonsecure firmware modes

Signed-off-by: Jimmy Brisson <[email protected]>
@galak galak removed the DNM This PR should not be merged (Do Not Merge) label Dec 7, 2021
@galak
Copy link
Contributor

galak commented Dec 7, 2021

The CI failure is not related to this PR, so going to merge it and we'll open an issue to track the failure which is due to QEMU.

@galak galak merged commit 33c97f6 into zephyrproject-rtos:main Dec 7, 2021
@theotherjimmy theotherjimmy deleted the qemu-mps3-an547 branch December 7, 2021 18:25
@dleach02
Copy link
Member

dleach02 commented Dec 8, 2021

Okay... turns out CI failure was related to this PR... FYI :-(

@theotherjimmy
Copy link
Contributor Author

It's related to the mps3-an547, but not specifically relating to secure/non-secure. (note that the tests are for the mps3_an547 without the _ns suffix). At least one of the problems is documented in 2 issues: #40970 and zephyrproject-rtos/sdk-ng#420

@theotherjimmy
Copy link
Contributor Author

The other of the problems is documented here: #40569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants