Introduce syscalls to change preloaded app

Introduce syscalls:

- TK1_SYSCALL_PRELOAD_STORE
- TK1_SYSCALL_PRELOAD_STORE_FIN
- TK1_SYSCALL_PRELOAD_DELETE
- TK1_SYSCALL_REG_MGMT = 11

Change preload_store_finalize() not to take USS arg. Unused for
preloaded apps.
This commit is contained in:
Michael Cardell Widerkrantz 2025-03-18 14:56:15 +01:00 committed by Mikael Ågren
parent 970668a47b
commit dd147657a4
No known key found for this signature in database
GPG key ID: E02DA3D397792C46
4 changed files with 28 additions and 7 deletions

View file

@ -9,7 +9,9 @@
#include <tkey/led.h>
#include <tkey/lib.h>
#include "mgmt_app.h"
#include "partition_table.h"
#include "preload_app.h"
#include "storage.h"
#include "../tk1/resetinfo.h"
@ -71,6 +73,25 @@ int32_t syscall_handler(uint32_t number, uint32_t arg1, uint32_t arg2,
// first word. Serial is kept secret to the device
// app.
return udi[0];
case TK1_SYSCALL_PRELOAD_DELETE:
return preload_delete(&part_table, 1);
case TK1_SYSCALL_PRELOAD_STORE:
// arg1 offset
// arg2 data
// arg3 size
// always using slot 1
return preload_store(&part_table, arg1, (uint8_t *)arg2, arg3, 1);
case TK1_SYSCALL_PRELOAD_STORE_FIN:
// arg1 app_size
// always using slot 1
return preload_store_finalize(&part_table, arg1, 1);
case TK1_SYSCALL_REG_MGMT:
return mgmt_app_register(&part_table);
default:
assert(1 == 2);
}