This is a small experiment for AVR Atmega8
A simple swap function which is possibly re-used inside actual avr "C/C++" code as library
import platform.avr.*
import kotlinx.cinterop.internal.*
import kotlinx.cinterop.*
fun swap(a:uint8_tVar, b:uint8_tVar) = memScoped {
var temp = a
a.value = b.value
b.value = temp.value
}
Install mingw64 dependencies as below
pacman -S mingw-w64-x86_64-avr-gcc pacman -S mingw-w64-x86_64-avr-libc
in mingw64, Atmega8 library will be available inside C:\msys64\mingw64\avr\lib\avr4
Your code will be compiled and saved inside
arduino-atmega8\build\bin\libgnuplot\debugStatic\libarduino_atmega8.a
End Of Article