mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-09-20 12:54:46 -04:00
fpga/fw: Resize ROM and FW_RAM, add RESETINFO partition
In order to be able to leave data for firmware signalling the intention with a reset or to leave data for the next app in a chain of apps, we introduce a part of FW_RAM that can be used to store this data. In order to do this, we: - Change size of ROM from 6 KB to 8 KB. - Change size of FW_RAM, from 2 KB to 4 KB. - Add RESETINFO memory partition inside FW_RAM. - Add generation of map file. - Change CFLAGS from using -O2 to using -Os. - Update address ranges for valid access to ROM and FW_RAM. - Move stack to be located before data+bss and the RESETINFO data above them. This also means we introduce hardware stack overflow protection through the Security Monitor. - Revise firmware README to the new use of FW_RAM.
This commit is contained in:
parent
3126a9c51e
commit
8f2f312531
13 changed files with 310 additions and 77 deletions
|
@ -39,17 +39,24 @@ _start:
|
|||
li x31,0
|
||||
|
||||
/* Clear FW_RAM */
|
||||
li a0, 0xd0000000 // TK1_MMIO_FW_RAM_BASE
|
||||
li a1, 0xd0000800 // TK1_MMIO_FW_RAM_BASE + TK1_MMIO_FW_RAM_SIZE
|
||||
la a0, _sfwram
|
||||
la a1, _efwram
|
||||
clear:
|
||||
sw zero, 0(a0)
|
||||
addi a0, a0, 4
|
||||
blt a0, a1, clear
|
||||
|
||||
/*
|
||||
* Init stack at top of fw_ram.
|
||||
*/
|
||||
li sp, 0xd0000800 // 2 kiB (TK1_MMIO_FW_RAM_SIZE)
|
||||
/* Zero-init bss section */
|
||||
la a0, _sbss
|
||||
la a1, _ebss
|
||||
|
||||
loop_init_bss:
|
||||
sw zero, 0(a0)
|
||||
addi a0, a0, 4
|
||||
blt a0, a1, loop_init_bss
|
||||
|
||||
/* Init stack */
|
||||
la sp, _estack
|
||||
|
||||
call main
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue