I usually use this macro just before exiting the ISR. I have a situation where portENDSWITCHINGISR() needs to be called within a fuction call within the ISR making its position NOT just prior to ISR return but deeper within the ISR stack. Is using portENDSWITCHINGISR() deep within the ISR call stack permissable or do I need to bubble the request up so it used just prior to exiting the ISR? Thanks
It depends on the processor and the port. Some ports the portENDSWITCHINGISR() macro sets a pending interrupt which doesn’t actually happen until the ISR ends. In this case it doesn’t actually matter where the call is. Other ports, (which don’t support nesting interrupts, like the Pic24 port) the portENDSWITCHINGISR actually does the yield at that point and the following code in the ISR doesn’t get executed until the task that was interrupted gets run again. In this case it is very important that it be at the end of the ISR.
Thanks. I’m using an ARM and saw the IRQ being Set. Just wanted to make sure something I didn’t know/understand might bite me in the ass.
Different ARM processors do this in different ways too. If this is an ARM Cortex-M then it is fine for the call to portYIELDFROMISR() to appear anywhere in the ISR (if it were an ARM9, for example, it would not be ok).
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.