-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "Regression Bug Fix: Fix Incorrect Return of MSVC-MingW portYIELD_FROM_ISR (#1207)" #1219
Revert "Regression Bug Fix: Fix Incorrect Return of MSVC-MingW portYIELD_FROM_ISR (#1207)" #1219
Conversation
…ELD_FROM_ISR (FreeRTOS#1207)" This reverts commit 3ddfffd.
Quality Gate passedIssues Measures |
Which demo are you talking about? The signature of an interrupt handler on Windows port is supposed to be
|
These are the three demos in the base FreeRTOS repo. Sorry I see what you're talking about now. It's only just clicked for me the "port" part in the name. It's a bit of a pain as the reason I'm using the Windows simulator is to test application code off my device but it seems this implementation of portYIELD_FROM_ISR is different to all the others. How do you deal with this in your code? |
I've come up with a concept using thread local storage to pass back the result instead of using a return. Is this something you'd consider? |
The issue is not the implementation of the /* Common code. */
BaseType_t CommonInterruptHandler( void )
{
BaseType_t xHighPriorityTaskWoken = pdFALSE;
/* Handle interrupt and potentially call FreeRTOS FromISR APIs. */
return xHighPriorityTaskWoken;
}
/* Device code. */
void DeviceInterruptHandler( void )
{
BaseType_t xHighPriorityTaskWoken = pdFALSE;
xHighPriorityTaskWoken = CommonInterruptHandler();
portYIELD_FROM_ISR( xHighPriorityTaskWoken );
}
/* WinSim code. */
uint32_t WinSimInterruptHandler( void )
{
BaseType_t xHighPriorityTaskWoken = pdFALSE;
xHighPriorityTaskWoken = CommonInterruptHandler();
portYIELD_FROM_ISR( xHighPriorityTaskWoken );
} Alternatively, if you want to have compile time flags, you can do something like the following: #ifdef WINSIM
uint32_t InterruptHandler( void )
#else
void InterruptHandler( void )
#endif
{
BaseType_t xHighPriorityTaskWoken = pdFALSE;
/* Handle interrupt and potentially call FreeRTOS FromISR APIs. */
portYIELD_FROM_ISR( xHighPriorityTaskWoken );
} |
Got it. Makes sense that installation varies by platform. In my simulator I was using that function signature and not the yield when registering my fake interrupts for hardware I have simulated so they are fine, but other parts of the software that I haven't included in the simulation yet get broken because of the return in portYIELD_FROM_ISR means the enclosing function signature needs to change too. This looks like what's happening in the demo as well. Since the Windows simulator as far as I can see is the only version that handles portYIELD_FROM_ISR by doing a return it would be nice if there is a way it can align with the other ports. |
I'll close this since it doesn't fit the current implementation of the Windows port interrupts. Is there another place we can continue the discussion? |
Yes, please use FreeRTOS forums - https://forums.freertos.org/ |
Description
PR #1207 reverted portYieldFromISR to an earlier implementation that did a return. That has broken the demo and real world code on main as calling portYieldFromISR does a return where it isn't expected.
The description of the PR says the reason is that prvProcessSimulatedInterrupts calls portYIELD_FROM_ISR but that's not the case in current main.
Returning from portYieldFromISR doesn't match the behaviour of the other ports as they only act on the value and don't return a result.
It looks like the revert and tests were done at an earlier commit before current main was merged in the PR.
Test Steps
Build the demo project in Visual Studio and the build will succeed with a warning.
Build the demo project in Eclipse and it is treated as a build failure.
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.