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

[RFC] boards/cpu: model of 'common' directories #11674

Open
1 of 9 tasks
cladmi opened this issue Jun 11, 2019 · 4 comments
Open
1 of 9 tasks

[RFC] boards/cpu: model of 'common' directories #11674

cladmi opened this issue Jun 11, 2019 · 4 comments
Labels
Area: boards Area: Board ports Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: don't stale State: Tell state-bot to ignore this issue

Comments

@cladmi
Copy link
Contributor

cladmi commented Jun 11, 2019

Description

Boards based on a common board sometime only use Makefile.include but not Makefile.dep, or do not process Makefile.features even if it exist.
Sometime a common Makefile.dep does not exist at the beginning but may be created in the future and not all boards get updated.
Some boards do not use the board_common_abcd module implemented.

This leads to asking is this really in common ?

Because of this, the current model for common boards and common cpu is not completely clear as some board could only partially use a common board for good or bad reasons.

Questions

Makefile including files

Is it something we would like to have, that if a board/cup uses any of the Makefile.include|Makefile.dep|Makefile.features it must also process the other files (if they exist) ?

If a board/cpu was always processing all files, we can think of defining a board as

    board
       |-> board/common/1
       |-> board/common/2
           |-> board/common/3
       |-> cpu
           |-> cpu/common/1
               |-> cpu/common/2

If then this hierarchy can be defined recursively and be consistent, it could remove the need to re-include and add to DIRS all the common files in each Makefile|Makefile.dep|Makefile.features|Makefile.include and leave this to central files.

Also easily give "by which parts is my board/cpu implemented".
It could currently be deduced from MAKEFILE_LIST but would not mean all features or dependencies are used.

Examples

Some of the files not using Makefile.features were found during #11477

  • common/msba2, common/remote, common/msb-430 not using a common Makefile.features. Which was problematic when moving CPU/CPU_MODEL to it. TODO PR, currently in Tracking: move CPU/CPU_MODEL to Makefile.features #11477
  • boards/arduino-leonardo does not process common/arduino-atmega/Makefile.include|.dep
  • boards/jiminy-mega256rfr2/ does not process
  • boards/calliope-mini does not process common/nrf51/Makefile.dep
  • nucleo-f410rb and nucleo-f411re do not process common/nucleo64/Makefile.features
  • chronos declares dependency in Makefile.include and has not Makefile.dep
  • common/wsn430 declares a dependency in Makefile.include and has not Makefile.dep

TODO:

Find a script that really shows if a board/cpu does not use all the files from the common. And so ignores the non existing common files.

# Simplified version that miss some parts
git grep -l 'common/.*/Makefile.' boards/  | sed 's/Makefile.*//' | uniq -c | grep -v '3 '
      2 boards/arduino-leonardo/
      2 boards/avsextrem/
      2 boards/calliope-mini/
      1 boards/common/arduino-atmega/
      1 boards/common/kw41z/
      1 boards/common/nucleo144/
      1 boards/common/nucleo32/
      1 boards/common/nucleo64/
      2 boards/firefly/
      1 boards/frdm-k22f/
      1 boards/frdm-k64f/
      2 boards/jiminy-mega256rfr2/
      1 boards/mega-xplained/
      1 boards/msb-430/
      1 boards/msb-430h/
      2 boards/msba2/
      2 boards/nucleo-f410rb/
      2 boards/nucleo-f411re/
      2 boards/remote-pa/
      2 boards/remote-reva/
      2 boards/remote-revb/
      1 boards/waspmote-pro/
      2 boards/wsn430-v1_3b/
      2 boards/wsn430-v1_4/

A more verbose output that does not merge including two different common files, but even more false positive.

git grep 'common/.*/Makefile.' boards/ | sed 's/Makefile.[a-z]*/Makefile.xxx/g' | uniq -c | sed 's/Makefile..*//' | grep -v '3 '

Always defining each file

Question, should we move toward all the boards, cpu and commons always define Makefile.dep/Makefile.features/Makefile.include ?

This way it allows a board to use a common one and be future proof as if a dependency is added, it will always be processed. Otherwise, each time a new common included file is created all boards using that common one must be updated at the same time.

common code without function namespacing

Despite the namespacing requirement https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions#naming boards and cpu modules do not respect it.

Some boards/common define board_init directly, and have board.h and periph_conf.h headers which leads to the board not being able to extend a common board without duplicating the files.

Would it be good to change this and define board_common_abcd_init to allow re-using it ? Same for the headers and all.

Re-use of a board as a common board

Currently due to the previous issue with namespacing and that the fact that all boards define the board module and all cpu the cpu module, same for drivers/periph so a board cannot be used as a 'common' board. Having each board defining the board_boardname module and then the board_boardname_init would allow re-using that code.

A generic board module should be in riot to call the right board_boardname_init function.

Tracking updates

For the phynode-kw41z it was updated so that the USEMODULE += boards_common_kw41z is not put in common anymore but let on the board to include the module or not.

Related issues

This was currently found while moving CPU/CPU_MODEL to Makefile.features.

@cladmi cladmi added Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Area: boards Area: Board ports labels Jun 11, 2019
@cladmi cladmi changed the title boards/cpu: model of 'common' directories [RFC] boards/cpu: model of 'common' directories Jun 11, 2019
@stale
Copy link

stale bot commented Dec 13, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Dec 13, 2019
@stale stale bot closed this as completed Jan 13, 2020
@fjmolinas fjmolinas removed the State: stale State: The issue / PR has no activity for >185 days label Jan 13, 2020
@fjmolinas
Copy link
Contributor

Re-opening this is still valid IMO.

@fjmolinas fjmolinas reopened this Jan 13, 2020
@stale
Copy link

stale bot commented Jul 16, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Jul 16, 2020
@stale stale bot closed this as completed Aug 16, 2020
@fjmolinas fjmolinas added the State: don't stale State: Tell state-bot to ignore this issue label Aug 18, 2020
@fjmolinas
Copy link
Contributor

re-open

@fjmolinas fjmolinas reopened this Aug 18, 2020
@stale stale bot removed the State: stale State: The issue / PR has no activity for >185 days label Aug 18, 2020
@MrKevinWeiss MrKevinWeiss added this to the Release 2021.07 milestone Jun 21, 2021
@MrKevinWeiss MrKevinWeiss removed this from the Release 2021.07 milestone Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: don't stale State: Tell state-bot to ignore this issue
Projects
None yet
Development

No branches or pull requests

3 participants