MSPM0 Environment Setup
An MSPM0 project builds on the TI MSPM0 SDK and SysConfig, with CMake, Ninja and the GNU Arm Embedded Toolchain (compiler prefix arm-none-eabi-). The BSPs bsp-mspm0g3507-mini and bsp-mspm0g3519-mini are fully buildable projects and serve as the examples on this page; Code Generation describes how libxr mspm0 setup generates LibXR code in such a project.
For a quick start the Docker image ghcr.io/xrobot-org/docker-image-mspm0:main is recommended, see Docker Build below.
Base Environment
A local build installs:
- CMake (3.20 or newer) and Ninja
arm-none-eabi-gcc(GNU Arm Embedded Toolchain)- TI MSPM0 SDK
- The SysConfig standalone installation, whose
sysconfig_cliis the command-line entry point
The CMake project finds the SDK and SysConfig through two variables, named after the SDK's imports.mak; environment variables and the CMake cache (-D) both work:
MSPM0_SDK_INSTALL_DIR: the MSPM0 SDK rootSYSCONFIG_TOOL: the full path of the SysConfig command line,sysconfig_cli.baton Windows andsysconfig_cli.shon Linux
A Windows PowerShell example:
$env:MSPM0_SDK_INSTALL_DIR = "C:\ti\mspm0_sdk_2_11_00_07"
$env:SYSCONFIG_TOOL = "C:\ti\sysconfig_1.28.1\sysconfig_cli.bat"
Project Layout
The BSP directory structure:
.
|-- CMakeLists.txt
|-- CMakePresets.json
|-- main.c
|-- mspm0g3507_minidb48.syscfg
|-- cmake/
| |-- LibXR.CMake
| |-- MSPM0SysConfig.cmake
| `-- arm-none-eabi-gcc.cmake
|-- User/
| |-- app_main.cpp
| `-- libxr_config.yaml
|-- Modules/
`-- libxr/
main.csits in the project root, calls the SysConfig-generatedSYSCFG_DL_init()for the clocks, pins and peripherals, and then entersapp_main()- The
.syscfgfile is the SysConfig project, in the project root; it describes the device, clocks, pins and peripherals cmake/MSPM0SysConfig.cmakeruns the SysConfig command line at the CMake configure step and generatesti_msp_dl_config.c/.h,device.opt, the linker script and the rest into the build directory; CMake tracks changes to the.syscfgand regenerates on the next buildUser/holds the generatedapp_main.cppandlibxr_config.yamllibxr/is the LibXR submodule
CMake Integration
cmake/LibXR.CMake brings LibXR into the project with three variables:
set(LIBXR_SYSTEM None)
set(LIBXR_DRIVER mspm0)
set(LIBXR_NO_EIGEN True)
LIBXR_SYSTEM None is the bare-metal system and LIBXR_DRIVER mspm0 enables the LibXR driver/mspm0 driver directory. The link options are those of the SDK example gcc makefiles (-nostartfiles, --specs=nano.specs, --specs=nosys.specs), and __dso_handle, _getpid and _kill, which the C++ runtime then lacks, are provided as weak definitions by the LibXR driver/mspm0/mspm0_syscalls.c; a project can define its own.
Build
CMakePresets.json provides the debug and release presets (Ninja generator, toolchain file cmake/arm-none-eabi-gcc.cmake). The BSP uses XRobot Modules, so xrobot setup runs once before configuring; it fetches the Modules from xrobot.lock and generates Modules/CMakeLists.txt (installing xrobot is described in Environment Setup):
xrobot setup
cmake --preset debug
cmake --build --preset debug
The artifacts land in build/debug/: mspm0_minidb48.elf, .hex and .bin.
Docker Build
The image ghcr.io/xrobot-org/docker-image-mspm0:main ships arm-none-eabi-gcc, CMake, Ninja, the MSPM0 SDK and SysConfig, with MSPM0_SDK_INSTALL_DIR and SYSCONFIG_TOOL already set:
docker run --rm -v "$PWD:/work" -w /work ghcr.io/xrobot-org/docker-image-mspm0:main \
bash -c 'pip install xrobot==1.0.1 && xrobot setup && cmake --preset release && cmake --build --preset release'
FAQ
CMake configuration reports the MSPM0 SDK or SysConfig missing
The configure step checks both variables: MSPM0_SDK_INSTALL_DIR should contain .metadata/product.json, and SYSCONFIG_TOOL should point at the sysconfig_cli script itself. A failed check ends the configuration with an error that includes the current variable value; fix the variable through the environment or -D as the message suggests and configure again.