Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds initial Bazel support for Drivers #25

Closed

Conversation

nathaniel-brough
Copy link

This PR adds initial support for using the Bazel build system with stm32cubewl. This approach allows this repository and the targets specified in the Bazel build files to be fetched remotely with local configuration.

If required, I'm happy to provide some documentation to supplement this. Though I could do with some guidance in terms of where and what format the documentation should be in.

Alternatively, these build definitions can be placed in the third_party_libs, directory of this repository.

@nathaniel-brough nathaniel-brough force-pushed the main branch 2 times, most recently from f28c6fd to 58f4bbd Compare November 4, 2021 02:25
@RKOUSTM RKOUSTM added the enhancement New feature or request label Nov 15, 2021
@RKOUSTM RKOUSTM self-assigned this Nov 15, 2021
@RKOUSTM RKOUSTM added the help wanted Extra attention is needed label Nov 15, 2021
@RKOUSTM
Copy link
Contributor

RKOUSTM commented Nov 15, 2021

Hi @silvergasp,

Thank you for your contribution. This issue will be discussed with our development teams. We will be back to you as soon as we get an answer.

Thank you for you again for your contribution.

With regards,

@nathaniel-brough
Copy link
Author

No worries, feel free to post any queries here or email me directly.
As a bit of an update, this PR now adds build definitions for the 'LoRaWAN_End_Node' example project. This can be built using the command;

bazel build //Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node:lorawan_end_node --platforms=//:stm32wl55xx_cortex_m4

with the resulting elf available at;
bazel-bin/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/LoRaWAN_End_Node/lorawan_end_node

Also, just as a quick summary of the general level of interest, here is a shortlist of public projects already using Bazel with embedded toolchains + stm32's;

@RKOUSTM
Copy link
Contributor

RKOUSTM commented Dec 15, 2021

Hi @silvergasp,

Thank you for your contribution. Unfortunately, we don't treat aspect related to loader files and testing routines for external loaders for STM32 series of microcontrollers in our GitHub repositories. Please allow me to redirect you to the stm32-external-loader repository. There you shall find people who will address your request and whom you will hopefully find a solution with.

Thank you again for your contribution. We are looking forward to reading from you again.

With regards,

@RKOUSTM RKOUSTM closed this Dec 15, 2021
@RKOUSTM RKOUSTM added the wontfix This will not be worked on label Dec 15, 2021
@nathaniel-brough
Copy link
Author

Hey @RKOUSTM, I'm happy to move this PR elsewhere, however, I'm not sure that the stm32-external-loader is the right place for this to go. This PR isn't related to external flash loaders. It is specifically related to building (compiling/linking) software.

TLDR; I have not communicated what this PR is effectively, this PR adds the capability to use this repo with the Bazel build system, which is roughly equivalent to GNU make. It is not related to external/flash loaders.

To clarify bazel.build is the open-sourced version of Google's internal build system 'Blaze'. The BUILD.bazel files are roughly equivalent to GNU Make's Makefile's (GNU make is already a generator option as shown in the screenshot below). The ideal end goal here would be to facilitate adding a 'Bazel Build` option to the STM32Cube code generator. e.g.
image

As it currently stands this PR adds the necessary build configs for the 'library component' of stm32cube but does not do the code generation required for the project. Here is a fairly minimal BUILD.bazel file that I am currently using in my project that makes use of the 'library component' in this PR, without any code generation. Note the deps = ["@com_github_stmicroelectronics_stm32cubel4//:stm32l4xx_hal_driver"], line that depends on the build files in this PR.

cc_library(
    name = "config",
    hdrs = ["Core/Inc/stm32l4xx_hal_conf.h"],
    includes = ["Core/Inc"],
    visibility = ["//visibility:public"],
)

cc_library(
    name = "base_project",
    srcs = [
        "Core/Src/gpio.c",
        "Core/Src/i2c.c",
        "Core/Src/stm32l4xx_hal_msp.c",
        "Core/Src/stm32l4xx_it.c",
        "Core/Src/system_stm32l4xx.c",
        "Core/Src/usart.c",
    ],
    hdrs = [
        "Core/Inc/gpio.h",
        "Core/Inc/i2c.h",
        "Core/Inc/main.h",
        "Core/Inc/stm32l4xx_it.h",
        "Core/Inc/usart.h",
    ],
    includes = ["Core/Inc"],
    visibility = ["//visibility:public"],
    deps = ["@com_github_stmicroelectronics_stm32cubel4//:stm32l4xx_hal_driver"],
)

cc_binary(
    name = "main",
    srcs = [
        "Core/Src/main.c",
        "startup/startup_stm32l432xx.s",
    ],
    linkopts = [
        "-T $(location :STM32L432KCUx_FLASH.ld)",
    ],
    deps = [
        ":STM32L432KCUx_FLASH.ld",
        ":base_project",
    ],
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants