The simulator source code is included as a FreeRTOS contributed port. Below are some usage notes from Dushara.
IntroductionThe FreeRTOS WIN32 port allows your embedded application to be simulated on a PC with Microsoft windows XP (may work on NT as well).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: WIN32 _WIN32_WINNT=0x0400 WINVER=0x400Each 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).
InterruptsThe simulator provides 30 interrupt sources (1 - 30). These are defined in cpuemu.h The following API calls are useful for interrupt handling:
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: 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
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|