Advanced command line based build and debug

This section is useful for developers who want to use command line based build and project less debug using CCS.

If you are using CCS projects or other IDE projects you can skip this section.

This page assumes you have read through and setup your environment for command line build as mentioned in Regenerate libraries using command line

Clean all libraries and examples

Important

Make sure to do make clean when switching between library only build and library+executables builds

Tip

When in doubt, if files are not being generated as expected, do make clean to clean everything and build from scratch.

Do below to clean all generated files

make clean

Build libraries and examples

Do below to build libraries and examples. If libraries or examples were previously built, this does an incremental build.

make all

Map SDK directory as a Drive

  • You may encounter long path CMake warnings like following:-

    The maximum full path to an object file is 250 characters (see CMAKE_OBJECT_PATH_MAX).
    Object file cannot be safely placed under this directory. The build may not work correctly.
    
  • In this case map your SDK directory to T:\mcu_sdk

    make map-sdk-drive
    
  • Now you can cd to T:\mcu_sdk and build the SDK

NOTE: This mapping is not persistent across reboot and hence need to be performed again after reboot.

Additional build options

Do below to see a brief help about all the build options

make help

Some build options are described below, feel free to explore options not listed below.

Granular builds

  • make all will build all selected toolchains, and all profiles.

    • debug profile has optimization disabled for easier debug.

    • release profile has optimization enabled for performance optimized production use.

  • During development it’s convenient to be able to build only what one is working on at that moment rather than building everything. This section has some tips to do granular builds to save your build time.

Build for only specific toolchains

See Enable toolchains to include in build

Build specific profile

For debug profile, do

make debug

For release profile, do

make release

Build specific libraries or examples

  • Do below to list all cmake examples (and library) targets. These can be used to only build specific examples (or libraries). Note, this will also build any dependent libraries as needed.

    make showtargets
    
  • This lists the examples (and library) targets for all toolchains(that are enabled), and all profiles.

  • Copy paste the line of interest, from above output, and execute it on the command line.

e.g to build empty example for TI toolchain and debug profile do

cmake --build  build/am13e232x/m33_ti_arm_clang_debug --target ex_empty_lp.elf

Launching SysConfig GUI from command line for an example

For examples that use SysConfig, you may want to open the SysConfig GUI for that example SysConfig file to inspect or modify.

Do below for the same

  • Identify the example path of interest. Examples are organized as examples/{example_type}/{example_name}/{board}/{cpu}_{os}

e.g examples/driverlib/gpio/gpio_toggle_output/am13e232x_lp/m33_nortos

  • Open a command prompt at this path. There should be a file named makefile_syscfg_gui.mk. If this file is not present, it means this example is not based on SysConfig

  • Do below to launch SysConfig GUI for that examples SysConfig file

    make -f makefile_syscfg_gui.mk
    
  • Make any modifications and save the SysConfig file in GUI

  • Build the example as shown earlier

  • After build, generated SysConfig files are located at examples/{example_type}/{example_name}/{board}/{cpu}_{os}/cmake_syscfg_generated/

Load and run the built examples via debugger like CCS

The built examples binary files (.elf) are located under build/{device}/{cpu}_{toolchain}_{profile}/ directory with the same sub-directory structure as that of the examples source file.

e.g build/am13e232x/m33_ti_arm_clang_debug/examples/empty/am13e232x_lp/m33_nortos/ex_empty_lp.elf for examples/empty/am13e232x_lp/m33_nortos

You can load and run these binaries using CCS Project-less debug. For other IDEs, refer to your IDE user guide for help with Project-less debug.

Refer CCS Project-less Debug (AM13E2X) for brief steps to setup a Project-less debug session in CCS IDE.