Anyone interested in B4A + C ?

Discussion in 'Chit Chat' started by JordiCP, Mar 27, 2015.

  1. JordiCP

    JordiCP Well-Known Member Licensed User

    Hi all,

    Some of us come from the C world, programming microcontrollers/embedded sytems, and then have found such a great tool as B4A is. So, as this is my case, I wondered if it is possible to program only in B4A + C

    The "normal" way to do it (specially if the C part has already been developed and is "closed") is building a small JAR library which wraps the .so file and then use it from B4A code.

    But sometimes both parts (B4A and NDK-C) are being developed at once, in an endless trial-and-error loop. So, this part is longer and tedious (specially with eclipse)

    With inline Java, it is possible to avoid this "external" wrapping and do it inside your project. Of course, the C files are to be built with the NDK environment which must be previously set-up
    Also (but it requires a tricky setup) C files can be edited in the B4A IDE so you can have only one working environment


    If someone finds it interesting I can write a small tutorial/example about it.
     
  2. freedom2000

    freedom2000 Well-Known Member Licensed User

    Hi,

    I would be interested as I write also code with C for my Pic programs

    (but I must admit that I never used C for Android stuff)
     
  3. Beja

    Beja Expert Licensed User

    you mean edit it in B4C? because B4A is for A... duh

    I would be very interested because I also need easily write embedded software for PIC and Atmel.. I can try (not promise) to
    develop an emulator for Z8 and PIC MCUs and some views. Since this is non-GUI app then the emulator will simply mean
    a graphical representation of the memory and I/O maps beside the interrupts.

    Good luck.
     
  4. IanMc

    IanMc Well-Known Member Licensed User

    they are too lickle

    for example today I was programming the ATTiny85 (atmel) and found that when I tested the code on an Arduino Uno (atmel 328p) it worked great but when I ported it over to the 85 it crashed and burned.

    I found that I was casting an Int in my 328 code and the 85 didn't like it.

    I found a workaround but to answer your question

    B4x is massive

    embedded processors are lickle
     
  5. JordiCP

    JordiCP Well-Known Member Licensed User

    I am refering to link C code (written for Android, of course) with B4A and avoid having to compile a Java wrapper library, by doing this part with inline Java

    Of course, the C code has to be compiled externally, with the NDK, and there are certain rules specific to Android and also the JNI interface

    The possibility to use the B4A IDE to edit the C code is just a plus (and requires some tricks), but it can be edited externally
     
    Last edited: Mar 28, 2015
  6. Beja

    Beja Expert Licensed User

    Why not write a subset of B4A and send it to a cross compiler for the target MCU, that we also write, instead of to java compiler? for example (Run2)
    the B4A subset is not a new compiler, but simply taking notes to use specific syntax and avoid others.. and forget altogether using the libraries except new ones specifically written for the target MCU.

    too ambitious, huh!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice