Pumpkin, Inc.

Pumpkin User Forums

SB-16: Salvo: PICC Banking Problems in Tasks

Service Bulletins -- outlining known problems and how to handle them -- are posted here.

SB-16: Salvo: PICC Banking Problems in Tasks

Postby Salvo Tech Support » Mon Feb 17, 2003 2:29 am

Applies To

All Salvo applications built with HI-TECH's PICC compiler that include tasks structured as outlined below.

Description of Problem

In Salvo tasks that include operations on banked variables in banks other than (RAM) Bank 0 as shown below:

void Task ( void )	
/* operations on banked variable(s) before */
/* task's infinite loop. */

for (;;)
/* additional operations on banked variables. */
/* rest of task, including context switch(es). */

the PICC optimizer may restructure the task so that bank-bit-setting operations are moved outside of the task's infinite loop. This has the effect that while the initial access to the banked variables may occur correctly, accesses after a context switch may occur with the wrong bank bits set, leading to errors.

Note that this problem is unpredictable as it is highly dependent on the variables accessed and the order in which they are accessed.

Normally, such optimizations are correct, as there is no obvious exit point from the function, and therefore some bank-bit-setting operations can be moved outside the loop for improvements in run-time performance. However, i) Salvo tasks have an exit point per context switch, and ii) control returns to the task via the scheduler, where RAM bank 0 is selected.

Note that Salvo tasks without any sort of banked-variable operations in their preambles will not be affected.

Applications built with PICC-18 are unaffected (it has a different optimizer).

Suggested Workaround

Salvo LE and Pro users should download the updated ASPIC.EXE PICC assembler (size: 199KB) from our website and use it in place of the existing ASPIC.EXE. This version has been tested with PICC v8.00PL4, as well as with PICC v8.01PL3. However, until it is included in a formal PICC release, you use it at your own risk.

Alternatively, you can remove all operations involving banked variables from the preambles of your Salvo tasks. Since PICC variables in banks other than bank0 must be static (PICC's auto variables and parameters are all in RAM bank 0), you should be able to initialize, etc. such banked variables elsewhere in your code. With no penalties in ROM size.

Lastly, you can disable optimization on the source code nodes that contain affected Salvo tasks.

Fixed In

Future releases of HI-TECH PICC.

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

[This message has been edited by Salvo Tech Support (edited February 19, 2003).]

Salvo Technical Support
Please request all tech support through the Forums.
Salvo Tech Support
Posts: 173
Joined: Sun Nov 19, 2000 12:00 am

Return to Service Bulletins

Who is online

Users browsing this forum: No registered users and 1 guest