sw: bootrom: Make stack selectable via define

This commit is contained in:
Markus Koch 2025-01-30 20:14:19 +01:00
parent d4ca976641
commit 916a3c1a4e
2 changed files with 8 additions and 4 deletions

View File

@ -5,4 +5,4 @@ riscv64-elf-gcc -mabi=ilp32 -march=rv32i -nostdlib -nostartfiles -ffreestanding
#riscv64-elf-objdump -D bootrom.elf #riscv64-elf-objdump -D bootrom.elf
riscv64-elf-objcopy -O binary bootrom.elf bootrom.bin riscv64-elf-objcopy -O binary bootrom.elf bootrom.bin
od --endian=little -vtx4 -An -w4 bootrom.bin | tr -d ' ' > bootrom.vhex od --endian=little -vtx4 -An -w4 bootrom.bin | tr -d ' ' > bootrom.vhex
r2 -A -c 'pdf @ sym._start' -q bootrom.elf r2 -A -c 'pdf @ entry0' -q bootrom.elf

View File

@ -7,16 +7,20 @@
#define UART0_SR_RX_DATA_EMPTY (1 << 0) #define UART0_SR_RX_DATA_EMPTY (1 << 0)
#define UART0_SR_TX_FULL (1 << 1) #define UART0_SR_TX_FULL (1 << 1)
/* //#define ENABLE_STACK
#ifdef ENABLE_STACK
// Set up stack pointer // Set up stack pointer
asm("_start:\ asm("_start:\
xor sp, sp, sp;\ xor sp, sp, sp;\
lui sp, 0x40100;\ lui sp, 0x40100;\
j main;\ j main;\
"); ");
*/ #else
#define main() _start()
#endif /* ifdef ENABLE_STACK */
__attribute__((noreturn)) void _start() { __attribute__((noreturn)) void main() {
uint8_t state = 0; uint8_t state = 0;
uint8_t c; uint8_t c;
uint8_t opcode; uint8_t opcode;