-
Notifications
You must be signed in to change notification settings - Fork 2k
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
riotboot: add RIOTBOOT_BUILD make var #12307
Conversation
makefiles/boot/riotboot.mk
Outdated
@@ -145,10 +145,13 @@ riotboot/slot1: $(SLOT1_RIOT_BIN) | |||
# Default flashing rule for bootloader + slot 0 | |||
riotboot/flash: riotboot/flash-slot0 riotboot/flash-bootloader | |||
|
|||
# make applications that use the riotboot feature default to actually using it | |||
# Target 'all' will generate the combined file directly. | |||
ifeq (,$(filter riotboot_bootloader,$(FEATURES_USED))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply ifneq $(riotboot, $(APPLICATION))
... ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why not? Do we expect people calling their application "riotboot"?
Anyhow, an alternative to having to add the feature everywhere would be to set "BUILDING_RIOTBOOT=1" in bootloader/riotboot/Makefile and check for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or re-use "-DRIOTBOOT" as in "ifneq (,$(filter -DRIOTBOOT,$(CFLAGS)))...".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having to add the feature everywhere
I cannot imagine @cladmi would accept use of FEATURES for that, anyways. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot imagine @cladmi would accept use of FEATURES for that, anyways. wink
That can be correct, he may not like any of the solutions I had proposed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyhow, before, we introduced "FLASHFILE = $(RIOTBOOT_EXTENDED_BIN) ". This is wrong in the bootloader case, as riotboot itself behaves like a normal application. So we need to get the information that we're building the bootloader into that file.
Using a feature might seem like a straightforward idea, but that forces us to make changes to completely unrelated files (board / cpu / *). Those might even be external, and they grow.
So that's a bad idea in any case.
Adding a simple "BUILDING_RIOTBOOT=1" to the riotboot makefile can do the same, without the need to add a line everywhere else.
Is makefiles/boot/riotboot.inc.mk" actually supposed to be included when building riotboot itself? Maybe we can skip including it altogether in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is makefiles/boot/riotboot.inc.mk" actually supposed to be included when building riotboot itself? Maybe we can skip including it altogether in that case.
I don't think it does, the target riotboot/flash-bootloader
does though. But we would still have to change the trigger for including makefiles/boot/riotboot.inc.mk
since right now it is still FEATURES_USED += riotboot
. It would come down to the same kind of solutions but done elsewhere. But in this case we would avoid including uneeded targets so your approach sounds better to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a simple "BUILDING_RIOTBOOT=1" to the riotboot makefile can do the same, without the need to add a line everywhere else.
Ok, this does sound more simple. I still don't like calling it RIOTBOOT
, but I know you don't agree with this as stated in #11940. So I'll change it to your suggestion.
1de0348
to
a8c3861
Compare
@kaspar030 changed do implement your approach and I'm checking @cladmi I know this isn't great, but i wasn't a fan of checking CFLAGS or creating yet another variable to tell we are building the bootloader. |
If you think But as CFLAGS (not even considering evaluating CFLAGS can slow down the build), it goes for me against the dependency inversion principle, but as I will not maintain it is your choice My issue with doing something with "it's the bootloader", is that then the behavior is not triggered by enabling a feature, or a module, but enabled even when not needed except when we disable it after. If only the feature |
@cladmi I pushed a different approach which I think makes sense respecting your thoughs, if agreed I will also update the documentation. The idea is that now Application that want more than that, i.e. compile for riotboot should do @kaspar030 what do you think about this? PS: I have to change in the commit that riotboot is in caps right now. |
This actually doesn't work since without |
Set a make variables to indicate `riotboot` application (riots bootloader) is being built.
ecd0ad9
to
138aaa3
Compare
@kaspar030 adapted to one of your first suggeestion, can you take a look? |
- riotboot targets should not be needed for riotboot application so dont include it. - also fixes RIOT-OS#12003 by not setting FLASHFILE = $(RIOTBOOT_EXTENDED_BIN) when compiling riotboot application
138aaa3
to
aa5c617
Compare
IMO this is straight forward. |
Is that an ACK? |
ping @kaspar030 ! |
Yes, ACK. Tests still compile & run as expected. |
Contribution description
This PR attempts to fix the first part of #12003
With the pseudomodule we can specify that the bootloader application is using to
bootloader
itself, and normal applications aren't, they are just usingriotboot
modules or functionality.This allows defining FLASHFILE as a regular
ELFFILE
for the bootloader and keeping the current behavior where we wan't it, i.e. flashing an application + boot-loader usingriotboot
.All boards providing riotboot now provide
riotboot_bootloader
.Testing procedure
Issues/PRs references
Addresses #12003
Related to #12302