I am having hard fault when `nrf_sdh_enable_request` is called in BLE init. I am following BLE_TEMPLATE. I did not copy the solution, I am extending TWI example to include softdevice.
Following code gets this printed
Hard Fault at address: 0x07000001
void HardFault_Handler(void)
{
uint32_t *sp = (uint32_t *) __get_MSP(); // Get stack pointer
uint32_t ia = sp[12]; // Get instruction address from stack
printf("Hard Fault at address: 0x%08x\r\n", (unsigned int)ia);
while(1)
;
}
Board is nRF52DK.
My section placement macros are (from https://devzone.nordicsemi.com/tutorials/b/getting-started/posts/adjustment-of-ram-and-flash-memory)
SOFTDEVICE IN USE S132 RAM_START = 0x20001628 FLASH_START = 0x26000 FLASH_SIZE <= FLASH_PH_SIZE - FLASH_START FLASH_SIZE = 0x80000 - 0x26000 FLASH_SIZE = 5A000 RAM_SIZE+ RAM_START <= RAM_PH_START + RAM_PH_SIZE RAM_SIZE+ 0x20001628 = 0x20000000 + 0x10000 RAM_SIZE = 0x20010000 - 0x20001628 RAM_SIZE = 0xE9D8 0xE9D8 + 0x20001628 =< 0x20010000 0x20010000 =< 0x20010000 ===> TRUE
Another interesting fact. If I program softdevice using nRFGo I get HardFault but if I use Segger, I get Stopped by vector catch and does not enter in main.
Following is the output
Preparing target for download Executing script TargetInterface.resetAndStop() Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. Downloading ‘EM7180.elf’ to J-Link Programming 76.7 KB of addresses 00026000 — 000392db Programming 0.0 KB of addresses 000392dc — 000392ef Programming 14.1 KB of .rodata addresses 000392f0 — 0003cb77 Programming 0.2 KB of addresses 0003cb78 — 0003cc5f J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match Download successful Stopped by vector catch
Thanks