Skip to content

This project is a template for using rake to build STM32 embedded projects.

License

Notifications You must be signed in to change notification settings

Ackleberry/stm32f3xx_c_scaffold

Repository files navigation

About:

This is an Stm32 project template that uses Rake, rather than Make, for its build tool.

Why switch to Rake?:

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.

Getting Started:

Windows Setup Instructions:

  1. Install Ruby

  2. Install latest Ruby Rake gem:

    gem install rake

  3. Install Arm GCC. Ensure the path to arm-none-eabi-gcc.exe is added to your PATH system environment variable.

  4. Verify arm-none-eabi-gcc command is recognized in command prompt:

    arm-none-eabi-gcc --version

  5. Install ST-Link. Ensure the path to st-flash.exe is added to your PATH system environment variable.

  6. Verify st-flash command is recognized in command prompt:

    st-flash --version

OSX Setup Instructions:

TBD

Linux Setup Instructions:

  1. Install Ruby:

    sudo apt install ruby

  2. Install latest Ruby Rake gem:

    sudo gem install rake

  3. Install Arm GCC:

    sudo apt install gcc-arm-none-eabi

  4. Install ST-Link:

    sudo apt install stlink-tools

List All Tasks:

rake --tasks

Example:

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.

Porting Scaffold to Other STM32Fx Targets:

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.

Licensing:

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.

Acknowledgements:

ADVI.CODES - Rake Tutorials

ElectronVector - blog-rake-gcc-depends

ThrowTheSwitch - arduino_c_scaffold

About

This project is a template for using rake to build STM32 embedded projects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages