S12XF512 - big array is not initialized correctly

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12XF512 - big array is not initialized correctly

747 Views
philipp_k
Contributor I

Hello Everybody,

 

in the file blubb.c I have defined and initialized an array of structures. The array is called "Msg_List".

 But if I step through my code only the items of the array located below the adress 0x3000 are initialized correctly.

All items in this structure following from adress 0x3000 have values I did not entered in the source code.

 

I am using banked memory model. And I get no errors on compiling.

 

Any ideas why this is happening ?

 

Thanks Philipp

 

 

Here is an excerpt from the map file:

 

OBJECT-ALLOCATION SECTION
  Name                              Module                 Addr          hSize          dSize         Ref Section          RLIB
---------------------------------------------------------------------------------------------------------------------------------------------

MODULE:                  -- blubb.c.o --
- PROCEDURES:
- VARIABLES:
  Msg_List                                                         2E3F         47C           1148                2                       .data  
  Frame_Config                                               32BB            70             112                1                       .data

Labels (1)
0 Kudos
2 Replies

337 Views
CompilerGuru
NXP Employee
NXP Employee

Works for me Smiley Wink

 

Here's what I tried:

 

 

#include <hidef.h>#include "derivative.h"#define CHARS_10 "1234567890"#define CHARS_20 CHARS_10 CHARS_10#define CHARS_40 CHARS_20 CHARS_20#define CHARS_100 CHARS_40 CHARS_40 CHARS_20#define CHARS_200 CHARS_100 CHARS_100#define CHARS_400 CHARS_200 CHARS_200#define CHARS_800 CHARS_400 CHARS_400char Msg_List[1148] @ 0x2E3F =CHARS_800 CHARS_200 CHARS_100 CHARS_40 "1234567";void main(void) {  for(;;) {    _FEED_COP();  }}

 

 

Is the boundary of the incorrect initialization at exact 0x3000?

There is no boundary at that address if the RAM is accessed using its unpaged address, I assume you use the 0x2000 ram unpaged (say not with its 0xFE1000'L or 0xFE000'G alias addresses).

 

 

Also have a look at the COPYDOWN SECTION in the map file, it shows what the startup code should be initializing.
*********************************************************************************************COPYDOWN SECTION---------------------------------------------------------------------------------------------------- ROM-ADDRESS: 0xC031 ---- SIZE       4 ---Filling bytes inserted 1F402100------- ROM-ADDRESS: 0xC035 ---- RAM-ADDRESS: 0x2100 ---- SIZE    8000 ---Name of initialized Object : Msg_List1 3132333435 3637383930 3132333435

 

Anything else special (like using define __FAR_DATA, special prm file, adapted startup code,....)?
Daniel

 

0 Kudos

337 Views
philipp_k
Contributor I

Hi Daniel,

 

thank you for your help and advices.

Now I mapped my array to the mapped RAM...

There it is working.

 

greetings Philipp

0 Kudos