TommyLau / stm32_cmake

CMake template for STM32 projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

About

CMake template for STM32 projects

License:MIT License


Languages

Language:C 96.2%Language:Assembly 3.8%Language:C++ 0.1%Language:CMake 0.0%Language:Makefile 0.0%Language:GDB 0.0%