EEVblog Electronics Community Forum

Electronics => Projects, Designs, and Technical Stuff => Topic started by: justavm on April 30, 2020, 12:02:30 am

Title: Java8/Dalvik vm on STM32
Post by: justavm on April 30, 2020, 12:02:30 am
I wrote a Dakvik VM from scratch in C with the following major features below, need your help to find my next steps.

* >1M instructions on STM32 based BluePill board(<$3).
* Precise compacting GC.
* Interrupt support.
* Native C interface generator.
* Platform abstraction layer for HW peripherals.
* Arrays, Float, Switch, Exception, Interface, Multiple inheritance, dynamic and etc. * Believe or not RXJava lie programming is possible, sort of :).

Features not available on master branch;
 * MultiThreading (Developed a simple preemptive rtos for cortex m but not integrated yet.)
* Shared Library support. (Working on a bare metal project for Cortex M series.)

QUESTIONS As a freelancer/remote engineer I want to make money out of this.
* From your experience what are my options?
* What do you think is the best way to generate money out of this project?
* Open Source(which license) or proprietary license?
* What do you think about doing a Kickstarter project in this Covid19 days?
* Creating a Udemy course? How I can protect ownership of the code? Can I survive with it as a family?
* Selling it to a company?
* Landing to a remote job around this tech?
* Any idea how Oracle vs Google lawsuit will end, Do you think my customers will need to pay to Oracle or Google?
* Can I find support/funding to bring Kotlin or Groovy like language to embedded world with no java involved rather than compiler it self written in Java.
* What you would love to have as a way of programming for small devices?

The only thing i know for sure is make it free for makers/hobbyist.

Below is the sample code and the apis;
package demo; import eapi.*;
public class App {
    public static void main(String args[]) {

        final Led led = Led.init('C', 13); // Port C Pin 13
        PushButton pushButton = PushButton.init('A',
                                                8, //Port A Pin 8
                                                GPIO.INPUT_PULL_UP,
                                                GPIO.FALLING_EDGE,
                                                200, //debounce
                                                (time) -> {
            Core.println("push button event");
            led.flip();
        });

        while (true) {
            Looper.loop();
        }
}
Analog.inSetup(Analog.IN1); Analog.read(Analog.IN1);
Analog.outSetup(Analog.OUT5); Analog.write(Analog.OUT5, (short)255);
I2C.setup(I2C.I2C2, 400); SPI.setup(SPI.SPI_ID2, 0, SPI.SPI_MODE_3, SPI.SPI_FB_MSB);
References: https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html


Title: Re: Dalvik vm on STM32, need your help
Post by: justavm on April 30, 2020, 12:47:31 am
 Any feedback/thought is appreciated!
Title: Re: Java8/Dalvik vm on STM32
Post by: martinribelotta on April 30, 2020, 02:55:02 pm
Quote
I wrote a Dakvik VM from scratch in C with the following major features below, need your help to find my next steps.

* >1M instructions on STM32 based BluePill board(<$3).
* Precise compacting GC.
* Interrupt support.
* Native C interface generator.
* Platform abstraction layer for HW peripherals.
* Arrays, Float, Switch, Exception, Interface, Multiple inheritance, dynamic and etc. * Believe or not RXJava lie programming is possible, sort of :).

Very impresive!!!

Quote
* From your experience what are my options?
* What do you think is the best way to generate money out of this project?

The money is proportional to people willing to pay for you work...
This is very difficult to estimate and maybe need a many prove and error phases...

In my experience, the best way to do it is centering in the service and not in the producto...

Explaining it: The peopel is more disposed to pay for a customising service but not for a end-product, specially the developers (the maker-world are worst in this sense)

By example, if a developer (or maker) can obtain the same results using C/C++ with an Arduino toolchain, will not pay for a java VM (ok, this is dalvik but you understandme...) even if your solution provides better time-to-market or smoother development.

The only market with pay-per-tool in this days, is very specialised EDA users like clients of mentor, sinopsis or cadence...

Or clients with very concise objectives (and very concise businesses with very concise estimate gain) that pay for a low time-to-market but not for a fancy-language-like-my-preferred-language (sorry if this sound bad but is for illustration only)

Some peoples is illusion with the business model of IAR, Segger or others tool-providers but this business have a captive marketplace legacy from the 90's era of tools. Is not realistic to join in this marker without a stroke of luck

Quote
* Open Source(which license) or proprietary license?

My opinion is: Propietary == BIG NO.

But the answer Open source == YES is more complicate to explain:

The real question in this point is:
Depending in your bussines model, you can decide for one or other...

By example, Digia with Qt libraries is decanted by a mixed propietary and full open source solution using strong copyleft in the libraries but not restrict the closed source programs if you only link unmodified Qt libraries (LGPL model). This is very reasonable in order to take advantage of colavorative development in the library and buy the specific solutions (like automotive thinks) to very specific clients disposed to pay for it (because the client bussines need some guaranties and vastly support).

The Qt case is very interesting in the last times because two projects in Digia portfolio:
If you need other board, pay for it, if you need SDK pay for it... is a great strategy in my understand...



In other side, you see the very FLOSS projects with non copyleft licence like micropython or espruino... Both projects have MIT or some similar BSD-like licences and obtain the money for the special cases in the comunity.

The last case is my most nearly experience: Several years ago, I port micropython to LPC43xx and build a little comunity around of it... Some time late, I catch many freelance works customising this to an other processors and others boards (with closed source solutions because my work is covered by MIT licence)

In sort: If you have a big company with a lawyers disposed to figth with a GPL/LGPL infractors, and you can provide consistently and high-cuality service of customization for a big clients, go ahead for a full copyleft licence and figth with it. This is the best model.
If you are a little developer with many little clients, the full copyleft bussine may not fit in your work well... maybe you can deal with a copyleft licence, little comunity and very entusiast people with sporadics customization works...

Quote
* What do you think about doing a Kickstarter project in this Covid19 days?

The micropython work very well with this... but the project was coupled to a flagship platform (pyboard)

Maybe you can propose a Dalvik platform... and maintain others boards upon request?

Depending what is your country (USA mabye?) you can start a traditional investor search and deal with the investor requeriments...

Quote
* Creating a Udemy course? How I can protect ownership of the code? Can I survive with it as a family?

I not know Udmey platform and its privacity policies, but the courses is a good entry of money... spatially if you are willing to use your time in face-to-face classes (the training courses is very expensives in many cases and many peapol is ready to pay for it in a certain circumstances)

If you can live from this? I wouldn't know how to tell you, it depends on how much income you follow and what your standard of living is

Quote
* Selling it to a company?

Is very dificult... major companies work for a bussines incentive... maybe some companies see this work like a potential bussiness, but in my view is not a good idea if you are ready for do a kickstart project, build courses and others thiks... The buying company will do this for you after you sell it.

Quote
* Landing to a remote job around this tech?

Sound great... maybe if your tech resolve some thiks like ota-fw or multiple application codes in the same thing...

Quote
* Any idea how Oracle vs Google lawsuit will end, Do you think my customers will need to pay to Oracle or Google?

Not end at all, maintain your ass in the seat  :popcorn: : https://en.wikipedia.org/wiki/Google_v._Oracle_America

By the way.. google promotes Kotlin usage with the objective to make this litigation obsolete

By the (other) yay, Kotling can produce Dalvik bytecode, JVM bytecode and ART binaries...

Quote
* Can I find support/funding to bring Kotlin or Groovy like language to embedded world with no java involved rather than compiler it self written in Java.

In my opinion is desirable... Java-a-shit in my view (But it's my personal vision as a java hater :box:)

Quote
* What you would love to have as a way of programming for small devices?

It seems my day to ask things of Santa:

Finally, excellent work and I hope I can see it as a floss code, but this will depend on how you decide your business model...
I can not guarantee success but I think that, at least, it can measure up to projects like micropython or espruino
Title: Re: Java8/Dalvik vm on STM32
Post by: justavm on April 30, 2020, 09:29:59 pm
   First of all thank you Martin for the detailed reply, apreciado!

Quote
Very impresive!!!

After reading your feedback wanted to learn about your development efforts and checked your github.
Your background in embedded system is very impressive and would love to chat with you over the phone if you have time.

Quote
The money is proportional to people willing to pay for you work...
This is very difficult to estimate and maybe need a many prove and error phases...

In my experience, the best way to do it is centering in the service and not in the producto...

Explaining it: The peopel is more disposed to pay for a customising service but not for a end-product, specially the developers (the maker-world are worst in this sense)

By example, if a developer (or maker) can obtain the same results using C/C++ with an Arduino toolchain, will not pay for a java VM (ok, this is dalvik but you understandme...) even if your solution provides better time-to-market or smoother development.

The only market with pay-per-tool in this days, is very specialised EDA users like clients of mentor, sinopsis or cadence...

Or clients with very concise objectives (and very concise businesses with very concise estimate gain) that pay for a low time-to-market but not for a fancy-language-like-my-preferred-language (sorry if this sound bad but is for illustration only)

Some peoples is illusion with the business model of IAR, Segger or others tool-providers but this business have a captive marketplace legacy from the 90's era of tools. Is not realistic to join in this marker without a stroke of luck

I hear your points, agree on tool provider market, remember old days where you need to pay at least $1000 for debuggers, dev boards, compilers and etc. I really want to convert what i have which makers/developers loves a lot, I do believe there are some clear wins using the project that i am working on over Arduino. I also do understand java is not for everyone and looking forward to add a more common language to current platform.

Quote
My opinion is: Propietary == BIG NO.

But the answer Open source == YES is more complicate to explain:

The real question in this point is:
Copyleft YES or...
Copyleft NO
Depending in your bussines model, you can decide for one or other...

By example, Digia with Qt libraries is decanted by a mixed propietary and full open source solution using strong copyleft in the libraries but not restrict the closed source programs if you only link unmodified Qt libraries (LGPL model). This is very reasonable in order to take advantage of colavorative development in the library and buy the specific solutions (like automotive thinks) to very specific clients disposed to pay for it (because the client bussines need some guaranties and vastly support).

The Qt case is very interesting in the last times because two projects in Digia portfolio:
Boot2QT: Propietary solution providing an entire Yocto system ready out-of-the-box (yes, this build scripts is FLOSS but the build service and customization is payed)
Qt for MCU: An very strip down Qt+QML version over a RTEMS or FreeRTOS with really closed sources only avaliabled in public as forms of prebuild binaries with little demo for a particular board.
If you need other board, pay for it, if you need SDK pay for it... is a great strategy in my understand...



In other side, you see the very FLOSS projects with non copyleft licence like micropython or espruino... Both projects have MIT or some similar BSD-like licences and obtain the money for the special cases in the comunity.

The last case is my most nearly experience: Several years ago, I port micropython to LPC43xx and build a little comunity around of it... Some time late, I catch many freelance works customising this to an other processors and others boards (with closed source solutions because my work is covered by MIT licence)

In sort: If you have a big company with a lawyers disposed to figth with a GPL/LGPL infractors, and you can provide consistently and high-cuality service of customization for a big clients, go ahead for a full copyleft licence and figth with it. This is the best model.
If you are a little developer with many little clients, the full copyleft bussine may not fit in your work well... maybe you can deal with a copyleft licence, little comunity and very entusiast people with sporadics customization works...

If I can not find a good home for the project then I am inclined to make it MIT/BSD license and make money by selling preloaded boards by giving an early access to backers. My only worry is if there is a company out there willing to add this to their product line.
Think about FreeRTOS, would Amazon bought them if they were MIT/BSD initially?

Quote
The micropython work very well with this... but the project was coupled to a flagship platform (pyboard)

Maybe you can propose a Dalvik platform... and maintain others boards upon request?

Depending what is your country (USA mabye?) you can start a traditional investor search and deal with the investor requeriments...

Having a preloaded great software a side what was the biggest killer features of the pyboard in terms of hardware?
If i choose the kickstarter route, What things would you love see in let's say dvmBoard?

Quote
Is very dificult... major companies work for a bussines incentive... maybe some companies see this work like a potential bussiness, but in my view is not a good idea if you are ready for do a kickstart project, build courses and others thiks... The buying company will do this for you after you sell it.

Could you please elaborate more on this?

Quote
Not end at all, maintain your ass in the seat  :popcorn: : https://en.wikipedia.org/wiki/Google_v._Oracle_America

By the way.. google promotes Kotlin usage with the objective to make this litigation obsolete

By the (other) yay, Kotling can produce Dalvik bytecode, JVM bytecode and ART binaries...

Unfortunately afaik Kotlin and especially Grovvy tightly coupled with Java. If Oracle wins it will be a big hit to future of tech and innovation.I have good ideas around this, but unfortunately no resources yet.

Quote
In my opinion is desirable... Java-a-shit in my view (But it's my personal vision as a java hater :box:)
I am not religiously tight to Java. Would love to hear more around what is you like and hate most in Java. What would you love to see if a new language will be developed from ground up?

 
Quote
It seems my day to ask things of Santa:
Bytecode with position independent code and load-and-go
  You can load multiple bytecodes to anywhere(ram/flash even sdcard(slower for sure)) you like and switch between by altering or maintaining their states.

Quote
PEEK&POKE or similar way to access raw memory: Yes, I have more than 30 years old...
I can embed this to Core api which will take 10 mins(already developed a code generator for native interfaces)
My biggest concern was security/portability.

Quote
Self hosted compiler: This is very dificult and very memory hungry but is my list for santa's thinks
I love this concept as a hobbyist. Also shipped lua enabled embedded device before. But need to hear more use cases for end products.

Quote
Very consistent hardware abstraction layer: This help so much in the port to other platforms (like RISC-V or Xtensa)
Currently you just need to create a new folder and put a c file in it which follow a single include file as agreement.

Quote
Access to persistence of bytecode in flash
It is available as flash api, could you please tell your use case in your mind?

Quote
Posibility to Ahead on time compilation
Bluepill board as of today can run as fast as Arduino uno and mega like devices by consuming similar power mainly due to arch/tech differences. I did some experiments and have some thoughts what is doable but need finance for development.

Gracias!


Title: Re: Java8/Dalvik vm on STM32
Post by: Doctorandus_P on May 01, 2020, 01:23:21 pm
It will be near impossible to make money for software based around Blue Pill boards.
People in the low budget market use open source tools for free.
Have a look at MicroPython as an example.

On the other end, examine the business model of Paul Stoffregen. He seems to be profitable with his Teensy boards.

Personaly I would not buy a Teensy board easily. Not really because of the price, but for my love of the open source world.
I believe he put some custom closed source bootloader in those things.
It makes me wonder if the Teensy's are supported by Platformio.

A real advantage of the price point of the Blue Pill boards for me is that at such prices, I can easily afford to stack some 20 odd of them in a drawer and not be bothered by chinese lead times of a month or more. In the end it boils down to: With a Blue Pill, I can grab one from a drawer, with a Teensy, I have to first order one (or more, never like to have just one board because of hardware failure) and wait for shipping etc.
Title: Re: Java8/Dalvik vm on STM32
Post by: justavm on May 01, 2020, 10:25:26 pm
First of all thank you for the feedback!

Quote
It will be near impossible to make money for software based around Blue Pill boards.
People in the low budget market use open source tools for free.
Have a look at MicroPython as an example.

For makers/hobbyist a do agree. As Vm written in pure C as of today it can work on any 32bit micro out there including esp32.
Do you think people/companies ships products would pay for one time money which includes some support time?

Quote
On the other end, examine the business model of Paul Stoffregen. He seems to be profitable with his Teensy boards.

He did a great job, one of its kind of hard working, quality, dedication, support and awesome community  :-+
I wish i can discuss some of my questions with him.

Quote
Personaly I would not buy a Teensy board easily. Not really because of the price, but for my love of the open source world.

I do agree, in the past I also bought things just for the sake of supporting an effort and open source outcomes for the future.

Quote
I believe he put some custom closed source bootloader in those things.
It makes me wonder if the Teensy's are supported by Platformio.

I did a quick search and here are my top findings, correct me if i am wrong or missing a point;
*He puts a separate programmer micro on his boards which uses jtag/swd to program master micro by using master micro's usb port.
*Programmer micro puts code in ram of the master micro through jtag/swd and this code knows how to use master micro's usb port to get the program from PC to flash or he pushes just enough code to master micro's sram for creating a bridge back to programmer micro. This way you can not brick the master micro through fw.
*Main idea is if you create your own board with same components without programmer mcu same fw you developed will just work.
*He supports all major platforms Windows, Linux and Mac for programmer with no drivers involved, seamless.
*Basically his programmer is closed source which you should not care anyway if you are building your own fw upgrade system for your end product.
*He targeted people who are interested in creating their own usb peripherals such as keyboards with high pin count availability.
*He targeted people who has a passion and taste in rgb led/displays and audio/music.

Although you can not do gdb(may be possible?), if Platformio creates the right hex file then teensy programmer will just let it work.
I am sure you can add cli to your build system to do it from your IDEs menu click.

Quote
A real advantage of the price point of the Blue Pill boards for me is that at such prices, I can easily afford to stack some 20 odd of them in a drawer and not be bothered by chinese lead times of a month or more. In the end it boils down to: With a Blue Pill, I can grab one from a drawer, with a Teensy, I have to first order one (or more, never like to have just one board because of hardware failure) and wait for shipping etc.

What do you think is the sweet spot price point for a board which is plug and play and supports Java out of the box?
Please assume you are ok with Java and want to do things without tackling internals of how mcu/peripherials works.