Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wolfTPM Zephyr Project Port #395

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

aidangarske
Copy link
Contributor

@aidangarske aidangarske commented Jan 18, 2025

Description

This is the pr for adding Zephyr support for wolfTPM. I added wolftpm_wrap_test and wolftpm_wrap_caps samples. Each one builds successfully. The user_settings.h in the zephyr project is used correctly. that means if you want to supply your own you can either change the file or add yours in place.

Testing

setup Zephyr module in zephyrproject and build samples:

west update
cd [zephyrproject]
west build -p auto -b qemu_x86 modules/lib/wolftpm/zephyr/samples/wolftpm_wrap_test
west build -p auto -b qemu_x86 modules/lib/wolftpm/zephyr/samples/wolftpm_wrap_caps

A zephyr.yml Github CI workflow was added to test builds.

TODO

I still need to run it with a physical tpm device or one of the supported boards.
when running west build -t run getting:

SeaBIOS (version rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org)
Booting from ROM..
*** Booting Zephyr OS build v4.0.0-2817-g19526795c6af ***
[00:00:00.010,000] <err> os: Page fault at address 0x4 (error code 0x0)
[00:00:00.010,000] <err> os: Linear address not present in page tables
[00:00:00.010,000] <err> os: Access violation: supervisor thread not allowed to read
[00:00:00.010,000] <err> os: PTE: not present
[00:00:00.010,000] <err> os: EAX: 0x00000000, EBX: 0x0010a0c0, ECX: 0x00000000, EDX: 0x00114558
[00:00:00.020,000] <err> os: ESI: 0x00000000, EDI: 0x00102791, EBP: 0x0012710c, ESP: 0x00125834
[00:00:00.020,000] <err> os: EFLAGS: 0x00010206 CS: 0x0008 CR3: 0x00113000
[00:00:00.020,000] <err> os: EIP: 0x00101bfd
[00:00:00.020,000] <err> os: call trace:
[00:00:00.020,000] <err> os:      0: 0x00101e42
[00:00:00.020,000] <err> os:      1: 0x0010599a
[00:00:00.020,000] <err> os:      2: 0x001027b3
[00:00:00.020,000] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:00.020,000] <err> os: Current thread: 0x1144e0 (unknown)
[00:00:00.020,000] <err> os: Halting system
FAILED: zephyr/CMakeFiles/run_qemu /Users/aidangarske/zephyrproject/build/zephyr/CMakeFiles/run_qemu 
cd /Users/aidangarske/zephyrproject/build && /usr/local/bin/qemu-system-i386 -m 32 -cpu qemu32,+nx,+pae -machine q35 -device isa-debug-exit,iobase=0xf4,iosize=0x04 -no-reboot -nographic -machine acpi=off -net none -pidfile qemu.pid -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -icount shift=5,align=off,sleep=off -rtc clock=vm 
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /Users/aidangarske/zephyrproject/build --target run

Documentation

For now I have made a zephyr/README.md with all the information needed to get started.

@aidangarske aidangarske self-assigned this Jan 18, 2025
@dgarske dgarske self-requested a review January 20, 2025 15:46
@dgarske dgarske self-assigned this Jan 20, 2025
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work.

zephyr/user_settings.h Show resolved Hide resolved
@dgarske dgarske marked this pull request as ready for review January 20, 2025 18:39
@dgarske dgarske requested a review from ColtonWilley January 20, 2025 18:40
@aidangarske aidangarske removed their assignment Jan 23, 2025
dgarske
dgarske previously approved these changes Jan 23, 2025
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful work. As you get time please add a GitHub CI test. @ColtonWilley please review also.

zephyr/CMakeLists.txt Show resolved Hide resolved
@dgarske dgarske assigned ColtonWilley and wolfSSL-Bot and unassigned dgarske Jan 23, 2025
@dgarske dgarske assigned aidangarske and unassigned ColtonWilley Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants