mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-03-13 10:36:53 -04:00

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.
65 lines
752 B
ArmAsm
65 lines
752 B
ArmAsm
/*
|
|
* Copyright (C) 2022, 2023 - Tillitis AB
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
|
*/
|
|
|
|
.section ".text.init"
|
|
.globl _start
|
|
_start:
|
|
li x1, 0
|
|
li x2, 0
|
|
li x3, 0
|
|
li x4, 0
|
|
li x5, 0
|
|
li x6, 0
|
|
li x7, 0
|
|
li x8, 0
|
|
li x9, 0
|
|
li x10,0
|
|
li x11,0
|
|
li x12,0
|
|
li x13,0
|
|
li x14,0
|
|
li x15,0
|
|
li x16,0
|
|
li x17,0
|
|
li x18,0
|
|
li x19,0
|
|
li x20,0
|
|
li x21,0
|
|
li x22,0
|
|
li x23,0
|
|
li x24,0
|
|
li x25,0
|
|
li x26,0
|
|
li x27,0
|
|
li x28,0
|
|
li x29,0
|
|
li x30,0
|
|
li x31,0
|
|
|
|
/* Clear FW_RAM */
|
|
la a0, _sfwram
|
|
la a1, _efwram
|
|
clear:
|
|
sw zero, 0(a0)
|
|
addi a0, a0, 4
|
|
blt a0, a1, clear
|
|
|
|
/* 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
|
|
|
|
loop:
|
|
j loop
|