-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add support for easy compilation of define-only custom targets. #12335
Add support for easy compilation of define-only custom targets. #12335
Conversation
e.g. ``` make TARGET=STM32H730 CUSTOM_TARGET=SPRO-SPRACINGH7EXTREME ``` Thus, no need to create temporary build scripts anymore.
Do you want to test this code? Here you have an automated build: |
Maintainers: this PR comes about because of the plan to go 'define-only' for the unified targets, see betaflight/betaflight-configurator#3316 (comment) |
AUTOMERGE: (FAIL)
|
Aside from the use of unified targets how is this different from the board.h scratch pad for developers? Wouldn't this be better to say make the scratch pad from the unified config. Eg make board_details CONFIG=X You only need board.h, and board.mk (which only needs one line. TARGET:=XXX). Why reinvent something that already exists? Why not simply improve on it? Also, please use wget or curl and download the content, don't force a dependency on child repos. We could also move the logic for config file parsing to the build api then and remove the repo dependency. |
No, as
See above, I did consider changing it, but after evaluating things it didn't make any sense.
There dependency on the child repo is not forced for normal builds without However, there is no reason why curl couldn't be used as a secondary source for the config, using it as a primary source however is BAD for a number of reasons:
Using a local repo allows fully offline compilation and allows devs to work on their target configuration before publishing it, typical workflow is: by integrating curl you would break the above workflow. Furthermore, it also lets you use a SPECIFIC version of a target config and/or SPECIFIC version of a target config, which is extremely helpful when trying to git-bisect, another very important workflow that should not be broken. And is extremely helpful when developing new targets on branches of the two repos.
No, see above. Config parsing should be available offline from the firmware repo. The solution in this PR works offline, addresses all dev workflows that I'm aware of and doesn't introduce any new requirements for non-custom targets, it's only when you build a custom target that you need the other repo. I'm not against adding curl to allow CI/cloud build systems that want to build targets, but a CI/cloud build system could make the file for the target available locally and still use the CUSTOM_TARGET option in here and could also specify the path to a fake repo that just contains the 1 file for the target being built. Using curl is beyond the scope of this PR and can be added later, as-required. this works, now. time is short. |
What specifically is your use case here? To make it easy for developers to build locally - with the odd few flyers (who don't consider themselves developers) to be able to build a local hex. This is EXACTLY what board.h is for. It is explicitly excluded from git for that very reason also. You are just introducing yet another layer of complexity for a problem that does not exist on the auspices of keeping things separate under some guise of "clean". It is of my opinion that this approach is entirely unnecessary. In addition I am also not a fan of adding in curl, but it is the lesser of two evils in regards to linking in a repo that is about to be archived! My view is if you are going to all that trouble, you can simply download the defines, and create your own board.h. For EVERYONE else there is an entire make command to run at the start of every CLOUD BUILD log that allows someone to repeat it locally! |
Reducing the barrier-to-entry for contributions and to make developers life EASY is another goal, in addition to the offline, bisect suitable, always-consistant, and workflow requirements above. All of which are my use-cases, are all very important, and all have been known goals for the codebase for 10 years or so now. At the moment if someone downloads the codebase and wants to build the /exact/ same code that is already on their FC they're going to have a much harder time doing it than with the approach that this PR brings. This PR brings a return to the /simple/ way of building a target that previously existing for all the legacy targets and that still exists for the base targets. With the approach outlined above the knowledge of how to build a target is hidden in the code that generates the commands to build the target for their board. |
this requires much faffing with moving files around locally when you're trying to test code on multiple targets, as is often the case during normal development. you have to locate some code, copy/paste code into a file, build, test, locate some different code, copy paste into board.c/h build, test, etc. you can't bisect easily, etc, it's just a terrible workflow.
that is not the case, there is no 'guise of clean' here, it's about developer workflow, simplicity, understandable and also being time-efficient. the I don't see how you can argue about this not-complex. The current world of building two different targets, one after the other.
or
vs this (this PR)
Simple, easy, repeatable, bisect-capable, efficient, understandable, not-error-prone, always-consistent, maintainable, workflow friendly, ide-friendly. |
Can we merge this as a stop-gap change until the new |
From discussions in discord: another reason against using the existing board.h file is that |
Following the discussion, the PR #12341 makes this approach redundant. Whilst the config.h files will be periodically updated from the unified targets repo, this is only transitory - as we adjust the cloud build processes and documentation. Closing the PR. |
e.g.
Thus, no need to create temporary build scripts anymore.
To test this, ensure you have BF and BF unified targets repo as siblings in your filesystem.
then setup BF for development as usual, usually just:
then finally just run:
this will result in a log similar to this: