TQMa8MPxS - YOCTO Linux BSP documentation
This guide describes how to prepare, build and run a Cortex-M7 MCUXpresso hello world demo on STKa8MPxS with Windows and Linux.
Unless otherwise specified, the commands apply to both operating systems.
Prerequisites
Prepare Host System
On Windows Host
This section describes the installation of the following tools:
Download the installers and complete the installation wizards for Python and the ARM GNU Toolchain. If these tools are already installed, make sure their versions meet the version requirements mentioned above.
CMake and West will be installed after the workspace is set up.
Remember the installation directory for the ARM GNU Toolchain as this is important later on.
Set up a workspace directory in a local directory
mkdir workspace
cd workspace
The ARMGCC_DIR system variable must be set to the installation directory of the ARM GNU toolchain. (e.g. C:\Program Files (x86)\Arm\GNU Toolchain mingw-w64-i686-arm-none-eabi) This can be achieved in the Windows Settings → System → Advanced System Settings → Advanced → Environment Variables
On Linux Host
This section describes the installation of the following tools:
Python3 (including pip) (version 3.8 or above)
ARM GNU Toolchain (e.g. version 15.2rel1, use
AArch32 bare-metal target (arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi.tar.xz))
CMake (version 3.30 or above)
West (version 1.5.0 or above)
Ninja (version 1.13.0)
Install Python
sudo apt update
sudo apt install git python3-full python-is-python3 python3-pip
Install the ARM GNU Linux Toolchain
wget https://developer.arm.com/-/media/Files/downloads/gnu/15.2.rel1/binrel/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi.tar.xz
sudo tar --xz -xf arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi.tar.xz --directory /opt
rm arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi.tar.xz
Check the ~/.profile
cat ~/.profile
It should contain the following lines:
# set PATH so it includes user's private bin if it exists
PATH="$HOME/bin:$PATH"
# set PATH so it includes user's private bin for python if it exists
PATH="$HOME/.local/bin:$PATH"
Create an ARMGCC_DIR environment variable
export ARMGCC_DIR=/opt/arm-gnu-toolchain-15.2.rel1-x86_64-arm-none-eabi/
Note: The exported variable will be gone if the terminal is closed.
Set up the workspace directory
mkdir ~/workspace
cd ~/workspace
Set up Workspace
Go to the root workspace directory and then clone the Git Repository:
git clone https://github.com/tq-systems/mcuxsdk-examples-tq.git
Install necessary dependencies for the SDK:
pip install ninja jsonschema cmake west
pip install -r mcuxsdk-examples-tq/scripts/requirements.txt
Initialize the workspace
west init --local mcuxsdk-examples-tq
west update
Note: If the installed commands (e.g. west) are not recognized, their location needs to be added to PATH first.
For Windows, add the following to the system environment:
C:/Users/<Username>/AppData/Roaming/Python/Python3x/Scripts
For Linux, execute:
export PATH=$PATH:$HOME/.local/bin
Compile the Demo
Remove old builds if necessary
On Windows Host
On Linux Host
Build the demo
west build mcuxsdk-examples-tq/_boards/tqma8mpxs-mb-smarc-2/examples/demo_apps/hello_world --board tqma8mpxs-mb-smarc-2 -Dcore_id=cm7 -DBINARY_DIR=mcuxsdk-examples-tq/build -DCUSTOM_BOARD_ROOT="mcuxsdk-examples-tq/_boards" --config=debug --pristine
Build configuration and parameters:
Parameters:
-DBINARY_DIR: Location of the finished build artefacts
-DCUSTOM_BOARD_ROOT: Necessary for board definitions outside of the mcuxsdk directory.
-Dcore_id: Target core for the build (e.g. cm7, cm33).
--config: Optional, used to set the build configuration. Uses configuration debug by default.
--pristine: With this parameter, the build directory is cleaned before the build process.
Build Configurations:
| Build Configuration | Description |
| debug | Build for SRAM with full debug symbols and no optimization |
| release | Speed- and size-optimized build for internal memory |
The final build is located in ~/build/hello_world_cm7.xxx.
Run the Demo
Using U-Boot on the target
To run the hello world demo from U-Boot of the TQMa8MPxS, copy it into the SD-Card or use a USB flash drive.
Before starting the demo, connect a Micro-USB cable to X20 and a USB-to-RS232 cable to X40 of MB-SMARC-2 and open these two ports in a serial terminal. The first port will show the output of the Cortex-A53 and the second will show the demo output from the Cortex-M7.
In U-Boot, execute the commands below:
# when loading from usb
usb start
load usb 0:1 0x48000000 hello_world_cm7.bin
# or when loading from SD
fatload mmc 1:1 0x48000000 hello_world_cm7.bin
cp.b 0x48000000 0x7e0000 20000
bootaux 0x7e0000
Now, the Cortex-M7 terminal should print hello world.. Furthermore, any given character on the terminal is processed by the Cortex-M7 and gets echoed back to the terminal.
For debugging, hardware modifications on the SoM are needed. Debugging is currently not supported by
default.