Hi,
has anyone yet been able to compile Kotlin Native applications for use on ARMv6 embedded devices? For example, the first generation Raspberry Pi (with Broadcom BCM2835 SoC).
Unfortunately the ARMv6 architecture is still very common in our industry (point of sale terminals) and we are hoping to find a way to make this work, but we also know that key pieces like valgrind simply are not supported on ARMv6 as it doesn’t support the needed instructions.
Everything else with preparation for our projects with Kotlin Native has been surprisingly easy (especially C interop in both directions!). We’re hoping to break this final barrier to allowing us to use Kotlin and Kotlin Native for all of our embedded system projects.
Thank you for any help you can give us with this.
Ben
What you mean by “embedded” - embedded Linux, or baremetall, or what?
Embedded targets is WIP, first experimental target is Zephyr RTOS on Cortex-M4 CPU.
Hi Mike. Thanks for replying!
I maybe over-described with “embedded Linux”. This is standard Linux running on ARMv6 devices. The equivalent of Raspbian running on the first generation Broadcom SoC ARMv6-based Raspberry Pi’s.
There are some custom drivers that we have to deal with as well as signing applications before they can run, but nothing that would impact the compiled application itself.
In Kotlin Native 0.6 we see a reference to “armv6-unknown-linux-gnueabihf”, but we didn’t want to read too much into this.
Do you know if it possible to compile for an ARMv6 target with Kotlin Native 0.6?
Thank you again for responding so quickly.
Ben
-target raspberrypi
should generate code for exactly that - first generation of RaspberryPi.
Or more precisely, LLVM options are -float-abi=hard -mcpu=arm1136jf-s
Thanks again Mike. Before we proceed, would Kotlin Native be okay with LLVM option -float-abi=soft? The ARMv6 implementation we’re working with has no floating point capability in hardware. We expect it will be okay (though slower), but I wanted to check if you are aware of this causing any problems.
I’m not from Kotlin/Native team, but personally do not see any reason why soft-float will not work.
But to be sure better ask in Kotlin/Native issue tracker on github.
Yes, K/N is known to be able to produce ARM v6 soft float binaries (i.e. android_arm32 target). So probably you could just tweak a bit following place kotlin-native/konan.properties at 8955d247b19ee9188f291b27a9177434d7aa5443 · JetBrains/kotlin-native · GitHub with proper FP flags.
Thank you Mike and Nikolay for your replies. We’re now able to successfully compile our test Kotlin application for a specific ARMv6 target, including with -float-abi=soft directive, with a C++11 toolchain we sourced for the Broadcom ARMv6 target system.
Unfortunately the target device is currently running with a much older set of runtime libraries. The vendor is sourcing/generating the last dependency for us - GLIBC_2.17. (the vendor’s system currently only supports C++03 toolchain, so we have had to help push this to minimum C++11 for Kotlin support)
I will post here in the next week when we’re able to build, sign and run our Kotlin application on an ARMV6 point of sale terminal.
Hello, could you share your config file to me for reference, I want to build a arm soft float target but have no idea how to implement it