From e4028d9a86f7e17394deca3356d664dfd132f16a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20=C3=85gren?= Date: Mon, 17 Mar 2025 18:41:50 +0100 Subject: [PATCH] Handle reset info in reset syscall Disabling debug printouts to get firmware to fit in ROM --- hw/application_fpga/fw/tk1/main.c | 4 +++- hw/application_fpga/fw/tk1/syscall_handler.c | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/application_fpga/fw/tk1/main.c b/hw/application_fpga/fw/tk1/main.c index fdb56d3..014e3aa 100644 --- a/hw/application_fpga/fw/tk1/main.c +++ b/hw/application_fpga/fw/tk1/main.c @@ -524,6 +524,7 @@ int main(void) // TODO Remove // Wait for terminal program and a character to be typed + /* enum ioend endpoint = IO_NONE; uint8_t available = 0; uint8_t in = 0; @@ -537,6 +538,7 @@ int main(void) // read failed! I/O broken? Just redblink. assert(1 == 2); } + */ // TODO end of remove block @@ -556,7 +558,7 @@ int main(void) // TODO Just start something from flash without looking in // FW_RAM. - state = FW_STATE_LOAD_FLASH; + //state = FW_STATE_LOAD_FLASH; for (;;) { switch (state) { diff --git a/hw/application_fpga/fw/tk1/syscall_handler.c b/hw/application_fpga/fw/tk1/syscall_handler.c index 083824d..0de09cd 100644 --- a/hw/application_fpga/fw/tk1/syscall_handler.c +++ b/hw/application_fpga/fw/tk1/syscall_handler.c @@ -7,15 +7,18 @@ #include #include #include +#include #include "partition_table.h" #include "storage.h" +#include "../tk1/resetinfo.h" #include "../tk1/syscall_num.h" // clang-format off static volatile uint32_t *system_reset = (volatile uint32_t *)TK1_MMIO_TK1_SYSTEM_RESET; static volatile uint32_t *udi = (volatile uint32_t *)TK1_MMIO_TK1_UDI_FIRST; +static volatile uint8_t *resetinfo = (volatile uint8_t *) TK1_MMIO_RESETINFO_BASE; // clang-format on extern struct partition_table part_table; @@ -25,7 +28,10 @@ int32_t syscall_handler(uint32_t number, uint32_t arg1, uint32_t arg2, { switch (number) { case TK1_SYSCALL_RESET: + // TODO: Take length from user + memcpy((uint8_t *)resetinfo, (uint8_t *)arg1, sizeof(struct reset)); *system_reset = 1; + return 0; case TK1_SYSCALL_ALLOC_AREA: if (storage_allocate_area(&part_table) < 0) {