Hello,
I have a real strange problem with some variable declaration:
I have the following piece of code:
INTEGER16 CO_NMT_init(
CO_NMT_t **ppNMT,
CO_emergencyProcess_t *EMpr,
UNSIGNED8 nodeId,
UNSIGNED16 firstHBTime,
CO_CANmodule_t *NMT_CANdev, UNSIGNED16 NMT_rxIdx, UNSIGNED16 CANidRxNMT,
CO_CANmodule_t *HB_CANdev, UNSIGNED16 HB_txIdx, UNSIGNED16 CANidTxHB)
{
CO_NMT_t *NMT;
//allocate memory if not already allocated
if((*ppNMT) == NULL){
if(((*ppNMT) = (CO_NMT_t*) malloc(sizeof(CO_NMT_t))) == NULL){ return CO_ERROR_OUT_OF_MEMORY;}
}
NMT = *ppNMT; //pointer to (newly created) object
NMT->nodeId = 0x30;
After this declaration, the value is not 0x30 but still zero.
//------------------------------------------------
I did same disassembly
// NMT value 0xB2D4
// *(ppNMT) value 0xB2D4
Disassembly code
NMT->nodeId // -> Address: 0XB2DE@data
SP[12] = 0xB2D4
3e8890: 8A4C MOVL XAR4, *-SP[12]
3e8891: D00A MOVB XAR0, #0xa // OXB2D4 + 0xa = OX2B2DE is correct
3e8892: 56BF3094 MOVB *+XAR4[AR0], #0x30, UNC // So The Address is correct Why is 0x30 not correctly copied.
result Address: 0xB2D4 = 0 and not 0x30
Any suggestions? I'm a bit out of options. Hope you can help.