Does anyone know if you can compile and upload to the Portenta M4 core using arduino-cli?
I can only find info on programming the M7 core:
arduino-cli compile --fqbn arduino:mbed_portenta:envie_m7 .
Does anyone know if you can compile and upload to the Portenta M4 core using arduino-cli?
I can only find info on programming the M7 core:
arduino-cli compile --fqbn arduino:mbed_portenta:envie_m7 .
Hi @milnepe. The core is selected using a custom board option.
The Arduino boards platform framework allows the platform developer to include "custom board options" in a board definition. These "custom board options" can be used by the user to adjust the configuration of that board definition (e.g., choosing the clock speed).
In Arduino IDE, you would do this by selecting Tools > Target core > M4 Co-processor from the menus.
When using Arduino CLI, the custom board options are set via --board-options
flags added to the arduino-cli
commands.
The format of the flag is like this:
--board-options "<menu ID>=<option ID>"
(where <menu ID>
and <option ID>
are placeholders for the custom board options menu and menu option you are setting)
You can learn all the available menu IDs and option IDs for a given board by running the following arduino-cli
command:
arduino-cli board details --fqbn <FQBN>
(where <FQBN>
is replaced by the fully qualified board name of the board you are using)
For example:
$ arduino-cli board details --fqbn arduino:mbed_portenta:envie_m7
Board name: Arduino Portenta H7
FQBN: arduino:mbed_portenta:envie_m7
Board version: 4.0.8
Official Arduino board: ✔
Identification properties: vid=0x2341
pid=0x025b
Identification properties: vid=0x2341
pid=0x035b
Identification properties: vid=0x2341
pid=0x045b
Identification properties: vid=0x2341
pid=0x055b
Package name: arduino
Package maintainer: Arduino
Package URL: https://downloads.arduino.cc/packages/package_index.tar.bz2
Package website: http://www.arduino.cc/
Package online help: http://www.arduino.cc/en/Reference/HomePage
Platform name: Arduino Mbed OS Portenta Boards
Platform category: Arduino
Platform architecture: mbed_portenta
Platform URL: http://downloads.arduino.cc/cores/staging/ArduinoCore-mbed-portenta-4.0.8.tar.bz2
Platform file name: ArduinoCore-mbed-portenta-4.0.8.tar.bz2
Platform size (bytes): 20864770
Platform checksum: SHA-256:cb30adaabd8edbcb56e30fd264e498496e27fc9253c9c9e5b70523e959ec7c1d
Required tool: arduino:adb 32.0.0
Required tool: arduino:arm-none-eabi-gcc 7-2017q4
Required tool: arduino:dfu-util 0.10.0-arduino1
Required tool: arduino:imgtool 1.8.0-arduino.2
Required tool: arduino:openocd 0.11.0-arduino2
Option: Flash split split
1MB M7 + 1MB M4 ✔ split=50_50
1.5MB M7 + 0.5MB M4 split=75_25
2MB M7 + M4 in SDRAM split=100_0
Option: Target core target_core
Main Core ✔ target_core=cm7
M4 Co-processor target_core=cm4
Option: Security setting security
None ✔ security=none
Signature + Encryption security=sien
Programmers: ID Name
cmsis-dap ARM CMSIS-DAP compatible
stlink STMicroelectronics STLINK
Here we can see that the ID for the "Target core" menu is target_core
and the ID for the "M4 Co-processor" option is cm4
.
So, if you wanted to compile a sketch with this custom board option, you would use the following command:
arduino-cli compile --fqbn arduino:mbed_portenta:envie_m7 --board-options "target_core=cm4"
ⓘ You can add multiple --board-options
flags to an arduino-cli
command if you want to set multiple custom board options menus.
Thanks @ptillisch for the clear explanation.
Maybe you could include the following command line as an example in the options section of the arduino-cli board details docs to help other customers?
arduino-cli compile --fqbn arduino:mbed_portenta:envie_m7 --board-options "target_core=cm4"
Arduino CLI is super useful especially as it runs on Arm 64 SBCs
You are welcome. I'm glad if I was able to be of assistance, and also very glad that you found Arduino CLI to be useful!
Regards,
Per