Skip to content

Commit 1c1e745

Browse files
authored
Merge branch 'arduino:arduino' into llext_heap-fix-for-NANO33
2 parents b61491b + 2746c8a commit 1c1e745

13 files changed

+103
-33
lines changed

Diff for: .github/workflows/package_core.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
./extra/bootstrap.sh -o=--filter=tree:0
3636
echo "CORE_TAG=$(git describe --always)" >> "$GITHUB_ENV"
3737
echo "CORE_ARTIFACT=ArduinoCore-zephyr-$(git describe --always)" >> "$GITHUB_ENV"
38-
echo "BOARD_VARIANTS=[ $(cat boards.txt | grep '^[^#]*\.build\.variant' | sed -e 's/^\([^#]*\)\.build\.variant=\(.*\)/{ \"variant\": \"\2\", \"board\": \"\1\" },/' | sort | tr '\r\n' ' ' | sed -e 's/,\s*$//') ]" >> "$GITHUB_ENV"
38+
echo "BOARD_VARIANTS=$(extra/get_board_details.sh | jq -cr 'sort_by(.variant)')" >> "$GITHUB_ENV"
3939
4040
- name: ccache
4141
uses: hendrikmuhs/[email protected]
@@ -50,7 +50,6 @@ jobs:
5050
- name: Package
5151
run: |
5252
./extra/package.sh ${{ env.CORE_TAG }}
53-
mv ../${{ env.CORE_ARTIFACT }}.tar.bz2 .
5453
5554
- name: Archive core
5655
uses: actions/upload-artifact@v4
@@ -221,6 +220,7 @@ jobs:
221220
if: ${{ github.event_name == 'push' && github.repository == 'arduino/ArduinoCore-zephyr' }}
222221
needs:
223222
- package-core
223+
- test-core
224224
- publish-core
225225
env:
226226
CORE_ARTIFACT: ${{ needs.package-core.outputs.CORE_ARTIFACT }}

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
extra/post_build_tool/distrib/
22
build/
33
venv/
4+
ArduinoCore-zephyr-*.tar.bz2

Diff for: boards.txt

+17-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ giga.menu.debug.true=Debug
1212
giga.menu.debug.false.postbuild_debug=
1313
giga.menu.debug.true.postbuild_debug=-debug
1414

15+
giga.build.zephyr_target=arduino_giga_r1//m7
16+
giga.build.zephyr_args=--shield giga_display_shield
1517
giga.build.variant=arduino_giga_r1_stm32h747xx_m7
1618
giga.build.mcu=cortex-m7
1719
giga.build.fpu=-mfpu=fpv5-d16
@@ -75,6 +77,8 @@ nano33ble.menu.debug.true=Debug
7577
nano33ble.menu.debug.false.postbuild_debug=
7678
nano33ble.menu.debug.true.postbuild_debug=-debug
7779

80+
nano33ble.build.zephyr_target=arduino_nano_33_ble//sense
81+
nano33ble.build.zephyr_args=
7882
nano33ble.build.variant=arduino_nano_33_ble_nrf52840_sense
7983
nano33ble.build.mcu=cortex-m4
8084
nano33ble.build.fpu=-mfpu=fpv4-sp-d16
@@ -136,6 +140,8 @@ ek_ra8d1.menu.debug.true=Debug
136140
ek_ra8d1.menu.debug.false.postbuild_debug=
137141
ek_ra8d1.menu.debug.true.postbuild_debug=-debug
138142

143+
ek_ra8d1.build.zephyr_target=ek_ra8d1
144+
ek_ra8d1.build.zephyr_args=
139145
ek_ra8d1.build.variant=ek_ra8d1_r7fa8d1bhecbd
140146
ek_ra8d1.build.mcu=cortex-m85+nomve
141147
ek_ra8d1.build.fpu=-mfpu=fpv5-d16
@@ -192,6 +198,8 @@ frdm_mcxn947.menu.debug.true=Debug
192198
frdm_mcxn947.menu.debug.false.postbuild_debug=
193199
frdm_mcxn947.menu.debug.true.postbuild_debug=-debug
194200

201+
frdm_mcxn947.build.zephyr_target=frdm_mcxn947//cpu0
202+
frdm_mcxn947.build.zephyr_args=
195203
frdm_mcxn947.build.variant=frdm_mcxn947_mcxn947_cpu0
196204
frdm_mcxn947.build.mcu=cortex-m33
197205
frdm_mcxn947.build.fpu=-mfpu=fpv5-sp-d16
@@ -243,6 +251,8 @@ portentah7.menu.debug.true=Debug
243251
portentah7.menu.debug.false.postbuild_debug=
244252
portentah7.menu.debug.true.postbuild_debug=-debug
245253

254+
255+
portentah7.build.zephyr_args=
246256
portentah7.build.variant=arduino_portenta_h7_stm32h747xx_m7
247257
portentah7.build.mcu=cortex-m7
248258
portentah7.build.fpu=-mfpu=fpv5-d16
@@ -306,6 +316,8 @@ frdm_rw612.menu.debug.true=Debug
306316
frdm_rw612.menu.debug.false.postbuild_debug=
307317
frdm_rw612.menu.debug.true.postbuild_debug=-debug
308318

319+
frdm_rw612.build.zephyr_target=frdm_rw612
320+
frdm_rw612.build.zephyr_args=
309321
frdm_rw612.build.variant=frdm_rw612_rw612
310322
frdm_rw612.build.mcu=cortex-m33+nodsp
311323
frdm_rw612.build.fpu=-mfpu=fpv5-sp-d16
@@ -356,6 +368,8 @@ niclasense.menu.debug.true=Debug
356368
niclasense.menu.debug.false.postbuild_debug=
357369
niclasense.menu.debug.true.postbuild_debug=-debug
358370

371+
niclasense.build.zephyr_target=arduino_nicla_sense_me
372+
niclasense.build.zephyr_args=
359373
niclasense.build.variant=arduino_nicla_sense_me_nrf52832
360374
niclasense.build.mcu=cortex-m4
361375
niclasense.build.fpu=-mfpu=fpv4-sp-d16
@@ -429,10 +443,12 @@ portentac33.menu.mode.linked=linked
429443
portentac33.menu.mode.linked.build.extra_ldflags=-lc -lm -lgcc -L{build.variant.path} -Wl,--wrap=random -Wl,--wrap=calloc -Wl,--wrap=free -Wl,--wrap=malloc -Wl,--wrap=realloc
430444
portentac33.menu.mode.linked.build.llext_link_flags=
431445
portentac33.menu.mode.linked.build.suffix=_linked
432-
portentac33.menu.mode.linked.build.ldscript={runtime.platform.path}/variants/linked/linker_script.ld
446+
portentac33.menu.mode.linked.build.ldscript={runtime.platform.path}/variants/_linked/linker_script.ld
433447
portentac33.menu.mode.linked.upload.extension=bin-zsk.bin
434448
portentac33.menu.mode.linked.postbuild_mode=-prelinked
435449

450+
portentac33.build.zephyr_target=arduino_portenta_c33
451+
portentac33.build.zephyr_args=
436452
portentac33.build.variant=arduino_portenta_c33_r7fa6m5bh3cfc
437453
portentac33.build.mcu=cortex-m33
438454
portentac33.build.fpu=-mfpu=fpv5-sp-d16

Diff for: extra/build.sh

+8-6
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,32 @@ if [ x$ZEPHYR_SDK_INSTALL_DIR == x"" ]; then
1313
fi
1414

