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
  • This one also.

    Link

    I've added this command line option, and now get farther into the application. However, now I am getting a reset later on.

    In ble_advdata_set, when the last line is executed, according to the disassembly, SVC 0x72 is executed. Stepping over that line resets the processor.

    So I've found at least part of the solution. Not sure if I should close this and open a new question or not. return sd_ble_gap_adv_data_set(p_encoded_advdata, len_advdata, p_encoded_srdata, len_srdata);

Reply
  • This one also.

    Link

    I've added this command line option, and now get farther into the application. However, now I am getting a reset later on.

    In ble_advdata_set, when the last line is executed, according to the disassembly, SVC 0x72 is executed. Stepping over that line resets the processor.

    So I've found at least part of the solution. Not sure if I should close this and open a new question or not. return sd_ble_gap_adv_data_set(p_encoded_advdata, len_advdata, p_encoded_srdata, len_srdata);

Children
No Data
Related