diff --git a/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/main.c b/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/main.c index d534a7d7f..1800e663b 100644 --- a/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/main.c +++ b/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/main.c @@ -111,8 +111,8 @@ static const sb_config_t sb_config2 = { /* Sandbox objects.*/ sb_class_t sbx1, sbx2; -static THD_WORKING_AREA(waUnprivileged1, 512); -static THD_WORKING_AREA(waUnprivileged2, 512); +static THD_WORKING_AREA(waUnprivileged1, 1024); +static THD_WORKING_AREA(waUnprivileged2, 1024); static thread_t *sb1tp, *sb2tp; @@ -155,7 +155,7 @@ static void SBHandler(eventid_t id) { * Application entry point. */ int main(void) { - event_listener_t el0, el1, el2; + event_listener_t elsb; vfs_node_c *np; msg_t ret; static const evhandler_t evhndl[] = { @@ -310,11 +310,9 @@ int main(void) { } /* - * Listening to sandbox and card events. + * Listening to sandbox events. */ - chEvtRegister(&sdmon_inserted_event, &el0, (eventid_t)0); - chEvtRegister(&sdmon_removed_event, &el1, (eventid_t)1); - chEvtRegister(&sb.termination_es, &el2, (eventid_t)2); + chEvtRegister(&sb.termination_es, &elsb, (eventid_t)2); /* * Normal main() thread activity, in this demo it monitors the user button diff --git a/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/source/sdmon.c b/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/source/sdmon.c index cc964f6f8..43dd1045c 100644 --- a/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/source/sdmon.c +++ b/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/source/sdmon.c @@ -89,6 +89,7 @@ static void tmrfunc(virtual_timer_t *vtp, void *p) { * @notapi */ void sdmonInit(void) { + static event_listener_t el0, el1; /* Activates the SDC driver using default configuration.*/ sdcStart(&SDCD1, NULL); @@ -96,6 +97,9 @@ void sdmonInit(void) { chEvtObjectInit(&sdmon_inserted_event); chEvtObjectInit(&sdmon_removed_event); + chEvtRegister(&sdmon_inserted_event, &el0, (eventid_t)0); + chEvtRegister(&sdmon_removed_event, &el1, (eventid_t)1); + sdmon_ready = false; cnt = POLLING_INTERVAL; chVTSet(&tmr, TIME_MS2I(POLLING_DELAY), tmrfunc, (void *)&SDCD1);