Access to the zero address no error of DA14585_SDK_6.0.2.243

Learn MoreFAQsTutorials

2 posts / 0 new
Last post
lucienkuang
Offline
Last seen:4个月2天前
加入:2016-10-23 09:51
Access to the zero address no error of DA14585_SDK_6.0.2.243

嗨Dialog:
When I give specification of customer on-site hardware interrupt error, I found a problem.
I wrote a test procedure is as follows(DA14585_SDK_6.0.2.243):

//global initialise
system_init();

uint8* pAddr = NULL;
*pAddr = 100;
arch_printf("*pAddr:%d\n",*pAddr);
.
Run results gave out 100 print. I use the zero address, should not enter the hardware fault interrupt ,But not

Device:
MT_dialog
Offline
Last seen:1 month 1 week ago
工作人员
加入:2015-06-08 11:34
嗨lucienkuang,

嗨lucienkuang,

Well, ARM doesn't restrict you from writting to address 0x0 of the memory, a hardfault isn't triggered by that action, usually when you do that (write to address zero) you corrupt the interrupt vector table and that is why you get the hardfault and usually the hardfault is triggered because when its time for the ARM to use that table (an interrupt hit for example) the values are corrupted, so thats why the Hardfault is triggered when your write at address 0x0.

The 580 and the 585 are similar but not identical, in the 580 as address 0x0 is considered the address of the sysram which is 0x20000000 if it is remaped to the SYSRAM. By default when downloading from keil the address 0x0 is not mapped on the SYSRAM but it points to the ROM, so when you attempt to write to 0x0 on the 580 actually you are attempting to write at the ROM, that results in a bus error therefore on a Hardfault. In the 585 the 0x0 address is remaped in the sysram via keil, so when you write at the 0x0 the value 100 you just corrupt the initial stack pointer, which its doesn't make any difference at the main() function, since this value is only used once at the starting of the ARM.

Thanks MT_dialog