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

Feature: Refactor build-types for apps and samples #48

Open
MarkoSagadin opened this issue Feb 13, 2023 · 6 comments
Open

Feature: Refactor build-types for apps and samples #48

MarkoSagadin opened this issue Feb 13, 2023 · 6 comments
Assignees
Labels
type: discussion This requires further discussion. type: feature request New feature or request.

Comments

@MarkoSagadin
Copy link
Collaborator

MarkoSagadin commented Feb 13, 2023

Context

Build type system does not cover one of the possible project configurations that came up in practical development. Due to that usage of build types is uncomfortable/non-convenient.

Problematic setup

Project is setup to build for two different boards:

  • some regular board, such as nrf52840dk_nrf52840
  • native_posix board, suitable for running on the development machine

For nrf52840dk_nrf52840 board we want to have a dev build type, which uses debug KConfig options and RTT Kconfig options (RTT is used as logging and shell back-end), and debug build type, which used debug KConfig options.

native_posix board only needs debug build type.

east.yml for such setup would look something like this:

apps:
  - name: example_app
    west-boards:
      - nrf52840dk_nrf52840
      - native_posix

    build-types:
      - type: dev
        conf-files:
          - debug.conf
          - rtt.conf

      - type: debug
        conf-files:
          - debug.conf

The problem

With above config east release builds every possible west-board/build-type combination. This is not okay as native_posix does not support RTT, so you get a bunch of warnings when compiling for this combination.

Basically, all possible build-types are not suitable for all west-boards.

Solution

Add a new combinations key, where each west-board defines its own list of possible build-types.
There can be one or more west-boards, for each combination.

That way we can avoid the above situation.

In that case the east.yml should support something like this:

apps:
  - name: example_app
    combinations:
      - west-boards: 
        - nrf52840dk_nrf52840
        - nrf52dk_nrf52832
        build-types:
        - type: dev
          conf-files:
            - debug.conf
            - rtt.conf
        - type: debug
          conf-files:
            - debug.conf
         
      - west-boards: 
        - native_posix
        build-types:
        - type: debug
          conf-files:
            - debug.conf
   
@MarkoSagadin
Copy link
Collaborator Author

@TjazVracko See above, tell me what you think.

This is definitely not the final form how should it be done, but a starting form.
One thing, if this is changed then inherit key for samples should also be adjusted.

@MarkoSagadin MarkoSagadin self-assigned this Feb 13, 2023
@MarkoSagadin MarkoSagadin added type: discussion This requires further discussion. type: feature request New feature or request. labels Feb 13, 2023
@TjazVracko
Copy link
Contributor

I like this in general.
The case where this is unused (all buid types are good for all boards) is also supported by just having one "combination".

We have to bikeshed the hell out of the word "combination" though.

@MarkoSagadin
Copy link
Collaborator Author

We have to bikeshed the hell out of the word "combination" though.

I agree, I don't like it either, consider it as a placeholder name 😆

@TjazVracko
Copy link
Contributor

I have an additional idea which is kind of related to this.

The selected build type should also be the value of CONFIG_VERSION_INFO_APP_BUILD_TYPE.
You can probably just pass it directly as a define into west:
west build -b some_board -u dev -- -DCONFIG_VERSION_INFO_APP_BUILD_TYPE="dev"

@MarkoSagadin
Copy link
Collaborator Author

MarkoSagadin commented Feb 16, 2023

Good idea, maybe we can pass it in just as EAST_BUILD_TYPE="dev", to not have any assumptions what is on the other end.

@MarkoSagadin
Copy link
Collaborator Author

Good idea, maybe we can pass it in just as EAST_BUILD_TYPE="dev", to not have any assumptions what is on the other end.

So this is already done.

Furthermore, we realized that it would be quite beneficial to make release build type explicit. Currently it is quite hard to make build types work nicely across widely different boards (native_posix versus actual hardware boards)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion This requires further discussion. type: feature request New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants