Control of a stepper motor for a press machine as an excercise to use Pigweed and Bazel.
- Make sure submodules have been cloned:
git submodule update
. - Bootstrap Pigweed with
source bootstrap.sh
(from the project root dir). - Install presubmit git-hooks with
pw presubmit --install
. - Modify
pw_malloc_freelist
to always link (checkCurrent Issues
section). - To build the application code:
bazel build //:app.elf
. - To run unit tests on app modules:
bazel test //src/app/...
. - To run clang-tidy from pw plugins:
pw tidy
. - To run clang-tidy manually:
- Update compile commands:
bazel run //:compile_commands_devices
. - Run clang-tidy for a single file (currently failing):
run-clang-tidy -use-color=1 src/main.cc
.
- Update compile commands:
-
Code won't link without adding
alwayslink = 1
to thepw_malloc_freelist
rule inthird_party/pigweed/pw_malloc_freelist/BUILD.bazel
.- The link errors flag undefined references to
__wrap__malloc_r
,__wrap__realloc_r
and__wrap__free_r
- The link errors flag undefined references to
-
clang-tidy is not working properly.
pw tidy
plugin command runs bazel for//:compile_commands_device
to generate compile commands and runsrun-clang-tidy
for those files, butcompile_commands.json
list is missing references to system include paths, causing system includes to not be found.
- Bootstrapping configuration to enable Pigweed environment is very cumbersome and difficult to get right without many iterations over python exceptions. There are no simple examples online on how to do so.
- No clear guidance on how to create pw plugins.
- No native support for clang-tidy (similar to what is available on GN).
- No pw watch in Bazel.