Debugging M4 with Segger JLink

cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging M4 with Segger JLink

Jump to solution
3,266 Views
nathanb_
Contributor III

Hello Everyone,

I recently purchased a Segger Jlink and am attempting to debug MQX on the M4 core of a VF6xx with it.  Does anyone have a gdbinit file or instructions for this scenario?  I can only find a gdbinit file for the VF6XX_A5 scenario, and not for the VF6XX_M4 scenario.

Thanks.

Labels (4)
1 Solution
648 Views
nathanb_
Contributor III

Hello Everyone,

I managed to fix the issues I was seeing.

I had to turn the DAP on inside the gdbinit file and remove some conflicting peripherals from the kernel.

set ((unsigned int)0x4006b008) = 0xf101ff24

and

CONFIG_SND_SOC_FSL_SAI_WM9712 = n

View solution in original post

6 Replies
648 Views
nathanb_
Contributor III

More info on what's going on:

# /usr/bin/JLinkGDBServer -if JTAG -device VF6xx_M4 -speed auto

SEGGER J-Link GDB Server V5.00e Command Line Version

JLinkARM.dll V5.00e (DLL compiled Jun 23 2015 18:28:42)

-----GDB Server start settings-----

GDBInit file:                  none

GDB Server Listening port:     2331

SWO raw output listening port: 2332

Terminal I/O port:             2333

Accept remote connection:      yes

Generate logfile:              off

Verify download:               off

Init regs on start:            off

Silent mode:                   off

Single run mode:               off

Target connection timeout:     0 ms

------J-Link related settings------

J-Link Host interface:         USB

J-Link script:                 none

J-Link settings file:          none

------Target related settings------

Target device:                 VF6xx_M4

Target interface:              JTAG

Target interface speed:        0kHz

Target endian:                 little

Connecting to J-Link...

J-Link is connected.

Firmware: J-Link V9 compiled Jun 23 2015 10:00:59

Hardware: V9.30

S/N: 609302246

Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB

Checking target voltage...

Target voltage: 1.80 V

Listening on TCP/IP port 2331

Connecting to target...

J-Link found 1 JTAG device, Total IRLen = 4

JTAG ID: 0x4BA00477 (Cortex-M4)

Connected to target

Waiting for GDB connection...Connected to 10.42.0.1

Reading all registers

Read 4 bytes @ address 0x0000F4B6 (Data = 0x4848E7FD)

Read 4 bytes @ address 0x0000F4B2 (Data = 0xBF304820)

Read 4 bytes @ address 0x0000F4B6 (Data = 0x4848E7FD)

Read 4 bytes @ address 0x0000F4B2 (Data = 0xBF304820)

Read 4 bytes @ address 0x0000F4B6 (Data = 0x4848E7FD)

Read 4 bytes @ address 0x0000F4B2 (Data = 0x48304820)

Read 4 bytes @ address 0x0000F4B6 (Data = 0x4848E7FD)

Read 4 bytes @ address 0x0000F4B2 (Data = 0xBF304820)

Read 4 bytes @ address 0x0000F4B6 (Data = 0x4848E7FD)

Read 4 bytes @ address 0x0000F4B6 (Data = 0x4848E7FD)

Read 4 bytes @ address 0x0000F4B6 (Data = 0x4848E7FD)

Resets the core only, not peripherals.

Halting target CPU...

...Target halted (PC = 0x0000F4B8)

Downloading 1024 bytes @ address 0x3F000000

Downloading 4096 bytes @ address 0x3F000400

Downloading 4096 bytes @ address 0x3F001400

Downloading 4096 bytes @ address 0x3F002400

Downloading 4096 bytes @ address 0x3F003400

Downloading 4096 bytes @ address 0x3F004400

Downloading 4096 bytes @ address 0x3F005400

Downloading 4096 bytes @ address 0x3F006400

Downloading 4096 bytes @ address 0x3F007400

Downloading 4096 bytes @ address 0x3F008400

Downloading 4096 bytes @ address 0x3F009400

Downloading 4096 bytes @ address 0x3F00A400

Downloading 4096 bytes @ address 0x3F00B400

Downloading 4096 bytes @ address 0x3F00C400

Downloading 4096 bytes @ address 0x3F00D400

Downloading 3864 bytes @ address 0x3F00E400

Downloading 8 bytes @ address 0x3F00F318

Downloading 1232 bytes @ address 0x3F00F320

Writing register (PC = 0x3f0026ac)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Reading all registers

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F000000 (Data = 0x1F807EF0)

Writing register (SP = 0x1f807ef0)

Reading all registers

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026A8 (Data = 0x40001000)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Read 4 bytes @ address 0x3F0026AC (Data = 0x49134812)

Starting target CPU...

WARNING: T-bit of XPSR is 0 but should be 1. Changed to 1.

...Target halted (PC = 0x0000F2F4)

Reading all registers

Read 4 bytes @ address 0x0000F2F4 (Data = 0xE59F1170)

Read 4 bytes @ address 0x0000F2F0 (Data = 0xE12FFF10)

Read 4 bytes @ address 0x0000F2F4 (Data = 0xE59F1170)

Read 4 bytes @ address 0x0000F2F0 (Data = 0xE12FFF10)

Read 4 bytes @ address 0x0000F2F4 (Data = 0xE59F1170)

Read 4 bytes @ address 0x0000F2F0 (Data = 0xE12FFF10)

Read 4 bytes @ address 0x0000F2F4 (Data = 0xE59F1170)

Read 4 bytes @ address 0x0000F2F0 (Data = 0xE12FFF10)

Read 4 bytes @ address 0x0000F2F4 (Data = 0xE59F1170)

Read 4 bytes @ address 0x0000F2F4 (Data = 0xE59F1170)

Read 4 bytes @ address 0x0000F2F4 (Data = 0xE59F1170)

Starting target CPU...

...Target halted (PC = 0x0000EE30)

Reading all registers

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Starting target CPU...

...Target halted (PC = 0x0000EE30)

Reading all registers

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Starting target CPU...

...Target halted (PC = 0x0000EE30)

Reading all registers

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE2C (Data = 0x6023021B)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

Read 4 bytes @ address 0x0000EE30 (Data = 0x5B01F811)

-------------------------------------------------------------------------------------------------------------------------------------------------------------

# gdb -x m4.gdbinit

(gdb) LOAD_RAM /home/microcom/Vybrid-Toolchain/J-Link/test.elf

0x0000f4b6 in ?? ()

Resets the core only, not peripherals.

Loading section .vectors, size 0x400 lma 0x3f000000

Loading section .text, size 0xef18 lma 0x3f000400

Loading section .ARM, size 0x8 lma 0x3f00f318

Loading section .data, size 0x4d0 lma 0x3f00f320

Start address 0x3f0026ac, load size 63472

Transfer rate: 74 KB/sec, 3526 bytes/write.

$1 = 528514800

Program received signal SIGTRAP, Trace/breakpoint trap.

0x0000f2f4 in ?? ()

(gdb) continue

Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.

0x0000ee30 in ?? ()

(gdb) continue

Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.

0x0000ee30 in ?? ()

(gdb) step

Cannot find bounds of current function

(gdb) continue

Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.

0x0000ee30 in ?? ()

(gdb)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

m4.gdbinit:

#==============================================================================

# How to run & debug vybrid using JLinkGDBServer

#

# 1)  Run "JLinkGDBServer.exe -select USB -device VF6xx_M4 -if JTAG -speed auto"

# 2)  Run gdb client: "arm-none-eabi-gdb.exe –x <script_file>.gdbinit"

# 3)  Run one of LOAD_XXXXX functions defined in <script_file>.gdbinit,

#    using application path as argument.

#        f.i "LOAD_RAM app/path/ram_debug/hello.elf"

# 4) Type "continue" to run application

#

# verified with JLINK JLinkARM_V466, codesourcery arm-2012.03-56-arm-none-eabi

#==============================================================================

#==============================================================================

# LOAD_RAM <my_app.elf>

define LOAD_RAM

#==============================================================================

    if $argc == 0

        print "missing elf filename"

    else

        # remote connection

        target remote 10.42.0.1:2331

        # reset type - core reset

        monitor reset 1

        # halt cpu

        monitor halt

        # load image, 'pc' is set automatically

        load $arg0

        # load symbols

        file $arg0

        # take stack address from 0.th item of  __vector_table

        print (*((unsigned int *)__vector_table))

        # and set sp register

        set $sp = $

    continue

    end

end

#==============================================================================

-------------------------------------------------------------------------------------------------------------------------------------------------------------------

Also -- As far as I can tell, the elf file is being properly identified.

(gdb) list main

    int main (void)

    { /* Body */  

       extern const MQX_INITIALIZATION_STRUCT MQX_init_struct;

   

       /* Start MQX */

(gdb) list responder_task

    *     Upon receiving the message the data is incremented before

    *     the message is returned to the sender.

    *END*-----------------------------------------------------------*/

   

    void responder_task(uint32_t node_num)

    {

         

        int bytesReceived;

        unsigned int * data;

        CORE_MUTEX_PTR  coremutex_app_ptr;

0 Kudos
648 Views
timesyssupport
Senior Contributor II

Hello karinavalencia​ and nathanb.​,

Unfortunately, we don't have anything on hand with regards to MQX on the M4 with Segger.

Not sure if the MQX team would have any further input Karina, or, Segger?

Regards,

Timesys Support

0 Kudos
648 Views
karina_valencia
NXP Apps Support
NXP Apps Support

rendy​ can you help here?

0 Kudos
649 Views
nathanb_
Contributor III

Hello Everyone,

I managed to fix the issues I was seeing.

I had to turn the DAP on inside the gdbinit file and remove some conflicting peripherals from the kernel.

set ((unsigned int)0x4006b008) = 0xf101ff24

and

CONFIG_SND_SOC_FSL_SAI_WM9712 = n

View solution in original post

648 Views
dry
Senior Contributor I

Hi,

What does this do set ((unsigned int)0x4006b008) = 0xf101ff24

And where is this CONFIG_SND_SOC_FSL_SAI_WM9712 = n  (Linux kernel?), and why is this required?

0 Kudos
648 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Thank Nathan  for let us know.

0 Kudos