fw: load app at the start of RAM

Since app is always loaded at the start of RAM, the TK1_APP_ADDR define
is no longer needed.

Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
Daniel Lublin 2023-03-06 14:07:03 +01:00
parent 425fdb4b90
commit 7eb4d0304b
No known key found for this signature in database
GPG key ID: 75BD0FEB8D3E7830
5 changed files with 12 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 - Tillitis AB
* Copyright (C) 2022, 2023 - Tillitis AB
* SPDX-License-Identifier: GPL-2.0-only
*/
@ -8,7 +8,6 @@ ENTRY(_start)
MEMORY
{
/* TODO ROM size should be adjusted, RAM should be ok. */
ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x20000 /* 128 KB */
RAM (rwx) : ORIGIN = 0x40000000, LENGTH = 0x20000 /* 128 KB */
}

View file

@ -147,7 +147,7 @@ int main()
struct frame_header hdr; // Used in both directions
uint8_t cmd[CMDLEN_MAXBYTES];
uint8_t rsp[CMDLEN_MAXBYTES];
uint8_t *loadaddr = (uint8_t *)TK1_APP_ADDR;
uint8_t *loadaddr = (uint8_t *)TK1_RAM_BASE;
int left = 0; // Bytes left to receive
uint8_t use_uss = FALSE;
uint8_t uss[32] = {0};
@ -183,7 +183,7 @@ int main()
case FW_STATE_RUN:
htif_puts("state_run\n");
*app_addr = TK1_APP_ADDR;
*app_addr = TK1_RAM_BASE;
// CDI = hash(uds, hash(app), uss)
compute_cdi(digest, use_uss, uss);
@ -382,7 +382,7 @@ int main()
blake2s_ctx ctx;
blake2s(digest, 32, NULL, 0,
(const void *)TK1_APP_ADDR, *app_size,
(const void *)TK1_RAM_BASE, *app_size,
&ctx);
print_digest(digest);

View file

@ -25,8 +25,7 @@ enum {
TK1_MMIO_BASE = 0xc0000000, // 0b11000000...
TK1_MMIO_SIZE = 0xffffffff - TK1_MMIO_BASE,
TK1_APP_ADDR = TK1_RAM_BASE + 0x7000, // 28 KB of stack
TK1_APP_MAX_SIZE = TK1_RAM_SIZE - (TK1_APP_ADDR - TK1_RAM_BASE),
TK1_APP_MAX_SIZE = TK1_RAM_SIZE,
TK1_MMIO_TRNG_BASE = TK1_MMIO_BASE | 0x00000000,
TK1_MMIO_TIMER_BASE = TK1_MMIO_BASE | 0x01000000,