Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

How to load only mJS engine without APIs?

We have an ESP-32 application that has about 400 lines of JavaScript code. It makes calls to C functions and ISRs that comprise another 400 lines. We are running out of both memory and file space. Since we do not need AWS, Azure, Watson,.... etc, I can see that one obvious way to save both memory and file space is to adjust our YML file such that these elements are not loaded.

The trouble is that the the api_everything.js files that are automatically loaded with - origin: https://github.com/mongoose-os-libs/mjs require that associated libraries also be loaded. If we don't load the mjs library, then the mJS engine doesn't load, and our js code won't run.

How do we load mJS alone? We will extract the few api_xxx.js files that we need and include them in our fs.

Thanks for your help,

JSW

Comments

  • SergeySergey Dublin, Ireland

    The mjs library comes with relatively small set of api_..js files.
    The rest are coming with other libraries. You don't need to use them if you don't need them.
    If you don't need aws, azure, watson - don't include those.

    I agree with the point that those api_.. files coming with the mjs lib must go into the associated libraries, but that's not yet done.

    Thanked by 1jstevewood
  • Thanks for the help. I can't figure out a minimum set of libraries to include in the YML file that will include mJS, and exclude all of the services that I don't need. I am starting from the demo bundles. Can you recommend how to isolate only the required services?

    Thanks,

    JSW

  • SergeySergey Dublin, Ireland

    https://github.com/mongoose-os-apps/empty/blob/master/mos.yml is a good start.
    Add mjs library there, then build your app. See what's missing, and add only missing libs

    Thanked by 1jstevewood
  • mamuespmamuesp Germany/Northern coast

    @jstevewood - Speaking a flash space: are you sure you have used every bit of flash space of your ESP32? Perhaps you may look in the documentation HowTos how to add some additional filesystem to move several files there. And if possible, use ESP-WROVER modules with some additional PSRAM and/or bigger flash sizes.

  • Thanks, I cleared everything out of conf0.json (this was the real problem, I think), and added libraries one by one until it started. Lots of memory now.

    JSW

Sign In or Register to comment.