Embedded module TQMa117xL
Building Examples (Visual Studio Code)
Below you can choose your operating system to use the corresponding guide to build example projects for the TQMa117xL
Preface
The aim is to create a reproducible build chain for a “Hello World” demo on the Cortex-M7 core of the TQMa117xL using VS code under Ubuntu 24.04.
The following regarding the OS is necessary:
- Ubuntu 24.04 (64-bit), kept up-to-date.
- Super user rights for tool installations and system changes.
Prerequisites
Software Versions
Building under Windows has been tested with the following software and versions.
Tool | Version |
---|---|
GitHub Repository | MBa117xL.SW.MCU.BSP |
VS-Code | Version 1.88.1 |
NXP's MCUXpresso SDK | MCUX_2.14.0_UPDATE_ENHC1 |
CMAKE | Version 3.27.4 |
West | Version 1.0.0 |
Python | Version 3.10.4 |
Segger J-Link for debugging | Version v7.92l |
Download MinGW for Windows | v13.1.0 |
VS-Code-Extentions
In order to build and debug the examples via VS-Code you need to add the following VS-Code extentions.
Extention | Version |
---|---|
ms-vscode.cmake-tools | CMake tools (from Microsoft): v1.16.3 |
marus25.cortex-debug | Cortex-Debug (from marus25): v1.12.0 |
Setup Host System and VS-Code
Setup Host
1. Install Python3 (needed for west and helper scripts)
sudo apt install python3 python3-pip python3-venv -y
3. Setup Virtual Enviroment
python3 -m venv ~/mba117xl-env source ~/mba117xl-env/bin/activate
2. Install Arm GNU Toolchain Download from: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
sudo apt install gcc-arm-none-eabi
3. Install CMake
sudo apt install cmake -y
4. (Optional) Install SEGGER J-Link for Debugging
Setup Project
Setup Project
Clone the TQMa117xL demo repository:
mkdir -p ~/workspace/NXP cd ~/workspace git clone https://https://github.com/tq-systems/MBa117xL.SW.MCU.BSP.git cd MBa117xL.SW.MCU.BSP git checkout MBa117xL.SW.MCU.BSP.0003 -b tqma117xl-bsp
Clone NXP MCUXpresso SDK via West:
pip3 install west cd dependencies west init -m https://github.com/NXPmicro/mcux-sdk --mr MCUX_2.16.000 mcuxsdk cd mcuxsdk west update
ATTENTION: This step is absolutely necessary!
cp ../replace_include_guards.py ./
After downloading the SDK from NXP using West, the Python script replace_include_guards.py must be run once. This is required because targets set to global cannot be built in the same build folder due to the existing include guards in the CMake files in the NXP SDK.
cd ..
python3 replace_include_guards.py
VS-Code additional step:
When using Visual Studio Code as your development environment, the `.vscode` folder plays a critical role in configuring how your project is built and debugged.
These files inside the `.vscode` folder are specific to your local development environment.
.vscode/ ├── settings.json → Environment vars and toolchain path ├── launch.json → Debug configuration (e.g. for J-Link) ├── cmake-variants.yaml → Build variants (Debug/Release + bootDisk)
Place the `.vscode` folder under:
mv ~/workspace/MBa117xL.SW.MCU.BSP/templates .vscode
You can use the templates provided in the `templates/` folder of the repository as a starting point. Open VS-Code
code .
Building examples
Building
After fulfilling the preparations, VS-Code should be displaying the CMake-Tools option on the lower bar. In order to build a target, select the build variant by clicking on the corresponding option. You can also select your target by clicking on "set default build target".
Click after selection of the desired options on "Build" to build your target(s).
Optionally you can choose the target within the CMake-menu-bar.
Preface
The aim is to create a reproducible build chain for a “Hello World” demo on the Cortex-M7 core of the TQMa117xL using VS code under Windows 11.
The following regarding the OS is necessary:
- Windows 11 (64-bit), kept up-to-date.
- Administrator rights for tool installations and system changes.
Keep in mind that the paths specified in these instructions refer to the test system. Your paths may differ.
Prerequisites
Software Versions
Building under Windows has been tested with the following software and versions.
Tool | Version |
---|---|
GitHub Repository | MBa117xL.SW.MCU.BSP |
VS-Code | Version 1.88.1 |
NXP's MCUXpresso SDK | MCUX_2.14.0_UPDATE_ENHC1 |
CMAKE | Version 3.27.4 |
West | Version 1.0.0 |
Python | Version 3.10.4 |
Segger J-Link for debugging | Version v8.83 |
Download MinGW for Windows | v13.1.0 |
VS-Code-Extentions
In order to build and debug the examples via VS-Code you need to add the following VS-Code extentions.
Extention | Version |
---|---|
ms-vscode.cmake-tools | CMake tools (from Microsoft): v1.16.3 |
marus25.cortex-debug | Cortex-Debug (from marus25): v1.12.0 |
Setup Host System and VS-Code
Setup
Install Tools & Dependencies
- Git (latest version):
- Download: https://git-scm.com/download/win
- Installation: Default settings, ensure Git is added to PATH.
- After installation, open Git Bash or PowerShell and run:
git config --global core.longpaths true
(to minimize issues with long paths during Git operations).
- Python (Version ≥ 3.10):
- Installation: Important: Enable “Add Python to PATH” or “Add python.exe to PATH”.
- CMake (Version ≥ 3.20):
- Download: https://cmake.org/download/ (Windows x64 Installer).
- Installation: Important: Select “Add CMake to the system PATH for all users” (or “for current user”).
- ARM GNU Toolchain (Version 14.2.rel1):
- Download:ARM Developer Website (Version 14.2.rel1 for AArch32 bare-metal target (arm-none-eabi), x86_64-hosted Windows ZIP).
- Installation: Create C:\opt and extract the archive there. The path should be: C:\opt\arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.
- Install MinGW:
- Download: https://sourceforge.net/projects/mingw/
- Follow instructions (e.g., from NXP's documentation: https://github.com/nxp-mcuxpresso/mcux-sdk/blob/main/docs/run_a_project_using_armgcc.md).
- Add its bin directory to the system PATH variable (e.g., <Path to MinGW>/MinGW/bin).
- Segger J-Link Software (Version ≥ v8.83):
- Download: https://www.segger.com/downloads/jlink/ (“J-Link Software and Documentation Pack” for Windows).
- Installation: Default path (e.g., C:\Program Files\SEGGER\JLink_V838).
- Visual Studio Code:
- (If you don't have it already) Download: https://code.visualstudio.com/
- Installation: Standard, “Add to PATH” is good.
- Install the necessary extentions listed here VS-CODE-Extentions
Configure Windows for Long Paths (IMPORTANT)
- Open Registry Editor: Windows key, type regedit, run as administrator.
- Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
- Create/modify value LongPathsEnabled:
- Look for LongPathsEnabled. If present, double-click and set the value to 1.
- If not present: Right-click → New → DWORD (32-bit) Value → Name LongPathsEnabled → Set value to 1.
Set Environment Variables
- Windows key, type “Environment Variables”, select “Edit the system environment variables”.
- Button “Environment Variables…”.
- Under “System variables” (recommended) or User variables:
- New: Variable ARMGCC_DIR, Value C:\opt\arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi
- Edit Path and add the following entries as separate lines (adjust paths if necessary):
- %ARMGCC_DIR%\bin
- C:\Program Files\CMake\bin
- C:\Program Files\SEGGER\JLink_V838
- Paths to Python (e.g., C:\Users\YourUser\AppData\Local\Programs\Python\Python310 and …\Python310\Scripts) should have been set by the installer in your user variables.
Check
To make sure everything is set correctly use the following commands in a new PowerShell terminal:
Get-Command arm-none-eabi-gcc | Select-Object -ExpandProperty Source Get-Command mingw32-make | Select-Object -ExpandProperty Source # oder make, je nach Installation Get-Command cmake | Select-Object -ExpandProperty Source Get-Command python | Select-Object -ExpandProperty Source Get-Command JLinkGDBServerCL | Select-Object -ExpandProperty Source echo $env:ARMGCC_DIR
If everything is correct, the output should be looking something like this:
PS C:\Users\TQ-Embedded> Get-Command mingw32-make | Select-Object -ExpandProperty Source # oder make, je nach Installation C:\MinGW\bin\mingw32-make.exe PS C:\Users\TQ-Embedded> Get-Command arm-none-eabi-gcc | Select-Object -ExpandProperty Source C:\opt\arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi\bin\arm-none-eabi-gcc.exe PS C:\Users\TQ-Embedded> PS C:\Users\TQ-Embedded> Get-Command cmake | Select-Object -ExpandProperty Source C:\Program Files\CMake\bin\cmake.exe PS C:\Users\TQ-Embedded> Get-Command python | Select-Object -ExpandProperty Source C:\Users\TQ-Embedded\AppData\Local\Programs\Python\Python313\python.exe PS C:\Users\TQ-Embedded> Get-Command JLinkGDBServerCL | Select-Object -ExpandProperty Source C:\Program Files\SEGGER\JLink_V762c\JLinkGDBServerCL.exe PS C:\Users\TQ-Embedded> PS C:\Users\TQ-Embedded> echo $env:ARMGCC_DIR C:\opt\arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi
Adjust PowerShell Execution Policy
- If PowerShell scripts cannot be executed:
- Start PowerShell as Administrator.
- Command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Confirm with Y (or A for Yes to All).
Setup Project
Setup Project
Create Workspace
mkdir C:\workspace
cd C:\workspace
Clone the TQMa117xL demo repository:
git clone https://github.com/tq-systems/MBa117xL.SW.MCU.BSP.git cd MBa117xL.SW.MCU.BSP git checkout MBa117xL.SW.MCU.BSP.0003 -b tqma117xl-bsp
Set up Python Virtual Environment
This isolates the Python tools for this project.
python -m venv .tqma117xl
.\.tqma117xl\Scripts\Activate.ps1
Clone NXP MCUXpresso SDK via West:
pip install west cd dependencies west init -m https://github.com/NXPmicro/mcux-sdk --mr MCUX_2.16.000 mcuxsdk cd mcuxsdk west update
ATTENTION: This step is absolutely necessary!
cp ../replace_include_guards.py ./
After downloading the SDK from NXP using West, the Python script replace_include_guards.py must be run once. This is required because targets set to global cannot be built in the same build folder due to the existing include guards in the CMake files in the NXP SDK.
cd ..
python.exe replace_include_guards.py
VS-Code additional step:
When using Visual Studio Code as your development environment, the `.vscode` folder plays a critical role in configuring how your project is built and debugged.
These files inside the `.vscode` folder are specific to your local development environment.
.vscode/ ├── settings.json → Environment vars and toolchain path ├── launch.json → Debug configuration (e.g. for J-Link) ├── cmake-variants.yaml → Build variants (Debug/Release + bootDisk)
Place the `.vscode` folder under:
cd .. mv C:\workspace\MBa117xL.SW.MCU.BSP\templates .vscode
You can use the templates provided in the `templates/` folder of the repository as a starting point. Open VS-Code
code .
Below you can find a example 'settings.json' and a 'launch.json'
settings.json
{ /* CMake configurations */ "cmake.configureOnOpen": false, "cmake.preferredGenerators": [ "Ninja", "Unix Makefiles", "MinGW Makefiles" ], "cmake.generator": "MinGW Makefiles", "cmake.environment": { "ARMGCC_DIR": "C:\\opt\\arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi" //Under Linux: "ARMGCC_DIR": "/opt/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi", //"MCUXSDK_ROOT": "C:\\nxp\\mcuxsdk" //can be used as alternative path for the sdk }, "cmake.buildDirectory": "${sourceDirectory}/build", "cmake.configureSettings": { "CMAKE_TOOLCHAIN_FILE": "dependencies\\mcuxsdk\\core\\tools\\cmake_toolchain_files\\armgcc.cmake" }, /* Debugger configurations */ "cortex-debug.gdbPath": "C:\\opt\\arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi\\bin\\arm-none-eabi-gdb.exe", "cortex-debug.armToolchainPath": "C:\\opt\\arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi\\bin\\", "cortex-debug.JLinkGDBServerPath": "C:\\Program Files\\SEGGER\\JLink_V838\\JLinkGDBServerCL.exe", "cortex-debug.variableUseNaturalFormat": true, /*Styling configurations*/ "files.insertFinalNewline": true, "files.trimFinalNewlines": true }
launch.json
{ "inputs": [ { "type": "pickString", "id": "app", "description": "choose your app", "options": [ "demo_hello_world", "demo_gpio_led", "demo_flexcan", "demo_digital_io", "demo_afe", "demo_rs485", "demo_sdcard", "demo_RTC", "demo_eeprom", "demo_iot", "demo_usb", "demo_PMIC", "demo_spi_flash", "demo_SE97BTP", "demo_display_dsi", "demo_ethernet_qos", "demo_ethernet_1g" ] } ], "configurations": [ { "showDevDebugOutput": "both", "type": "cortex-debug", "request": "launch", "name": "Debug J-Link Ram", "cwd": "${workspaceFolder}", "servertype": "jlink", "device": "MIMXRT1176xxxA_M7", "interface": "jtag", "executable": "${workspaceFolder}\\build\\dist\\Debug\\TQMa1176xL_${input:app}.elf", "serverArgs": [ "-endian", "little", "-LocalhostOnly", "-speed", "4000" ], "postLaunchCommands": [ "target remote localhost:50000", "monitor reset", "monitor halt", "load" ] }, { "showDevDebugOutput": "both", "type": "cortex-debug", "request": "launch", "name": "Debug J-Link Nor-Flash", "cwd": "${workspaceFolder}", "servertype": "jlink", "device": "MIMXRT1176xxxA_M7", "interface": "jtag", "executable": "${workspaceFolder}\\build\\dist\\Debug\\Flash\\TQMa1176xL_${input:app}.elf", "serverArgs": [ "-endian", "little", "-LocalhostOnly", "-speed", "4000", "-device", "MIMXRT1176xxxA_M7?BankAddr=0x30000000&Loader=nCS@AD18_CLK@AD19_D0@AD20_D1@AD21_D2@AD22_D3@AD23&BankAddr=0x60000000&Loader=nCS@SDB100_CLK@SDB101_D0@SDB102_D1@SDB103_D2@SDB104_D3@SDB105" ], "postLaunchCommands": [ "monitor reset" ] }, { "showDevDebugOutput": "both", "type": "cortex-debug", "request": "launch", "name": "Debug J-Link SD-Ram-Flash", "cwd": "${workspaceFolder}", "servertype": "jlink", "device": "MIMXRT1176xxxA_M7", "interface": "jtag", "executable": "${workspaceFolder}\\build\\dist\\Debug\\SD-Ram-Flash\\TQMa1176xL_${input:app}.elf", "serverArgs": [ "-endian", "little", "-LocalhostOnly", "-speed", "4000", "-device", "MIMXRT1176xxxA_M7?BankAddr=0x30000000&Loader=nCS@AD18_CLK@AD19_D0@AD20_D1@AD21_D2@AD22_D3@AD23&BankAddr=0x60000000&Loader=nCS@SDB100_CLK@SDB101_D0@SDB102_D1@SDB103_D2@SDB104_D3@SDB105" ], "postLaunchCommands": [ "monitor reset" ] } ] }
Building examples
Building
After fulfilling the preparations, VS-Code should be displaying the CMake-Tools option on the lower bar.
- In order to build a target, select the build variant by clicking on the corresponding option in the lower bar or by selecting the CMake-Tool icon on the left hand side.
- Choose the correct compiler (GCC 14.2.1 arm-none-eabi) and the desired build variant under “Configure”
- Select the example application you wish to build in the “Build” option tab.
- Finaly click “Build” in the lower bar.
- The generated build files will be placed under C:\workspace\MBa117xL.SW.MCU.BSP\build\dist\Debug or C:\workspace\MBa117xL.SW.MCU.BSP\build\dist\Release