Converts STM32CUBEMX Projects to bazel projects. This is acheived by making use of the generated .gpdsc files from stm32cubemx and outputing these in a bazel build file.
This project is in the early developement stage with fairly minimal but well tested functionality.
Requires a valid golang installation
go get -u github.com/gobuffalo/packr/v2/packr2
packr2 install github.com/silvergasp/CubeMxToBazel
wget https://github.com/silvergasp/CubeMxToBazel/releases/download/v1.0-beta.1/CubeMxToBazel-linux.tar.gz
tar xvzf CubeMxToBazel-linux.tar.gz
mv CubeMxToBazel ~/bin/
Select the "Other Toolchains (GPDSC)" configuration for your project in 'project>settings'.
Running the generator is as simple as changing directories into the project and running the converter
cd YOUR_PROJECT_PATH_HERE
$GOPATH/bin/CubeMxToBazel
The output of this is not neccesarily nice to look at, it is recommended to use bazel auto formatter for this.
# Install Autoformatter
go install github.com/bazelbuild/buildtools/buildifier
# Run formatter on generated build file
$GOPATH/bin/buildifier BUILD
Build all targets
cd YOUR_PROJECT_PATH_HERE
bazel build ... --crosstool_top=@bazel_arm_none//tools/arm_compiler:toolchain --cpu=armeabi-v7a
The resulting binary executable and binary libraries can be found under YOUR_PROJECT_PATH_HERE/bazel-bin
. The resulting executable will be named YOUR_PROJECT_PATH_HERE/bazel-bin/main
.
NOTE: On first run this project will download the official arm compiler, as such it is expected that you have a strong internet connection. This downloaded compiler will be cached and does not require re-downloading provided that the arm_none_bazel rule in WORKSPACE
is not modified.
- [x] Converts generated
*.gpdsc
files from stm32cubemx into bazel BUILD files - [x] Generates bazel WORKSPACE files
- [ ] Generate appropriate bazel compiler flags for; fpu, cpu, hosting specs, optimisations (Currently supports armv7e devices with hardware fpu)
- [x] Implement conditional file inclusion (e.g. conditional inclusion of assembly files based on the compiler)