[SOLVED] Changed instruction when uploading with arm-none-eabi-gdb and JLinkGDBServer

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

  • [SOLVED] Changed instruction when uploading with arm-none-eabi-gdb and JLinkGDBServer

    Hi,

    When I run a debugging session the processor Hard Faults for code which it should not hard fault for.

    The issue has been tracked down to the code running from the debugging session not beeing the same as the one in the elf file.

    When i run
    arm-none-eabi-objdump -d

    You can see that instruction 0x40a is different from when running in gdb session


    The practical information:
    OS: Ubuntu 16.04
    Debugger: J-Link Base
    MCU: NXP S32K144 (Evaluation board S32K144EVB)

    The commands I'm using
    To start the gdb server:
    JLinkGDBServer -device S32K144 -if SWD -speed 4000

    To start the gdb session:
    arm-none-eabi-gdb ../target/thumbv7em-none-eabihf/debug/examples/light.hex

    target remote :2331
    monitor semihosting enable
    load

    The elf file is ziped and added as an Attachments (light.zip) in case you wish to run tests on it.

    Hope you can make sense out of this bizarre bug as I'm completely lost.


    Files
    • light.zip

      (576.91 kB, downloaded 306 times, last: )
  • Hi,


    as described in the user manual of the device, section "Flash configuration field description", 0x040C - 0x040F is not flash memory which should be used for code, but "Option Bytes" (see MCU Security).
    You need to mask out 0x040C - 0x040F in the memory map used by your compiler.

    nxp.com/products/automotive-pr…EVB?tab=Documentation_Tab

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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,


    good to hear that you are up and running again!


    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    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.