Joachim Strömbergson
4644c79cbd
Adding test 8: GPIO test
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:28 +02:00
Joachim Strömbergson
394e437c91
Add test7: Control of LED RGB outputs.
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:27 +02:00
Joachim Strömbergson
480f4e3d45
Add test6: Test that RAM ASLR and SCRAMBLE registers can be set by fw
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:27 +02:00
Joachim Strömbergson
d70937c11b
Improved messaging from the testbench
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:27 +02:00
Joachim Strömbergson
59af60bdd5
Add test4: writing and reading blake2s entry point
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:27 +02:00
Joachim Strömbergson
dc2903a5b4
Update test3 to check that writing to CDI works when in fw mode
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:27 +02:00
Joachim Strömbergson
16a91bfdd5
Adding test 3: Reading out the CDI
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:27 +02:00
Joachim Strömbergson
1f47991ac2
Add test2: Read out UDI
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:27 +02:00
Joachim Strömbergson
6d9890d050
Add test1: Read out name and version
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:26 +02:00
Joachim Strömbergson
49eac9d101
Complete init of DUT and input, output display
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:26 +02:00
Joachim Strömbergson
1909833952
Add header with info and license
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:26 +02:00
Joachim Strömbergson
b1993742bb
Fix testbench buik including DUT instantiation
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:26 +02:00
Joachim Strömbergson
2fb61bba73
Add UDI used during simulation
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:26 +02:00
Joachim Strömbergson
cb2fd573b3
Add dummy LED macro driver module needed for simulation
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:26 +02:00
Joachim Strömbergson
61598f57e5
Add initial version of testbench annd Makfile for building sim target
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:26 +02:00
Joachim Strömbergson
97e3e25d98
Update the UART README with info about the core and its API
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:25 +02:00
Joachim Strömbergson
704d67c8ab
Add Makefile to build sim. Debug sim build
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:25 +02:00
Joachim Strömbergson
819b93deff
Complete testbench and update README with API info
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:25 +02:00
Joachim Strömbergson
bbff7576df
Fix markdown syntax for API listing
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:25 +02:00
Joachim Strömbergson
e6eaad87dc
Update README with info about the timer API
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:25 +02:00
Joachim Strömbergson
4c54b4b60b
Add info about the API in the README
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:25 +02:00
Joachim Strömbergson
18bb9b8599
Making the testbench self checking
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:25 +02:00
Joachim Strömbergson
1d2a71ec0c
Change file extension to markdown
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:24 +02:00
Joachim Strömbergson
1e97e27e66
Updated README, completed testcase and cleaned up the testbench
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:24 +02:00
Joachim Strömbergson
9d188a2f7f
Add more info about how the timer works
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:24 +02:00
Joachim Strömbergson
7c9dfaf45a
Add testcase for the timer top level wrapper and clean up the tb
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:24 +02:00
Joachim Strömbergson
c185849ae4
Minor cleanup of README, testbench and Makefile
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:24 +02:00
Michael Cardell Widerkrantz
e0e871c730
Include debug symbols in the ELF
2023-07-04 09:04:23 +02:00
Daniel Lublin
ea7d64c29f
doc: update to refs to in-tree TP-1 firmware
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-07-04 09:04:23 +02:00
Joachim Strömbergson
6d0a761e65
Make memeq function side channel silent
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-07-04 09:04:23 +02:00
Daniel Lublin
2ddd523c29
Use tkey-builder:2; add hashes & checks for bitstream & fw bins
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-07-04 09:04:23 +02:00
Monrad-Aas
33abc7fcfe
pdf printed
2023-07-04 09:04:22 +02:00
Monrad-Aas
a964d3bb89
Replaced Cap w. spring contacts
...
Signed-off-by: Monrad-Aas <isak.monrad-aas@sigma.se>
2023-07-04 09:04:22 +02:00
Daniel Lublin
9aece67a41
testfw: test read bytes from CDI
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-28 11:44:13 +02:00
Daniel Lublin
eeed342b96
testfw: make output slightly more readable
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-28 11:32:56 +02:00
Daniel Lublin
aa86c9d58c
testfw: compare UDS correctly, correct byte-order
...
Also don't let fwram success overwrite anyfailed
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-28 11:32:56 +02:00
Daniel Lublin
dcc6351f79
testfw: use a func for fail prints
...
Now testfw fits again (when built with -Os)
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-28 11:32:56 +02:00
Daniel Lublin
bcac8eeaf4
testfw: update check for new known UDS; correctly and always print UDS
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-28 11:32:56 +02:00
Joachim Strömbergson
688910bee4
Use different byte values in test UDS words
...
Signed-off-by: Joachim Strömbergson <joachim@assured.se>
2023-03-28 09:26:23 +02:00
Michael Cardell Widerkrantz
c126199a41
fw: UDS not byte-readable
...
Since UDS is not byte-readable we copy it by word to local_uds. Now
UDS lives for a short while in local_uds on the stack in FW_RAM and in
the internal buffer of the blake2s context (also in FW_RAM) but is
very soon overwritten.
2023-03-27 16:24:02 +02:00
Michael Cardell Widerkrantz
fae2447344
testfw: Test UDS against known good
2023-03-27 16:24:02 +02:00
Michael Cardell Widerkrantz
cefb6ca9c1
fw: Change max frame size to 128 bytes
2023-03-27 10:58:16 +02:00
Michael Cardell Widerkrantz
c443ef8a3e
fw: clang-tidy and splint: New make target: check
...
Add clang-tidy and splint static analytics check. For now, we use only
the cert-* warnings on clang-tidy and run splint with a lot of flags
to allow more things.
Changes to silence these analytics:
- Stop returning stuff from our debug print functions. We don't check
them anyway and we don't have any way of detecting transmission
failure.
- Declare more things static that isn't used outside of a file.
- Change types to be more consistent, typically to size_t or
something or to uint32_t.
2023-03-22 11:05:32 +01:00
Michael Cardell Widerkrantz
f622937918
fw: Don't use reserved or reserved-looking names
2023-03-22 11:05:26 +01:00
Matt Mets
f83f919f9e
Print warning if the programmer device permissions are incorrect
2023-03-21 14:38:29 +01:00
Matthew Mets
fe1e2254d2
Pipecleaning
2023-03-21 14:38:29 +01:00
Matthew Mets
604bbdbd02
Add Pico SDK to docker image, for building tp1 firmware
2023-03-21 14:38:29 +01:00
Matt Mets
17ce7799a7
Rename programmer library, update VID/PID for programmer
2023-03-21 14:38:29 +01:00
Matt Mets
994ec270ef
pico: change USB vendor to Tillitis
2023-03-21 14:38:29 +01:00
Matt Mets
9c7022edd0
Pull in programmer board firmware
2023-03-21 14:38:29 +01:00
Matt Mets
2cd7c9f8e3
Linting
2023-03-21 14:38:28 +01:00
Matt Mets
12f6575afd
Update raw_usb interface
...
* Update raw_usb interface to the 0200 version
* Rename ice* commands to be less confusing
* Split production test into a runner script and test library
* Add continuous randomized test for test library
* Speed improvements for nvcm commands
2023-03-21 14:38:28 +01:00
Matt Mets
3897a8269b
More agressive python linting
2023-03-21 14:38:28 +01:00
Matt Mets
6371ab68fb
USB speed improvements
...
* Add write-only commands to avoid unneded reads
* Add clock-only command to avoid excessive writes
* Add partial async support to reduce inter-command delays
2023-03-21 14:38:28 +01:00
Matt Mets
3fd4ec44b4
Add bootloader command, SPI clock speed setting
2023-03-21 14:38:28 +01:00
Matt Mets
d09919d354
Lint more python scripts
2023-03-21 14:38:28 +01:00
Matt Mets
49c3b35a4b
NVCM programmer: add 'verify' option
2023-03-21 14:38:28 +01:00
Matt Mets
acdc900b3b
Reflow to max 70 characters
2023-03-21 14:38:28 +01:00
Matt Mets
84d020e3c0
Add type annotations, lint for pep8
2023-03-21 14:38:27 +01:00
Matt Mets
ac174afb8f
Use streamlined USB interface, make NVCM a class
2023-03-21 14:38:27 +01:00
Matthew Mets
4eb025a978
Remove HID interface
2023-03-21 14:38:27 +01:00
Matthew Mets
04be27f6a7
Make the flash sleep function toggleable
2023-03-21 14:38:27 +01:00
Matthew Mets
c81b186c10
Port NVCM programming script to raw_hid interface
2023-03-21 14:38:27 +01:00
Matthew Mets
3dbb3836f6
Pull in raw_usb version of the programmer firmware
2023-03-21 14:38:27 +01:00
Matthew Mets
17b8cb515b
Update toolchain for raw_usb dependencies
...
Addresses #82
2023-03-21 14:38:27 +01:00
Matthew Mets
a9f99fc217
Add test routine for erasing CH552
2023-03-21 14:38:26 +01:00
Matthew Mets
6a0e0478a6
Switch production test to use raw USB interface
2023-03-21 14:38:26 +01:00
Matthew Mets
2536011fb9
Add script to set up venv and run production test
2023-03-21 14:38:22 +01:00
Michael Cardell Widerkrantz
709a4449ff
testfw: clang format
2023-03-16 15:08:36 +01:00
Michael Cardell Widerkrantz
9488f0633d
fw: Hide *led in led.c
2023-03-16 14:26:20 +01:00
Michael Cardell Widerkrantz
8665031bb4
fw/testfw: Simplify hexdump
2023-03-16 14:26:13 +01:00
Michael Cardell Widerkrantz
7ce1d9fe06
fw: Remove forgotten hexdump
2023-03-16 14:03:11 +01:00
Michael Cardell Widerkrantz
1f10c8e2db
fw: Initialize automatic variables
2023-03-16 13:51:24 +01:00
Michael Cardell Widerkrantz
226bcbaed1
fw: Update comments
2023-03-16 13:30:56 +01:00
Michael Cardell Widerkrantz
00d806df10
fw: Rename variable rnd to rnd_sleep to indicate what it's for
2023-03-16 13:17:42 +01:00
Michael Cardell Widerkrantz
cd2dc55371
fw: Add function declaration for static functions
2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
0a1e1db40e
fw: Init stack pointer to end of fw_ram
2023-03-14 11:31:48 +01:00
Daniel Lublin
2b9bfc0eff
Consistently set any new state and do break out of case/default
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
f9960de506
fw: Re-introduce print_hw_version() - simplify namever handling
2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
78eb472ac9
fw: Go to state fail on bad command lengths
2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
ebf8a11ed0
fw: Move all variable declaration to first in scope
2023-03-14 11:31:48 +01:00
Michael Cardell Widerkrantz
9c766794db
fw: Move scramble RAM to own function
2023-03-14 11:31:47 +01:00
Michael Cardell Widerkrantz
9de7f294df
fw: Move all command switches to their own functions
2023-03-14 11:31:47 +01:00
Michael Cardell Widerkrantz
4e3f5469ef
fw: Simplify logic
...
Switch on state, then read commands specifically in the states that
allow reading of commands, then switch on specific command.
2023-03-14 11:31:47 +01:00
Daniel Lublin
7a97f1ee5f
Add more complete fw_ram test; let testfw have stack in RAM
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 11:21:47 +01:00
Daniel Lublin
5fe7ba7f9d
fw: optimize for speed (-O2) instead of size (-Os)
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:05 +01:00
Daniel Lublin
957df5e6b4
fw: enable addr & data scrambling; fill RAM with random data
...
Use a rnd_word() func
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:03 +01:00
Daniel Lublin
4afdc1cd1f
fw: Steady white led while waiting cmd; led off while loading app
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:03 +01:00
Daniel Lublin
7eb4d0304b
fw: load app at the start of RAM
...
Since app is always loaded at the start of RAM, the TK1_APP_ADDR define
is no longer needed.
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:03 +01:00
Daniel Lublin
425fdb4b90
fw: adjust for 2 KB of FW_RAM
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:02 +01:00
Daniel Lublin
c1fffcb70b
Keep uninitialized var in main, not globally, preventing any BSS
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:02 +01:00
Daniel Lublin
3ddd6e83a3
Refuse to produce a .bin if .elf has non-empty data or bss section
...
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:02 +01:00
Michael Cardell Widerkrantz
d77654bb8e
fw: No .data or .bss segment
...
We don't use any .data or .bss segment at all to keep all the firmware
variables in the stack in protected fw_ram.
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:02 +01:00
Michael Cardell Widerkrantz
56e34b3add
fw/testfw: Use fw_ram for firmware stack
...
This means firmware's stack shouldn't be accessible to programs
running in app_mode.
It also means we don't need to take special care of secure_ctx which
can now be an ordinary stack variable.
Nonetheless we zero out secure_ctx after final use and inline some
assembler to zero out the entire fw_ram after use, just before
switching to app_mode.
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:02 +01:00
Michael Cardell Widerkrantz
d2240b3e0f
fw: Use a bit string for allowed_commands
...
For every state, define a constant bitstring with allowed commands and
check incoming command agains that.
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:02 +01:00
Michael Cardell Widerkrantz
8edfdf9c36
fw: Remove state init_loading, introduce state fail
...
- We always assert on allowed commands in a state.
- We don't allow FW_CMD_LOAD_APP to be used twice.
- Enter fail state on read buffer overrun, header endpoint not for us,
header parse error, and unknown firmware command.
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:02 +01:00
Michael Cardell Widerkrantz
65f100a3c0
fw: Use byte readable UDS
...
UDS is now byte readable (but not writable).
Use UDS and USS directly in a blake2s_update() instead of
concatenating them into fw_ram. UDS will still live for a short while
in fw_ram in the blake2s context buffer but will soon be overwritten.
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:01 +01:00
Michael Cardell Widerkrantz
b34fdbcd37
testfw: Use wordcpy_s() and memcpy_s()
...
Use new wordcpy_s() and memcpy_s() functions from lib.c.
Add a local memcpy() which compiling with -Os seems to demand. Why?
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:01 +01:00
Michael Cardell Widerkrantz
cc032d9883
fw: Hide HTIF functions better when using NOCONSOLE
...
We define macros for them that expand to nothing or to a constant to
avoid any extra function calls to dummy functions when running on real
hardware with no console.
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:01 +01:00
Michael Cardell Widerkrantz
3a7ec9b9a0
fw: Run forever_redflash() when aborting from asserts
...
Should be more vissible than an eternal loop.
Signed-off-by: Daniel Lublin <daniel@lublin.se>
2023-03-14 10:25:01 +01:00