From 63b7d4a5a9def8282312672d03b3ba169c4afe8d Mon Sep 17 00:00:00 2001 From: Thorsten von Eicken Date: Mon, 6 Jan 2020 23:04:19 -0800 Subject: [PATCH] fix espfs image alignment issue --- pio-genespfs.py | 4 +++- src/main.c | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pio-genespfs.py b/pio-genespfs.py index 4aff19f..737653d 100644 --- a/pio-genespfs.py +++ b/pio-genespfs.py @@ -15,7 +15,9 @@ buf = BytesIO() espfsimg = mkespfs(dir, buf) fd = Path(espfile).open(mode='w') -fd.write("unsigned char espfs_image[] __attribute__((section(\".irom.text\"))) = {"); +fd.write("unsigned char espfs_image[] "); +fd.write("__attribute__((aligned(4))) "); +fd.write("__attribute__((section(\".irom.text\"))) = {"); for i, b in enumerate(buf.getbuffer()): if i%16 == 0: fd.write("\n") fd.write(" 0x{:02x},".format(b)) diff --git a/src/main.c b/src/main.c index 09a4805..3eddd20 100644 --- a/src/main.c +++ b/src/main.c @@ -185,10 +185,9 @@ user_init(void) { // Wifi wifiInit(); // init the flash filesystem with the html stuff - espFsInit(espLinkCtx, espfs_image, ESPFS_MEMORY); + EspFsInitResult res = espFsInit(espLinkCtx, espfs_image, ESPFS_MEMORY); + os_printf("espFsInit %s (%d)\n", res?"ERR":"ok", res); - //EspFsInitResult res = espFsInit(&_binary_espfs_img_start); - //os_printf("espFsInit %s\n", res?"ERR":"ok"); // mount the http handlers httpdInit(builtInUrls, 80); #ifdef WEBSERVER