ATmega323 port lacks of portYIELD_FROM_ISR macro

Hi,

This example recommends to call the macro portYIELD_FROM_ISR() but such macro isn’t defined for the ATmega323 port.

Looking around for the macro’s code I found a guy that recommended to look into the demo projects (last message in this thread). There’s not such project for the GCC compiler, but there is for IAR. So looking inside the serial demo (Demo/AVR_ATMega323_IAR/serial/serial.c) I found that it’s using the macro taskYIELD instead:

__interrupt void SIG_UART_RECV( void )
{
signed char ucChar, xHigherPriorityTaskWoken = pdFALSE;

	ucChar = UDR;

	xQueueSendFromISR( xRxedChars, &ucChar, &xHigherPriorityTaskWoken );

	if( xHigherPriorityTaskWoken != pdFALSE )
	{
		taskYIELD();
	}
}

Is it safe to use the taskYIELD() macro inside an ISR instead of portYIELD_FROM_ISR()? Or this solutions only works for the IAR compiler? Are there guidelines to code our portYIELD_FROM_ISR() version?

Thank you!

On the ATMega port yes, that is fine. On most ports, no it is not ok.

1 Like