summaryrefslogtreecommitdiff
path: root/startup/riscv_reset_handler.cpp
blob: 0eed06d2d24147273e2770d209cf3f0f19756d44 (plain)
1
2
3
4
5
6
7
8
9
10
11
void entry();
extern int _ram_end;

[[gnu::naked]]
[[gnu::section(".vectors")]]
void _reset_handler() {
    // Initialize stack pointer.
    asm volatile("lui sp, %%hi(%0); add sp, sp, %%lo(%0)" :: "i"(&_ram_end));
    // Absolute jump to entry function.
    asm volatile("jr %0" :: "m"(entry));
}