/stm32_cmake

CMake template for STM32 projects

Primary LanguageCMIT LicenseMIT

STM32 CMake Project Template

This template has been tested in Linux. Additional adjustments may be required for use in Windows.

How to compile code

Prerequisite:

This cmake setup assumes the gcc-arm-none-eabi toolchain has been set up correctly in your system.

Generally there are two ways to set up the toolchain:

  1. Install using the package manager

    $ sudo apt install gcc-arm-none-eabi
    
  2. Download the toolchain binaries and add its directory to system path

Now you can try to compile the sample project using the cmake template.

$ cd <path-of-this-repo>
$ mkdir build && cd build
$ cmake ..
$ make -j

If the "cmake .." step runs successfully, you should see something similar to the below screenshot:

cmake step

Then you can continue to actually compile the code and you can expect a similar result:

cmake step

You can find the compiled .elf, .hex and .bin binary files in "build/src".

Reference: