mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-12-10 14:25:33 -05:00
fw/testfw: Use fw_ram for firmware stack
This means firmware's stack shouldn't be accessible to programs running in app_mode. It also means we don't need to take special care of secure_ctx which can now be an ordinary stack variable. Nonetheless we zero out secure_ctx after final use and inline some assembler to zero out the entire fw_ram after use, just before switching to app_mode. Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
parent
d2240b3e0f
commit
56e34b3add
3 changed files with 39 additions and 23 deletions
|
|
@ -46,8 +46,10 @@ clear:
|
|||
addi a0, a0, 4
|
||||
blt a0, a1, clear
|
||||
|
||||
/* init stack below 0x40007000 (TK1_APP_ADDR) where we load app */
|
||||
li sp, 0x40006ff0
|
||||
/*
|
||||
* Init stack at top of fw_ram. Leave 16 byte for entering our first function
|
||||
*/
|
||||
li sp, 0xd00003f0 // 1 kiB - 16 byte in FW_RAM
|
||||
|
||||
/* copy data section */
|
||||
la a0, _sidata
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue