Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLRStartup as OS thread #2

Merged
merged 1 commit into from
Aug 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions CMSIS-OS/ChibiOS/ST_NUCLEO_F411RE_EX/nanoCLR/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
#include <cmsis_os.h>

#include "usbcfg.h"
#include <CLR_Startup_Thread.h>
#include <WireProtocol_ReceiverThread.h>
#include <nanoCLR_Application.h>
#include <nanoPAL_BlockStorage.h>

// 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) {
Expand All @@ -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);
}
Expand Down