This is an Stm32 project template that uses Rake, rather than Make, for its build tool.
Rake is an internal Domain Specific Language (DSL) which gives it an advantage to traditional build tools like Make. Rake has the full power of the Ruby programming language behind it. This allows you to easily integrate interesting tasks and scripts into your project. Consolidating your build tool into a general purpose programming language means easier installation, unified functionality, and one less language to remember.
-
Install Ruby
-
Install latest Ruby Rake gem:
gem install rake
-
Install Arm GCC. Ensure the path to
arm-none-eabi-gcc.exe
is added to your PATH system environment variable. -
Verify arm-none-eabi-gcc command is recognized in command prompt:
arm-none-eabi-gcc --version
-
Install ST-Link. Ensure the path to
st-flash.exe
is added to your PATH system environment variable. -
Verify st-flash command is recognized in command prompt:
st-flash --version
TBD
-
Install Ruby:
sudo apt install ruby
-
Install latest Ruby Rake gem:
sudo gem install rake
-
Install Arm GCC:
sudo apt install gcc-arm-none-eabi
-
Install ST-Link:
sudo apt install stlink-tools
rake --tasks
Build debug HEX image:
rake debug:hex
Flash debug HEX image to target:
rake stlink:flash:debug
The target should now blink its LED to verify correct functionality.
STM32F303RE is the defaulted target. The .ioc
file in the project allows you to generate additional code for this device. STM32CubeMX can also generate code for any other STM32Fx device. After generating a new project with STM32CubeMX, copy the Rakefile
and rakelib
folder to the new directory. Then refer to the table below to copy the variables from the new projects Makefile to the Rakefile.
Makefile | Rakefile |
---|---|
C_SOURCES | SOURCES |
ASM_SOURCES | SOURCES |
C_INCLUDES | INCLUDES |
C_DEFS | DEFINES |
MCU | TARGET[:mcu_args] |
FPU | TARGET[:mcu_args] |
FLOAT-ABI | TARGET[:mcu_args] |
LDSCRIPT | TARGET[:ld_script] |
Once the Rakefile works you can remove the Makefile from the project.
Please note this projects license does not cover:
- Any drivers/modules in the
drivers
folder. - Any code generated by STMCubeMX.
Please refer to the specific licensing of that project/driver/module.
ADVI.CODES - Rake Tutorials
ElectronVector - blog-rake-gcc-depends
ThrowTheSwitch - arduino_c_scaffold