mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-01 19:26:13 -04:00
Initial test of resetinfo area
This commit is contained in:
parent
33f14122ad
commit
bfe109fce6
11 changed files with 467 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
|||
#include "proto.h"
|
||||
#include "state.h"
|
||||
#include "syscall_enable.h"
|
||||
#include "resetinfo.h"
|
||||
|
||||
// clang-format off
|
||||
static volatile uint32_t *uds = (volatile uint32_t *)TK1_MMIO_UDS_FIRST;
|
||||
|
@ -33,8 +34,11 @@ static volatile uint32_t *timer_status = (volatile uint32_t *)TK1_MMIO_TIMER
|
|||
static volatile uint32_t *timer_ctrl = (volatile uint32_t *)TK1_MMIO_TIMER_CTRL;
|
||||
static volatile uint32_t *ram_addr_rand = (volatile uint32_t *)TK1_MMIO_TK1_RAM_ADDR_RAND;
|
||||
static volatile uint32_t *ram_data_rand = (volatile uint32_t *)TK1_MMIO_TK1_RAM_DATA_RAND;
|
||||
static volatile uint8_t *resetinfo = (volatile uint8_t *)TK1_MMIO_RESETINFO_BASE;
|
||||
// clang-format on
|
||||
|
||||
#define RESETINFO ((struct reset *)TK1_MMIO_RESETINFO_BASE)
|
||||
|
||||
// Context for the loading of a TKey program
|
||||
struct context {
|
||||
uint32_t left; // Bytes left to receive
|
||||
|
@ -406,6 +410,32 @@ int main(void)
|
|||
uint8_t cmd[CMDSIZE] = {0};
|
||||
enum state state = FW_STATE_INITIAL;
|
||||
|
||||
if (RESETINFO->type != UNKNOWN) {
|
||||
debug_puts("\nTKEY was reset!\n");
|
||||
debug_puts("Reset type = ");
|
||||
debug_putinthex(RESETINFO->type);
|
||||
debug_lf();
|
||||
switch(RESETINFO->type) {
|
||||
case LOAD_APP_FROM_HOST_WITH_DIGEST:
|
||||
debug_puts("App Digest = ");
|
||||
for(uint8_t i = 0; i<32; i++) {
|
||||
debug_puthex(RESETINFO->app_digest[i]);
|
||||
}
|
||||
debug_lf();
|
||||
break;
|
||||
case LOAD_APP_FROM_FLASH_WITH_DIGEST:
|
||||
debug_puts("App Digest = ");
|
||||
for(uint8_t i = 0; i<32; i++) {
|
||||
debug_puthex(RESETINFO->app_digest[i]);
|
||||
}
|
||||
debug_lf();
|
||||
break;
|
||||
}
|
||||
|
||||
// Clear resetinfo area
|
||||
memset((uint8_t *)resetinfo, 0, TK1_MMIO_RESETINFO_SIZE);
|
||||
}
|
||||
|
||||
print_hw_version();
|
||||
|
||||
/*@-mustfreeonly@*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue