[SOLVED] Unexplained HardException fault

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Unexplained HardException fault

    Hi

    I'm seeing something odd in Ozone...

    If I create a new project (without specifying JLINK settings )and load an elf file, Ozone is happy to download that to my target, provided the connected JLINK has already been configured for the target.

    If I then add those JLINK target settings to the project (see below), downloading to the target immediately produces a HardFault exception. What could be the reason for this?

    Target setitngs:
    Project.SetDevice ("MK60FN1M0xxx15");
    Project.SetHostIF ("USB", "");
    Project.SetTargetIF ("SWD");
    Project.SetTIFSpeed ("200 kHz");

    HardException details
    The target stopped in HardFault exception state.


    Reason: Undefined instruction executed at 0x000001B0.


    The initial UsageFault exception was escalated to HardFault, because its handler was not enabled or a fault occurred within the handler.




    Many thanks
    David
  • Hi David,
    Thank you for your inquiry.

    Does a bootloader run on your device?
    If so, please refer to this article:
    wiki.segger.com/Debug_on_a_Target_with_Bootloader

    Best regards,
    Fabian
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/


    Or you can contact us via e-mail.
  • Hi Fabian -thanks for responding so quickly!

    Yes, in fact it is the bootloader elf that I am debugging.

    I've applied the recommended tweak to the setting of PC and SP as per wiki.segger.com/Debug_on_a_Target_with_Bootloader and it's now working, so thank you!

    I notice that the difference that this tweak has made has only been to set the PC to a different value than is obtained by the 'default' method (i.e. by fetching PC and SP locations from the elf file vector table). It appears to be that the default 'vector table' method is obtaining PC value for 'main', whereas the bootloader needs to run the startup asm beforehand. I assume this is the reason why this 'manual' adjustment of PC on reset is necessary in the case of bootloader code- is this right?

    Many thanks

    David

    The post was edited 1 time, last by dnfuss ().

  • Hello David,

    Great to hear that you are up and running again.
    Correct, as Ozone has no knowledge of any bootloaders or what kind of elf you are debugging it will assume that it is always the "main" application that you try to debug so the generic Ozone project script will try to get the SP and PC locations from the elf file.
    However if you have a system that relies on running a bootloader beforehand you have to change the default Ozone project as explained in the Wiki article for the different use cases.

    As the initial inquiry has been answered this thread will be closed now.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.