Skip to content

Commit

Permalink
ci(noglib): Add noglib creation process
Browse files Browse the repository at this point in the history
  • Loading branch information
tore-espressif committed Sep 9, 2024
1 parent dc1b596 commit ffa2a5f
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 46 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/process_noglib_bsps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Process noglib BSPs

on:
push:
branches:
- master
pull_request:
types: [opened, reopened, synchronize]

# TODO: Extend this part to all BSPs
env:
BSPs: "bsp/esp_wrover_kit bsp/esp32_s3_eye bsp/esp32_p4_function_ev_board bsp/m5stack_core_s3 bsp/m5dial bsp/m5stack_core_2"

jobs:
noglib_check:
runs-on: ubuntu-latest
container: 'espressif/idf:latest'
steps:
- uses: actions/checkout@master

- name: Create noglib version of BSPs
# We need to run export.sh to get python and pip
run: |
. ${IDF_PATH}/export.sh
pip install idf-component-manager==1.* py-markdown-table --upgrade
python .github/ci/bsp_noglib.py ${BSPs}
- name: Build noglib example
shell: bash
env:
ENV_BUILD_NOGLIB: "1"
IDF_EXTRA_ACTIONS_PATH: "${{ github.workspace }}/examples"
run: |
. ${IDF_PATH}/export.sh
pip install idf-component-manager==1.* ruamel.yaml idf-build-apps --upgrade
idf-build-apps find -p examples/noglib
idf-build-apps build -p examples/noglib
- name: Check idf_component.yml files
uses: espressif/upload-components-ci-action@v1
with:
directories: >
bsp/esp32_s3_eye_noglib;
bsp/esp32_p4_function_ev_board_noglib;
bsp/m5stack_core_s3_noglib;
bsp/m5dial_noglib;
bsp/m5stack_core_2_noglib;
bsp/esp_wrover_kit_noglib;
namespace: "espressif"
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}
dry_run: true

noglib_release:
runs-on: ubuntu-latest
permissions:
contents: write # Give the default GITHUB_TOKEN write permission to commit and push the added or changed files to the repository.
needs: noglib_check
if: ${{ github.ref_name == 'master' }}
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Create noglib version of BSPs
run: |
pip install idf-component-manager==1.* py-markdown-table --upgrade
python .github/ci/bsp_noglib.py ${BSPs}
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "feat: Noglib BSPs based on commit ${{ github.sha }}"
branch: release/noglib

- name: Upload noglib BSPs to ESP-Registry
uses: espressif/upload-components-ci-action@v1
if: ${{ github.repository_owner == 'espressif' }}
with:
directories: >
bsp/esp32_s3_eye_noglib;
bsp/esp32_p4_function_ev_board_noglib;
bsp/m5stack_core_s3_noglib;
bsp/m5dial_noglib;
bsp/esp_wrover_kit_noglib;
namespace: "espressif"
api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}
34 changes: 0 additions & 34 deletions .github/workflows/upload_component_noglib.yml

This file was deleted.

20 changes: 19 additions & 1 deletion BSP_development_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,31 @@
This guide describes necessary steps to add a new BSP to the esp-bsp project.

### New BSP requirements
* We want the BSPs to be used by as many users and projects as possible. All BSP must support IDF from version 4.4 up to latest release. Boards that were released after IDF v5.0 do not have to be backward compatible with v4.4.
* We want the BSPs to be used by as many users and projects as possible. All BSP must support IDF from version 5.0 up to latest release.
* We want the BSPs to provide a 'board abstraction layer' that allows the user to run his application on a range of different boards. Public API for each BSP must be the same. The API consistency is ensured by conventions described below.
* We want the main features to be clearly visible for new users. Each new BSP must be added to a table of supported boards in root [README.md](https://github.com/espressif/esp-bsp/blob/master/README.md) it must contain a license (Apache-2) and a README.md file. Conventions for the readme file are described below
* All BSPs are uploaded to [ESP Registry](https://components.espressif.com/). So each BSP must contain `idf_component.yml` file and must be added to [CI upload job](https://github.com/espressif/esp-bsp/blob/master/.github/workflows/upload_component.yml). The `idf_component.yml` must contain: version, description, url, target and (optional) dependencies.
* We want to provide LVGL users with easy, out-of-the-box working solution for their GUI applications. Each board that has a display must be added to LVGL's [SquareLineStudio](https://squareline.io/) pre-defined boards. For more information refer to [this readme](https://github.com/espressif/esp-bsp/blob/master/SquareLine/README.md).
* List of currently implemented LCD drivers is maintained in a [separate table](https://github.com/espressif/esp-bsp/blob/master/LCD.md)
* We have an experimental idf.py extension, [bsp_ext.py](https://github.com/espressif/esp-bsp/blob/master/examples/bsp_ext.py) that allows changing of BSP during project configuration. Please add new BSPs to the list in this file.
* *OPTIONAL:* For noglib BSP version (see below) we provide `include/bsp/config.h` file that contains compilation switch for noglib version (see eg. [here](bsp/esp_wrover_kit/include/bsp/config.h)). Add this file if you want to generate noglib version for your BSP.

### Noglib versions

To provide easy-to-use experience, BSPs with display are shipped with [LVGL](https://components.espressif.com/components/lvgl/lvgl) component by default. LVGL was picked from all the other available graphical libraries because it is free and open source, thus compatible with ESP-IDF Apache-2.0 license.

We provide option for users who don't want to use LVGL (eg. do not need it or want to use a different graphical library) to use 'noglib' version of BSPs. This version is created automatically in GitHub action [noglib_release](./.github/workflows/process_noglib_bsps.yml) and the source code is pushed to [release/noglib branch](https://github.com/espressif/esp-bsp/tree/release/noglib). The actual BSP modification of original BSP to its noglib version is done in [bsp_noglib.py script](./.github/ci/bsp_noglib.py). It performs following actions:

1. Renames original_bsp_name to original_bsp_name_noglib
2. Modifies `include/bsp/config.h` to define noglib version
3. Removes `lvgl` and `esp_lvgl_port` from `idf_component.yml`
4. Updates component URL to point to `release/noglib` branch
5. Adds a note to `README.md` about the noglib version and removes LVGL from dependencies table

If you want to create noglib version of a new BSP, you must
1. Provide compilation switch `BSP_CONFIG_NO_GRAPHIC_LIB` in `include/bsp/config.h`
2. Add it to [noglib release job](./.github/workflows/process_noglib_bsps.yml)
3. See eg. [ESP-Wrover-kit](bsp/esp_wrover_kit/include/bsp/config.h)

### API conventions

Expand Down
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ Best way to start with ESP-BSP is trying one of the [examples](examples) on your
### BSP headers and options
* `bsp/name-of-the-bsp.h`: Main include file of the BSP with public API
* `bsp/esp-bsp.h`: Convenience include file with the same name for all BPSs
* `bsp/display.h` and `bsp/touch.h`: Only for BSPs with LCD or touch controller. Contain low level initialization functions for usage without LVGL graphical library
* By default, BSPs with display are shipped with LVGL, if you are interested in BSP without LVGL you can use BSP versions with `noglib` suffix (eg. `esp32_s3_eye_noglib`).

#### No graphical library BSP
* By default, BSPs with display are shipped with LVGL graphical library, if you are interested in BSP without LVGL you can use BSP versions with `noglib` suffix (eg. `esp32_s3_eye_noglib`).
* `bsp/display.h` and `bsp/touch.h`: Only for BSPs with LCD or touch controller. Contain low level initialization functions and basic operations for usage without LVGL.
* 'noglib' versions of BSPs are uploaded to ESP-Registry, same as original BSPs. The noglib source code is kept in [release/noglib branch](https://github.com/espressif/esp-bsp/tree/release/noglib).

> **_NOTE:_** There can be only one BSP in a single esp-idf project.
Expand All @@ -70,15 +73,6 @@ You can add them to your project via `idf.py add-dependency`, e.g.

When you want to use a BSP in a real project, it is highly recommended to disable configuration option `CONFIG_BSP_ERROR_CHECK` in menuconfig. You should check all returned error codes from all BSP functions you call. Otherwise, if the option `CONFIG_BSP_ERROR_CHECK` is enabled, any error encountered in a BSP will abort the program.

## Migration to ESP-IDF v5.0
ESP-IDF v5.0 brings a lot of new features, but, as the bump in major version suggests, also a lot of breaking changes.

ESP-BSP is kept up-to-date with the latest ESP-IDF version, but some breaking changes in ESP-BSP API are inevitable.
Usually, BSPs compatible with IDF v5.0 are version 2. If you want to use BSP with IDF v4.4 you can still use version 1 of the particular BSP.
If you are interested in BSP examples for IDF v4.4, you can git checkout tag `examples_v4.4`.

More information about ESP-IDF breaking changes can be found in the [official migration guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/release-5.x/index.html).

### Compiling project for multiple BSPs

> :warning: **Experimental feature**: This feature is under development!
Expand Down

0 comments on commit ffa2a5f

Please sign in to comment.