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 missing CLRStartup thread to reference boards #262

Merged
merged 2 commits into from
Mar 29, 2017
Merged
Show file tree
Hide file tree
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
38 changes: 16 additions & 22 deletions targets/CMSIS-OS/ChibiOS/MBN_QUAIL/nanoCLR/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
#include <cmsis_os.h>

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

//void BlinkerThread(void const * argument)
//{
// (void)argument;
void BlinkerThread()
{
palSetPad(GPIOE, GPIOE_LED1);
Expand Down Expand Up @@ -68,6 +65,9 @@ osThreadDef(BlinkerThread, osPriorityNormal, 128);
// need to declare the Receiver thread here
osThreadDef(ReceiverThread, osPriorityNormal, 1024);

// declare CLRStartup thread here
osThreadDef(CLRStartupThread, osPriorityNormal, 1024);

static const I2CConfig i2cconfig = { OPMODE_I2C, 100000U, STD_DUTY_CYCLE };

// Application entry point.
Expand All @@ -81,22 +81,25 @@ int main(void) {
// main() is executing with absolute priority but interrupts are already enabled.
osKernelInitialize();

// // Initializes a serial-over-USB CDC driver.
//sduObjectInit(&SDU1);
//sduStart(&SDU1, &serusbcfg);
// Initializes a serial-over-USB CDC driver.
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);

// // Activates the USB driver and then the USB bus pull-up on D+.
// // Note, a delay is inserted in order to not have to disconnect the cable after a reset
//usbDisconnectBus(serusbcfg.usbp);
//chThdSleepMilliseconds(1500);
//usbStart(serusbcfg.usbp, &usbcfg);
//usbConnectBus(serusbcfg.usbp);
// Activates the USB driver and then the USB bus pull-up on D+.
// Note, a delay is inserted in order to not have to disconnect the cable after a reset
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1500);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);

// Creates the blinker thread, it does not start immediately.
osThreadCreate(osThread(BlinkerThread), NULL);

// create the receiver thread
osThreadCreate(osThread(ReceiverThread), NULL);

// create the CLR Startup thread
osThreadCreate(osThread(CLRStartupThread), NULL);

