TQMa93xxLA - YOCTO Linux BSP documentation

WORK IN PROGRESS

  • Ubuntu 22.04 Host System (virtual machine with usb passthrough or native)
  • Segger J-Link Debugger
sudo apt update  
sudo apt install git python3-full python-is-python3 python3-pip
   Download the Debian package from the Segger website [[https://www.segger.com/downloads/jlink/JLink_Linux_V762c_x86_64.deb|https://www.segger.com/downloads/jlink/JLink_Linux_V762c_x86_64.deb]] and install the debian package afterwards. 
cd ~/Downloads 
sudo dpkg -i JLink_Linux_V762c_x86_64.deb

Patch required for Segger JLink is available on the NXP website:
https://www.nxp.com/webapp/sps/download/license.jsp?colCode=SDK_MX93_3RDPARTY_PATCH&appType=file1&DOWNLOAD_ID=null
Download and extract the archive e.g to the home folder. Afterwards the iMX93 folder has to be copied to the Segger JLink installation and a new device entry has to made in the JLinkDevices.xml.

  • Extract SDK_MX93_3RDPARTY_Patch and copy i.MX93 folder.
mkdir -p ~/sdk_mx93_3rdparty_patch
unzip ~/Downloads/SDK_MX93_3RDPARTY_PATCH.zip -d ~/sdk_mx93_3rdparty_patch
unzip ~/sdk_mx93_3rdparty_patch/JLink.zip -d ~/sdk_mx93_3rdparty_patch/
sudo cp -r ~/sdk_mx93_3rdparty_patch/JLink/Devices/NXP/iMX93 /opt/SEGGER/JLink_V762c/Devices/NXP/
  • Create new entry for i.MX93 Cortex M33 in /opt/SEGGER/JLink_V762c/JLinkDevices.xml, to do so add the following lines below line 300 in JLinkDevices.xml.
<!--  iMX9   -->
<!--         -->
<Device>
<ChipInfo Vendor="NXP" Name="MIMX9352_M33" Core="JLINK_CORE_CORTEX_M33" WorkRAMAddr="0xFFE0000" WorkRAMSize="0x00080000" JLinkScriptFile="Devices/NXP/iMX93/NXP_iMX93_Connect_CortexM33.JLinkScript" Aliases="MIMX9351_M33; MIMX9332_M33; MIMX9331_M33; MIMX9322_M33; MIMX9321_M33; MIMX9312_M33; MIMX9311_M33; MIMX9302_M33; MIMX9301_M33"/>
</Device>    

Example after adding new entry in JLinkDevices.xml

...
  <Device>
    <ChipInfo Vendor="NXP" Name="MIMX8ML8_M7" Core="JLINK_CORE_CORTEX_M7" JLinkScriptFile="Devices/NXP/iMX8ML/NXP_iMX8M_Connect_CortexM7.JLinkScript" />
  </Device>
<!--  iMX9   -->
<!--         -->
<Device>
<ChipInfo Vendor="NXP" Name="MIMX9352_M33" Core="JLINK_CORE_CORTEX_M33" WorkRAMAddr="0xFFE0000" WorkRAMSize="0x00080000" JLinkScriptFile="Devices/NXP/iMX93/NXP_iMX93_Connect_CortexM33.JLinkScript" Aliases="MIMX9351_M33; MIMX9332_M33; MIMX9331_M33; MIMX9322_M33; MIMX9321_M33; MIMX9312_M33; MIMX9311_M33; MIMX9302_M33; MIMX9301_M33"/>
</Device>    
  <!--                 -->
  <!-- NXP (iMXRT105x) -->
  <!--                 -->
...

Download and install ARM toolchain.

wget https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz
sudo tar --xz -xf arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz --directory /opt
rm arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz
wget https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip
mkdir -p ~/bin
gunzip -c ninja-linux.zip > ~/bin/ninja
chmod +x ~/bin/ninja
rm ninja-linux.zip

Check that the following is available in the ~./profile

cat ~/.profile
# 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"
The toolchain path has to be exported everytime a new shell is opened.
export ARMGCC_DIR=/opt/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi
python -m venv .venv
source .venv/bin/activate
pip install west
pip install cmake

Create new workspace folder and navigate to it.

mkdir ~/workspace
cd ~/workspace 
# Initialize west with the manifest repository
west init -m https://github.com/nxp-mcuxpresso/mcuxsdk-manifests/ mcuxpresso-sdk --mr v25.03.00
# Update the west projects
cd mcuxpresso-sdk
west update
cd mcuxsdk
pip install -r scripts/requirements.txt

TQ provides a patch series to extend the MCUXpresso by the STKa93xx.

mkdir ~/tqma93xx-mcusdk-patches
wget https://support.tq-group.com/_media/dl/tqma93-mcusdk-patches.tar.gz
tar xvzf tqma93-mcusdk-patches.tar.gz -C ~/tqma93xx-mcusdk-patches
cd ~/workspace/mcuxpresso-sdk/mcuxsdk/examples/ 
git am ~/tqma93xx-mcusdk-patches/0001-_boards-mcimx93evk-board_runner.cmake-use-SEGGER-ups.patch
git am ~/tqma93xx-mcusdk-patches/0002-demo_apps-hello_world-add-fallback-for-missing-BOARD.patch
git am ~/tqma93xx-mcusdk-patches/0003-demo_apps-hello_world-print-banner-using-BOARD_NAME.patch
git am ~/tqma93xx-mcusdk-patches/0004-_boards-add-tqma93xx-mba93xxca.patch
# list compatible boards for hello world build  
west list_project -p demo_apps/hello_world

#  prepare cmake for board / project / configuration / processor
west build -b tqma93xx-mba93xxca demo_apps/hello_world --config debug -Dcore_id=cm33 --cmake-only -p

# configure project 
west build -t menuconfig

# compile project
west build

Leave the terminal open, it will be used later to debug the application.

Connect Starterkit to Host as described in the STKa93xxLA Quickstart Guide and open a new terminal with second COM Port Device to receive the serial output from Cortex M33.

Open a new terminal to start the debug server and leave the terminal open after the server has been started.

source .venv/bin/activate
export ARMGCC_DIR=/opt/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi
cd ~/workspace/mcuxpresso-sdk/mcuxsdk
west debugserver -r jlink

Use the terminal which as been used to build the Hello World application and execute the commands below to start debugging it.

west debug -r jlink --tui
monitor reset
monitor halt
load
monitor go