From 1085918d5d81e2e0cb0059859d47260093d6a44d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Fri, 11 Aug 2017 17:30:59 +0100 Subject: [PATCH] Add CLRStartup OS thread - see nanoframework/nf-interpreter#425 --- .../ST_NUCLEO_F411RE_EX/nanoCLR/main.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/CMSIS-OS/ChibiOS/ST_NUCLEO_F411RE_EX/nanoCLR/main.c b/CMSIS-OS/ChibiOS/ST_NUCLEO_F411RE_EX/nanoCLR/main.c index 6b6f4b62..62d04c3d 100644 --- a/CMSIS-OS/ChibiOS/ST_NUCLEO_F411RE_EX/nanoCLR/main.c +++ b/CMSIS-OS/ChibiOS/ST_NUCLEO_F411RE_EX/nanoCLR/main.c @@ -8,12 +8,15 @@ #include #include "usbcfg.h" +#include #include #include #include // need to declare the Receiver thread here osThreadDef(ReceiverThread, osPriorityNormal, 2048, "ReceiverThread"); +// declare CLRStartup thread here +osThreadDef(CLRStartupThread, osPriorityNormal, 2048, "CLRStartupThread"); // Application entry point. int main(void) { @@ -39,24 +42,12 @@ int main(void) { // create the receiver thread osThreadCreate(osThread(ReceiverThread), NULL); + // create the CLR Startup thread + osThreadCreate(osThread(CLRStartupThread), NULL); // start kernel, after this main() will behave like a thread with priority osPriorityNormal osKernelStart(); - // preparation for the CLR startup - BlockStorage_AddDevices(); - - CLR_SETTINGS clrSettings; - - memset(&clrSettings, 0, sizeof(CLR_SETTINGS)); - - clrSettings.MaxContextSwitches = 50; - clrSettings.WaitForDebugger = false; - clrSettings.EnterDebuggerLoopAfterExit = true; - - // startup CLR now - ClrStartup(clrSettings); - while (true) { osDelay(100); }