Commit graph

731 commits

Author SHA1 Message Date
Michael Cardell Widerkrantz
cbcb7fb1de
build: Run static code analysis after fw build
Since we now generate at least one source code file we need to run the
static code analysis after the build.
2025-09-02 11:09:15 +02:00
Michael Cardell Widerkrantz
34e9f0a314
tkey-libs: Import tag fw-5 of tkey-libs
Use tag fw-5 from https://github.com/tillitis/tkey-libs/
2025-09-02 11:09:12 +02:00
Michael Cardell Widerkrantz
17e5e77187
build: Always rebuild firmware if any header file changes 2025-09-01 18:19:54 +02:00
Michael Cardell Widerkrantz
18386b4865
build: Remove all built qemu artefacts when cleaning 2025-09-01 18:19:54 +02:00
Michael Cardell Widerkrantz
90a91ba1ba
build: Create and use a complete filesystem image
- Create a flash image in flash_image.bin, useful for both a real TKey
  and QEMU.

- Use flash_image.bin directly in prog_flash for a real TKey, which
  also flashes the bitstream.

- Remove building of tools/default_partition.bin.

- Update documentation about the tool use.

- We keep the load_preloaded_app.sh for development purposes,
  but it's no longer used in the build.
2025-09-01 18:19:54 +02:00
Michael Cardell Widerkrantz
65ff0a5d61
doc: Document the filesystem 2025-09-01 18:19:54 +02:00
Michael Cardell Widerkrantz
6fc4d264cc
build: Introduce DEFAULT_APP with automatic builds
Introduce the Makefile variable DEFAULT_APP which should be the path
to the device app binary to include in the obliagory slot 0.

Build automatically: the default app, the new digest file
mgmt_app_digest.h for the firmware which contains the digest of
DEFAULT_APP, the default partition table, and all the tools necessary
to generate this.
2025-09-01 18:19:54 +02:00
Michael Cardell Widerkrantz
9eed887a75
ci: Bump to tkey-builder:5rc2 2025-09-01 18:19:53 +02:00
Michael Cardell Widerkrantz
d3492e2a34
tool: Change b2s to output exact variable used
- Use correct name.
- Don't declare it as static.
- Lose the toolchain
- Use only basename of path in the b2s comment
2025-09-01 18:19:53 +02:00
Jonas Thörnblad
13767ee7df
Add loopbackapp for app debugging using physical TKey with QEMU
This app takes data coming in on any of the normal USB endpoints
like CDC and FIDO (or CCID) and outputs the data on the DEBUG
endpoint.

Using the scripts (tkey_to_udp_linux.py, tkey_to_udp_win.py) in
QEMU (tk1 branch) under tools/tk1, the data from the DEBUG
endpoint can be read and sent over the network to the script
udp_to_qemu_linux.py that feeds it to QEMU.
2025-08-28 17:01:07 +02:00
Jonas Thörnblad
1926d19146
fw: Change loader app
- Change loader app from testloadapp to defaultapp
- Update default_partition.bin to contain defaultapp.bin
2025-08-22 15:11:01 +02:00
Michael Cardell Widerkrantz
babdef52f5
toolchain: Add Go package
- Add Go 1.23.
- Set up PATH for container to include the Go binaries.
2025-07-17 07:53:50 +02:00
Jonas Thörnblad
a0f699aea5
Update USB product descriptor for Castor 2025-06-27 15:01:29 +02:00
Jonas Thörnblad
62adf4da71
Update USB VID and PID for Castor
VID has been wrong for some reason, therefore changed to the
correct value 0x1209.

New PID to differentiate Castor from Bellatrix.
2025-06-27 15:01:29 +02:00
Jonas Thörnblad
1a904e8857
Fix allowed_app_digest formatting
Fix formating of BLAKE2s digest of app allowed to start from
flash slot 0.
2025-06-27 15:01:29 +02:00
Jonas Thörnblad
03d96c3e96
tool: Fix b2s BLAKE2s digest zero padding 2025-06-24 18:18:17 +02:00
Jonas Thörnblad
c0b3c80620
Add make targets for building CH552 firmware with podman 2025-06-24 17:27:21 +02:00
Mikael Ågren
460d310c73
fw: Fix qemu_firmware build warnings 2025-06-19 08:50:13 +02:00
Michael Cardell Widerkrantz
f4f8c9e6c6
doc: Update Building & flashing docs
- Point out where to find tools.

- Add some description that we assume a Linux dist.

- Move the make targets around: make flash builds and flashes the
  entire thing so someone who just want to exactly that can use it
  right away.

- Explain what kind of hardware the USB controller is.

- Add a description on how to be able to use chprog without being
  root when running chprog.
2025-05-30 18:07:29 +02:00
Sasko Simonovski
ed9395c832
doc: Describe how to test alpha release in release notes
Adds information and link on how to test alpha release.
2025-05-28 11:56:22 +02:00
Mikael Ågren
888f18e5fe
doc: Refer to CH55x Reset Controller silk screen labels in flash docs 2025-05-26 07:59:50 +02:00
Michael Cardell Widerkrantz
24ef7b412b
doc: Add description on how to build and flash USB controller firmware 2025-05-23 15:43:44 +02:00
Michael Cardell Widerkrantz
f5d2cfef15
doc: Mention the tkeyimage tool in firmware README 2025-05-23 14:12:36 +02:00
Michael Cardell Widerkrantz
9a93da087d
doc: Document how to flash with filesystem 2025-05-23 14:12:36 +02:00
Michael Cardell Widerkrantz
916c37eab9
doc: Update release notes
Co-authored-by: Mikael Ågren <mikael@tillitis.se>
2025-05-23 14:05:58 +02:00
Michael Cardell Widerkrantz
29e5888482
doc: Remove old toolchain setup text
Use current information in Developer Handbook,
https://dev.tillitis.se/ instead of relying on this old description.
2025-05-23 14:05:58 +02:00
Mikael Ågren
e8acc7aee2
build: Flash partition table when running make prog_flash
Changes make targets:

