This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Porting HRS Example to IAR - Crash at SVC 0x10

I'm trying to port the HRS example using S110 Softdevice and SDK 7.1.0 to IAR 7.10 on the pca10028 board.

I've created an IAR project which uses the same files as the Keil version, using the Keil limited demo IDE to determine the paths of each file, and each dependency. The only exception is the arm_startup_nrf51.s is replaced by iar_startup_nrf51.s. I also created a linker .icf file to set the memory regions and stack sizes, as well as the intvec location. This was copied from the file included with IAR 7.10 and placed into the same folder as main.c.

I use nRFGo to erase the part, then load the soft device. I can build the Keil demo and run it, and use the nRFToolbox app's Heartrate Monitor function to see the output from the board.

If I duplicate this with IAR, I can compile and load the app onto the board, and begin execution, but the app crashes when it hits the line:

err_code = sd_softdevice_enable(clock_source, softdevice_assertion_handler);

in softdevice_handler.c.

Digging deeper by tracing through the disassembly, I see that this is a wrapper for calling the SVC interrupt with index 0x10. As soon as this occurs, I get a Hard Fault exception.

I have verified by checking the .map file that my interrupt vectors are being placed at 0x16000, the same as the Keil compiler version.

Does anyone have any clue as to what I may have missed? I can provide a ZIP of the project files if necessary and allowed.

Thanks in advance, Jeff.

Parents
  • A little progress. If I increase my applications stack size, then it will complete the SVC 10 call. However, it crashes again a little later after calling sd_nvic_EnableIRQ. I assume this is related to the IRQ table mixup noted above, where the hard fault handler being called is from my application, when nothing I can see should have mapped the vectors to that location. I expect if I find where that is happening I may find the source of this problem.

Reply
  • A little progress. If I increase my applications stack size, then it will complete the SVC 10 call. However, it crashes again a little later after calling sd_nvic_EnableIRQ. I assume this is related to the IRQ table mixup noted above, where the hard fault handler being called is from my application, when nothing I can see should have mapped the vectors to that location. I expect if I find where that is happening I may find the source of this problem.

Children
No Data
Related