mirror of
https://github.com/saymrwulf/pulp-runtime.git
synced 2026-05-26 22:35:49 +00:00
Clean-up crt0.S
This commit is contained in:
parent
4c5afc03a2
commit
95a05dcc6d
3 changed files with 19 additions and 35 deletions
|
|
@ -45,18 +45,12 @@ static void cluster_core_init()
|
|||
eu_bar_setup(eu_bar_addr(0), (1<<ARCHI_CLUSTER_NB_PE) - 1);
|
||||
}
|
||||
|
||||
|
||||
void cluster_entry_stub()
|
||||
{
|
||||
cluster_core_init();
|
||||
|
||||
#ifdef ARCHI_NO_FC
|
||||
synch_barrier();
|
||||
|
||||
if(hal_core_id()==0)
|
||||
cluster_start(hal_cluster_id(), main);
|
||||
|
||||
synch_barrier();
|
||||
#endif
|
||||
|
||||
int retval = ((int (*)())cluster_entry)();
|
||||
|
||||
|
|
@ -69,7 +63,6 @@ void cluster_entry_stub()
|
|||
cluster_retval = retval;
|
||||
cluster_running = 0;
|
||||
#ifdef ARCHI_NO_FC
|
||||
pos_init_stop();
|
||||
exit(cluster_retval);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,11 @@ pos_init_entry:
|
|||
csrr a0, 0xF14
|
||||
andi a1, a0, 0x1f
|
||||
#ifdef ARCHI_NO_FC
|
||||
# PEs from 1 to 7 will go to cluster_entry_stub. PE0 will reach them
|
||||
# PEs from 1 to 7 will go to cluster_first_setup. PE0 will reach them
|
||||
# later after the pos_init_start
|
||||
bnez a0, cluster_entry_stub
|
||||
li t0, 0x10080000
|
||||
sw x0, 0(t0)
|
||||
bnez a0, sync_loop
|
||||
#else
|
||||
srli a0, a0, 5
|
||||
#ifdef ARCHI_CL_BOOT
|
||||
|
|
@ -47,18 +49,11 @@ pos_init_entry:
|
|||
bnez a1, pe_start
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ARCHI_NO_FC
|
||||
srli a0, a0, 5
|
||||
li x2, 0x10200000
|
||||
li x3, 0x1
|
||||
la x4, _start
|
||||
sw x4, 0x40(x2)
|
||||
sw x3, 8(x2)
|
||||
#endif
|
||||
|
||||
# Clear the bss segment
|
||||
la t0, _bss_start
|
||||
la t1, _bss_end
|
||||
|
|
@ -70,16 +65,18 @@ pos_init_entry:
|
|||
|
||||
|
||||
# Stack initialization
|
||||
#ifndef ARCHI_NO_FC
|
||||
la x2, stack
|
||||
#endif
|
||||
|
||||
|
||||
/* Do all other initializations from C code */
|
||||
jal x1, pos_init_start
|
||||
|
||||
#ifdef ARCHI_NO_FC
|
||||
j cluster_entry_stub
|
||||
csrr a0, 0xF14
|
||||
andi a1, a0, 0x1f
|
||||
li t0, 0x10080000
|
||||
li t1, 0x1
|
||||
sw t1, 0(t0)
|
||||
j pe_start
|
||||
#endif
|
||||
|
||||
.section .text
|
||||
|
|
@ -149,11 +146,7 @@ pos_init_entry:
|
|||
.org 0x80
|
||||
.global _start
|
||||
_start:
|
||||
#ifdef ARCHI_NO_FC
|
||||
jal x0, pe_start
|
||||
#else
|
||||
jal x0, pos_init_entry
|
||||
#endif
|
||||
|
||||
pos_illegal_instr:
|
||||
j __rt_handle_illegal_instr
|
||||
|
|
@ -171,21 +164,13 @@ pos_semihosting_call:
|
|||
|
||||
#if defined(ARCHI_HAS_CLUSTER)
|
||||
pe_start:
|
||||
#if defined(ARCHI_NO_FC)
|
||||
csrr a0, 0xF14
|
||||
andi a1, a0, 0x1f
|
||||
#endif
|
||||
la x2, cluster_stacks
|
||||
lw x2, 0(x2)
|
||||
li x3, CLUSTER_STACK_SIZE
|
||||
addi a1, a1, 1
|
||||
mul x1, x3, a1
|
||||
add x2, x2, x1
|
||||
#if defined(ARCHI_NO_FC)
|
||||
j pos_init_entry
|
||||
#else
|
||||
j cluster_entry_stub
|
||||
#endif
|
||||
#endif
|
||||
|
||||
do_cl_boot:
|
||||
|
|
@ -202,3 +187,8 @@ loop:
|
|||
sw x0, 0(x2)
|
||||
wfi
|
||||
j loop
|
||||
|
||||
sync_loop:
|
||||
lw t1, 0(t0)
|
||||
bnez t1, pe_start
|
||||
j sync_loop
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ void pos_init_start()
|
|||
hal_irq_enable();
|
||||
|
||||
#ifdef ARCHI_NO_FC
|
||||
cluster_start(hal_cluster_id(), main);
|
||||
}
|
||||
#else
|
||||
if (!hal_is_fc())
|
||||
|
|
|
|||
Loading…
Reference in a new issue