From b65205ccf49f745fb28038d572e273ccc83dbcba Mon Sep 17 00:00:00 2001 From: Juan Molero Date: Mon, 27 May 2019 15:58:50 -0400 Subject: [PATCH] Initial Commit --- fs/init.js | 1 + fs/jstore.json | 3 +++ mos.yml | 27 +++++++++++++++++++++++++++ mos_esp32.yml | 11 +++++++++++ src/main.c | 15 +++++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 fs/init.js create mode 100644 fs/jstore.json create mode 100644 mos.yml create mode 100644 mos_esp32.yml create mode 100644 src/main.c diff --git a/fs/init.js b/fs/init.js new file mode 100644 index 0000000..31633b9 --- /dev/null +++ b/fs/init.js @@ -0,0 +1 @@ +load('api_timer.js'); \ No newline at end of file diff --git a/fs/jstore.json b/fs/jstore.json new file mode 100644 index 0000000..f184fef --- /dev/null +++ b/fs/jstore.json @@ -0,0 +1,3 @@ +{"items":[ +["item", ], +]} \ No newline at end of file diff --git a/mos.yml b/mos.yml new file mode 100644 index 0000000..8424dfb --- /dev/null +++ b/mos.yml @@ -0,0 +1,27 @@ +author: Juan +description: Reproduction of a JStore crash due to invalid file structure +arch: esp32 +version: 1.0 +manifest_version: 2017-05-18 + +tags: + - js + - c + +sources: + - src + +filesystem: + - fs + +libs: + - origin: https://github.com/mongoose-os-libs/ca-bundle + - origin: https://github.com/mongoose-os-libs/rpc-service-config + - origin: https://github.com/mongoose-os-libs/rpc-service-fs + - origin: https://github.com/mongoose-os-libs/rpc-uart + - origin: https://github.com/mongoose-os-libs/sntp + - origin: https://github.com/mongoose-os-libs/wifi + - origin: https://github.com/mongoose-os-libs/mjs + - origin: https://github.com/mongoose-os-libs/ota-shadow + - origin: https://github.com/mongoose-os-libs/mbedtls + - origin: https://github.com/mongoose-os-libs/jstore diff --git a/mos_esp32.yml b/mos_esp32.yml new file mode 100644 index 0000000..213efd6 --- /dev/null +++ b/mos_esp32.yml @@ -0,0 +1,11 @@ +libs: + - origin: https://github.com/mongoose-os-libs/i2c + - origin: https://github.com/mongoose-os-libs/pwm + - origin: https://github.com/mongoose-os-libs/rpc-loopback + - origin: https://github.com/mongoose-os-libs/rpc-mqtt + - origin: https://github.com/mongoose-os-libs/rpc-service-gpio + - origin: https://github.com/mongoose-os-libs/rpc-service-i2c + - origin: https://github.com/mongoose-os-libs/rpc-service-ota + - origin: https://github.com/mongoose-os-libs/rpc-service-wifi + - origin: https://github.com/mongoose-os-libs/spi + - origin: https://github.com/mongoose-os-libs/vfs-dev-spi-flash \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..a237383 --- /dev/null +++ b/src/main.c @@ -0,0 +1,15 @@ +#include "mgos.h" +#include "mgos_jstore.h" + +enum mgos_app_init_result mgos_app_init(void) { + char *error; + struct mgos_jstore *store = mgos_jstore_create("jstore.json", &error); + if(store == NULL){ + LOG(LL_ERROR, ("JSTORE FAILED TO CREATE!")); + if(error != NULL){ + LOG(LL_ERROR, ("Error: %s", error)); + } + } + mgos_jstore_free(store); + return MGOS_APP_INIT_SUCCESS; +} \ No newline at end of file