IRNAS / irnas-east-software

East is a command line meta-tool, useful for creating, managing, and deploying Zephyr or nRF Connect SDK projects.
MIT License
10 stars 1 forks source link

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

Open MarkoSagadin opened 1 year ago

MarkoSagadin commented 1 year ago

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:

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 commented 1 year ago

@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.

TjazVracko commented 1 year ago

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 commented 1 year ago

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 :laughing:

TjazVracko commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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)