- prog_flash in hw/application/Makefile which flashes only the
  bitstream is renamed to prog_flash_bs.

- prog_flash in hw/application/Makefile is modified to flash the
  bitstream, the testloadapp.bin in app slot 0, and the partition table.

- flash in contrib/Makefile is modified to use prog_flash from
  hw/application/Makefile
2025-05-22 15:24:45 +02:00
Mikael Ågren
4172db8dfb
build: Do not use sudo when running tillitis-iceprog 2025-05-22 15:06:39 +02:00
Mikael Ågren
7b1c1e5076
testapp: Update to 24 MHz clock 2025-05-22 09:31:54 +02:00
Michael Cardell Widerkrantz
1fec28ff0d
doc: Complete copyright and licenses
- Point out licensing terms in docs.
- Add missing SPDX tags
- Update the SPDX checker to check all the files we want to check.
- Include spdx-ensure in CI.
2025-05-22 09:31:54 +02:00
Michael Cardell Widerkrantz
8f9c706b9e
doc: Correct the GPL file
Import file

https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt

verbatim since it clearly says in the license that we are now allowed
to change it. I think it might have been a cut and paste from

https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

before?
2025-05-22 09:31:54 +02:00
Mikael Ågren
07e487733b
build: Check app code formatting from application_fpga/Makefile 2025-05-22 09:31:54 +02:00
Michael Cardell Widerkrantz
ba17a2b29e
build: Use only one Makefile for apps
- Use one common Makefile for all test device apps.
- Use a single copy of syscall.[Sh].
- Update docs for building.
2025-05-22 09:31:50 +02:00
Michael Cardell Widerkrantz
6e3034c3ce
build: Move .clang-format to top level 2025-05-21 09:44:17 +02:00
Michael Cardell Widerkrantz
e302910f4d
Remove superfluous file __init__.py 2025-05-20 17:41:18 +02:00
Michael Cardell Widerkrantz
13641cb18b
build: Move test applications and the defaultapp
Instead of having the test apps under fw we create a new directory for
them.
2025-05-20 17:37:58 +02:00
Michael Cardell Widerkrantz
69940d2c64
doc: Link to firmware docs from TKey hardware design 2025-05-20 17:28:01 +02:00
Michael Cardell Widerkrantz
4ec58ce04c
tools: Prune and document tools
Add a tools/README.md.

Remove:

- create_flash_image.py: role now overtaken by tkeyimage which does
  more.
- reset-tk1: Leftover from when production_test was removed.

Rename:

- makehex.py: Moved up one level.
2025-05-20 17:12:46 +02:00
Michael Cardell Widerkrantz
a1f37d17c9
tool: Rename partition_table to tkeyimage 2025-05-20 13:50:55 +02:00
Michael Cardell Widerkrantz
fab126b695
tool: Add docs to partition_table
Co-authored-by: Mikael Ågren <mikael@tillitis.se>
2025-05-20 13:50:55 +02:00
Michael Cardell Widerkrantz
9a17aa6bdb
tool: Add SPDX tag to partition_table 2025-05-20 13:50:55 +02:00
Michael Cardell Widerkrantz
0d6e1d9ba5
fw: Add debug print when reading partition table fails 2025-05-20 13:50:55 +02:00
Michael Cardell Widerkrantz
ea29843037
tool: Make partition_table able to produce flash file
Usage:

  ./partition_table -o flash.bin -f -app0 path/to/app

Will produce a flash.bin that can be used for qemu.

- Adjust the size of the partition table.
- Refactor and rename genPartitionFile().
2025-05-20 13:50:51 +02:00
Mikael Ågren
6afdc114b8
Update binary hashes for bitstream 2025-05-20 11:59:44 +02:00
Mikael Ågren
2556f61f5a
fpga: Bump tk1 core version to 6 2025-05-20 11:27:07 +02:00
Mikael Ågren
b144cdfbdb
fpga: Use Castor specific VID/PID in UDI
Allows an app to determine which type of device it is running on.

- Reserve vendor ID 0x7357 for people using Unlocked.
- Use Castor product ID.
- Serial number is just nonsense, as before.
2025-05-20 11:25:54 +02:00
Michael Cardell Widerkrantz
8965fea947
Reset USB controller endpoints when starting
When starting, reset the USB controller to only enable the USB CDC
endpoint and the internal command channel. If the app resets firmware,
but had differend endpoints enabled, we want to go back to a known
state.
2025-05-16 17:09:13 +02:00
Mikael Ågren
daa7807c0f
Update binary hashes for bitstream & firmware 2025-05-15 16:15:14 +02:00
Mikael Ågren
53bc2d5fa0
fw: Update flash_write_data() to handle sizes larger than 4096 bytes 2025-05-15 16:13:30 +02:00
Mikael Ågren
5a9b77806f
fw: Return 0 on sys_alloc success, -1 on error
It is left to the app to keep track of whether it has had access to the
allocated area before.
2025-05-15 16:13:30 +02:00