Set Up Toolchain
This section contains the steps to install the necessary components required to build and run a KSDK demo application with the Arm GCC toolchain, as supported by the Kinetis SDK. There are many ways to use Arm GCC tools, but this example focuses on a Windows environment. Though not discussed here, GCC tools can also be used with both Linux OS and Mac OSX.
Install GCC Arm Embedded Toolchain
Download and run the installer from GNU Arm Embedded Toolchain. This is the actual toolchain (i.e., compiler, linker, etc.). The GCC toolchain should correspond to the latest supported version, as described in the
Kinetis SDK Release Notes.
The Minimalist GNU for Windows (MinGW) development tools provide a set of tools that are not dependent on third party C-Runtime DLLs (such as Cygwin). The build environment used by the KSDK does not utilize the MinGW build tools, but does leverage the base install of both MinGW and MSYS. MSYS provides a basic shell with a Unix-like interface and tools.
Download the latest MinGW mingw-get-setup installer from
MinGW - Minimalist GNU for Windows Files.
Run the installer. The recommended installation path is C:\MinGW, however, you may install to any location.
Ensure that the "mingw32-base" and "msys-base" are selected under Basic Setup.
Click "Apply Changes" in the "Installation" menu and follow the remaining instructions to complete the installation.
Add the appropriate item to the Windows operating system Path environment variable. It can be found under
Control Panel -> System and Security -> System -> Advanced System Settings in the "Environment Variables..." section. The path is:
Assuming the default installation path, C:\MinGW, an example is shown below. If the path is not set correctly, the toolchain does not work.
Add a New Environment Variable for ARMGCC_DIR
Create a new system environment variable and name it ARMGCC_DIR. The value of this variable should point to the Arm GCC Embedded tool chain installation path, which, for this example, is:
C:\Program Files (x86)\GNU Tools Arm Embedded\4.9 2015q3
Reference the installation folder of the GNU Arm GCC Embedded tools for the exact path name of your installation.
Download CMake 3.0.x from Get CMake
Install CMake, ensuring that the option "Add CMake to system PATH" is selected when installing. It's up to the user to select whether it's installed into the PATH for all users or just the current user. In this example, the assumption is that it's installed for all users.
Follow the remaining instructions of the installer.
You may need to reboot your system for the PATH changes to take effect.
Build an Example Application
To build an example application, follow these steps.
If not already running, open a GCC ARM Embedded tool chain command window. To launch the window, from the Windows operating system Start menu, go to “Programs -> GNU Tools ARM Embedded <version>” and select “GCC Command Prompt”. </version>
Change the directory to the example application project directory, which has a path like this:
<install_dir >/boards/<board_name >/<example_type >/ <application_name>/armgcc</application_name> </example_type> </board_name> </install_dir>
For this guide, the exact path is:
<install_dir> /boards/evkmimxrt1060/demo_apps/hello_world/armgcc </install_dir>
Type “build_flexspi_nor_debug.bat” on the command line or double click on the "build_flexspi_nor_debug.bat" file in Windows operating system Explorer to perform the build. The output is shown in this figure:
Run an Example Application
This section describes steps to run a demo application using J-Link GDB Server application. To perform this exercise, two things must be done:
After the J-Link interface is configured and connected, follow these steps to download and run the demo applications:
This board supports the J-Link debug probe. Before using it, install SEGGER software, which can be downloaded from
Connect the development platform to your PC via USB cable between the OpenSDA USB connector and the PC USB connector. If using a standalone J-Link debug pod, also connect it to the SWD/JTAG connector of the board.
Open the terminal application on the PC, such as PuTTY or TeraTerm, and connect to the debug serial port number. Configure the terminal with these settings:
115200 baud rate, (reference BOARD_DEBUG_UART_BAUDRATE variable in board.h file)
8 data bits
1 stop bit
Open the J-Link GDB Server application. Go to the SEGGER install folder, for example, C:\Program Files (x86)\SEGGER\JLink_V616f. Open the command windows here, for Debug and Release targets, and use the command "JLinkGDBServer.exe".
Note: for the sdram_debug and sdram_release targets, use the command:
JLinkGDBServer.exescriptfile<install_dir> /boards/evkmimxrt1060/demo_apps/hello_world/evkmimxrt1060_sdram_init.jlinkscript </install_dir>
- The target device selection chosen for this example is the Cortex-M7.
After it is connected, the screen should resemble this figure:
If not already running, open a GCC ARM Embedded tool chain window. To launch the window, from the Windows operating system Start menu, go to “Programs -> GNU Tools ARM Embedded <version>” and select “GCC Command Prompt”.</version>
Change to the directory that contains the example application output. The output can be found in using one of these paths, depending on the build target selected:
<install_dir >/boards/<board_name >/<example_type >/ <application_name>/armgcc/debug</application_name> </example_type> </board_name> </install_dir>
<install_dir >/boards/<board_name >/<example_type >/ <application_name>/armgcc/release</application_name> </example_type> </board_name> </install_dir>
For this example, the path is:
<install_dir> /boards/evkmimxrt1060/demo_apps/hello_world/armgcc/debug </install_dir>
Run the command “arm-none-eabi-gdb.exe <application_name> .elf”. For this example, it is “arm-none-eabi-gdb.exe hello_world.elf”. </application_name>
Run these commands:
"target remote localhost:2331"
- The application is now downloaded and halted at the reset vector. Execute the “monitor go” command to start the demo application.
The hello_world application is now running and a banner is displayed on the terminal. If this is not true, check your terminal settings and connections.