Description
At present, development on mac-arm64* uses the mac-x86_64 tools, including the xPack toolchain. Although Apple makes binary translation available (under the name Rosetta), it produces suboptimal performance. Rosetta is not a bundled part of macOS, it’s an optional download, so not all mac-arm64 systems will even have it available. It’s also more difficult to debug and troubleshoot non-native code, and it leads to frustrating conflicts. For example, dfu-util
from STM32Tools depends on /opt/local/lib/libusb-1.0.0.dylib
, which if present on a mac-arm64 system is probably going to be a mac-arm64 library, and can’t be loaded into the mac-x86_64 dfu-util
process. This produces an unusable dfu-util
on mac-arm64 systems without further (and very fiddly) intervention.
Arduino’s package infrastructure falls back from mac-arm64 to mac-x86_64 and finally mac-x86, which is how these mac-x86_64 packages now advertised by STM32duino’s package_index.json
are making it onto mac-arm64 systems.
At least for xPack-provided packages (both the toolchain and OpenOCD), providing native mac-arm64 tools is straightforward, as xPack has published them itself for quite some time: the toolchain since 10.3.1-2.3 (2022-03-24) and OpenOCD since 0.11.0-3 (2021-12-07). It’s trivial to add these to STM32duino’s package_index.json
, at least for current versions, to begin resolving this in favor of proper mac-arm64 support.
Neither CMSIS nor STM32_SVD contain executable code for a build host, so they can be used as-is on mac-arm64 build hosts. (The same packages are already used across all supported build operating systems and architectures.) They can be added to STM32duino’s package_index.json
as mac-arm64 to make this relationship explicit.
That leaves STM32Tools as the last package requiring a rebuild for mac-arm64. The dfu-*
tools appear to come straight from dfu-util**, hid-flash
appears to come from STM32_HID_Bootloader, and upload_reset
is directly within the Arduino_Tools repository. It is almost certainly straightforward to do mac-arm64 builds for all of these, but before doing so, I’d like to clarify what specific source (version, patches, build settings) was used for the existing versions, and whether binaries for this need to be built on common infrastructure.
* What I call “mac-arm64” may otherwise be referred to as ”Apple Silicon”, M1, or some other M-number. I’m including these terms here for searchability.
** As part of this effort, it may be possible to fix the dfu-util
libusb
dependency problem, and not require libusb
to be externally provided.