|
This page relates to an older contributed simulator. Please see the
official FreeRTOS Windows simulator
that can be build using Visual Studio 2010 Express and Eclipse with MingW (GCC).
|
The simulator source code is included as a FreeRTOS contributed port. Below are
some usage notes from Dushara.
The source code is available in the FreeRTOS download, but requires unzipping
separately from the main FreeRTOS code. Once unzipped you will find the Visual Studio project in the FreeRTOS/Demo/Win32 directory.
To enable compilation, the following Pre-processor definitions must be present:
iPortSetIsrHandler - Set the interrupt handler.
Interrupt generation is simulated using separate threads.
Create the interrupt generator thread as follows:
SetThreadPriority(CreateThread(NULL, 0, irq_generator, NULL, 0, NULL), THREAD_PRIORITY_ABOVE_NORMAL);
Sample interrupt generator:
The Win32 FreeRTOS simulator was kindly provided by Dushara Jayasinghe.
I have used it with Visual Studio 2008 Express Edition
(which can be downloaded for free) under WinXP and found it to be a very valuable tool.
Introduction
The FreeRTOS WIN32 port allows your embedded application to be simulated on a PC with Microsoft windows XP (may work on NT as well).
WIN32
_WIN32_WINNT=0x0400
WINVER=0x400
Each FreeRTOS task that you create is wrapped by a Windows thread. This has a significant implication:
The stack size argument in 'xTaskCreate' is ignored (meaning you won't catch stack overflow errors via the simulator).
Interrupts
The simulator provides 30 interrupt sources (1 - 30). These are defined in cpuemu.h
The following API calls are useful for interrupt handling:
vPortEnableInt - enable the specified interrupt.
vPortDisableInt - disable the specified interrupt.
DWORD WINAPI irq_generator(LPVOID lpParameter)
{
for(;;)
{
// wait for some windows event.
__generate_interrupt(IRQ_NO);
}
}
tick_generator in port.c can be used as a good example.
Important Notes
Any and all data, files, source code, html content and documentation included in the FreeRTOS distribution or available on this site are the exclusive property of Real Time Engineers Ltd..
See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOSTM are trade marks of Real Time Engineers Ltd..