makes bootup multi core able

This commit is contained in:
2026-03-16 08:08:18 +01:00
parent 58fc04bbb3
commit 2d0ec274ac

View File

@@ -9,7 +9,7 @@
#include <stdint.h>
#include <string.h>
#include <picotls.h>
#include <tx_port.h>
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
@@ -50,7 +50,6 @@ extern int main(void);
// The linker script will place this in the reset entry point.
// It will be 'called' with no stack or C runtime configuration.
// NOTE - this only supports a single hart.
// tp will not be initialized
void _start(void) {
// Setup SP and GP
@@ -64,6 +63,24 @@ void _start(void) {
"la gp, __global_pointer$;"
".option pop;"
"la sp, _sp;"
#if defined(__riscv_zicsr)
"csrr t0, mhartid;"
#else
"li t0, 0;"
#endif
"la t1, __stack_size;"
"la t1, __stack_size;"
"la sp, _sp;"
// Loop incase M extension is not present
"1:;"
"beqz t0, 2f;"
"sub sp, sp, t1;"
"addi t0, t0, -1;"
"j 1b;"
"2:;"
#ifdef TX_THREAD_SMP_MAX_CORES
"call _tx_thread_smp_initialize_wait;"
#endif
"jal zero, _initialize;"
: /* output: none %0 */
: /* input: none */