347 Commits

Author SHA1 Message Date
Daniel Jobson
8c073c3d01
fw: adapt fw syscall to hw syscall implementation
- Use new syscall API from hw
- 4 byte align the syscall function
- Restore blake2s
- Remove setting system_mode_ctrl since it is done by the hardware instead

Co-authored-by: Mikael Ågren <mikael@tillitis.se>
2024-12-09 09:01:34 +01:00
Daniel Jobson
a65eddbb00
temp: add define to toggle the use of fw RAM 2024-12-09 09:01:34 +01:00
Daniel Jobson
a57178f9d9
fw: add workaround so objdump can disassemble compressed rv32
instructions
2024-12-09 09:01:34 +01:00
Daniel Jobson
e21961ca0d
fw: simplify switch to FW_RAM 2024-12-09 09:01:33 +01:00
Daniel Jobson
027978f4d4
fw: switch to FW RAM when executing a syscall. 2024-12-09 09:01:33 +01:00
Daniel Jobson
290f826e76
storage: add erase command
Add an erase command to let the user have more control over the
allocated area. This will also be more familiar to embedded developers.
As a bonus it minimizes the logic needed in firmware, and in theory we
can now increase the current write limit of one sector.
2024-12-09 09:01:33 +01:00
Daniel Jobson
6ac874584d
Optimize SPI functions, lowering ROM usage by 70 bytes.
- Have only one transfer function, to minimize duplicate code.
- Remove address assignments that does not make a difference.
2024-12-09 09:01:33 +01:00
Daniel Jobson
9fabff90cb
Increase ROM to 8K 2024-12-09 09:01:33 +01:00
Daniel Jobson
e046b7ad0f
Implement preload_store 2024-12-09 09:01:33 +01:00
Daniel Jobson
c300718c9c
Temporarily override the blake2s trampoline 2024-12-09 09:01:32 +01:00
Daniel Jobson
d22d9b8392
Wip syscall function.
PoC of how a syscall could look like.
2024-12-09 09:01:32 +01:00
Daniel Jobson
150cf2977f
WIP app storage calls 2024-12-09 09:01:32 +01:00
Daniel Jobson
496c5fb12a
preload_app: only allow mgmt app to store or delete 2024-11-21 09:48:51 +01:00
Daniel Jobson
2541790f21
WIP management app 2024-11-21 09:48:50 +01:00
Daniel Jobson
925962483a
fw: remove address-of operator (&) where it is not needed
- `digest` is an array and hence the address of the first element is
  returned.
