-
-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move CLRStartup to its own OS thread (#425)
- this makes it easy to isolate it and adjust stack size, for example - fixes #416 Signed-off-by: José Simões <[email protected]>
- Loading branch information
1 parent
d56a38e
commit b5ad6a0
Showing
9 changed files
with
80 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// Copyright (c) 2017 The nanoFramework project contributors | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#ifndef _CLRSTARTUPTHREAD_ | ||
#define _CLRSTARTUPTHREAD_ | ||
|
||
// declaration of RTOS thread | ||
void CLRStartupThread(void const * argument); | ||
|
||
#endif //_CLRSTARTUPTHREAD_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// Copyright (c) 2017 The nanoFramework project contributors | ||
// See LICENSE file in the project root for full license information. | ||
// | ||
|
||
#include <ch.h> | ||
#include <cmsis_os.h> | ||
|
||
#include <nanoCLR_Application.h> | ||
#include <nanoPAL_BlockStorage.h> | ||
|
||
// This thread needs to be implemented at ChibiOS level because it has to include a call to chThdShouldTerminateX() | ||
// in case the thread is requested to terminate by the CMSIS call osThreadTerminate() | ||
|
||
void CLRStartupThread(void const * argument) | ||
{ | ||
(void)argument; | ||
|
||
BlockStorage_AddDevices(); | ||
|
||
CLR_SETTINGS clrSettings; | ||
|
||
memset(&clrSettings, 0, sizeof(CLR_SETTINGS)); | ||
|
||
clrSettings.MaxContextSwitches = 50; | ||
clrSettings.WaitForDebugger = false; | ||
clrSettings.EnterDebuggerLoopAfterExit = true; | ||
|
||
ClrStartup(clrSettings); | ||
|
||
// loop until thread receives a request to terminate | ||
while (!chThdShouldTerminateX()) { | ||
osDelay(500); | ||
} | ||
|
||
// nothing to deinitialize or cleanup, so it's safe to return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters