Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

Re: [freertos:discussion] simulating interrupts in Window FrreeRTOS port

Posted by rtel on December 29, 2016

I'm not sure I fully understand your question. The Windows port cannot use real interrupts because it runs under Windows so, unlike when running on a real MCU target, has no control over the hardware. Unlike any other port layer the Windows port layer looks for, and then executes, (simulated) interrupts as the hardware will not run application interrupts automatically. When you post a simulated interrupt is sets a bit in a control variable to tell the port which ISR it should execute, then invokes the port layer code which does the necessary.


Re: [freertos:discussion] simulating interrupts in Window FrreeRTOS port

Posted by mdubon on December 29, 2016

Quote: " When you post a simulated interrupt is sets a bit in a control variable to tell the port which ISR it should execute, then invokes the port layer code which does the necessary." Yes, that's corresponding to the (working) example code, I see that concept. But in my oppinion it would be good to have another use case for simulating interrupts on Windows. I think it would be more comparable to a "real" uC if the ISR can directly be called by the user (see my example in https://sourceforge.net/p/freertos/discussion/382005/thread/a7385a2d/) So instead of setting a flag with the "vPortGenerateSimulatedInterrupt" function just call the ISR directly (e.g. in a high priority WINDOWS thread). I am aware that this solution would be more error prone but it would give more flexibility (and better interrupt timing accuracy) for certain use cases. But I am not (yet) fully aware of the FreeRTOS internas to see how this could be enabled in the FreeRTOS windows port. But this use case is quite comparable to a "real" hardware, I guess it should be possible with some (hopefully) simple modification in the windows port. I will also try to work on that feature if necessary but first I am interesed in the oppinion of the FreeRTOS experts.


Re: [freertos:discussion] simulating interrupts in Window FrreeRTOS port

Posted by rtel on December 29, 2016
I'm not sure what difference it would make between calling the API function or calling the lSR function directly, but remember what I said about Windows threads not being able to communicate with threads that are running FreeRTOS tasks directly. If you try and do that by using a FreeRTOS IPC function such as a direct to task notification or semaphore give you have a big problem because the Windows thread that is outside the simulation has no context as far as FreeRTOS knows and the result will be bad. 

However, it is possible for Windows threads to communicate with FreeRTOS tasks using Windows IPC functions, but only in non blocking mode which means you need high priority tasks to poll the Windows IPC which is not desirable as it uses a lot of CPU time that would otherwise be used to run your application. This is however how the TCP examples work to pass TCP packets from a Windows callback into the FreeRTOS application in the TCP interrupt simulator task.

Writing this on my cell phone so excuse brevity and typos.

Re: [freertos:discussion] simulating interrupts in Window FrreeRTOS port

Posted by mdubon on December 29, 2016

Thanks for typing all that from a smarthone. But yes, I understand the implication and I agree but that's not my point. I'll try to explain it better. In the example: http://www.freertos.org/vTaskNotifyGiveFromISR.html there is an ISR called "vTransmitEndISR". This ISR is an entry in the interrupt vector table of the processor and is directly called as result of e.g. a hardware event. The ISR is not embedded in a FreeRTOS context, the ISR is totally FreeRTOS agnostic (correct me if I am wrong here). In the vTransmitEndISR there is a call to ~~~ * Notify the task that the transmission is complete. */ vTaskNotifyGiveFromISR( xTaskToNotify, &xHigherPriorityTaskWoken ); ~~~ Bottom line: As far as I understand it is possible to call a FreeRTOS function out of a FreeRTOS agnostic context (e.g. an ISR of an uC). This basic concept should be working on any FreeRTOS target, am I right here?


Re: [freertos:discussion] simulating interrupts in Window FrreeRTOS port

Posted by rtel on December 30, 2016

am I right here?

No, but I think I've tried to explain that already. Running the RTOS directly on an otherwise bare metal small MCU with limited memory management is very different to running it on top of a rich OS such as Windows.


Re: [freertos:discussion] simulating interrupts in Window FrreeRTOS port

Posted by mdubon on December 30, 2016

ok, got it, that's answering my question. I am going to have a look on the Windows port to understand these differences better. Thanks for your patience and your time.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS