fw: No .data or .bss segment

We don't use any .data or .bss segment at all to keep all the firmware
variables in the stack in protected fw_ram.

Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
Michael Cardell Widerkrantz 2023-03-07 12:01:00 +01:00 committed by Daniel Lublin
parent 56e34b3add
commit d77654bb8e
No known key found for this signature in database
GPG Key ID: 75BD0FEB8D3E7830
2 changed files with 4 additions and 28 deletions

View File

@ -40,6 +40,8 @@ SECTIONS
_sidata = _etext;
} >ROM
/* XXX We don't allow any data or BSS - but they need be defined or linking will fail */
.data : AT (_etext)
{
. = ALIGN(4);
@ -51,7 +53,7 @@ SECTIONS
*(.sdata*) /* .sdata* sections */
. = ALIGN(4);
_edata = .;
} >RAM
} >ROM
/* Uninitialized data section */
.bss :
@ -66,6 +68,5 @@ SECTIONS
. = ALIGN(4);
_ebss = .;
} >RAM
/* Init stack to _ebss + size */
} >ROM
}

View File

@ -51,31 +51,6 @@ clear:
*/
li sp, 0xd00003f0 // 1 kiB - 16 byte in FW_RAM
/* copy data section */
la a0, _sidata
la a1, _sdata
la a2, _edata
bge a1, a2, end_init_data
loop_init_data:
lw a3, 0(a0)
sw a3, 0(a1)
addi a0, a0, 4
addi a1, a1, 4
blt a1, a2, loop_init_data
end_init_data:
/* zero-init bss section */
la a0, _sbss
la a1, _ebss
bge a0, a1, end_init_bss
loop_init_bss:
sw zero, 0(a0)
addi a0, a0, 4
blt a0, a1, loop_init_bss
end_init_bss:
call main
loop: