SEGGER has released a build of its Embedded Studio for the new Apple M1 chip. By natively compiling for the Arm based M1 chip rather than translate from Intel x86-64, applications can execute significantly faster.
The M1 is the Apple’s first Arm-based system on chip specifically designed for the Mac. While the ARM-based M1 can execute applications for Intel x86-based CPUs using Apple’s Rosetta 2 translator, applications built specifically for the M1 core execute much faster and use less power.
To fully utilize the speed and performance potential of a natively compiled application, SEGGER created a build of Embedded Studio for M1. Embedded Studio is SEGGER’s cross-platform integrated development environment (IDE) for ARM/Cortex and RISC-V architectures. There are now two macOS packages available for download – one for the Intel x86-64 and one for the Apple M1.
Ivo Geilenbrügge, managing director of SEGGER, said, “This is the first commercial embedded system IDE optimized for the M1 and the performance results of our comparison tests show it was worth the work.”
In SEGGER’s own benchmark, the company said natively compiled code ran almost twice as fast as both the Intel i7 and M1 running translated code. In its blog, product manager Johannes Lask highlights that in contrast to most CPUs, which use the x86-64 instruction set architecture, the M1 cores use the AArch64/ARMv8-A instruction set. While x86-64 is an extension of x86, and 32-bit x86 applications can be natively executed on x86-64, Arm code is entirely different.
To maintain compatibility with existing applications, Apple introduced Rosetta 2, an emulator that translates x86-64 instructions to run on M1. Translation is a one-time event, usually done on installation or at the first start-up of an application. After that the application can be natively executed, just like on any other machine.
Lask says, “Translation takes some time and translated code is not as good or as efficient as original code. For optimal results Apple encourages developers to build applications specifically for the M1. Natively compiled source code produces fewer instructions to execute or more efficient instruction sequences. Such natively optimized code requires less time to execute and can result in less power usage.”
Since the company has two versions of its Embedded Studio, one for both the Arm and the Intel chips, it carried out a performance comparison of the M1 with a specific software development task. It did this by installing Embedded Studio on two MacBooks. On the 2016 MacBook PRO with 2.7 GHz Intel i7, the x86-64 build was installed; and on the new MacBook PRO with the Apple M1, both builds were installed.
It then built a SEGGER Flasher firmware project consisting of about 570 C source files, which produced a 740kByte application image. The results were as follows:
MacBook PRO, Intel i7, x86-64 completed the task in 30 seconds. MacBook PRO, M1, x86-64 (translated) completed it 31 seconds. MacBook PRO, M1, ARM (native) completed in 17 seconds.
With this comparison, SEGGER was aiming to illustrate the benefit of natively compiled code versus translated code, and hence the rationale for building a version of Embedded Studio specifically for the M1.