What happens if i try to write data to memory location where NULL POINTER is pointing, in ARM? _my understanding_ The Null Pointer is a Pointer pointing to 0. Does that mean memory location 0x0(the reset vector address, writing to this memory location is definitely not possible without IAP. so it may not be pointing 0x00 memory address)?
Or does it mean that the Pointer is pointing to nothing? If pointer is pointing to nothing, then where is the data being written in the following code if pQEI becomes a NULL POINTER?
void QEI_Init(uint8_t qeiId, QEI_CFG_Type *QEI_ConfigStruct) { LPC_QEI_TypeDef* pQei = QEI_GetPointer(qeiId); pQei->MAXPOS = 0x00; pQei->CMPOS0 = 0x00; //where is 0x00 being written if the pQEI becomes NULL POINTER . . . /* an so on*/ } LPC_QEI_TypeDef* QEI_GetPointer(uint8_t qeiId) { LPC_QEI_TypeDef* pQei = NULL; if(qeiId == 0) { pQei = LPC_QEI; } return pQei; }
Andrew, request you to clear my understanding of NULL POINTER w.r.t. 8051. Per's explanations are also very knowledgeable.
Do you both write Blogs? Provide me the link, if yes. If no, i request you to consider writing one.
Know that NXP have already written it, and I am no great C expert (as compared to all of you), i would like your advice on the possible modifications.
"equest you to clear my understanding of NULL POINTER w.r.t. 8051"
Why don't you request of yourself that you spend some time will the relevant documentation? How much time have you actually invested reading the manual for the C51 compiler? And for reading up on the different memory address regions available in 8051 processors?
Why don't you request of yourself that you spend some time will the relevant documentation? I try to spend as much time as i can, but dont go on reading only. Work practically and if get stuck-up somewhere or come across something which i am novice about, i study.
And for reading up on the different memory address regions available in 8051 processors? Have a good knowledge on 8051 (architecture) controllers.
How much time have you actually invested reading the manual for the C51 compiler? Have not spent much time on C51 compiler (not more than a year). But try to learn it (whenever i come across something interesting on ARM and think what will happen on 8051)