[env:frdm_k64f]
platform = freescalekinetis
framework = mbed
board = frdm_k64f
targets = upload
src_build_flags = -Wall -g -no-integrated-cpp -save-temps -fverbose-asm -Wa,-aghlmns=assembly.s
#include "mbed.h"
DigitalOut myled(LED1);
int main() {
while(1) {
myled = 1;
wait(1);
myled = 0;
wait(1);
}
}
Windows commands
pip install Cython
pip install --pre -U pyocd
pyocd-gdbserver --help
pyocd-gdbserver -l
tpwmac12:local tpw$ pyocd-gdbserver -l
INFO:root:new board id detected: 02400221AA524E54578CB3EC
0 => MBED MBED CMSIS-DAP (0xd28, 0x204) [k64f] boardId => 02400221AA
In terminal window 1
————————————
run the command "pyocd-gdbserver" to obtain this session
tpwmac12:~ tpw$ pyocd-gdbserver
INFO:root:new board id detected: 02400221AA524E54578CB3EC
INFO:root:board allows 5 concurrent packets
INFO:root:DAP SWD MODE initialised
INFO:root:IDCODE: 0x2BA01477
INFO:root:K64F not in secure state
INFO:root:6 hardware breakpoints, 4 literal comparators
INFO:root:CPU core is Cortex-M4
INFO:root:FPU present
INFO:root:4 hardware watchpoints
INFO:root:GDB server started at port:3333
INFO:root:One client connected!
[====================] 100% <--*NOTE* You will not see the lines denoted in RED when you first run the command it will say "none" and wait for the other terminal...
In terminal window 2
run arm-none-eabi-gdb on your compiled elf file for your project as follows
————————————Windows user will need to recall or search for where the ".platformio" directory is stored on their PC and use the following command (sometimes it happens to be in a directory called "SPB_Data" but your directory location may be different).
C:\Windows\system32\
C:\SPB_Data\.platformio\packages\toolchain-gccarmnoneeabi\bin\arm-none-eabi-gdb "C:\Users\USERNAME\Desktop\blink_pe\.pioenvs\frdm_k64f\firmware.elf"If you cannot find the directory for the “arm-none-eabi-gdb” simply download and extract it from here:
https://launchpad.net/gcc-arm-embedded
This is the command as it would appear on a MAC: tpwmac12:~ tpw$ ~/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gdb /Users/tpwece/Documents/00_platformioEclipseProjects/blink_pe/.pioenvs/frdm_k64f/firmware.elf
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140731-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/tpw/tp_frdm_blink_3.elf...done.
(gdb) target remote localhost:3333 <-- This is the command that you will run
Remote debugging using localhost:3333
0x00000eb2 in wait_us ()
(gdb) load <-- This is the command that you will run
Loading section .isr_vector, size 0x1f0 lma 0x0
Loading section .flash_protect, size 0x10 lma 0x400
Loading section .text, size 0x8548 lma 0x410
Loading section .ARM.exidx, size 0x8 lma 0x8958
Loading section .data, size 0x8b4 lma 0x8960
Start address 0x198, load size 36868
Transfer rate: 14 KB/sec, 1602 bytes/write.
(gdb) quit <-- This is the command that you will run
If you received this message: “Error: Program “platformio” not found in PATH”, then you need to update Eclipse $PATH variable. In Eclipse IDE make right click on the created project (“Project Explorer“) : “Properties → C/C++ Build → Environment → PATH → Edit” and set to /usr/local/bin:/bin:/usr/bin:/usr/sbin:/sbin .
If all goes well, you should see a successful IDE debug
environment like the following:
Copyright 2015 T. Weldon
Freescale, Kinetis are registered trademarks of Freescale Semiconductor, Inc. Texas Instruments, TI, C2000, and Code Composer Studio are a registered trademarks of Texas Instruments Incorporated. Adafruit is a registered TradeMark of Limor Fried. ARM, Cortex and Keil are registered trademarks of ARM Limited (or its subsidiaries). Apple, Yosemite, Mac OS, iPhone, iPad, MacBook, Mac, iTunes, and Xcode are trademarks of Apple inc. All other product or service names are the property of their respective owners. Arduino is a registered trademark of Arduino.