Search code examples
platformioembedded-javascript

Problem installing mjs library (embedded javascript) using platformio cli


I get a build error when trying to use a function in mjs after importing it into platformio:

platformio lib --storage-dir lib install https://github.com/cesanta/mjs.git

I can try #include <../lib/mjs/mjs.h>, but it will only include the header file and not the .c files. Nothing is being linked.

How can I get mjs (or any external library with a .c in it) setup as a platformio library?


Details:


  1. I can try #include <mjs.h> or #include <mjs/mjs.h> in main.c, neither work.
  2. I expect libraries to be copied to .pioenvs while they are being compiled.
    But that doesn't look to be the case.
  3. I have tried several things from my favorite search engine. But no luck. Platformio documentation doesn't seem to be much help either. If you think this requires submitting a github issue, let me know in a comment.

ESP32 espressif DFU library Version 1.5 Currently on Windows 10 (will also be using WSL Debian, Gentoo Linux, and Mac in future)

platformio.ini

[env:esp32dev]
platform = espressif32
framework = espidf
board = esp32dev
build_flags = -DCONFIG_WIFI_SSID=\"ESP_AP\" -DCONFIG_WIFI_PASSWORD=\"MYPASS\"
monitor_speed = 115200

p.s. I understand there is a gpl restriction after I finish the prototyping phase (while prototyping, there is no restrictions). So I do plan on buying a commercial license. I don't think this library would be a good fit in the platformio store. I want a local-only library.

But many libraries out there could follow the found steps, expanding platformio usability...


Solution

  • mjs has a previous project named v7. I am still interested in importing external libraries. But this satisfies my need for now.


    platform.ini

    [env:esp32dev]
    platform = espressif32
    board = esp32dev
    framework = arduino
    
    build_flags = -I lib/mjs
                  -L lib/mjs
                  -I lib/TFT_eSPI-master
                  -L lib/TFT_eSPI-master
                  -Os
                  -DPIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS
                  -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
                  -DUSER_SETUP_LOADED=1
                  -DILI9163_DRIVER=1
                  -DTFT_WIDTH=128
                  -DTFT_HEIGHT=160
                  -DTFT_MISO=19
                  -DTFT_MOSI=23
                  -DTFT_SCLK=18
                  -DTFT_CS=5
                  -DTFT_DC=19
                  -DTFT_RST=-1
                  -DLOAD_GLCD=1
                  -DSPI_FREQUENCY=27000000
    

    Got mjs to work. https://github.com/tamusjroyce/platformio-esp32-mjs

    Note: MJS is GPL V2 or commercial. License is reasonable. I am in no way affiliated with Ciesta, MongooseOS, or mjs. Hence, v7 (which I believe is licensed differently?).