Code:
#define SRAM_ENDERECO_INICIAL 0xE0084000lu // Endereço Inicial da SRAM
typedef struct stRede
{
unsigned int iIP[4];
unsigned int iMascara[4];
unsigned int iGateway[4];
unsigned int iDns[4];
unsigned int iPorta;
unsigned char MacAddress[6];
} SYSCONFIG_REDE;
typedef struct stSerial
{
unsigned int iSerialID[4];
long lBaudRate[4];
unsigned int iDataBits[4];
unsigned int iStopBits[4];
unsigned int iParity[4];
} SYSCONFIG_SERIAL;
typedef struct stDiversos
{
unsigned int iContrasteDisplay;
long iSenhaOperador;
long iSenhaServico;
long iSenhaManutencao;
unsigned int iIdioma;
} SYSCONFIG_DIVERSOS;
typedef struct stPesagem
{
unsigned int iModeloPlaca;
unsigned int iFilterMode;
unsigned int iFiltroASF;
unsigned int iVelocidadeICR;
unsigned int iResolucaoRSN;
unsigned int iZeraAutomatico;
unsigned int iUtilizaTrigger;
long lPesoCalibracao;
long lPesoMaximo ;
unsigned char cUnidadeMedida[3];
} SYSCONFIG_PESAGEM;
SYSCONFIG_REDE *CONFIG_REDE;
SYSCONFIG_SERIAL *CONFIG_SERIAL;
SYSCONFIG_DIVERSOS *CONFIG_DIVERSOS;
SYSCONFIG_PESAGEM *CONFIG_PESAGEM;
// HERE CALCULATE ADDRESS
CONFIG_REDE = (SYSCONFIG_REDE *) SRAM_ENDERECO_INICIAL;
//
CONFIG_SERIAL = (SYSCONFIG_SERIAL *) (SRAM_ENDERECO_INICIAL + sizeof(CONFIG_REDE));
//
CONFIG_DIVERSOS = (SYSCONFIG_DIVERSOS *) (SRAM_ENDERECO_INICIAL + sizeof(CONFIG_SERIAL));
//
CONFIG_PESAGEM = (SYSCONFIG_PESAGEM *) (SRAM_ENDERECO_INICIAL + sizeof(CONFIG_DIVERSOS));
My program write data to fixed memory positions..
I need point each variable to a point, whats the correct way to calc the next addres
Another question, how to show the address of variable in printf ?