1515
if [[ $# -eq 0 ]]; then
16-
board=$(jq -cr '.[0].board' < ./extra/targets.json)
17-
args=$(jq -cr '.[0].args' < ./extra/targets.json)
16+
first_board=$(extra/get_board_details.sh | jq -cr '.[0]')
17+
target=$(jq -cr '.target' <<< "$first_board")
18+
args=$(jq -cr '.args' <<< "$first_board")
1819
else
19-
board=$1
20+
target=$1
2021
shift
22+
args="$*"
2123
fi
2224

2325
source venv/bin/activate
2426

2527
ZEPHYR_BASE=$(west topdir)/zephyr
2628

2729
# Get the variant name (NORMALIZED_BOARD_TARGET in Zephyr)
28-
variant=$(extra/get_variant_name.sh $board)
30+
variant=$(extra/get_variant_name.sh $target)
2931

3032
if [ -z "${variant}" ] ; then
31-
echo "Failed to get variant name from '$board'"
33+
echo "Failed to get variant name from '$target'"
3234
exit 1
3335
fi
3436

3537
# Build the loader
3638
BUILD_DIR=build/${variant}
3739
VARIANT_DIR=variants/${variant}
3840
rm -rf ${BUILD_DIR}
39-
west build -d ${BUILD_DIR} -b ${board} loader -t llext-edk $*
41+
west build -d ${BUILD_DIR} -b ${target} loader -t llext-edk ${args}
4042

4143
# Extract the generated EDK tarball and copy it to the variant directory
4244
mkdir -p ${VARIANT_DIR} firmwares

Diff for: extra/build_all.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,21 @@ if [ ! -z "$GITHUB_STEP_SUMMARY" ] ; then
2424
echo "### Variant build results:" >> "$GITHUB_STEP_SUMMARY"
2525
fi
2626

27-
jq -cr '.[]' < ./extra/targets.json | while read -r item; do
28-
board=$(jq -cr '.board // ""' <<< "$item")
27+
extra/get_board_details.sh | jq -cr 'sort_by(.variant) | .[]' | while read -r item; do
28+
board=$(jq -cr '.board' <<< "$item")
29+
variant=$(jq -cr '.variant' <<< "$item")
30+
target=$(jq -cr '.target' <<< "$item")
2931
args=$(jq -cr '.args // ""' <<< "$item")
3032

31-
variant=$(extra/get_variant_name.sh "$board" || echo "$board")
3233
if [ -z "$GITHUB_STEP_SUMMARY" ] ; then
3334
echo && echo
34-
echo ${variant}
35-
echo ${variant} | sed -e 's/./=/g'
35+
echo "${board} (${variant})"
36+
echo "${board} (${variant})" | sed -e 's/./=/g'
3637
else
37-
echo "::group::=== ${variant} ==="
38+
echo "::group::=== ${board} (${variant}) ==="
3839
fi
3940

40-
./extra/build.sh "$board" $args
41+
./extra/build.sh "$target" $args
4142
result=$?
4243

4344
if [ -z "$GITHUB_STEP_SUMMARY" ] ; then

Diff for: extra/get_board_details.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
get_boards() {
4+
cat boards.txt | sed -e 's/#.*//' | grep -E '^.*\.build\.variant=' | sed -e 's/\.build\.variant=.*//'
5+
}
6+
7+
get_board_field() {
8+
board=$1
9+
field=$2
10+
cat boards.txt | sed -e 's/#.*//' | grep -E "^$board\\.build\\.$field=" | cut -d '=' -f2- | sed -e 's/"/\"/g'
11+
}
12+
13+
for BOARD in $(get_boards); do
14+
VARIANT=$(get_board_field $BOARD "variant")
15+
TARGET=$(get_board_field $BOARD "zephyr_target")
16+
ARGS=$(get_board_field $BOARD "zephyr_args")
17+
18+
if [ -z "$TARGET" ] ; then
19+
echo "error: missing '$BOARD.build.zephyr_target'" 1>&2
20+
exit 1
21+
fi
22+
23+
echo "{ \"board\": \"$BOARD\", \"variant\": \"$VARIANT\", \"target\": \"$TARGET\", \"args\": \"$ARGS\" }"
24+
done | jq -crs .

Diff for: extra/package.lst

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file contains all the *static* files and directories that will be added
2+
# to any core package archive.
3+
#
4+
# NOTE: board-specific entries in the 'firmwares/' and 'variants/' directories
5+
# are automatically added by package.sh depending on the information in
6+
# 'boards.txt', so they should not be included here.
7+
8+
boards.txt
9+
platform.txt
10+
programmers.txt
11+
LICENSE
12+
README.md
13+
doc/
14+
cores/
15+
libraries/
16+
variants/_llext/
17+
variants/_linked/

Diff for: extra/package.sh

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
#!/bin/bash
22

3-
if [ ! -f platform.txt ]; then
4-
echo Launch this script from the root core folder as ./extras/package.sh VERSION
5-
exit 2
3+
set -e
4+
5+
if [ -z "$1" ]; then
6+
echo "Usage: $0 VERSION"
7+
exit 1
68
fi
79

8-
FOLDER=`basename $PWD`
10+
if [ ! -f platform.txt ]; then
11+
echo "Launch this script from the root core folder as ./extra/package.sh VERSION"
12+
exit 2
13+
fi
914

15+
PACKAGE=ArduinoCore-zephyr
1016
VERSION=$1
1117

12-
cd ..
13-
tar --exclude=extras/** --exclude=.git* --exclude=build --exclude=venv --exclude=samples -cjhf ArduinoCore-zephyr-${VERSION}.tar.bz2 $FOLDER
18+
TEMP_LIST=$(mktemp)
19+
20+
# import a basic list of files and directories
21+
cat extra/package.lst | sed -e 's/\s*#.*//' | grep -v '^\s*$' > ${TEMP_LIST}
22+
23+
# add the board-specific files
24+
extra/get_board_details.sh | jq -cr '.[]' | while read -r item; do
25+
variant=$(jq -cr '.variant' <<< "$item")
26+
echo "variants/${variant}/" >> ${TEMP_LIST}
27+
ls firmwares/zephyr-${variant}.* >> ${TEMP_LIST}
28+
done
29+
cat ${TEMP_LIST}
30+
tar -cjhf ${PACKAGE}-${VERSION}.tar.bz2 -T ${TEMP_LIST} --transform "s,^,${PACKAGE}/,"
31+
rm -f ${TEMP_LIST}

Diff for: extra/targets.json

-10
This file was deleted.

Diff for: loader/llext_exports.c

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ EXPORT_SYMBOL(sin);
181181
EXPORT_SYMBOL(cos);
182182
EXPORT_SYMBOL(tan);
183183
EXPORT_SYMBOL(atan);
184+
EXPORT_SYMBOL(pow);
184185

185186
EXPORT_SYMBOL(puts);
186187
EXPORT_SYMBOL(putchar);

Diff for: platform.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ build.extra_flags=
5151
build.extra_ldflags=
5252
compiler.zephyr=
5353

54-
build.ldscript={runtime.platform.path}/variants/llext/linker_script.ld
54+
build.ldscript={runtime.platform.path}/variants/_llext/linker_script.ld
5555
build.llext_link_flags=-r -e main
5656
build.extra_extra_ldflags=
5757
build.suffix=
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)