posted December 19, 2003 14:43
Applies ToAll Salvo for Atmel AVR and MegaAVR users who are using the AVR-GCC compiler.
Description of Problem
The runtime behavior of a task is not what is expected. For example, the <flag> variable in this task will not be set to the proper value:
code:
void TaskCount( void )
{
static unsigned int flag; for (;;)
{
counter++;
if ((counter % 2) == 0)
{
OS_Yield(TaskCount99);
flag = 0;
}
}
}
The problem is due to a register allocation / filling optimization that the AVR-GCC compiler is applying to the task. This optimization is incompatible with Salvo's task structure due to the fact that Salvo tasks can be (re-)entered after every context switch.
Suggested Workaround
Replace OS_Yield() in salvo\inc\portgccavr.h with:
code:
#define OS_Yield(label) do { OSCtxSw(); __asm__ __volatile__(" nop"::); } while (0)
Fixed In
v3.2.4
------------------
--------
Salvo Technical Support
Please request all tech support through the Forums.