mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-12 16:35:25 -04:00
Handle reset info in reset syscall
Disabling debug printouts to get firmware to fit in ROM
This commit is contained in:
parent
4a2c1e59f8
commit
44624d8e3f
4 changed files with 13 additions and 3 deletions
|
@ -195,7 +195,7 @@ tkey-libs:
|
||||||
$(FIRMWARE_OBJS): $(FIRMWARE_DEPS)
|
$(FIRMWARE_OBJS): $(FIRMWARE_DEPS)
|
||||||
$(TESTFW_OBJS): $(FIRMWARE_DEPS)
|
$(TESTFW_OBJS): $(FIRMWARE_DEPS)
|
||||||
|
|
||||||
firmware.elf: CFLAGS += -DTKEY_DEBUG
|
# firmware.elf: CFLAGS += -DTKEY_DEBUG
|
||||||
firmware.elf: tkey-libs $(FIRMWARE_OBJS) $(P)/fw/tk1/firmware.lds
|
firmware.elf: tkey-libs $(FIRMWARE_OBJS) $(P)/fw/tk1/firmware.lds
|
||||||
$(CC) $(CFLAGS) $(FIRMWARE_OBJS) $(LDFLAGS) -o $@ > $(basename $@).map
|
$(CC) $(CFLAGS) $(FIRMWARE_OBJS) $(LDFLAGS) -o $@ > $(basename $@).map
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ int main(void)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
debug_puts("Waiting for command\n");
|
debug_puts("reset_test: Waiting for command\n");
|
||||||
|
|
||||||
memset(cmdbuf, 0, BUFSIZE);
|
memset(cmdbuf, 0, BUFSIZE);
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ int main(void)
|
||||||
assert(1 == 2);
|
assert(1 == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
led_set(LED_BLUE | LED_RED);
|
||||||
|
|
||||||
switch (cmdbuf[0]) {
|
switch (cmdbuf[0]) {
|
||||||
case '1':
|
case '1':
|
||||||
rst.type = START_DEFAULT;
|
rst.type = START_DEFAULT;
|
||||||
|
|
|
@ -524,6 +524,7 @@ int main(void)
|
||||||
|
|
||||||
// TODO Remove
|
// TODO Remove
|
||||||
// Wait for terminal program and a character to be typed
|
// Wait for terminal program and a character to be typed
|
||||||
|
/*
|
||||||
enum ioend endpoint = IO_NONE;
|
enum ioend endpoint = IO_NONE;
|
||||||
uint8_t available = 0;
|
uint8_t available = 0;
|
||||||
uint8_t in = 0;
|
uint8_t in = 0;
|
||||||
|
@ -537,6 +538,7 @@ int main(void)
|
||||||
// read failed! I/O broken? Just redblink.
|
// read failed! I/O broken? Just redblink.
|
||||||
assert(1 == 2);
|
assert(1 == 2);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// TODO end of remove block
|
// TODO end of remove block
|
||||||
|
|
||||||
|
@ -556,7 +558,7 @@ int main(void)
|
||||||
|
|
||||||
// TODO Just start something from flash without looking in
|
// TODO Just start something from flash without looking in
|
||||||
// FW_RAM.
|
// FW_RAM.
|
||||||
state = FW_STATE_LOAD_FLASH;
|
//state = FW_STATE_LOAD_FLASH;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
|
@ -7,15 +7,18 @@
|
||||||
#include <tkey/assert.h>
|
#include <tkey/assert.h>
|
||||||
#include <tkey/debug.h>
|
#include <tkey/debug.h>
|
||||||
#include <tkey/led.h>
|
#include <tkey/led.h>
|
||||||
|
#include <tkey/lib.h>
|
||||||
|
|
||||||
#include "partition_table.h"
|
#include "partition_table.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
|
#include "../tk1/resetinfo.h"
|
||||||
#include "../tk1/syscall_num.h"
|
#include "../tk1/syscall_num.h"
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static volatile uint32_t *system_reset = (volatile uint32_t *)TK1_MMIO_TK1_SYSTEM_RESET;
|
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 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
|
// clang-format on
|
||||||
|
|
||||||
extern struct partition_table part_table;
|
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) {
|
switch (number) {
|
||||||
case TK1_SYSCALL_RESET:
|
case TK1_SYSCALL_RESET:
|
||||||
|
// TODO: Take length from user
|
||||||
|
memcpy((uint8_t *)resetinfo, (uint8_t *)arg1, sizeof(struct reset));
|
||||||
*system_reset = 1;
|
*system_reset = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
case TK1_SYSCALL_ALLOC_AREA:
|
case TK1_SYSCALL_ALLOC_AREA:
|
||||||
if (storage_allocate_area(&part_table) < 0) {
|
if (storage_allocate_area(&part_table) < 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue