Skip to content

boards: introduce board alias and make native default to host target #21242

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

Merged
merged 9 commits into from
Apr 2, 2025

Conversation

mguetschow
Copy link
Contributor

@mguetschow mguetschow commented Feb 24, 2025

Contribution description

TODO

  • make native an alias for native32 or native64 depending on the host architecture (see boards: rename native64 -> native #21100 (comment))
  • somehow (re-)add documentation for BOARD=native
  • add build system test for alias
  • think about implications of using native (or any alias, for that matter) in BOARD_WHITELIST et al.

Testing procedure

CI should be happy. On 64-bit host platforms, BOARD=native now defaults to BOARD=native64. BOARD=native32 can be used for the 32-bit executable from now on.

Issues/PRs references

Alternative to #21100, #21291

@github-actions github-actions bot added Platform: native Platform: This PR/issue effects the native platform Area: doc Area: Documentation Area: tests Area: tests and testing framework Area: core Area: RIOT kernel. Handle PRs marked with this with care! Area: build system Area: Build system Area: CI Area: Continuous Integration of RIOT components Area: tools Area: Supplementary tools Area: boards Area: Board ports Area: Kconfig Area: Kconfig integration labels Feb 24, 2025
@mguetschow mguetschow added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: full build disable CI build filter CI: no fast fail don't abort PR build after first error labels Feb 24, 2025
@github-actions github-actions bot added Area: pkg Area: External package ports Area: sys Area: System labels Feb 24, 2025
@riot-ci
Copy link

riot-ci commented Feb 24, 2025

Murdock results

✔️ PASSED

96694ab doc/porting-boards: document board alias feature

Success Failures Total Runtime
10280 0 10280 15m:04s

Artifacts

@github-actions github-actions bot added the Area: examples Area: Example Applications label Feb 24, 2025
@mguetschow
Copy link
Contributor Author

Hum, somehow this PR wrongly changes the output of make info-boards-supported causing a bunch of "missing periph" build failures.

Evidence: make -C tests/core/thread_float info-boards-supported | grep gba_cartridge returns nothing on master, but does so with this PR.

I can't tell why though.

@mguetschow
Copy link
Contributor Author

I can't tell why though.

I can now. It's because I need to use override in board_alias.inc.mk to be able to alter the BOARD variable if passed from the command line. override can only be overwritten by another override, so adding that in info-global.inc.mk.

Should work now. Not sure if this is the right fix though.

@mguetschow mguetschow removed the CI: no fast fail don't abort PR build after first error label Feb 26, 2025
@mguetschow mguetschow force-pushed the native-alias branch 2 times, most recently from dfb6296 to c0f3555 Compare February 27, 2025 14:36
@mguetschow mguetschow force-pushed the native-alias branch 2 times, most recently from 2f5a7e1 to bee2659 Compare March 13, 2025 13:48
@maribu maribu added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 14, 2025
@mguetschow mguetschow removed the CI: full build disable CI build filter label Mar 17, 2025
@mguetschow
Copy link
Contributor Author

Squash it like it's hot!

Done :)

@maribu maribu added this pull request to the merge queue Apr 2, 2025
Merged via the queue into RIOT-OS:master with commit ca781c2 Apr 2, 2025
25 checks passed
@mguetschow mguetschow deleted the native-alias branch April 2, 2025 10:59
@mguetschow
Copy link
Contributor Author

Thanks everyone, and let's keep fingers crossed! :)

mguetschow added a commit to mguetschow/Release-Specs that referenced this pull request Apr 7, 2025
follow-up after RIOT-OS/RIOT#21242 where native was changed to be an alias for native32/64 depending on the host architecture
mguetschow added a commit to mguetschow/Release-Specs that referenced this pull request Apr 7, 2025
follow-up after RIOT-OS/RIOT#21242 where native was changed to be an alias for native32/64 depending on the host architecture

Co-authored-by: Martine Lenders <martine.lenders@tu-dresden.de>
mguetschow added a commit to mguetschow/Release-Specs that referenced this pull request Apr 7, 2025
triggered as a follow-up after RIOT-OS/RIOT#21242 where native was changed to be an alias for native32/64 depending on the host architecture

