sebasira

Place variables at absolute address

Discussion created by sebasira on Jul 1, 2013
Latest reply on Jul 2, 2013 by sebasira

Hello to all of you!

 

I'm working with CW v6.1 and MCF51QE128. I've got a special section where I put constant data (user config). Till now, I didn't mind where the compiler puts those variables, as long as they were inside this section. Rigth now, the order matters to me.

 

First, I assume that the compiler will place the variables in the same order I declare them. If VAR1 is declared before VAR2, then VAR1 is in a smaller address than VAR2. But I found out that the compiler place them wherever it wants. I also try adding the @ but if I do, then the variable dissapears from xMAP.

 

Here's how I declare them and how they appear in the xMAP:

 

#pragma define_section _myDATA ".myDATA" far_absolute R

#pragma explicit_zero_data on

__declspec(_myDATA) dword FLASH_DATA_CHECKSUM;

__declspec(_myDATA) tUSUARIO FLASH_USUARIOS[FLASH_USUARIOS_dim];

__declspec(_myDATA) byte FLASH_USUARIO_ACTIVO = 0xFF;

__declspec(_myDATA) dword FLASH_CLAVE = 0xFFFFFFFF;

__declspec(_myDATA) byte FLASH_RECARGA_SALDO_NUM[FLASH_TEL_NUMBER_size];

__declspec(_myDATA) byte FLASH_CONSULTA_SALDO_TXT[FLASH_SALOO_TXT_size];

__declspec(_myDATA) byte FLASH_CONSULTA_SALDO_NUM[FLASH_TEL_NUMBER_size];

__declspec(_myDATA) byte ResetCounter = 0xFF;

__declspec(_myDATA) byte ForceDelAllCounter = 0x00;

__declspec(_myDATA) byte ATcmdNotRecogCounter = 0x00;

__declspec(_myDATA) byte ATcmdNoRtaCounter  = 0x00;

__declspec(_myDATA) byte FLASH_ALARM_STATE[4];

__declspec(_myDATA) byte FLASH_IGNICION_STATE[4];

__declspec(_myDATA) tSPAM FLASH_SPAM_list[dim_SPAM];

__declspec(_myDATA) dword FLASH_DATA_END;

 

 

# .myDATA

  00002800 00000001 .myDATA FLASH_USUARIO_ACTIVO (Grabaciones Flash.c)

  00002801 00000004 .myDATA FLASH_CLAVE (Grabaciones Flash.c)

  00002805 00000001 .myDATA ResetCounter (Grabaciones Flash.c)

  00002806 00000001 .myDATA ForceDelAllCounter (Grabaciones Flash.c)

  00002807 00000001 .myDATA ATcmdNotRecogCounter (Grabaciones Flash.c)

  00002808 00000001 .myDATA ATcmdNoRtaCounter (Grabaciones Flash.c)

  00002809 00000004 .myDATA FLASH_DATA_END (Grabaciones Flash.c)

  0000280D 00000050 .myDATA FLASH_SPAM_list (Grabaciones Flash.c)

  0000285D 00000004 .myDATA FLASH_IGNICION_STATE (Grabaciones Flash.c)

  00002861 00000004 .myDATA FLASH_ALARM_STATE (Grabaciones Flash.c)

  00002865 00000010 .myDATA FLASH_CONSULTA_SALDO_NUM (Grabaciones Flash.c)

  00002875 00000014 .myDATA FLASH_CONSULTA_SALDO_TXT (Grabaciones Flash.c)

  00002889 00000010 .myDATA FLASH_RECARGA_SALDO_NUM (Grabaciones Flash.c)

  00002899 000000A8 .myDATA FLASH_USUARIOS (Grabaciones Flash.c)

  00002941 00000004 .myDATA FLASH_DATA_CHECKSUM (Grabaciones Flash.c)

 

 

I hope someone can help me

 

Best Regards!

 

SebaS

Outcomes