Page 1 of 1

SB-24: Salvo: Local Auto Vars with Microchip MPLAB-C18 and IAR PIC18C

PostPosted: Fri Feb 06, 2004 7:58 am
by Salvo Tech Support
Applies To

Salvo for PICmicro(R) MCUs distributions and Microchip MPLAB-C18 and IAR PIC18C users.

Description of Problem

The use of local auto vars (normally allowed if persistence between context switches is not required) causes runtime problems in Salvo tasks.

Normally, the use of local auto vars in a Salvo task is permitted, so long as the values of the auto vars are not expected or required to persist across context switches. However, the Salvo context switchers for these two compilers do not handle the presence of local auto vars properly, and this leads to stack corruption.

Suggested Workaround

Use only static local variables in Salvo tasks when using either the Microchip MPLAB-C18 or IAR PIC18C compilers.

Fixed In

Salvo documentation will be updated to reflect this issue. At a later date, these context switchers may be updated to permit the use of local auto variables between Salvo context switches.

Salvo Technical Support
Please request all tech support through the Forums.