Run a demo using Arm GCC
This section describes the steps to configure the command-line Arm GCC tools to build, run, and debug demo applications and necessary driver libraries provided in the MCUXpresso SDK. The hello_world
demo application is targeted for the MIMXRT595-EVK hardware platform which is used as an example.
Note: ARMGCC version 7-2018-q2 is used as an example in this document. The latest GCC version for this package is as described in the MCUXpresso SDK Release Notes (document MCUXSDKMIMXRT5XXRN).
Set up toolchain
This section contains the steps to install the necessary components required to build and run an MCUXpresso SDK demo application with the Arm GCC toolchain, as supported by the MCUXpresso SDK. There are many ways to use Arm GCC tools, but this example focuses on a Windows operating system environment.
Install GCC Arm Embedded tool chain
Download and run the installer from GNU Arm Embedded Toolchain. This is the actual toolset (in other words, compiler, linker, and so on). The GCC toolchain should correspond to the latest supported version, as described in MCUXpresso SDK Release Notes.
Parent topic:Set up toolchain
Install MinGW (only required on Windows OS)
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 MCUXpresso SDK does not use 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.
Run the installer. The recommended installation path is
C:\MinGW
, however, you may install to any location.Note: The installation path cannot contain any spaces.
Ensure that the mingw32-base and msys-base are selected under Basic Setup.
|
|
In the Installation menu, click Apply Changes 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:
<mingw_install_dir>\bin
Assuming the default installation path,
C:\MinGW
, an example is shown below. If the path is not set correctly, the toolchain will not work.Note: If you have
C:\MinGW\msys\x.x\bin
in your PATH variable (as required by Kinetis SDK 1.0.0), remove it to ensure that the new GCC build system works correctly.|
|
Parent topic:Set up toolchain
Add a new system environment variable for ARMGCC_DIR
Create a new system environment variable and name it as ARMGCC_DIR
. The value of this variable should point to the Arm GCC Embedded tool chain installation path. For this example, the path is:
See the installation folder of the GNU Arm GCC Embedded tools for the exact pathname of your installation.
Short path should be used for path setting, you could convert the path to short path by running command for %I in (.) do echo %~sI
in above path.
|
|
|
|
Parent topic:Set up toolchain
Install CMake
Download CMake 3.0.x from www.cmake.org/cmake/resources/software.html.
Install CMake, ensuring that the option Add CMake to system PATH is selected when installing. The user chooses to select whether it is installed into the PATH for all users or just the current user. In this example, it is 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.
Make sure
sh.exe
is not in the Environment Variable PATH. This is a limitation ofmingw32-make
.
Parent topic:Set up toolchain
Parent topic:Run a demo using Arm GCC
Build an example application
To build an example application, follow these steps.
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.
|
|
Change the directory to the example application project directory which has a path similar to the following:
<install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc
For this example, the exact path is:
<install_dir>/examples/evkmimxrt595/demo_apps/hello_world/armgcc
Note: To change directories, use the
cd
command.Type build_debug.bat on the command line or double click on build_debug.bat file in Windows Explorer to build it. The output is as shown in Figure 2.
|
|
Parent topic:Run a demo using Arm GCC
Run an example application
This section describes steps to run a demo application using J-Link GDB Server application. To perform this exercise, make sure that either:
The OpenSDA interface on your board is programmed with the J-Link OpenSDA firmware. To determine if your board supports OpenSDA, see Default debug interfaces. For instructions on reprogramming the OpenSDA interface, see Updating debugger firmware. If your board does not support OpenSDA, a standalone J-Link pod is required.
You have a standalone J-Link pod that is connected to the debug interface of your board. Note that some hardware platforms require hardware modification in order to function correctly with an external debug interface.
After the J-Link interface is configured and connected, follow these steps to download and run the demo applications:
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 (to determine the COM port number, see How to determine COM port). Configure the terminal with these settings:
115200 or 9600 baud rate, depending on your board (reference
BOARD_DEBUG_UART_BAUDRATE
variable in theboard.h
file)No parity
8 data bits
1 stop bit
|
|
Open the J-Link GDB Server application. Assuming the J-Link software is installed, the application can be launched by going to the Windows operating system Start menu and selecting Programs->SEGGER->J-Link <version> J-Link GDB Server.
Modify the settings as shown in Figure 2. The target device selection chosen for this example is MIMXRT595_M33.
|
|
After it is connected, the screen should be as shown in Figure 3.
|
|
If not already running, open a GCC Arm Embedded tool chain command window. To launch the window, from the Start menu of the Windows operating system, go to Programs->GNU Tools Arm Embedded <version> and select GCC Command Prompt.
|
|
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
<install_dir>/boards/<board_name>/<example_type>/<application_name>/armgcc/release
For this example, the path is: <install_dir>/boards/evkmimxrt595/demo_apps/hello_world/armgcc/debug
Run the
arm-none-eabi-gdb.exe <application_name>.elf
command. For this example, it isarm-none-eabi-gdb.exe hello_world.elf
.|
|
**Note:** Make sure that the board is set to FlexSPI flash boot mode before debugging.
Run these commands:
target remote localhost:2331
monitor reset
monitor halt
load
monitor reset
The application is now downloaded and halted. Execute the
c
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.|
|
Parent topic:Run a demo using Arm GCC
Build a TrustZone example application
This section describes the steps to build and run a TrustZone application. The demo application build scripts are located in this folder:
<install_dir>/boards/<board_name>/trustzone_examples/<application_name>/[<core_type>]/<application_name>_ns/armgcc
<install_dir>/boards/<board_name>/trustzone_examples/<application_name>/[<core_type>]/<application_name>_s/armgcc
Begin with a simple TrustZone version of the Hello World application. The TrustZone Hello World GCC build scripts are located in this folder:
<install_dir>/boards/evkmimxrt595/trustzone_examples/hello_world/hello_world_ns/armgcc/build_debug.bat
<install_dir>/boards/evkmimxrt595/trustzone_examples/hello_world/hello_world_s/armgcc/build_debug.bat
Build both applications separately, following steps for single core examples as described in Section 6.2, “Build an example application”. It is requested to build the application for the secure project first, because the non-secure project must know the secure project, since CMSE library is running the linker. It is not possible to finish the non-secure project linker with the secure project because the CMSE library is not ready.
|
|
|
|
Parent topic:Run a demo using Arm GCC
Run a TrustZone example application
When running a TrustZone application, the same prerequisites for J-Link/J-Link OpenSDA firmware, and the serial console as for the single core application, apply, as described in Run an example application.
To download and run the TrustZone application, perform steps 1 to 10, as described in Run an example application. These steps are common for both single core and TrustZone applications in Arm GCC.
Then, run these commands:
arm-none-eabi-gdb.exe
target remote localhost:2331
monitor reset
monitor halt
monitor exec SetFlashDLNoRMWThreshold = 0x20000
load
<install\_dir\>/boards/evkmimxrt595/trustzone\_examples/hello\_world/hello\_world\_ns/armgcc/debug/hello\_world\_ns.elf
load
<install\_dir\>/boards/evkmimxrt595/trustzone\_examples/hello\_world/hello\_world\_s/armgcc/debug/hello\_world\_s.elf
monitor reset
The application is now downloaded and halted. Execute the c
command to start the demo application.
|
|
|
|
Parent topic:Run a demo using Arm GCC