Clear all RAM during start

Since SRAM has some data remanence even without power it seems good
hygien to clear all RAM when starting the device so as not to leak
potential sensitive data between device apps.
This commit is contained in:
Michael Cardell Widerkrantz 2022-10-21 16:27:23 +02:00 committed by Daniel Lublin
parent 1661ac20d4
commit 490571b6c0
No known key found for this signature in database
GPG Key ID: 75BD0FEB8D3E7830

View File

@ -38,6 +38,14 @@ _start:
li x30,0
li x31,0
/* Clear all RAM */
li a0, 0x40000000 // RAM base
li a1, 0x40020000 // To end of SRAM
clear:
sw zero, 0(a0)
addi a0, a0, 4
blt a0, a1, clear
/* init stack to right under where we load app at 0x40010000 */
li sp, 0x4000fff0