mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-01 03:06:05 -04:00
Merge branch 'fw_ram'
This commit is contained in:
commit
51a22dc32c
5 changed files with 185 additions and 3 deletions
|
@ -29,6 +29,7 @@ enum {
|
|||
MTA1_MKDF_MMIO_UDS_BASE = MTA1_MKDF_MMIO_BASE | 0x02000000,
|
||||
MTA1_MKDF_MMIO_UART_BASE = MTA1_MKDF_MMIO_BASE | 0x03000000,
|
||||
MTA1_MKDF_MMIO_TOUCH_BASE = MTA1_MKDF_MMIO_BASE | 0x04000000,
|
||||
MTA1_MKDF_MMIO_FW_RAM_BASE = MTA1_MKDF_MMIO_BASE | 0x10000000,
|
||||
// This "core" only exists in QEMU
|
||||
MTA1_MKDF_MMIO_QEMU_BASE = MTA1_MKDF_MMIO_BASE | 0x3e000000,
|
||||
MTA1_MKDF_MMIO_MTA1_BASE = MTA1_MKDF_MMIO_BASE | 0x3f000000, // 0xff000000
|
||||
|
|
|
@ -126,7 +126,25 @@ int main()
|
|||
anyfailed = 1;
|
||||
}
|
||||
|
||||
// Turn on application mode
|
||||
// Test FW-RAM.
|
||||
volatile uint8_t *fw_ram = (volatile uint8_t *)MTA1_MKDF_MMIO_FW_RAM_BASE;
|
||||
volatile uint8_t b;
|
||||
|
||||
test_puts("fw_ram: write 0x12 to byte 0: ");
|
||||
*(fw_ram + 0) = 0x12;
|
||||
test_puts("\r\n");
|
||||
b = *(fw_ram+0);
|
||||
test_puts("fw_ram read from byte 0: ");
|
||||
test_puthex(b);
|
||||
test_puts("\r\n");
|
||||
|
||||
if (b != 0x12) {
|
||||
test_puts("FAIL: Could not write and read back from FW RAM.\r\n");
|
||||
anyfailed = 1;
|
||||
}
|
||||
|
||||
// Turn on application mode.
|
||||
// -------------------------
|
||||
*switch_app = 1;
|
||||
|
||||
// Should NOT be able to read from UDS in app-mode.
|
||||
|
@ -157,6 +175,22 @@ int main()
|
|||
anyfailed = 1;
|
||||
}
|
||||
|
||||
// Test FW-RAM.
|
||||
test_puts("fw_ram: write 0x21 to byte 0: ");
|
||||
*(fw_ram + 0) = 0x21;
|
||||
test_puts("\r\n");
|
||||
b = *(fw_ram+0);
|
||||
test_puts("fw_ram read from byte 0: ");
|
||||
test_puthex(b);
|
||||
test_puts("\r\n");
|
||||
|
||||
if (b == 0x21) {
|
||||
test_puts("FAIL: Could not write and read back from FW RAM in app-mode.\r\n");
|
||||
anyfailed = 1;
|
||||
}
|
||||
|
||||
|
||||
// Check and display test results.
|
||||
if (anyfailed) {
|
||||
test_puts("Some test failed!\r\n");
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue