iMX8MQ Cortex-M4 Programming with JTAG

Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX8MQ Cortex-M4 Programming with JTAG

Jump to solution
Contributor III


I want to program Cortex-M4 of iMX8MQ with a Segger J-Link Plus Programmer via JTAG.

I have successfully ran programs with CM4 by loading them with U-Boot. Now I want to do the same thing with a programmer:

Here are the steps I took, But the program did not output anything:

#Running JLink Debug Server

$ ./JLinkGDBServer -if JTAG -device MIMX8MQ6_M4

<Prints some other stuffs>

J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x5BA00477 (Cortex-M4)
Connected to target
Waiting for GDB connection...Connected to

#Building CM4 Firmware

$ export ARMGCC_DIR=/home/gcc-arm-none-eabi-10-2020-q4-major

$ cd /home/sdk/boards/evkmimx8mq/demo_apps/hello_world/armgcc

$ ./build_debug

#Connecting to Debug Server with GDB

$ export PATH=/home/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH

$ cd debug

$ arm-none-eabi-gdb hello_world.elf

# GDB Commands

(gdb) target remote localhost:2331
Remote debugging using localhost:2331
0x1ffe0008 in __isr_vector ()
(gdb) monitor reset
Resetting target
(gdb) monitor halt
(gdb) load
Loading section .interrupts, size 0x240 lma 0x1ffe0000
Loading section .resource_table, size 0x10 lma 0x1ffe0240
Loading section .text, size 0x3650 lma 0x1ffe0250
Loading section .ARM, size 0x8 lma 0x1ffe38a0
Loading section .init_array, size 0x4 lma 0x1ffe38a8
Loading section .fini_array, size 0x4 lma 0x1ffe38ac
Loading section .data, size 0x64 lma 0x1ffe38b0
Start address 0x1ffe030c, load size 14612
Transfer rate: 285 KB/sec, 2087 bytes/write.
(gdb) monitor go

#JLinkGDBServer outputs when entering commands in gdb

Reading all registers
Read 4 bytes @ address 0x1FFE0008 (Data = 0xE7FEE7FE)
Read 2 bytes @ address 0x1FFE0008 (Data = 0xE7FE)
Reading 64 bytes @ address 0x1FFE0000
Received monitor command: reset
Resetting target
Received monitor command: halt
Halting target CPU...
...Target halted (PC = 0x1FFE0008)
Downloading 576 bytes @ address 0x1FFE0000
Downloading 16 bytes @ address 0x1FFE0240
Downloading 13904 bytes @ address 0x1FFE0250
Downloading 8 bytes @ address 0x1FFE38A0
Downloading 4 bytes @ address 0x1FFE38A8
Downloading 4 bytes @ address 0x1FFE38AC
Downloading 100 bytes @ address 0x1FFE38B0
Writing register (PC = 0x1ffe030c)
Received monitor command: go
Starting target CPU...

The Scenario is that Linux is running and when I run JLinkGDBServer on my Host, the target termnial stops till I terminate JLinkGDBServer. I expect the program is loaded in memory and the output is shown in UART2 Terminal. Everything looks good but the output on UART2 is not shown.

Question: What could be the problem? and in general, How can I program CM4 with JLink programmer via JTag?

Thanks in advance for your help

0 Kudos
1 Solution
Contributor III


The problem fixed when I terminated JLinkGDBServer. I don't know why that happened

View solution in original post

2 Replies
Contributor III


The problem fixed when I terminated JLinkGDBServer. I don't know why that happened

NXP TechSupport
NXP TechSupport

You can refer to our user guide

0 Kudos