- This will keep it more consistent with the rest of the code base.
- Fixed misspelled comment.
2024-11-21 09:48:50 +01:00
Daniel Jobson
c4d738a8d6
fw: use bool as return type for memeq 2024-11-21 09:48:50 +01:00
Daniel Jobson
5da60cba1a
Include authentication of preloaded app 2024-11-21 09:48:50 +01:00
Daniel Jobson
8c0f66282e
fw: break out trng and xorwow to rng.[ch] 2024-11-21 09:48:50 +01:00
Daniel Jobson
5188584fcf
fw: Break out htif functions for qemu to separate files 2024-11-21 09:48:50 +01:00
Daniel Jobson
ece53e044c
temp commit: Expose write functions to make development easier 2024-11-21 09:48:49 +01:00
Daniel Jobson
7f7820b698
Add fw state and fw cmd to trigger a start of a preloaded app 2024-11-21 09:48:49 +01:00
Daniel Jobson
9a1c9635f4
WIP auth app 2024-11-21 09:48:49 +01:00
Daniel Jobson
d859ca0357
WIP preload_app 2024-11-21 09:48:49 +01:00
Daniel Jobson
a0ce957f10
WIP partition table 2024-11-21 09:48:49 +01:00
Daniel Jobson
a873e7c211
Import spi.[ch] and flash.[ch] 2024-11-21 09:48:49 +01:00
Daniel Jobson
c00d5317b3
fw: Create compute_app_digest() function 2024-11-21 09:48:48 +01:00
Daniel Jobson
18ebdae030
Remove types.h in favor of standard libs such as stdint, stddef 2024-11-21 09:48:48 +01:00
Daniel Jobson
1941a22007
Doc: move implementation details of RAM scrambling to RAM core 2024-11-20 15:48:49 +01:00
Michael Cardell Widerkrantz
86aedcce69
Revise top-level README for the hardware design
Merged information from fpga.md, and hence fpga.md is removed.
2024-11-20 15:48:49 +01:00
Michael Cardell Widerkrantz
9f975bb66f
Add clangd target
Create a compile_commands.json to help clangd for LSP.
2024-11-15 15:01:31 +01:00
Michael Cardell Widerkrantz
fe8f0b1aa9
doc: Harmonize preformatted in tk1 core
- No unnecessary indentation
- Mark API constants as preformatted
2024-11-15 15:01:31 +01:00
Michael Cardell Widerkrantz
7043521ba9
Move high level system description to README in application_fpga 2024-11-15 15:01:31 +01:00
Jonas Thörnblad
7dc72ade04
Updated application_fpga.bin.sha256 with new hash 2024-11-14 16:35:51 +01:00
Jonas Thörnblad
1b3bae334a
Change "rosc" references to "trng" 2024-11-14 16:35:51 +01:00
Jonas Thörnblad
2364466a9e
Rename rosc.v to trng.v 2024-11-14 16:35:51 +01:00
Jonas Thörnblad
49189a3ba7
Fix typo 2024-11-14 16:35:50 +01:00
Jonas Thörnblad
1ea5db1179
Renamed sb_rgba_drv.v to sb_rgba_drv_sim.v 2024-11-14 16:35:29 +01:00
Jonas Thörnblad
2b89b28b82
Fix small TRNG testbench issues 2024-11-14 11:09:33 +01:00
Daniel Jobson
c4e8f6b6fb
Doc: fix typo of system mode in readme 2024-11-13 14:13:02 +01:00
Daniel Jobson
b90bbea1f6
Remove duplicate entries in default values assignment of tk1 api
cpu_mon_en_we and cdi_mem_we was set twice
2024-11-13 11:16:05 +01:00
Jonas Thörnblad
330146ba3a
Rename top level simulation files
* Rename application_fpga_vsim.v and reset_gen_vsim.v to
  application_fpga_sim.v and reset_gen_sim.v
* Update Makefile
* Fix a typo
2024-11-12 15:33:33 +01:00
Jonas Thörnblad
aea2e319eb
Harmonize the naming of firmware and app mode.
- The API changes name from `_SWITCH_APP` to `_SYSTEM_MODE_CTRL`.
- The registers and wires changes name to `system_mode_*`, instead of a
  mix of `switch_app_*` and `fw_app_mode`.
2024-11-12 15:13:59 +01:00
Jonas Thörnblad
c6e8b6930c
Add place and route script
Run multiple threads of nextpnr-ice40 to find a seed that gives a
layout that meets timing.
2024-10-22 15:20:39 +02:00
Jonas Thörnblad
8af048fb9a
Add yosys flags to optimize synthesis
* -abc2, run two passes of 'abc' for slightly improved logic density
  * -device u, optimize timing for up5k device
  * -dff, run 'abc'/'abc9' with -dff (D flip flop) option

  Update digest of application_fpga.bin
2024-10-22 12:46:12 +02:00
Jonas Thörnblad
3514d7ef3c
FPGA: Format verilog code 2024-10-22 12:04:19 +02:00
Jonas Thörnblad
e04aacda48
Add make target to format verilog code using verible-verilog-format
Flags:
        --indentation_spaces=2
        --wrap_end_else_clauses=true

Verify flag, used in checkfmt, only returns error if the last file is
not formatted, temporary fix implemented with grep.
2024-10-22 12:04:19 +02:00
Jonas Thörnblad
9e57296d91
Include SPI master in default build
This prevents building without the SPI master, the intention is to use
a different method than if-defs, but it will be introduced at a later
stage.
2024-10-16 12:50:32 +02:00
Daniel Jobson
cbb2ba7512
Doc: fix typo in tk1 core readme 2024-10-11 15:50:07 +02:00
Daniel Jobson
d9d41811bd
tb: fix tk1 testbench after name change
This issue was introduced in commit 53c5e707, after name change of RAM
randomization API.
2024-10-11 15:50:07 +02:00
Daniel Jobson
056ee4d3ee
Add make target to clean testbench files
Add it as default in the contrib Makefile.
2024-10-11 15:50:07 +02:00