Embedded Signal Processing

Apple/Mac OsX ElCapitan system - FRDM-K64F KDS 3.2 (Kinetis Design Studio) Setup 


Overview

This page describes setup of  setting up an  FRDM-K64F KDS (Kinetis Design Studio) setup on Apple/Mac systems.

The following instructions are particularly targeted to Apple/mac systems, and may need to be adjusted for other machines/platforms.

Note: Freescale was acquired by NXP



Apple/Mac system - FRDM-K64F KDS 3.2 (Kinetis Design Studio) Setup and Software Installation


On a PC/linux, you might be abe to skip the next pyocd/gdb installation steps,
if KDS works right out of the box (...not sure, since this install was done for Apple/Mac systems)

sudo -H pip install Cython
sudo -H pip install --pre -U pyocd

and in a command terminal test your pyocd by running the commands:

  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 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%

 In terminal window 2
run arm-none-eabi-gdb on your compiled elf file for your project as follows
  ————————————

    tpwmac12:~ tpw$ /Applications/KDS.app/Contents/toolchain/bin/arm-none-eabi-gdb /Users/tpw/Downloads/bubble_frdmk64f.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
Remote debugging using localhost:3333
0x00005104 in UART_WriteBlocking (base=0x4006a000, data=0x2002fee4 "1", length=0)
    at /Users/tpw/Documents/03embedded/motoKDS32frdmK64Fprojects/KSDK20FRDMK64F/devices/MK64F12/drivers/fsl_uart.c:451
    451            while (!(base->S1 & UART_S1_TDRE_MASK))
(gdb) load
Loading section .interrupts, size 0x400 lma 0x0
Loading section .flash_config, size 0x10 lma 0x400
Loading section .text, size 0x7258 lma 0x410
Loading section .ARM, size 0x8 lma 0x7668
Loading section .init_array, size 0x4 lma 0x7670
Loading section .fini_array, size 0x4 lma 0x7674
Loading section .data, size 0x78 lma 0x7678
Start address 0x4d8, load size 30448
Transfer rate: 29 KB/sec, 1449 bytes/write.
(gdb) quit
A debugging session is active.
    Inferior 1 [Remote target] will be detached.
Quit anyway? (y or n) y
Detaching from program: /Users/tpw/Downloads/bubble_frdmk64f.elf, Remote target
Ending remote debugging

#include "fsl_port.h" //you must add this to hello_world

int main(void)
{


    /* Init board hardware. */
    BOARD_InitPins();
    BOARD_BootClockRUN();
    BOARD_InitDebugConsole();

    // Enable the clock to the PORT module that the LED is on.
   CLOCK_EnableClock(kCLOCK_PortB);
   CLOCK_EnableClock(kCLOCK_PortE);

   // Setup the red and green LED pin as GPIO
   PORT_SetPinMux(BOARD_LED_RED_GPIO_PORT, BOARD_LED_RED_GPIO_PIN, kPORT_MuxAsGpio);
   PORT_SetPinMux(BOARD_LED_GREEN_GPIO_PORT, BOARD_LED_GREEN_GPIO_PIN, kPORT_MuxAsGpio);
   PORT_SetPinMux(BOARD_LED_BLUE_GPIO_PORT, BOARD_LED_BLUE_GPIO_PIN, kPORT_MuxAsGpio);

   //initialise the RGB to on/off condition
   LED_RED_INIT(LOGIC_LED_OFF);
   LED_GREEN_INIT(LOGIC_LED_OFF);
   LED_BLUE_INIT(LOGIC_LED_OFF);
    LED_RED_OFF();     //Turn off RED Led
    LED_GREEN_OFF(); // Turn on Green Led
    LED_GREEN_OFF(); // Turn on Green Led

    LED_RED_ON();
    while(1)
       {
        for(int xx=0; xx<80000; xx++)
            LED_RED_OFF();
            LED_RED_OFF();
        for(int xx=0; xx<80000; xx++)
            LED_RED_ON();
            LED_RED_ON();
       }

   // ..... and the rest of the code follows below, and is unreachable, and will not execute

xx