Topic : Memory Mapping Problem

Forum : ST7/STM8

Original Post
Post Information Post
October 14, 2013 - 11:53am
Guest

I have been testing a code with global and local variables as usual. In particular this featured a variable
u16 pippo[16];
and this mapped to memory this way

...
DATA 000000H 000004H PAGE0 CSTDLIB_REGISTERS
DATA 000004H 00006DH PAGE0 ?ZD0?PFC_DATA
DATA 000071H 00004CH PAGE0 ?ZD0?ADC
...

While trying to improve my application, I happened to change the definition of pippo to
u16 pippo[32];
this caused a different result on the application despite I didn't change anything else but the definition of this variable.
So I checked the memory mapping and I saw the mapping of the PFC_DATA and ADC was in inverse order

...
DATA 000000H 000004H PAGE0 CSTDLIB_REGISTERS
DATA 000004H 00006DH PAGE0 ?ZD0?ADC
DATA 000071H 00004CH PAGE0 ?ZD0?PFC_DATA
...

Investigating about the issue I found this inversion (and consequently the different behaviour of the code) to happen with Pippo's length>31. Now I suspect this myght happen because the compiler is not able to properly resolve some addresses it translates to absolute, but I can't understand why.

Anyone has had the same issue? Looking forward to suggestions about how to solve it.

Replies
Post Information Post
+1
0
-1
October 18, 2013 - 3:13pm
Raisonance Support Team

Without explicit rules, the linker locates the segment in any order.
You cannot except the same order if you link your project twice.

Where is located you pippo variable? Page0 or data? Local or global? In pfc_data.c or adc.c?

Regards,

Stéphane