// start kernel, after this the main() thread has priority osPriorityNormal by default
osKernelStart();
Expand All @@ -106,15 +109,6 @@ int main(void) {
DisplayClear (1);
DisplayWrite (1,1, "Hello world !");
DisplayWrite (2,3, "nanoFramework rules");

CLR_SETTINGS clrSettings;

memset(&clrSettings, 0, sizeof(CLR_SETTINGS));
clrSettings.MaxContextSwitches = 50;
clrSettings.WaitForDebugger = false;
clrSettings.EnterDebuggerLoopAfterExit = true;

ClrStartup(clrSettings);

osDelay(3000);
DisplayClear (0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

#ifndef _HALCONF_NF_H_
#define _HALCONF_NF_H_
#define _HALCONF_NF_H_ 1

// Enables the ChibiOS community overlay.
#if !defined(HAL_USE_COMMUNITY)
Expand All @@ -13,7 +13,7 @@

// enables STM32 Flash driver
#if !defined(HAL_USE_STM32_FLASH)
#define HAL_USE_STM32_FLASH FALSE
#define HAL_USE_STM32_FLASH TRUE
#endif

#endif // _HALCONF_NF_H_
36 changes: 16 additions & 20 deletions targets/CMSIS-OS/ChibiOS/ST_NUCLEO144_F746ZG/nanoCLR/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <cmsis_os.h>

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

void BlinkerThread(void const * argument)
Expand Down Expand Up @@ -51,6 +51,9 @@ osThreadDef(BlinkerThread, osPriorityNormal, 128);
// need to declare the Receiver thread here
osThreadDef(ReceiverThread, osPriorityNormal, 1024);

// declare CLRStartup thread here
osThreadDef(CLRStartupThread, osPriorityNormal, 1024);

// Application entry point.
int main(void) {

Expand All @@ -62,36 +65,29 @@ int main(void) {
// main() is executing with absolute priority but interrupts are already enabled.
osKernelInitialize();

// // Initializes a serial-over-USB CDC driver.
// sduObjectInit(&SDU1);
// sduStart(&SDU1, &serusbcfg);
// Initializes a serial-over-USB CDC driver.
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);

// // Activates the USB driver and then the USB bus pull-up on D+.
// // Note, a delay is inserted in order to not have to disconnect the cable after a reset
// usbDisconnectBus(serusbcfg.usbp);
// chThdSleepMilliseconds(1500);
// usbStart(serusbcfg.usbp, &usbcfg);
// usbConnectBus(serusbcfg.usbp);
// Activates the USB driver and then the USB bus pull-up on D+.
// Note, a delay is inserted in order to not have to disconnect the cable after a reset
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1500);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);

// Creates the blinker thread, it does not start immediately.
osThreadCreate(osThread(BlinkerThread), NULL);

// create the receiver thread
osThreadCreate(osThread(ReceiverThread), NULL);

// create the CLR Startup thread
osThreadCreate(osThread(CLRStartupThread), NULL);

// start kernel, after this the main() thread has priority osPriorityNormal by default
osKernelStart();

CLR_SETTINGS clrSettings;

memset(&clrSettings, 0, sizeof(CLR_SETTINGS));

clrSettings.MaxContextSwitches = 50;
clrSettings.WaitForDebugger = false;
clrSettings.EnterDebuggerLoopAfterExit = true;

ClrStartup(clrSettings);

while (true) {
osDelay(1000);
}
Expand Down
36 changes: 16 additions & 20 deletions targets/CMSIS-OS/ChibiOS/ST_STM32F429I_DISCOVERY/nanoCLR/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <cmsis_os.h>

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

void BlinkerThread(void const * argument)
Expand Down Expand Up @@ -40,6 +40,9 @@ osThreadDef(BlinkerThread, osPriorityNormal, 128);
// need to declare the Receiver thread here
osThreadDef(ReceiverThread, osPriorityNormal, 1024);

// declare CLRStartup thread here
osThreadDef(CLRStartupThread, osPriorityNormal, 1024);

// Application entry point.
int main(void) {

Expand All @@ -51,36 +54,29 @@ int main(void) {
// main() is executing with absolute priority but interrupts are already enabled.
osKernelInitialize();

// // Initializes a serial-over-USB CDC driver.
// sduObjectInit(&SDU1);
// sduStart(&SDU1, &serusbcfg);
// Initializes a serial-over-USB CDC driver.
sduObjectInit(&SDU1);
sduStart(&SDU1, &serusbcfg);

// // Activates the USB driver and then the USB bus pull-up on D+.
// // Note, a delay is inserted in order to not have to disconnect the cable after a reset
// usbDisconnectBus(serusbcfg.usbp);
// chThdSleepMilliseconds(1500);
// usbStart(serusbcfg.usbp, &usbcfg);
// usbConnectBus(serusbcfg.usbp);
// Activates the USB driver and then the USB bus pull-up on D+.
// Note, a delay is inserted in order to not have to disconnect the cable after a reset
usbDisconnectBus(serusbcfg.usbp);
chThdSleepMilliseconds(1500);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);

// Creates the blinker thread, it does not start immediately.
osThreadCreate(osThread(BlinkerThread), NULL);

// create the receiver thread
osThreadCreate(osThread(ReceiverThread), NULL);

// create the CLR Startup thread
osThreadCreate(osThread(CLRStartupThread), NULL);

// start kernel, after this the main() thread has priority osPriorityNormal by default
osKernelStart();

CLR_SETTINGS clrSettings;

memset(&clrSettings, 0, sizeof(CLR_SETTINGS));

clrSettings.MaxContextSwitches = 50;
clrSettings.WaitForDebugger = false;
clrSettings.EnterDebuggerLoopAfterExit = true;

ClrStartup(clrSettings);

while (true) {
osDelay(1000);
}
Expand Down