Topic : volatile and automatic variables relocation

Forum : ST7/STM8

Original Post
Post Information Post
July 13, 2009 - 11:22pm
Guest

It appears that when I enable Automatic Variables Relocation (AVR) some of my volatile variables are no longer treated as such. Looking at the assembly code between code built with and without AVR, the code without AVR correctly reloads my volatile variables, the code with AVR enabled does not. What is the expected behavior?

John

Replies
Post Information Post
+1
0
-1
July 15, 2009 - 11:22am
Raisonance Support Team

Hi John,

Automatic variables relocation detects the most used global variables (the ones with the highest number of fixups) and locates them to page0 (addresses [0-0xFF]).
This is technically done through a SPACEDEF compiler directive, which locates the given global variables to page0.

There is no link with the "volatile" qualifier, so your code cannot be different with or without AVR.

Can you send us a project or some excerpts that show the problem (.lst files are the most useful)? We will then be able to explain what you see.

Regards,
Bruno

+1
0
-1
July 15, 2009 - 3:48pm
Guest

I will try to throw something together in the near future, I have a huge deadline coming fast. All I can say is that a volatile variable set in a timer interrupt works correctly unless I build with AVR. The code is identical with and without AVR, it doesn't work with AVR enabled.