64 responses to “Setting up Linux opensource build and debug tools for freescale freedom board FRDM-KL25Z”

  1. DIY Free Toolchain for Kinetis: Part 5 – Linux Host with OpenOCD and CMSIS-DAP | MCU on Eclipse

    […] Setting up Linux opensource build and debug tools for freescale freedom board FRDM-KL25Z […]

  2. Jorge Hernandez

    When i run make, i get an error that says:

    cmsis_dap.c: In function ‘cmsis_dap_cmd_DAP_SWJ_Clock’:
    cmsis_dap.c:274:50: error: declaration of ‘clock’ shadows a global declaration [-Werror=shadow]
    cc1: all warnings being treated as errors

    how can i fix this? why is this happening? (i’m a noob regarding “make”). Thank you Karibe. Keep up the good work!

  3. Programming the FRDM-KL25Z board with a baremetal LED toggle >> Karibe

    […] this post on how to setup arm-gnu […]

  4. Online mbed compiler and the freescale freedom board frdm-kl25z LED_blinker >> Karibe

    […] version 1.08, you can get it from pemicro. Look for the BOOTUPDATEAPP.SDA. follow the steps in this post to update […]

  5. MB

    Well Done. Thanks for documenting it. This will be useful for so many people. I don’t know why element14 and freescale don’t push more with open source tools.

  6. allankliu

    I am trying my best to support KL25Z with Wiring API, like Arduino did. Before porting API, I have to setup a complete open source toolchain on Windows.

    The C version built with arm-gcc-embedded runs OK on FRDM. But CPP version didn’t. I have no idea where I have done wrong.

    Do you have any working demo? which can be built with arm-gcc-embedded and makefile? Maybe I can find my problem after cross-checking the makefile.

    Or, should I run the code in mBed and export to arm-gcc-embedded?

  7. Hagai Cohen

    I Was able to make it work!

    the openocd cmsis-dap support are at last stages of a approval, so at this moment they are not approved yet. probably later on they will be, and be merged into mainline.

    I was using http://openocd.zylin.com/#/c/1542/11.

    1.Clone to OpenOCD Repo:

    git clone http://openocd.zylin.com/openocd cd openocd

    2.Since it’s not merged into mainline, i took the patch:

    git fetch http://openocd.zylin.com/openocd refs/changes/42/1542/11 && git checkout FETCH_HEAD

    3.bootstrap & configure:

    ./bootstrap ./configure –enable-maintainer-mode –enable-cmsis-dap –enable-hidapi-libusb

    4.added adapter settings into kl25.cfg (hopefuly this will be added into the mainline as well.)

    vim ./tcl/drivers/kl25.cfg

    adapter_khz 50
    $_TARGETNAME configure -event gdb-attach {
    halt
    }
    

    5.make & sudo make install

    6.setup UDEV Rules. (in the post)

    7.test it works:

    openocd -c “interface cmsis-dap” -f /usr/local/share/openocd/scripts/target/kl25.cfg

  8. Sándor Bognár

    Hi!

    I also managed to debug kl25 apps by openocd, but I missed the uart terminal
    badly, it is not too fast and still in beta state.
    I installed the USBDM and it works perfectly. Having a very fast flash, debug
    and uart interface.
    I is more than perfect.

    I work on SuSe linux 12.3 and there is no 64 rpm package for it, that’s why I had to compiled the git version.

    Cheers,

    Sándor

  9. Ed

    Did exactly all steps and am getting this, altho i did made some misstakes at first, maybe i need to uninstall and redo, but how?

    ~/openocd$ openocd -c “interface cmsis-dap” -f tcl/target/kl25.cfg
    Open On-Chip Debugger 0.7.0-dev-g1d8f0c1 (2013-10-27-21:43)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.sourceforge.net/doc/doxygen/bugs.html
    Info : only one transport option; autoselect ‘cmsis-dap’
    Info : CMSIS-ADI: cmsis_dap_select
    Info : CMSIS-DAP: cmsis_dap_swd_init
    Error: Can’t find CMSIS-DAP Interface! Please check connection and permissions.
    Error: Error selecting ‘cmsis-dap’ as transport
    in procedure ‘interface’

  10. Marcos

    Hi Karibe

    Did you find any solution to the invalid command name “jtag”?

  11. Patrick Krekelberg

    Hi Karibe!

    Really nice work on this. I know how much effort it takes to hand-roll a toolchain, let alone spend the time to write about it so others can benefit. Thanks!

    I’d been trying to get this going for OS X. I was unable to build OpenOCD due to some environment issues. Have you heard when the CMSIS-DAP support will go into the OpenOCD mainline? I looked at the code review page and it appeared to be still in process.

    My only reservation about all this is that the Processor Expert component does not function on OS X. I am honestly unsure whether I’ll need it or not, but it’s nice to have the option. What are your thoughts?

    MCU vendors seem very pro-Windows unfortunately. Anything that allows me to stay in unix land is well worth some extra effort, but I still haven’t found a way toward a full development/debugging/production workflow for Freescale KL25/KL46 on mac/linux.

    As a backup I am spinning everything up with bare Eclipse in a Windows VM as well (thanks to Erich’s writings at http://mcuoneclipse.com)…

    Cheers,
    Patrick

  12. Freescale freedom board FRDM-KL05Z with openocd and GNU-ARM tools | Karibe

    […] for Freescale mcus (and other arm-based mcus) using open-source tools as documented on this post. One of my students had a look at the FRDM-KL05 and it can actually be used in exactly the same […]

  13. ARM microcontroller emulation using QEMU | Karibe

    […] I already covered installation procedures for gnu-arm toolchain in this post. […]

  14. Nick

    Hi Karibe,
    Thanks for posting this guide. When I try your steps to install hidapi, it fails when after I download the files from github and try to run ./bootstrap, it says “autoreconf: not found”
    Do you know how I’d get autoreconf set up so that this will work? I’m running ubuntu 13.10 64 bit.

  15. Rafael Murakami

    Karibe Hello, congratulations on the blog! I did the whole process, but I have a doubt. After running opencd what the process required to compile the code for my board?

  16. Alex Makau

    when installing hidapi i reached the “/cofigure” step but t=i am getting the below problem but i seem not to find a way to install libudev.help

    checking for libudev… no

    Library libudev was not found on this system.
    Please install it and re-run ./configure

  17. kevin

    just before installing OPENOCD am stuck at this stage where am supposed 2 check

    ls -l /dev/hidraw*

    is ok and the files are present…….but av found out the file r not being created…even checked manually …and repeated previous stages again….giving me

    nivek@nivek-HP-Pavilion-dv6-Notebook-PC:~$ ls -l /dev/hidraw*
    ls: cannot access /dev/hidraw*: No such file or directory

  18. Alex Makau

    while installing OPenOCD am getting the following error when i run configure.
    configure: error: /bin/bash ./config.sub …. failed

    help out

  19. Iker

    Hello, very nice tutorial! I am trying to use the KL46 from freescale. I have still a problem connecting to the device. After drag’n dropping the CMSIS SDA on the board in BOOTLOADER mode I unplug and plug again the device. No drive appears then. I try anyway to go on in the tutorial but after running sudo openocd -c “interface cmsis-dap” -f etc… in the end I get:

    Polling target kl46.cpu failed, GDB will be halted.
    Error: CMSIS-DAP: Read Error (0x04)

    Any help will be appreciated.

    Thanks

  20. Developing for FRDM-KL25Z platform in Linux – Flashing | CoolParadox Blog

    […] Setting up Linux opensource build and debug tools for freescale freedom board FRDM-KL25Z […]

  21. Desenvolvendo em Linux para FRDM-KL25Z – Gravação | CoolParadox Blog

    […] Setting up Linux opensource build and debug tools for freescale freedom board FRDM-KL25Z […]

  22. tobias

    i have this error

    program “arm-non-eabi-” not found in path

    is this a problem with the path i cant seem to remove the error…help

  23. kl05z kinetis mcu custom circuit and Processor Expert Valentine LED twinkle >> Karibe

    […] A GUI pops up, it will automatically detect the board as a BDM device, click on the TARGET tab and click on Detect chip to auto-detect the target chip, after that, set the port to serve through under GDBServer (you will use this in the eclipse debug configuration) and click on Keep Changes. A terminal window shows up and you are good to go. the rest of the debug settings remain as usual like OpenOCD settings in external tools, see the post on setting up debug tools in Linux […]

  24. USBDM ARM debug Server for Freescale micro-controllers in Linux with GNU Debugger >> Karibe

    […] A GUI pops up, it will automatically detect the board as a BDM device, click on the TARGET tab and click on Detect chip to auto-detect the target chip, after that, set the port to serve through under GDBServer (you will use this in the eclipse debug configuration) and click on Keep Changes. A terminal window shows up and you are good to go. the rest of the debug settings remain as usual like OpenOCD settings in external tools, see the post on setting up debug tools in Linux […]

  25. kevin

    plz remind me what we were editing to avoid this error when setting “sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded” am doing the whole process again…..

    Cannot add PPA: ‘ppa:terry.guo/gcc-arm-embedded’.
    Please check that the PPA name or format is correct.

  26. Debugging arm freescale microcontrollers with J-Link GDB Server and GNU-ARM toolchain gdb with semihosting in Linux >> Karibe

    […] I am assuming you have done the first three, if not, gather these details on this post  […]

  27. Pinkesh

    Hello Mr.Karibe

    Thanks for your stuff.
    I installed Openocd the way you mentioned here . But I am getting following erro while flashing.

    Error: flash driver ‘at91samd’ not found
    Runtime Error: /usr/local/share/openocd/scripts/target/at91samdXX.cfg:60:
    in procedure ‘script’
    at file “embedded:startup.tcl”, line 58
    at file “/usr/local/share/openocd/scripts/board/atmel_samr21_xplained_pro.cfg”, line 8
    in procedure ‘flash’ called at file “/usr/local/share/openocd/scripts/target/at91samdXX.cfg”, line 60
    make: *** [flash] Error 1

  28. Hemant Joshi

    I am using FRDM-KL25Z board with mbed. Hence installed “20140530_k20dx128_kl25z_if_opensda” firmware provided by Freescale. Since mbed online compiler/linker doesn’t allow me to generate a CRP (Code Read Protection) enabled binary, I hand modified the binary so that I could change value at 0x0000040C. However the OpenSDA FW doesn’t allow me to flash the file, giving error report “Reserved Bits”. I want to use mbed but want OpenSDA to ignore the modification. One way to do so is to modify the CMSIS-DAP source code and remove the check and rebuild. But before doing so, I wish to know if there is any simpler way or alternative to flash my modified mbed generated bin file?
    At the same time I strongly wish to use mbed.

    Thanks in advance,
    -Hemant

  29. Nelson

    Great article!
    Cheers 😉

  30. OpenOCD/CMSIS-DAP Debugging with Eclipse and without an IDE | MCU on Eclipse
  31. Angel

    Thanks !
    Beware: VirtualBox fails to properly pass-through the “hidraw” things. I`m trying this in my Virtualbox-OSE ARM-development VM and there are no /dev/hidraw* devices inside. lsusb gives me:
    Bus 001 Device 005: ID 0d28:0204 NXP LPC1768
    E.t.KL20x with MBED DAP FW on the FRDM-KL25 is recognized as LPC1768 (probably borrowed USB VID & PID).
    Result: the “MBED” folder mounts OK, but no CMSIS-DAP. I guess this should work in Qemu.
    On the host machine it`s OK.

    1. Angel

      I made it work in a Qemu VM, (USB passthrough), everything recognizes, but I get strange beahviour: OpenOCD finds adapter, writes flash, can do reset halt, Eclipse can step over first lines but if the breakpoint is set further, Eclipse returns to the reset handler; in the openOCD console:
      Polling target kl25.cpu failed, trying to reexamine
      Info : SWD IDCODE 0x0bc11477
      Info : SWD IDCODE 0x0bc11477
      Error: Failed to read memory at 0xe000ed00
      Examination failed, GDB will be halted. Polling again in 100ms
      Error: JTAG failure -5
      Now I’m going to check it outside Qemu.

  32. TWR-K60N512 full debug with OpenOCD and GNU-ARM in Linux >> Karibe

    […] We need eclipse IDE, CDT package and some additional plugins to have a full blown open-source IDE. The procedure for a DIY is outlined in this post. […]

  33. Angel G

    Under fresh Debian, to execute “./bootstrap” successfully, I need also to install the pkg-config package: aptitude install pkg-config

Leave a Reply

%d bloggers like this: