Skip to content

Commit 717bda6

Browse files
committed
bootstrap.sh: limit Zephyr HALs by default
This reworks the current west.yml and bootstrap.sh so that only the HALs used by the Arduino core are installed by default. Since those not named in the allowlist are discarded during the Zephyr import, it is impossible to allow the option to install every HAL that way. Instead, allow all HALs by path, then filter them by group using the 'manifest.project-filter' config that is automatically set by bootstrap.sh. This allows to enable all HALs, if needed, by simply removing the filter.
1 parent 5a4a6fb commit 717bda6

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,20 @@ After running the `bootstrap.sh` script, you can symlink the core to `$sketchboo
181181

182182
## 🚀 Adding a new target
183183

184+
> [!TIP]
185+
>
186+
> While Zephyr supports a lot of different hardware targets, only the few
187+
> currently used by the Arduino core are installed by default. To add the
188+
> support for every Zephyr target to your workspace, run the following
189+
> commands:
190+
>
191+
> ```bash
192+
> . venv/bin/activate
193+
> west config -d manifest.project-filter
194+
> west sdk install
195+
> west update
196+
> ```
197+
184198
To add a new board that is already supported by mainline Zephyr with the target `$your_board`, follow these steps:
185199
186200
* Get the variant name from your board by running `extra/get_variant_name.sh $your_board`.

extra/bootstrap.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ if [ ! -f platform.txt ]; then
55
exit 2
66
fi
77

8+
HAL_FILTER="-hal_.*"
9+
for hal in hal_nordic hal_nxp hal_renesas hal_stm32; do
10+
HAL_FILTER="$HAL_FILTER,+$hal"
11+
done
12+
813
python3 -m venv venv
914
source venv/bin/activate
1015
pip install west
1116
west init -l .
17+
west config manifest.project-filter -- "$HAL_FILTER"
1218
west update "$@"
1319
west zephyr-export
1420
pip install -r ../zephyr/scripts/requirements-base.txt

extra/build_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
FORCE=false
44

5-
while getopts "hfl" opt; do
5+
while getopts "hf" opt; do
66
case $opt in
77
h)
88
echo "Usage: $0 [-hfl]"

west.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,21 @@ manifest:
2626
name-allowlist:
2727
- cmsis
2828
- cmsis_6
29-
- hal_nordic
30-
- hal_ti
31-
- hal_ambiq
32-
- hal_espressif
33-
- hal_infineon
34-
- hal_intel
35-
- hal_nxp
36-
- hal_stm32
37-
- hal_xtensa
38-
- hal_nordic
39-
- hal_renesas
40-
- hal_adi
41-
- hal_atmel
42-
- hal_rpi_pico
43-
- hal_silabs
4429
- littlefs
4530
- tinycrypt
4631
- mbedtls
4732
- segger
4833
- thrift
4934
- mcuboot
5035
- lvgl
36+
path-allowlist:
37+
- modules/hal/*
38+
39+
# The actual list of enabled HALs is set by extra/bootstrap.sh via
40+
# the 'manifest.project-filter' config. Enable all Zephyr HALs with:
41+
#
42+
# west config -d manifest.project-filter
43+
5144
- name: ArduinoCore-API
5245
path: modules/lib/ArduinoCore-API
5346
revision: master

0 commit comments

Comments
 (0)