hey all, I’m trying to add a new hardware target f...
# kotlin-native
s
hey all, I’m trying to add a new hardware target for konan, so I put the new target description in 
.konan/platforms/zephyr
 and rebuilt the compiler but I’m not seeing it show up in
konanc -list-targets
. I should be seeing it show up with
-list-targets
, no? I’m not seeing the
stm32f4_disco
target show up either. when I try to compile a program for my target or the
stm32f4_disco
target I get this error:
Copy code
» konanc hello.kt -target zephyr_stm32f4_disco                                                                                                                               
error: compilation failed: Target zephyr_stm32f4_disco is not available on the macos_x64 host

 * Source files: hello.kt
 * Compiler version info: Konan: 1.6.0-dev / Kotlin: 1.6.255
 * Output kind: PROGRAM

exception: java.lang.IllegalStateException: Target zephyr_stm32f4_disco is not available on the macos_x64 host
	at org.jetbrains.kotlin.backend.konan.KonanConfig.<init>(KonanConfig.kt:95)
	at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:79)
    ...
I’ve been able to build and flash zephyr for my target boards. can I not build my kotlin program for these targets on a mac?
n
The stm32f4_disco Kotlin Native target isn't being actively maintained, and isn't an official target. It is likely that the target will be dropped in a future Kotlin version, in favour of targets that might become official in a future Kotlin version like the rp2040 ( https://youtrack.jetbrains.com/issue/KT-44498 ) for example.
This article provides a list of Kotlin targets that are officially supported: https://kotlinlang.org/docs/mpp-supported-platforms.html
s
ok…so even with adding the description to the platforms dir, it won’t show up in the list of targets?
👌 1
n
With the stm32f4_disco target it is a special case where a significant part of the build process has to be done outside of Gradle (through some shell scripts), and the target doesn't share common configuration options (via Gradle) like the other targets.
s
hm i see…ok