Moved espfs files and tools together, fixed espfstest
This commit is contained in:
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
build/
|
build/
|
||||||
firmware/
|
firmware/
|
||||||
mkespfsimage/*.o
|
espfs/mkespfsimage/*.o
|
||||||
mkespfsimage/mkespfsimage
|
espfs/mkespfsimage/mkespfsimage
|
||||||
webpages.espfs
|
webpages.espfs
|
||||||
espfstest/*.o
|
espfs/espfstest/*.o
|
||||||
espfstest/espfstest
|
espfs/espfstest/espfstest
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ TARGET = httpd
|
|||||||
|
|
||||||
# which modules (subdirectories) of the project to include in compiling
|
# which modules (subdirectories) of the project to include in compiling
|
||||||
#MODULES = driver user lwip/api lwip/app lwip/core lwip/core/ipv4 lwip/netif
|
#MODULES = driver user lwip/api lwip/app lwip/core lwip/core/ipv4 lwip/netif
|
||||||
MODULES = driver user
|
MODULES = espfs user
|
||||||
EXTRA_INCDIR = include \
|
EXTRA_INCDIR = include \
|
||||||
. \
|
. \
|
||||||
lib/heatshrink/
|
lib/heatshrink/
|
||||||
@@ -147,7 +147,7 @@ $(BUILD_DIR):
|
|||||||
flash: $(TARGET_OUT) $(FW_BASE)
|
flash: $(TARGET_OUT) $(FW_BASE)
|
||||||
$(Q) $(ESPTOOL) --port $(ESPPORT) --baud $(ESPBAUD) write_flash 0x00000 $(FW_BASE)/0x00000.bin 0x40000 $(FW_BASE)/0x40000.bin
|
$(Q) $(ESPTOOL) --port $(ESPPORT) --baud $(ESPBAUD) write_flash 0x00000 $(FW_BASE)/0x00000.bin 0x40000 $(FW_BASE)/0x40000.bin
|
||||||
|
|
||||||
webpages.espfs: html/ html/wifi/ mkespfsimage/mkespfsimage
|
webpages.espfs: html/ html/wifi/ espfs/mkespfsimage/mkespfsimage
|
||||||
ifeq ($(GZIP_COMPRESSION),"yes")
|
ifeq ($(GZIP_COMPRESSION),"yes")
|
||||||
$(Q) rm -rf html_compressed;
|
$(Q) rm -rf html_compressed;
|
||||||
$(Q) cp -r html html_compressed;
|
$(Q) cp -r html html_compressed;
|
||||||
@@ -158,13 +158,13 @@ ifeq ($(COMPRESS_W_YUI),"yes")
|
|||||||
$(Q) awk "BEGIN {printf \"YUI compression ratio was: %.2f%%\\n\", (`du -b -s html_compressed/ | sed 's/\([0-9]*\).*/\1/'`/`du -b -s html/ | sed 's/\([0-9]*\).*/\1/'`)*100}"
|
$(Q) awk "BEGIN {printf \"YUI compression ratio was: %.2f%%\\n\", (`du -b -s html_compressed/ | sed 's/\([0-9]*\).*/\1/'`/`du -b -s html/ | sed 's/\([0-9]*\).*/\1/'`)*100}"
|
||||||
endif
|
endif
|
||||||
$(Q) cd html_compressed; find . -type f -regex ".*/.*\.\(html\|css\|js\)" -exec sh -c "gzip -n {}; mv {}.gz {}" \;; cd ..;
|
$(Q) cd html_compressed; find . -type f -regex ".*/.*\.\(html\|css\|js\)" -exec sh -c "gzip -n {}; mv {}.gz {}" \;; cd ..;
|
||||||
$(Q) cd html_compressed; find | ../mkespfsimage/mkespfsimage > ../webpages.espfs; cd ..;
|
$(Q) cd html_compressed; find | ../espfs/mkespfsimage/mkespfsimage > ../webpages.espfs; cd ..;
|
||||||
$(Q) awk "BEGIN {printf \"GZIP compression ratio was: %.2f%%\\n\", (`du -b -s html_compressed/ | sed 's/\([0-9]*\).*/\1/'`/`du -b -s html/ | sed 's/\([0-9]*\).*/\1/'`)*100}"
|
$(Q) awk "BEGIN {printf \"GZIP compression ratio was: %.2f%%\\n\", (`du -b -s html_compressed/ | sed 's/\([0-9]*\).*/\1/'`/`du -b -s html/ | sed 's/\([0-9]*\).*/\1/'`)*100}"
|
||||||
else
|
else
|
||||||
$(Q) cd html; find | ../mkespfsimage/mkespfsimage > ../webpages.espfs; cd ..
|
$(Q) cd html; find | ../espfs/mkespfsimage/mkespfsimage > ../webpages.espfs; cd ..
|
||||||
endif
|
endif
|
||||||
mkespfsimage/mkespfsimage: mkespfsimage/
|
espfs/mkespfsimage/mkespfsimage: espfs/mkespfsimage/
|
||||||
make -C mkespfsimage
|
make -C espfs/mkespfsimage
|
||||||
|
|
||||||
htmlflash: webpages.espfs
|
htmlflash: webpages.espfs
|
||||||
$(Q) if [ $$(stat -c '%s' webpages.espfs) -gt $$(( 0x2E000 )) ]; then echo "webpages.espfs too big!"; false; fi
|
$(Q) if [ $$(stat -c '%s' webpages.espfs) -gt $$(( 0x2E000 )) ]; then echo "webpages.espfs too big!"; false; fi
|
||||||
|
|||||||
@@ -43,10 +43,11 @@ It's written for use with httpd, but doesn't need to be used as such.
|
|||||||
extern char* espFsData;
|
extern char* espFsData;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../mkespfsimage/espfsformat.h"
|
#include "espfsformat.h"
|
||||||
#include "espfs.h"
|
#include "espfs.h"
|
||||||
#include "httpdconfig.h"
|
|
||||||
#ifdef EFS_HEATSHRINK
|
#ifdef ESPFS_HEATSHRINK
|
||||||
|
#include "heatshrink_config_custom.h"
|
||||||
#include "heatshrink_decoder.h"
|
#include "heatshrink_decoder.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -83,6 +84,7 @@ a memory exception, crashing the program.
|
|||||||
//aligned 32-bit reads. Yes, it's no too optimized but it's short and sweet and it works.
|
//aligned 32-bit reads. Yes, it's no too optimized but it's short and sweet and it works.
|
||||||
|
|
||||||
//ToDo: perhaps os_memcpy also does unaligned accesses?
|
//ToDo: perhaps os_memcpy also does unaligned accesses?
|
||||||
|
#ifdef __ets__
|
||||||
void ICACHE_FLASH_ATTR memcpyAligned(char *dst, char *src, int len) {
|
void ICACHE_FLASH_ATTR memcpyAligned(char *dst, char *src, int len) {
|
||||||
int x;
|
int x;
|
||||||
int w, b;
|
int w, b;
|
||||||
@@ -96,6 +98,9 @@ void ICACHE_FLASH_ATTR memcpyAligned(char *dst, char *src, int len) {
|
|||||||
dst++; src++;
|
dst++; src++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define memcpyAligned memcpy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//Open a file and return a pointer to the file desc struct.
|
//Open a file and return a pointer to the file desc struct.
|
||||||
@@ -142,7 +147,7 @@ EspFsFile ICACHE_FLASH_ATTR *espFsOpen(char *fileName) {
|
|||||||
r->posDecomp=0;
|
r->posDecomp=0;
|
||||||
if (h.compression==COMPRESS_NONE) {
|
if (h.compression==COMPRESS_NONE) {
|
||||||
r->decompData=NULL;
|
r->decompData=NULL;
|
||||||
#ifdef EFS_HEATSHRINK
|
#ifdef ESPFS_HEATSHRINK
|
||||||
} else if (h.compression==COMPRESS_HEATSHRINK) {
|
} else if (h.compression==COMPRESS_HEATSHRINK) {
|
||||||
//File is compressed with Heatshrink.
|
//File is compressed with Heatshrink.
|
||||||
char parm;
|
char parm;
|
||||||
@@ -183,10 +188,10 @@ int ICACHE_FLASH_ATTR espFsRead(EspFsFile *fh, char *buff, int len) {
|
|||||||
fh->posComp+=len;
|
fh->posComp+=len;
|
||||||
// os_printf("Done reading %d bytes, pos=%x\n", len, fh->posComp);
|
// os_printf("Done reading %d bytes, pos=%x\n", len, fh->posComp);
|
||||||
return len;
|
return len;
|
||||||
#ifdef EFS_HEATSHRINK
|
#ifdef ESPFS_HEATSHRINK
|
||||||
} else if (fh->decompressor==COMPRESS_HEATSHRINK) {
|
} else if (fh->decompressor==COMPRESS_HEATSHRINK) {
|
||||||
int decoded=0;
|
int decoded=0;
|
||||||
unsigned int elen, rlen;
|
size_t elen, rlen;
|
||||||
char ebuff[16];
|
char ebuff[16];
|
||||||
heatshrink_decoder *dec=(heatshrink_decoder *)fh->decompData;
|
heatshrink_decoder *dec=(heatshrink_decoder *)fh->decompData;
|
||||||
// os_printf("Alloc %p\n", dec);
|
// os_printf("Alloc %p\n", dec);
|
||||||
@@ -218,7 +223,7 @@ int ICACHE_FLASH_ATTR espFsRead(EspFsFile *fh, char *buff, int len) {
|
|||||||
//Close the file.
|
//Close the file.
|
||||||
void ICACHE_FLASH_ATTR espFsClose(EspFsFile *fh) {
|
void ICACHE_FLASH_ATTR espFsClose(EspFsFile *fh) {
|
||||||
if (fh==NULL) return;
|
if (fh==NULL) return;
|
||||||
#ifdef EFS_HEATSHRINK
|
#ifdef ESPFS_HEATSHRINK
|
||||||
if (fh->decompressor==COMPRESS_HEATSHRINK) {
|
if (fh->decompressor==COMPRESS_HEATSHRINK) {
|
||||||
heatshrink_decoder *dec=(heatshrink_decoder *)fh->decompData;
|
heatshrink_decoder *dec=(heatshrink_decoder *)fh->decompData;
|
||||||
heatshrink_decoder_free(dec);
|
heatshrink_decoder_free(dec);
|
||||||
@@ -1,6 +1,12 @@
|
|||||||
#ifndef ESPFS_H
|
#ifndef ESPFS_H
|
||||||
#define ESPFS_H
|
#define ESPFS_H
|
||||||
|
|
||||||
|
//Define this if you want to be able to use Heatshrink-compressed espfs images.
|
||||||
|
#define ESPFS_HEATSHRINK
|
||||||
|
|
||||||
|
//Pos of esp fs in flash
|
||||||
|
#define ESPFS_POS 0x12000
|
||||||
|
#define ESPFS_SIZE 0x2E000
|
||||||
|
|
||||||
|
|
||||||
typedef struct EspFsFile EspFsFile;
|
typedef struct EspFsFile EspFsFile;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99
|
||||||
|
|
||||||
|
espfstest: main.o espfs.o heatshrink_decoder.o
|
||||||
|
$(CC) -o $@ $^
|
||||||
|
|
||||||
|
espfs.o: ../espfs.c
|
||||||
|
$(CC) $(CFLAGS) -c $^ -o $@
|
||||||
|
|
||||||
|
heatshrink_decoder.o: ../heatshrink_decoder.c
|
||||||
|
$(CC) $(CFLAGS) -c $^ -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o espfstest
|
||||||
@@ -7,8 +7,13 @@
|
|||||||
|
|
||||||
#if HEATSHRINK_DYNAMIC_ALLOC
|
#if HEATSHRINK_DYNAMIC_ALLOC
|
||||||
/* Optional replacement of malloc/free */
|
/* Optional replacement of malloc/free */
|
||||||
|
#ifdef __ets__
|
||||||
#define HEATSHRINK_MALLOC(SZ) os_malloc(SZ)
|
#define HEATSHRINK_MALLOC(SZ) os_malloc(SZ)
|
||||||
#define HEATSHRINK_FREE(P, SZ) os_free(P)
|
#define HEATSHRINK_FREE(P, SZ) os_free(P)
|
||||||
|
#else
|
||||||
|
#define HEATSHRINK_MALLOC(SZ) malloc(SZ)
|
||||||
|
#define HEATSHRINK_FREE(P, SZ) free(P)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
/* Required parameters for static configuration */
|
/* Required parameters for static configuration */
|
||||||
#define HEATSHRINK_STATIC_INPUT_BUFFER_SIZE 32
|
#define HEATSHRINK_STATIC_INPUT_BUFFER_SIZE 32
|
||||||
@@ -23,4 +28,3 @@
|
|||||||
#define HEATSHRINK_USE_INDEX 1
|
#define HEATSHRINK_USE_INDEX 1
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
#include "httpdconfig.h"
|
#include "espfs.h"
|
||||||
#ifdef EFS_HEATSHRINK
|
#ifdef ESPFS_HEATSHRINK
|
||||||
//Stupid wrapper so we don't have to move c-files around
|
//Stupid wrapper so we don't have to move c-files around
|
||||||
//Also loads httpd-specific config.
|
//Also loads httpd-specific config.
|
||||||
|
|
||||||
|
#ifdef __ets__
|
||||||
|
//esp build
|
||||||
#define _STDLIB_H_
|
#define _STDLIB_H_
|
||||||
#define _STRING_H_
|
#define _STRING_H_
|
||||||
#define _STDDEF_H
|
#define _STDDEF_H
|
||||||
@@ -11,9 +13,13 @@
|
|||||||
#include "c_types.h"
|
#include "c_types.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
#include "osapi.h"
|
#include "osapi.h"
|
||||||
#include "heatshrink_config_httpd.h"
|
|
||||||
#define memset(x,y,z) os_memset(x,y,z)
|
#define memset(x,y,z) os_memset(x,y,z)
|
||||||
#define memcpy(x,y,z) os_memcpy(x,y,z)
|
#define memcpy(x,y,z) os_memcpy(x,y,z)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "heatshrink_config_custom.h"
|
||||||
#include "../lib/heatshrink/heatshrink_decoder.c"
|
#include "../lib/heatshrink/heatshrink_decoder.c"
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
CFLAGS=-I../lib/heatshrink -std=gnu99
|
CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99
|
||||||
OBJS=main.o heatshrink_encoder.o
|
OBJS=main.o heatshrink_encoder.o
|
||||||
TARGET=mkespfsimage
|
TARGET=mkespfsimage
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
CFLAGS=-I../lib/heatshrink -I../user -I../include -std=gnu99
|
|
||||||
|
|
||||||
espfstest: main.o espfs.o heatshrink_decoder.o
|
|
||||||
$(CC) -o $@ $^
|
|
||||||
|
|
||||||
espfs.o: espfs.c ../user/espfs.c
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o espfstest
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "../user/espfs.c"
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#include "httpdconfig.h"
|
|
||||||
#ifdef EFS_HEATSHRINK
|
|
||||||
//Stupid wrapper so we don't have to move c-files around
|
|
||||||
//Also loads httpd-specific config.
|
|
||||||
|
|
||||||
#include "../lib/heatshrink/heatshrink_decoder.c"
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
|
|
||||||
//Define this if you want to be able to use Heatshrink-compressed espfs images.
|
|
||||||
#define EFS_HEATSHRINK
|
|
||||||
|
|
||||||
//Pos of esp fs in flash
|
|
||||||
#define ESPFS_POS 0x12000
|
|
||||||
#define ESPFS_SIZE 0x2E000
|
|
||||||
|
|
||||||
//If you want, you can define a realm for the authentication system.
|
|
||||||
//#define HTTP_AUTH_REALM "MyRealm"
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
#ifndef AUTH_H
|
#ifndef AUTH_H
|
||||||
#define AUTH_H
|
#define AUTH_H
|
||||||
|
|
||||||
#include "httpdconfig.h"
|
|
||||||
|
|
||||||
#ifndef HTTP_AUTH_REALM
|
#ifndef HTTP_AUTH_REALM
|
||||||
#define HTTP_AUTH_REALM "Protected"
|
#define HTTP_AUTH_REALM "Protected"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ flash as a binary. Also handles the hit counter on the main page.
|
|||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include <ip_addr.h>
|
#include <ip_addr.h>
|
||||||
#include "espmissingincludes.h"
|
#include "espmissingincludes.h"
|
||||||
#include "../include/httpdconfig.h"
|
|
||||||
|
|
||||||
|
|
||||||
//cause I can't be bothered to write an ioGetLed()
|
//cause I can't be bothered to write an ioGetLed()
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ Some flash handling cgi routines. Used for reading the existing flash and updati
|
|||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include <ip_addr.h>
|
#include <ip_addr.h>
|
||||||
#include "espmissingincludes.h"
|
#include "espmissingincludes.h"
|
||||||
#include "../include/httpdconfig.h"
|
#include "espfs.h"
|
||||||
|
|
||||||
|
|
||||||
//Cgi that reads the SPI flash. Assumes 512KByte flash.
|
//Cgi that reads the SPI flash. Assumes 512KByte flash.
|
||||||
|
|||||||
@@ -19,10 +19,7 @@ Esp8266 http server - core routines
|
|||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
#include "osapi.h"
|
#include "osapi.h"
|
||||||
|
|
||||||
#include "espconn.h"
|
|
||||||
#include "httpd.h"
|
#include "httpd.h"
|
||||||
#include "io.h"
|
|
||||||
#include "espfs.h"
|
|
||||||
|
|
||||||
|
|
||||||
//Max length of request head
|
//Max length of request head
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ Connector to let httpd use the espfs filesystem to serve the files in it.
|
|||||||
#include "espconn.h"
|
#include "espconn.h"
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
#include "httpd.h"
|
|
||||||
#include "espfs.h"
|
|
||||||
#include "httpdespfs.h"
|
#include "httpdespfs.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user