Add filesystem code and storage syscalls

Adds syscalls:

- ALLOCATE_AREA
- DEALLOCATE_AREA
- WRITE_DATA
- READ_DATA

and code to access the filesystem and the flash over SPI.

Based on original work by Daniel Jobson <jobson@tillitis.see> for
these files:

- auth_app.[ch]
- flash.[ch]
- spi.[ch]
- partition_table.[ch]
- rng.[ch]
- storage.[ch]

which are used with small changes to integrate with the new syscall
method.

Co-authored-by: Daniel Jobson <jobson@tillitis.se>
Co-authored-by: Mikael Ågren <mikael@tillitis.se>
This commit is contained in:
Michael Cardell Widerkrantz 2025-03-12 16:17:48 +01:00 committed by Mikael Ågren
parent bd2df9bd3f
commit 20b008d20e
No known key found for this signature in database
GPG key ID: E02DA3D397792C46
19 changed files with 974 additions and 7 deletions

View file

@ -12,6 +12,7 @@
#include <tkey/tk1_mem.h>
#include "blake2s/blake2s.h"
#include "partition_table.h"
#include "proto.h"
#include "state.h"
#include "syscall_enable.h"
@ -35,6 +36,8 @@ static volatile uint32_t *ram_addr_rand = (volatile uint32_t *)TK1_MMIO_TK1_R
static volatile uint32_t *ram_data_rand = (volatile uint32_t *)TK1_MMIO_TK1_RAM_DATA_RAND;
// clang-format on
struct partition_table part_table;
// Context for the loading of a TKey program
struct context {
uint32_t left; // Bytes left to receive
@ -418,6 +421,11 @@ int main(void)
scramble_ram();
if (part_table_read(&part_table) != 0) {
// Couldn't read or create partition table
assert(1 == 2);
}
#if defined(SIMULATION)
run(&ctx);
#endif