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
  • I'm not sure of what's causing the error you see, but I was able to port the hrs example by using the hrs IAR example in SDK 6.1.0 as reference.

    Extract the IAR.zip in ..\nRF51_SDK_7.1.0\examples\ble_peripheral\ble_app_hrs\pca10028\s110 to ensure the correct paths. Also had to make some small changes to the retarget.c for it to be compatible with IAR. You can replace the defalt on with this one: retarget.c. Then choose the debugger you're using in the debugger options.

  • Afraid I can't seem to reproduce your directory structure. I don't have a nRF51_SDK_7.1.0 directory, and thus can't find these paths.

          <state>$PROJ_DIR$\..\..\..\..\..\..\components\toolchain</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\button</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\sensorsim</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\ble_services\ble_hrs</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\ble_services\ble_dis</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\ble_services\ble_bas</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\softdevice\s110\headers</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\common</state>
      <state>$PROJ_DIR$\..\..\..\..\..\bsp</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\timer</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\gpiote</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\hal</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\device_manager</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\device_manager\config</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\softdevice\common\softdevice_handler</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\scheduler</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\pstorage</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\pstorage\config</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\util</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\trace</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\uart</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\fifo</state>
    

    All I have is this: C:\Keil_v5\ARM\Pack\NordicSemiconductor

    That has these subfolders:

    nRF_BLE nRF_DeviceFamilyPack nRF_Drivers nRF_Drivers_External nRF_Examples nRF_Libraries nRF_Properitary_RF nRF_RTX nRF_Serialization nRF_SoftDevice_Common nRF_SoftDevice_S110 nRF_SoftDevice_S120 nRF_SoftDevice_S130 nRF_SoftDevice_S210 nRF_SoftDevice_S310

    I'll just try to diff your code against mine and make all the remaining adjustments.

    Jeff.

Reply
  • Afraid I can't seem to reproduce your directory structure. I don't have a nRF51_SDK_7.1.0 directory, and thus can't find these paths.

          <state>$PROJ_DIR$\..\..\..\..\..\..\components\toolchain</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\button</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\sensorsim</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\ble_services\ble_hrs</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\ble_services\ble_dis</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\ble_services\ble_bas</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\softdevice\s110\headers</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\common</state>
      <state>$PROJ_DIR$\..\..\..\..\..\bsp</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\timer</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\gpiote</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\hal</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\device_manager</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\ble\device_manager\config</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\softdevice\common\softdevice_handler</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\scheduler</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\pstorage</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\pstorage\config</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\util</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\trace</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\drivers_nrf\uart</state>
      <state>$PROJ_DIR$\..\..\..\..\..\..\components\libraries\fifo</state>
    

    All I have is this: C:\Keil_v5\ARM\Pack\NordicSemiconductor

    That has these subfolders:

    nRF_BLE nRF_DeviceFamilyPack nRF_Drivers nRF_Drivers_External nRF_Examples nRF_Libraries nRF_Properitary_RF nRF_RTX nRF_Serialization nRF_SoftDevice_Common nRF_SoftDevice_S110 nRF_SoftDevice_S120 nRF_SoftDevice_S130 nRF_SoftDevice_S210 nRF_SoftDevice_S310

    I'll just try to diff your code against mine and make all the remaining adjustments.

    Jeff.

Children
No Data
Related