Pietro Maggi
10/17/2019, 10:09 AMVlad Balan
02/13/2020, 2:58 PMkotlin{
linuxArm64()
}
I am interested in creating a custom target for arm64 where I can specify what compiler/linker options I want to use.
Thanks in advance!
Slack ConversationAndy Victors
02/24/2020, 8:54 PMVlad Balan
03/11/2020, 7:28 AMtypedef struct {
uint8_t a;
} testStructDto;
is translated in Kotlin as follows:
@kotlinx.cinterop.internal.CStruct public final class testStructDto public constructor(rawPtr: kotlinx.cinterop.NativePtr /* = kotlin.native.internal.NativePtr */) : kotlinx.cinterop.CStructVar {
public companion object : kotlinx.cinterop.CStructVar.Type {
}
public final var a: liboverlay.uint8_t /* = kotlin.UByte */ /* compiled code */
}
My Kotlin native function:
@ExperimentalUnsignedTypes
override fun init(): CPointer<testStructDto> {
val dtoVar = nativeHeap.alloc<testStructDto>()
dtoVar.a = 0xa5.toUByte()
return dtoVar.ptr
}
I can use it in Kotlin like this:
@Test
fun `initialize`() {
val context = controller.init()
assertEquals(0xa5.toUByte(), context.pointed.a)
}
But when I try to use it in C like this:
libtest_ExportedSymbols *libPtr = libtest_symbols()
libtest_kref_MyObjectFactory kFactory = libPtr->kotlin.root.MyObjectFactory._instance();
libtest_kref_MyObject kObject = libPtr->kotlin.MyObjectFactory.create(kFactory);
testStructDto *dto = (testStructDto *) libPtr->kotlin.root.MyObject.init(kObject);
I always get
dto->a = 32
I get the value 32
even if I assign something else than 0xa5
.
Does anybody know what I am doing wrong?
Thanks in advance!
Slack Conversationdarkmoon_uk
03/30/2020, 4:40 AMBlundell
04/22/2020, 7:54 AMdarkmoon_uk
05/23/2020, 5:44 AMdarkmoon_uk
05/23/2020, 5:47 AMdarkmoon_uk
12/08/2020, 12:34 AM[JB]
) then take a look at the potential here: https://www.espressif.com/en/news/ESP32_C3
The massively popular Espressif ESP8266 chip is getting a spiritual successor in the form of their new C3 chip.
The interesting thing for Kotlin is that, whereas before the ESP8266 had a proprietary Tensilica core, the new one is RISC-V based.
This implied a shift surely opens up easier pathways for a Kotlin / PlatformIO / C3 three-way cuddle puddle - a traction-gainer for sure 👍
At this point the response might be 'Kotlin isn't suitable for a platform of this small size' to which I'd say '_why shouldn't it be?_' - Kotlin/Native should theoretically be able to compile simple enough programs to MCU sizes; just as C++ scales both large and small.
Maintaining Embedded as a goal, especially for the new IR compiler and linker, could bring both direct and side-benefits, on Kotlin's epic journey to platforms far and wide.darkmoon_uk
01/29/2021, 6:40 AMmaarten ha
06/11/2021, 9:05 AMlouiscad
09/10/2021, 9:54 AMPiotr Krzemiński
11/21/2021, 2:20 PMdarkmoon_uk
02/04/2022, 12:19 AMFrancis Mariano
07/25/2022, 7:55 PMnapperley
08/15/2022, 1:42 AMnapperley
10/19/2022, 9:32 PMdarkmoon_uk
01/04/2023, 4:34 AMnapperley
02/13/2023, 12:40 AMnapperley
02/22/2023, 1:36 AMnapperley
03/07/2023, 1:32 AMdarkmoon_uk
03/07/2023, 1:50 AMdarkmoon_uk
03/07/2023, 1:51 AMnapperley
03/14/2023, 12:03 AMnapperley
03/19/2023, 10:38 PMlouiscad
04/13/2023, 9:22 AMdarkmoon_uk
04/13/2023, 9:37 AMdarkmoon_uk
04/13/2023, 9:38 AMPiotr Krzemiński
07/02/2023, 3:48 PMFrancis Mariano
10/27/2023, 5:29 PM