NOTE: This project is designed for CMake to build. It will be very hard to move it to Arduino IDE.
LogisticsRobot.ino
is the main source code file includingsetup()
andloop()
.cmake
contains CMake scripts for configuring Arduino SDK and generating makefile.modules
stores all source files of submodules of this project. Each submodule has its own folder.
- Any MinGW 64 toolchain. It's recommended to use MSYS2. CLion has bundled an available MinGW.
- A CMake available in PATH. It's recommended to use scoop to install. CLion has bundled an available CMake.
- Official Arduino IDE.
Steps:
-
Open
CMakeLists.txt
, modify the names inCustom settings
. -
Open
cmake/ArduinoToolchain.cmake
, check or modify the path and target board inEnvironment settings
to fit your system environment. -
Create a directory
build
and open a terminal (Powershell is recommended) in it. -
Run cmake initialization command. Note that:
- To build a debug binary for performance testing and debugging, use
-DCMAKE_BUILD_TYPE=Debug
flag, otherwise use-DCMAKE_BUILD_TYPE=Release
flag. - Use
-G "CodeBlocks - MinGW Makefiles"
to build a MinGW makefile. - Use
-DCMAKE_MAKE_PROGRAM="...\mingw32-make.exe"
to specify the making tool. In MSYS2, it is in...\MSYS64\mingw64\bin
.
Here is an example:
cmake -G "CodeBlocks - MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM="...\MSYS64\mingw64\bin\mingw32-make.exe" ..
Do not miss the last
..
. - To build a debug binary for performance testing and debugging, use
-
If no error occurs, run
...\mingw32-make.exe
to build the binary. If it works, you will see message like this and will find a.hex
file:... Generating EEP image Generating HEX image Calculating image size Firmware Size: ... EEPROM Size: ... [100%] Built target ...