STM32f429i LED using XPM and yotta and QEMU

Submitted by Dickens A S on Sat, 08/08/2020 - 11:03

This article explains how to run STM32 embedded board in an emulator on windows

Step 1: Install Nodejs

Install Nodejs

Step 2: Check Nodejs in command prompt

C:\>node --version
v12.16.2

Step 3: Install XMP

C:\>npm install -g xpm

Step 4: Check XPM 

C:\>xpm --version
0.6.4

Step 5: Install Python 2.7

Install Python 2.7

Kotlin Web Assembly WebGL Auto Stub

Submitted by Dickens A S on Sat, 05/02/2020 - 05:37

WebGL is a big API, it has 200+ properties and 100+ methods, writing a JavaScript stub and corresponding Kotlin stub is very difficult 

We need to write 1400+ lines of JavaScript code and 3000+ lines Kotlin code

This Kotlin gradle script provides a simple approach to auto generate the stub and also compile the generated code to .klib

Gradle Stub Code in KTS

Kotlin Web Assembly direct buffer access with UTF-16 string

Submitted by Dickens A S on Fri, 05/01/2020 - 06:07

Kotlin WebAssembly runtime provides a global JavaScript array called heap

which can be accessed if the pointer of a variable is known

The pointer and size of the variable can be determined by library methods stringPointer and stringLengthBytes

The from JavaScript the value can be updated with below logic

Kotlin Main Code

Kotlin passing string to Web Assembly

Submitted by Dickens A S on Thu, 04/30/2020 - 14:09

From JavaScript as of now we cannot pass string to WebAssembly, therefore the string will be converted to an array of bytes and kept in browser's memory object of the kotlin web assembly framework object kotlinObject

From WebAssembly by calling the JavaScript method for each character, transfer the numeric value

Then convert the numeric value to character and combine to a string in kotlin

This is achieved using below code

JavaScript: string to UTF array utlity

Kickstart Kotlin Web Assembly HTML DOM with Spring Boot

Submitted by Dickens A S on Wed, 04/29/2020 - 08:43

Easily create Kotlin Web Assembly project from these multiplatform boilerplate Gradle DSL

This code involves Custom JavaScript - to - Kotlin - to - JavaScript stub

Kotlin Code

Call Kotlin from Python using shared DLL

Submitted by Dickens A S on Mon, 04/20/2020 - 11:44

Kotlin Shared DLL and Python Extension

Compile and Execute from MSYS2 or Cygwin with python development C header files

Demo Output

Python Output

Python Code which calls the module

import myModule
myModule.helloworld()

setup.py - extension definition

Kickstart Kotlin : Jython with Spring Boot

Submitted by Dickens A S on Fri, 03/20/2020 - 07:02

Easily create Kotlin based Jython project from these multiplatform boilerplate Gradle DSL

Run gradle command

  gradle assemble

Run gradle command

  gradle run

Browse http://localhost:8080/index.html

On the screen you will see response from Jython via AJAX

JavaScript libraries are maintained using "webjars"

Spring Boot REST code

Web Jars

Submitted by Dickens A S on Mon, 03/16/2020 - 10:49

Web Jars is a dependency management technique which reduces the leraning curve of the developer to use single dependency management system to manage the versions of JavaScript libraries or other non-maven-standard libraries which has other then java code

For Example: i you want to add jQuery into your spring boot project, in the past you need to put that in the static folder manually of you need to use tools like bower to download it inside the static folder

but now you don't have to do that, you can use same pom.xml or build.gradle and specify the webjar dependency

Kickstart Kotlin Web Socket with Spring Boot

Submitted by Dickens A S on Mon, 03/16/2020 - 10:39

Easily create Kotlin Web Socket project from these multiplatform boilerplate Gradle DSL

Run gradle command

  gradle assemble

Run gradle command

  gradle run

Browse http://localhost:8080/index.html

On the screen you will see connection status

JavaScript libraries are maintained using "webjars",

Source Code

End Of Article

Kotlin JUnit5

Submitted by Dickens A S on Sun, 12/15/2019 - 05:10

A simple JUnit 5 project with Gradle 6

package junit5

import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test

class AppTest {
    @Test fun `test greeting`() {
        val classUnderTest = App()
        assertNotNull(classUnderTest.greeting, "app should have a greeting")
    }
}

Note: a fresh gradle project always generates code for JUnit 4, for JUnit 5 you need to change the dependencies accordingly to jupiter package