Co-authored-by: Martine Lenders <martine.lenders@tu-dresden.de>
miri64 added a commit to RIOT-OS/Release-Specs that referenced this pull request Apr 7, 2025
triggered as a follow-up after RIOT-OS/RIOT#21242 where native was changed to be an alias for native32/64 depending on the host architecture

Co-authored-by: Martine Lenders <martine.lenders@tu-dresden.de>
@mguetschow mguetschow added this to the Release 2025.04 milestone Apr 8, 2025
@benpicco
Copy link
Contributor

This breaks the build of examples/advanced/suit_update:

$ make -C examples/advanced/suit_update BOARD=native
make: Entering directory '/home/benpicco/dev/RIOT/examples/advanced/suit_update'
using BOARD="native64" as "native" on a 64-bit system
Building application "suit_update" for "native64" with CPU "native".

make: *** No rule to make target '/home/benpicco/dev/RIOT/examples/advanced/suit_update/bin/native64/suit_update/fw.1745351351.bin', needed by 'link'.  Stop.
make: Leaving directory '/home/benpicco/dev/RIOT/examples/advanced/suit_update'

@crasbe
Copy link
Contributor

crasbe commented Apr 22, 2025

This is an interesting issue. The BOARD is used by examples/advanced/suit_update/Makefile.suit.custom, however the $(RIOTBASE)/Makefile.include is included after that. The Makefile.include changes the BOARD according to the alias and then the path is incorrect.

# Add custom SUIT targets
include $(CURDIR)/Makefile.suit.custom
include $(RIOTBASE)/Makefile.include

Swapping the two lines seems to fix the issue for me. The relevant variable here is BUILD_FILES, which is required by the link recipe:

RIOT/Makefile.include

Lines 743 to 750 in 7387c3a

ifeq ($(BUILD_IN_DOCKER),1)
link: ..in-docker-container
else
ifeq (,$(RIOTNOLINK))
link: ..compiler-check ..build-message $(BUILD_FILES) print-size ..module-check
else
link: ..compiler-check ..build-message $(BASELIBS) $(ARCHIVES) ..module-check
endif # RIOTNOLINK

But since the linking step is the last step, the updated variable will still be used. I added an @echo $(BUILD_FILES) to the link recipe and these are the outputs:

With the swapped files:

cbuec@W11nMate:~/RIOTstuff/riot-vanilla/RIOT$ make -C examples/advanced/suit_update BOARD=native
make: Entering directory '/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update'
using BOARD="native64" as "native" on a 64-bit system
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/Makefile.suit.custom:6: native64
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/Makefile.suit.custom:13: native64
Building application "suit_update" for "native64" with CPU "native".

read EC key
...
"make" -C /home/cbuec/RIOTstuff/riot-vanilla/RIOT/sys/ztimer
   text    data     bss     dec     hex filename
 201065    9032  235376  445473   6cc21 /home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.elf
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.elf 
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.bin 
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.elf 
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.bin 
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update/fw.1745363950.bin
make: Leaving directory '/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update'

Current master with native64:

cbuec@W11nMate:~/RIOTstuff/riot-vanilla/RIOT$ make -C examples/advanced/suit_update BOARD=native64
make: Entering directory '/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update'
Building application "suit_update" for "native64" with CPU "native".

read EC key
...
"make" -C /home/cbuec/RIOTstuff/riot-vanilla/RIOT/sys/ztimer
   text    data     bss     dec     hex filename
 201065    9032  235376  445473   6cc21 /home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.elf
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update/fw.1745363979.bin 
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.elf 
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.bin 
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.elf 
/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update/bin/native64/suit_update.bin
make: Leaving directory '/home/cbuec/RIOTstuff/riot-vanilla/RIOT/examples/advanced/suit_update'

As you can see, the order of the files is different, but all files are present and the output size is the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: build system Area: Build system Area: CI Area: Continuous Integration of RIOT components Area: core Area: RIOT kernel. Handle PRs marked with this with care! Area: doc Area: Documentation Area: examples Area: Example Applications Area: Kconfig Area: Kconfig integration Area: pkg Area: External package ports Area: sys Area: System Area: tests Area: tests and testing framework Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: native Platform: This PR/issue effects the native platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants