Few fixes to be able to use runtime without FC on pulp-open

This commit is contained in:
Germain Haugou 2020-01-20 21:24:53 +01:00
parent 56afec28d9
commit 5ef7ff3157
7 changed files with 47 additions and 4 deletions

View file

@ -95,9 +95,11 @@
* FC
*/
#ifndef ARCHI_NO_FC
#define ARCHI_FC_CID 31
#define ARCHI_HAS_FC_ITC 1
#define ARCHI_HAS_FC 1
#endif
/*

View file

@ -36,6 +36,8 @@ typedef enum {
void cluster_start(int cid, int (*entry)());
void cluster_entry_stub();
int cluster_wait(int cid);
void _start();

View file

@ -36,11 +36,14 @@ static void pos_wait_forever()
void cluster_entry_stub()
static void cluster_core_init()
{
eu_evt_maskSet((1<<PULP_DISPATCH_EVENT) | (1<<PULP_MUTEX_EVENT) | (1<<PULP_HW_BAR_EVENT));
}
eu_bar_setup(eu_bar_addr(0), (1<<ARCHI_CLUSTER_NB_PE) - 1);
void cluster_entry_stub()
{
cluster_core_init();
int retval = ((int (*)())cluster_entry)();
@ -68,6 +71,13 @@ void cluster_start(int cid, int (*entry)())
// Activate icache
hal_icache_cluster_enable(cid);
eu_bar_setup(eu_bar_addr(0), (1<<ARCHI_CLUSTER_NB_PE) - 1);
if (!hal_is_fc())
{
cluster_core_init();
}
cluster_running = 1;
// Fetch all cores
@ -89,6 +99,10 @@ int cluster_wait(int cid)
void synch_barrier()
{
#ifdef ARCHI_FC_CID
if (hal_cluster_id() != ARCHI_FC_CID)
#endif
{
eu_bar_trig_wait_clr(eu_bar_addr(0));
}
}

View file

@ -33,8 +33,12 @@ pos_init_entry:
csrr a0, 0xF14
andi a1, a0, 0x1f
srli a0, a0, 5
#ifdef ARCHI_FC_CID
li a2, ARCHI_FC_CID
bne a0, a2, pe_start
#else
bnez a1, pe_start
#endif
#endif

View file

@ -48,6 +48,8 @@ static void pos_init_do_dtors(void)
}
extern int main(int argc, const char * const argv[]);
void pos_init_start()
{
@ -77,6 +79,11 @@ void pos_init_start()
// Now now the minimal init are done, we can activate interruptions
hal_irq_enable();
if (!hal_is_fc())
{
cluster_start(hal_cluster_id(), main);
}
}

View file

@ -335,8 +335,18 @@ int pos_libc_prf_locked(int (*func)(), void *dest, char *format, va_list vargs)
static void __attribute__((noreturn)) pos_wait_forever()
{
#if defined(ITC_VERSION)
hal_itc_enable_clr(0xffffffff);
while(1) hal_itc_wait_for_interrupt();
if (hal_is_fc())
{
hal_itc_enable_clr(0xffffffff);
while(1) hal_itc_wait_for_interrupt();
}
else
{
#if defined(EU_VERSION) && EU_VERSION >=3
eu_evt_maskClr(0xffffffff);
eu_evt_wait();
#endif
}
#elif defined(EU_VERSION) && EU_VERSION >=3
eu_evt_maskClr(0xffffffff);
eu_evt_wait();

View file

@ -71,6 +71,10 @@ ifdef CONFIG_NB_PE
PULP_CFLAGS += -DARCHI_CLUSTER_NB_PE=$(CONFIG_NB_PE)
endif
ifdef CONFIG_NO_FC
PULP_CFLAGS += -DARCHI_NO_FC=1
endif
ifdef CONFIG_IO_UART
PULP_CFLAGS += -DCONFIG_IO_UART=$(CONFIG_IO_UART)
endif