mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-05-09 17:34:59 -04: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
|
@ -187,6 +187,13 @@ int main()
|
|||
|
||||
// Turn on application mode.
|
||||
// -------------------------
|
||||
|
||||
// Set up another stack because fw_ram is not available
|
||||
// anymore in app_mode.
|
||||
asm volatile(
|
||||
"li sp, 0x40006ff0"
|
||||
);
|
||||
|
||||
*switch_app = 1;
|
||||
|
||||
sw = *switch_app;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue