gdb debugging on Kinetis with Segger gdb server on Linux

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

gdb debugging on Kinetis with Segger gdb server on Linux

3,970 Views
macl
Senior Contributor I

Hi,

I'm a Kinetis guy with most of my embedded experience with CodeWarrior or IAR IDEs on Windows.  However, I just started to work with free GNU tools on a Linux host for compiling, & debugging code for Kinetis MCUs.  With gcc and gdb client from ARM, and gdb server and J-Link pod from Segger, you can compile, flash, and debug Kinetis devices with just command line operations. For me, it’s a different and very powerful model to work in. 

If you are interested in Kinetis development using gdb and Segger's gdb server and j-link, here are steps I used to get started.  This does not cover makefiles and compiling with gcc.

I'm using Ubuntu 12.04 running in VirtualBox.  I have a J-Link connected to a FRDM-KL25Z.

1. Install gcc (comes with gdb for ARM) maintained by ARM

(Details at https://launchpad.net/gcc-arm-embedded )

mac@mac-VirtualBox:/$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded

mac@mac-VirtualBox:/$sudo apt-get update

mac@mac-VirtualBox:/$sudo apt-get install gcc-arm-none-eabi

2. Install Segger J-Link software and documentation pack for Linux (DEB Installer 32-bit version)

http://www.segger.com/jlink-software.html

3. Start GDB Server

mac@mac-VirtualBox:/$ JLinkGDBServer -device MKL25Z128xxx4 -if SWD -speed 1000 -endian little &

For the FRDM-KL25Z, select MKL25Z128xxx4 as the device.  See list of all Segger supported devices here.

Kinetis L-series devices use SWD for debugging, so that is selected as the interface.

4. Start GDB client (command line):

mac@mac-VirtualBox:/$ arm-none-eabi-gdb

5. Connect to GDB Server

(gdb) target remote localhost: 2331

There are many references to gdb commands online.

6. flash target

(gdb) load myapp.elf

7. Set symbols for debugger

(gdb) file myapp.elf

8. Use target specific commands.  Here are some examples.

(gdb) monitor reset

(gdb) monitor go

(gdb) monitor halt

(gdb) dump srec memory file 0x0000 0x1000

For target specific commands the gdb client can pass commands to the gdb server by adding “monitor” in front on the gdb server command.  This is shown above.  See Segger gdb server documentation for list of gdb server commands.

See other great posts and blogs on related topics.

https://community.freescale.com/message/348225#348225

DIY Free Toolchain for Kinetis: Part 1 – GNU ARM Build Tools | MCU on Eclipse

Good luck!

0 Kudos
1 Reply

967 Views
manish2789
Contributor I

Hello ,

                  I am Manish .I have been working on open-source Embedded technologies on Linux platform since 2 years.Now  I have just started to learn about free scale freedom board .But I'm not able to flash (Load) same code take from this community using OpenSDA. Fllowing thing I have done successfully

1.I have installed Drivers of OpenSDA and verified for ttyACM0 port .

2.Went through Boot-loader mode of OpenSDA and found  "/media/BOOTLOADER" directory on Linux platform .

3.Compiled sample code given on this community and tried to copy main.srec to  "/media/BOOTLOADER"

  But expected output not got.

so please guide me

1.How to flash code freedom board (FRDM KL25Z) .

2.How to set  Debug Environment ?

3.Is any utilities for flashing and Debugging available..?

Regards

Manish

0 Kudos