FreeRTOS Windows Port
It is for simulating on Visual Studio.
Buildable CMakeLists.txt located on:
- here BasicTemplate project
and another example here(should be upgrade to FreeRTOS v10.0.1 and change the build instructions to 32-bit platform)
Also you can use the updated sources of FreeRTOS v10.0.1 as template by example on here
- If you want create yourself project you can refer to BasicTemplate project located here.
- First of all clone this repo (FreeRTOS_WindowsDemo)
- And then create your projects folder on inside ExamplesNExperiments folder ('FreeRTOS_WindowsDemo/ExamplesNExperiments').
- Copy the mentioned BasicTemplate project files to your created folder.
- Go to CMakeLists.txt file on your project folder.
- Open file and edit the line 2 by specifying your projects name i.e. MyProjectForExample:
set(PROJ_NAME MyProjectForExample)
- Save your edits and close file.
- Then do next steps:
mkdir build32
cd build32
cmake -G "Visual Studio 15 2017" ..
cd ..
- After successfully built project go to /build32 folder and open the "MyProjectForExample.sln" file.
- After opening it on VS (not
VS Code!) set the main project ("MyProjectForExample") as startup project. To do it open Solution Explorer window on VS and chose Set as Startup Project by clicking right mouse on MyProjectForExample in list. Now you can launch the VS debug.
Note: Unfortunatly I've found some buggy feature on VS 2019 Debug Launch. It doesn't shows the consoles processes/writings after Debug started so to avoid it just do a few restarts while debugging. In high performance PC/CPU & big RAM this bug not occure!
Note: CMSIS OS functions simulations testing in progress. Many functions works good. See theBasicTemplate/README.md
file.
Buildable and worky projects:
1. BasicTemplate
2. RTOSdebuggingTips-Tricks/FindingBugWithBitLoggerList (not brought into compatibiling with 32-bit platform! Soon)
3. TasksArrayTests (not 32-bit buildable. Soon)
4. TimerID_using (not 32-bit buildable)
5. TemplateFreeRTOSv10test (upgraded to FreeRTOS v10.0.1 and compiled.
Instructions for build and cmsis_os files not brought into
compatibiling with 32-bit platform! Soon)
Note: For using cmsis_os functions on ISR section to simulate use simulatePROCESSOR_HANDLER_MODE() function inside. Then before returning/exiting from ISR section execute simulatePROCESSOR_THREAD_MODE(). And don't forget use init_simulatePROCESSOR_MODES()
before launching the vTaskStartScheduler()
on main code.
And again one last Note! Unfortunately there is some limit in simulation of queue processes. For properly using osMessage()/osPool()/osMail() and s.o. features the max length of structure for putting to it's input queue should be 8 bytes or less. If structure variable put to the queue is more 8bytes, then simulation crashes! Good example:
typedef struct {
uint8_t BUFFER; //1..4bytes for 32bit platform
InterfacePortHandle_t* Port; //4bytes for 32bit platform
}portsBuffer_t;
//..
portsBuffer_t* ifsPtr;
ifsPtr = osPoolAlloc(mpool);
ifsPtr->Port = PortHandle;
ifsPtr->BUFFER = BUFFER;
osMessagePut(MsgBox, (uint32_t)ifsPtr, 10);
Bad example:
typedef struct { // Message object structure
uint32_t/*float and*//*uint32_t gets error*/ voltage;
uint32_t/*float*/ current;
uint32_t counter;
}T_MEAS; //the length of structure is more 8 bytes!
//..
T_MEAS* mptr;
mptr = osPoolAlloc(mpool);
mptr->voltage = 227;
mptr->current = 12;
mptr->counter = 170823;
osMessagePut(MsgBox, (uint32_t)mptr, osWaitForever);