Custom build zephyr in app lab
Suppose I build ArduinoCore-zephyr with current sources on my pc. How can I install this build on the Q to use in app lab.
Custom build zephyr in app lab
Suppose I build ArduinoCore-zephyr with current sources on my pc. How can I install this build on the Q to use in app lab.
Was poking around the filesystem and noticed the following:
~/.arduino15/packages/arduino/hardware/zephyr/0.53.0
boards.txt doc installed.json LICENSE programmers.txt variants
cores firmwares libraries platform.txt README.md
However not sure how to link in any firmware changes from the MPU side - know I can do it from the IDE ![]()
Have any ideas?
Well found my answer to how to revert to 0.52.0:
Bridge.provide() issues and method not available - UNO Family / UNO Q - Arduino Forum
arduino-cli core uninstall arduino:zephyr
arduino-cli core install arduino:zephyr@0.52.0
arduino-cli burn-bootloader -b arduino:zephyr:unoq -P jlink
@Merlin513 - I will probably raise this as an issue with the ArduinoCore-zephyr build, as likely more of the people monitoring this project will likely know what the steps are to run with a zephyr build from current sources.
And with that hopefully they will update the Readme files with the instructions.
Note: Looks like Arduino, is in the process of maybe releasing a new release, as they marked a release of 53.1 with an interesting Pull Request that was merged in.
loader: unoq: increase ram buffer by pennam ยท Pull Request #324 ยท arduino/ArduinoCore-zephyr
With the Commit comment of:
Otherwise sketches exceeding 64k will fail to run in weird ways. Still trying to understand if 128k would be big enough.
Which makes me wonder...
Ditto. Especially since the pr was issued yesterday and merged in just one day!
Here is a link to the new issue:
Closed by @ptillisch ...
Hi @KurtE. Unfortunately this is not as straightforward as we might hope.
As you are aware, the standard approach used to work with additional installations of boards platforms is to manually install it under the hardware subfolder of the sketchbook, under a "vendor" folder with a unique name. For example:
<sketchbook folder>/
โโโ hardware/
โ โโโ arduino-git/
โ โ โโโ zephyr/
โ โ โโโ boards.txt
โ ...
...
This gives the manually installed platform a machine identifier of arduino-git:zephyr. That is distinct from the Boards Manager installation of the platform, which has the identifier arduino:zephyr.
Consequently, we have established unique machine identifiers (FQBN) for the board definitions of each platform. We can specify the "Arduino UNO Q" board definition (board ID unoq) from the manually installed platform by using the FQBN arduino-git:zephyr:unoq. We can specify the board from the Boards Manager installed platform using the FQBN arduino:zephyr:unoq.
When working with Arduino CLI or Arduino IDE, we control the FQBN used when performing a compilation, upload, etc. With Arduino CLI, we specify this directly (either via the --fqbn command line flag, or via the fqbn key of the build profile, while with Arduino IDE we do it indirectly via the Tools > Board menu selection. So this allows us to specify the use of the manually installed platform as needed.
Unfortunately, Arduino App Lab does not give us this control. Instead, the FQBN is hardcoded in the Arduino App CLI tool that performs the compilation and upload for Arduino App Lab:
This means the standard approach is not applicable when using Arduino App Lab or Arduino App CLI.
I think the best approach is:
arduinoThe structure of the manual installation of the platform should be like so:
~/Arduino/
โโโ hardware/
โ โโโ arduino/
โ โ โโโ zephyr/
โ โ โโโ boards.txt
โ ...
...
Note it is under the path ~/Arduino/hardware/arduino, not ~/Arduino/hardware/arduino-git. This means the manually installed platform will have the identifier arduino:zephyr and thus its board definition will have the FQBN arduino:zephyr:unoq, as used by Arduino App CLI.
Now we have the problem that there are two installed platforms with the same identifier. Unlike libraries, there is no specification for which of the multiple installations Arduino CLI will give preference, and no guarantees that the one it happens to choose will be deterministic or maintained.
For this reason, we must modify the release installation so that it does not collide with the manual installation. One option would be to uninstall it. However, this will be inefficient in the case where you want to be able to switch back and forth between the manual and release installations. So I think the better approach will be to keep the release installation, but to cause it to not be considered as a candidate for the arduino:zephy platform.
I did this by renaming the architecture folder of the release installation using the following command from the shell terminal:
mv ~/.arduino15/packages/arduino/hardware/zephyr ~/.arduino15/packages/arduino/hardware/zephyr.disable
Now the FQBN arduino:zephyr:unoq is unambiguously associated with the manually installed platform.
โ I chose to rename the architecture folder instead of the vendor folder in order to restrict the effect of the change to the arduino:zephyr platform alone (whereas renaming the vendor folder would also change the identifier of any other official platforms that happen to be installed).
When you want to switch back to using the release installation of the arduino:zephyr platform, perform the following operations:
Rename the architecture folder of the release installation back to zephyr:
mv ~/.arduino15/packages/arduino/hardware/zephyr.disable ~/.arduino15/packages/arduino/hardware/zephyr
Change the name of the architecture folder of the manual installation to something other than zephyr:
mv ~/Arduino/hardware/arduino/zephyr ~/Arduino/hardware/arduino/zephyr.disable
Morning couldnt sleep so followed your instructions and worked like a charm!
Thanks for the detailed instructions.
Thanks @ptillish for the great explanation.
I am trying it now. I made one simple dumb mistake...
You need the Arduino directory under /home/arduino...
You showed it that way, but eyes skipped over it... Easy fix.
Also never noticed that some of the libraries (Router Bridge, RPC ...) are empty...
Which makes sense as they have their own git projects, never noticed it before,
but then again was not looking to debug them...
Copied those over from current sources.
Trying to build and now failing in link:
/home/arduino/.arduino15/packages/zephyr/tools/arm-zephyr-eabi/0.16.8/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld: cannot open linker script file /home/arduino/Arduino/hardware/arduino/zephyr/variants/_ldscripts/memory-check.ld: No such file or directory
collect2: error: ld returned 1 exit status
Looks like it is called out for in platform.txt
build.link_args.build-static="-T{build.variant.path}/syms-static.ld" "-T{build.ldscript.path}/memory-static.ld" "-T{build.ldscript.path}/build-static.ld"
Next up will see if Arduino builds work.
EDIT: User error forgot to copy the variants__ldscripts directory
sweet..
a word of caution, don't try this on your 2gb..
i was good until i ran bootstrap..
new 4gb had 16gb free when i started now i have 9.2gb..
but i did successfully build..
install.sh gave me hell, i fixed it, had to use https path to git..
then i blundered hard trying to do this in the wrong location..
do over.. made a folder in my projects for it and cloned in there..
i really don't know whats happening in there but it's happening..
build stopped on some invalid rsync command..
so i manually installed rsync and built again..
i got firmwares..
~q
Note, I have not tried actually building the ArduinoCore-zephyr directly on the UNO-Q,
I was not sure if all of the tools work on Linux Arm64... So I build locally on my PC,
under WSL and then copy stuff.
Well, I can confirm, it builds..
~q
Assuming that the third bullet here should be to remember to burn new bootloader?
@ptillisch @qubits-us @Merlin513, I confirmed I could also install
the sources and build environment on the Q4 and it built!
-- west build: running target llext-edk
[1/209] Preparing syscall dependency handling
[2/209] Generating include/generated/zephyr/version.h
-- Zephyr version: 4.2.0 (/home/arduino/git/zephyr), build: v4.2.0-38-g994b835f5936
[208/209] Linking CXX executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 203292 B 2 MB 9.69%
RAM: 206552 B 768 KB 26.26%
IDT_LIST: 0 GB 32 KB 0.00%
Generating files from /home/arduino/git/ArduinoCore-zephyr/build/arduino_uno_q_stm32u585xx/zephyr/zephyr.elf for board: arduino_uno_q
[209/209] Generating llext-edk.tar.Z
-- Found Python3: /home/arduino/git/ArduinoCore-zephyr/venv/bin/python (found suitable version "3.13.5", minimum required is "3.10") found components: Interpreter
-- Cache files will be written to: /home/arduino/.cache/zephyr
./extra/build.sh: line 81: rsync: command not found
arduino@Uno-Q4:~/git/ArduinoCore-zephyr$
Personally I still believe that there should be a native build on Windows! There is and I use a native install of Zephyr to do things like issue PRs to zephyr itself. But I know that is probably a different subject!
you're missing rsync too..
do a..
sudo apt install rsync
then build again..
good luck.. ~q
Definitely off topic for this discussion, but I'm certainly interested in the subject (I did give it a try a while back and was not successful). Feel free to open a dedicated forum topic on the subject if you like.
Ok now that 53.1 seems to be working decided to go ahead and build the core the Q4. Pretty much just followed the instructions for WSL on the arduinocore-zephyr readme.
Had a hiccup but got it working built no issues with ./extra/build.sh arduino_uno_q.
And I did remember to install rsync first ![]()
Only downside is that it eats about 45% space for arduino
/dev/mmcblk0p69 18G 8.1G 9.2G 47% /home/arduino
Definitely not something you can do on the Q2.
@KurtE has submitted a request for the addition of installation of this dependency to the instructions in the developer documentation hosted in the platform's repository:
Note: I also added a wish list item to it, that: I wish there was some way to
specify on the script like bootstrap a way to restrict it to a subset of the underlying modules.
That is if I am installing on Q, likely I am only building for Q. On PC or the like, I may not wish to ever build the community boards... So maybe a way to not download any things specific to those...
As I mentioned for a wishlist item, is a way to restrict which HALS to download.
On the Q, I think maybe it only needs: the stm32...
That is in the boards.txt we have:
unoq.build.zephyr_hals=hal_stm32
I am thinking of trying to delete the others... that is I installed in
~/git/ArduinoCore-zephyr
the Hals are downloaded into: ~/git/modules/hal
arduino@Uno-Q4:~/git/modules/hal$ ls -al
total 44
drwxrwxr-x 11 arduino arduino 4096 Feb 9 16:08 .
drwxrwxr-x 7 arduino arduino 4096 Feb 9 16:19 ..
drwxrwxr-x 5 arduino arduino 4096 Feb 9 15:53 cmsis
drwxrwxr-x 7 arduino arduino 4096 Feb 9 15:54 cmsis_6
drwxrwxr-x 17 arduino arduino 4096 Feb 9 15:54 infineon
drwxrwxr-x 5 arduino arduino 4096 Feb 9 16:08 libmetal
drwxrwxr-x 8 arduino arduino 4096 Feb 9 15:55 nordic
drwxrwxr-x 8 arduino arduino 4096 Feb 10 00:00 nxp
drwxrwxr-x 6 arduino arduino 4096 Feb 9 16:04 renesas
drwxrwxr-x 9 arduino arduino 4096 Feb 9 16:05 silabs
drwxrwxr-x 9 arduino arduino 4096 Feb 9 16:08 stm32
arduino@Uno-Q4:~/git/modules/hal$