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

UART example with external toolchain breaks debugging with "Stopped by vector catch"

I'm working in Segger Embedded Studio and NRF52840-dk. The project is configured to work with External Toolchain -> Arm Gnu Embedded Toolchain (9 2020-q2-update).

I've imported the complete UART example from the Nordic SDK folder. If I start debugging, while APP_UART_FIFO_INIT(), JLINK stops with following message: "Stopped by vector catch".

The application stops in startup_armcm-gcc.S at "Default_Handler: b"

I expect, that I need to assign a handler for e.g. NMI_HANDLER.

Sorry for this maybe nooby question - I'm literally lost.

Appreciate any help, thanks and cheers

Parents
  • Hi,

     A vector catch would indicate that the there is an exception thrown somewhere. 

    Sorry for this maybe nooby question - I'm literally lost.

    Is there a specific reason for why don't use the toolchain offered by SES? I would just recommend to either use SES as it is, or use a text editor such as VS Code with GCC. We already have examples that can be built with GCC and makefiles

    regards

    Jared

  • Hi Jared,

    Thanks for the fast response. I needed to use a more recent compiler than available because of other software parts.

    I choose to use SES because of other projects in the team going on, using SES. But I'll try to switch to VSC.

    Here's the part of the disassembly:

    --- startup_ARMCM_GCC.S -- 181 -----------------------------
    .thumb_func
    .weak NMI_Handler
    NMI_Handler:
    b .
        E7FE        b 0x00000186 <NMI_Handler>
    --- startup_ARMCM_GCC.S -- 186 -----------------------------
    Default_Handler:
    b .
        E7FE        b 0x00000188 <UsageFault_Handler>
        BF00        nop
    --- nrf_gpio.h -- 487 --------------------------------------

    In my startup_ARMCM_GCC.S, I defined

    def_irq_handler    NMI_Handler

Reply
  • Hi Jared,

    Thanks for the fast response. I needed to use a more recent compiler than available because of other software parts.

    I choose to use SES because of other projects in the team going on, using SES. But I'll try to switch to VSC.

    Here's the part of the disassembly:

    --- startup_ARMCM_GCC.S -- 181 -----------------------------
    .thumb_func
    .weak NMI_Handler
    NMI_Handler:
    b .
        E7FE        b 0x00000186 <NMI_Handler>
    --- startup_ARMCM_GCC.S -- 186 -----------------------------
    Default_Handler:
    b .
        E7FE        b 0x00000188 <UsageFault_Handler>
        BF00        nop
    --- nrf_gpio.h -- 487 --------------------------------------

    In my startup_ARMCM_GCC.S, I defined

    def_irq_handler    NMI_Handler

Children
  • Hi,

    devCheek said:
    In my startup_ARMCM_GCC.S,

     Does this indicate that you're not using the included startup files? 

    Honestly, I would just recommend using the gcc with the makefiles that are already included in the example folder in the SDK, if that is an option. I don't really have much experience with using the external toolchain option in SES. Maybe the community does? Slight smile

    regards

    Jared

  • Thanks for the feedback. I was able to solve the problem now.

    Maybe some chronological background for others facing the same problem:

    • I followed the tutorial to use an external toolchain in SES, created a new project, adapted the toolchain and compiler settings etc.
    • With this new project, a new startup file has been generated (which I used)
    • I was able to build an empty "hello-world" project.
    • I added the sdk, application code and includes from the peripheral/uart example in the sdk folder. Then the described problem occured.

    • After trying different solutions, I started to suspect the startup file to be the problem.
    • I copied the startup file from the uart SES example project in the sdk, which didn't help.
    • I swapped back to the generated Startup file, copied in all interrupt handler definitions from the example project - but it didn't help.
    • It was really strange. I added interrupt handlers for 43 interrupts, but it always stopped with "Default Handler", I wasn't able to handle any interrupts.

    Solution: I removed all statrtup files and added the specific startup file from the CMAKE folder of the example application.

    I'd really like to know, which exact part went wrong / was wrongly configured. I expected to get a working configuration using the "new external build executable" wizzard and handling all interrupts.

    Thanks Jared for the great and fast support.

    Best regards

Related