Moved espfs files and tools together, fixed espfstest
This commit is contained in:
+4
-4
@@ -1,8 +1,8 @@
|
||||
build/
|
||||
firmware/
|
||||
mkespfsimage/*.o
|
||||
mkespfsimage/mkespfsimage
|
||||
espfs/mkespfsimage/*.o
|
||||
espfs/mkespfsimage/mkespfsimage
|
||||
webpages.espfs
|
||||
espfstest/*.o
|
||||
espfstest/espfstest
|
||||
espfs/espfstest/*.o
|
||||
espfs/espfstest/espfstest
|
||||
*.DS_Store
|
||||
|
||||
@@ -30,7 +30,7 @@ TARGET = httpd
|
||||
|
||||
# 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
|
||||
MODULES = espfs user
|
||||
EXTRA_INCDIR = include \
|
||||
. \
|
||||
lib/heatshrink/
|
||||
@@ -147,7 +147,7 @@ $(BUILD_DIR):
|
||||
flash: $(TARGET_OUT) $(FW_BASE)
|
||||
$(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")
|
||||
$(Q) rm -rf 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}"
|
||||
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 | ../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}"
|
||||
else
|
||||
$(Q) cd html; find | ../mkespfsimage/mkespfsimage > ../webpages.espfs; cd ..
|
||||
$(Q) cd html; find | ../espfs/mkespfsimage/mkespfsimage > ../webpages.espfs; cd ..
|
||||
endif
|
||||
mkespfsimage/mkespfsimage: mkespfsimage/
|
||||
make -C mkespfsimage
|
||||
espfs/mkespfsimage/mkespfsimage: espfs/mkespfsimage/
|
||||
make -C espfs/mkespfsimage
|
||||
|
||||
htmlflash: webpages.espfs
|
||||
$(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;
|
||||
#endif
|
||||
|
||||
#include "../mkespfsimage/espfsformat.h"
|
||||
#include "espfsformat.h"
|
||||
#include "espfs.h"
|
||||
#include "httpdconfig.h"
|
||||
#ifdef EFS_HEATSHRINK
|
||||
|
||||
#ifdef ESPFS_HEATSHRINK
|
||||
#include "heatshrink_config_custom.h"
|
||||
#include "heatshrink_decoder.h"
|
||||
#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.
|
||||
|
||||
//ToDo: perhaps os_memcpy also does unaligned accesses?
|
||||
#ifdef __ets__
|
||||
void ICACHE_FLASH_ATTR memcpyAligned(char *dst, char *src, int len) {
|
||||
int x;
|
||||
int w, b;
|
||||
@@ -96,6 +98,9 @@ void ICACHE_FLASH_ATTR memcpyAligned(char *dst, char *src, int len) {
|
||||
dst++; src++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define memcpyAligned memcpy
|
||||
#endif
|
||||
|
||||
|
||||
//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;
|
||||
if (h.compression==COMPRESS_NONE) {
|
||||
r->decompData=NULL;
|
||||
#ifdef EFS_HEATSHRINK
|
||||
#ifdef ESPFS_HEATSHRINK
|
||||
} else if (h.compression==COMPRESS_HEATSHRINK) {
|
||||
//File is compressed with Heatshrink.
|
||||
char parm;
|
||||
@@ -183,10 +188,10 @@ int ICACHE_FLASH_ATTR espFsRead(EspFsFile *fh, char *buff, int len) {
|
||||
fh->posComp+=len;
|
||||
// os_printf("Done reading %d bytes, pos=%x\n", len, fh->posComp);
|
||||
return len;
|
||||
#ifdef EFS_HEATSHRINK
|
||||
#ifdef ESPFS_HEATSHRINK
|
||||
} else if (fh->decompressor==COMPRESS_HEATSHRINK) {
|
||||
int decoded=0;
|
||||
unsigned int elen, rlen;
|
||||
size_t elen, rlen;
|
||||
char ebuff[16];
|
||||
heatshrink_decoder *dec=(heatshrink_decoder *)fh->decompData;
|
||||
// os_printf("Alloc %p\n", dec);
|
||||
@@ -218,7 +223,7 @@ int ICACHE_FLASH_ATTR espFsRead(EspFsFile *fh, char *buff, int len) {
|
||||
//Close the file.
|
||||
void ICACHE_FLASH_ATTR espFsClose(EspFsFile *fh) {
|
||||
if (fh==NULL) return;
|
||||
#ifdef EFS_HEATSHRINK
|
||||
#ifdef ESPFS_HEATSHRINK
|
||||
if (fh->decompressor==COMPRESS_HEATSHRINK) {
|
||||
heatshrink_decoder *dec=(heatshrink_decoder *)fh->decompData;
|
||||
heatshrink_decoder_free(dec);
|
||||
@@ -1,6 +1,12 @@
|
||||
#ifndef 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;
|
||||
@@ -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
|
||||
/* Optional replacement of malloc/free */
|
||||
#ifdef __ets__
|
||||
#define HEATSHRINK_MALLOC(SZ) os_malloc(SZ)
|
||||
#define HEATSHRINK_FREE(P, SZ) os_free(P)
|
||||
#else
|
||||
#define HEATSHRINK_MALLOC(SZ) malloc(SZ)
|
||||
#define HEATSHRINK_FREE(P, SZ) free(P)
|
||||
#endif
|
||||
#else
|
||||
/* Required parameters for static configuration */
|
||||
#define HEATSHRINK_STATIC_INPUT_BUFFER_SIZE 32
|
||||
@@ -23,4 +28,3 @@
|
||||
#define HEATSHRINK_USE_INDEX 1
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "httpdconfig.h"
|
||||
#ifdef EFS_HEATSHRINK
|
||||
#include "espfs.h"
|
||||
#ifdef ESPFS_HEATSHRINK
|
||||
//Stupid wrapper so we don't have to move c-files around
|
||||
//Also loads httpd-specific config.
|
||||
|
||||
#ifdef __ets__
|
||||
//esp build
|
||||
#define _STDLIB_H_
|
||||
#define _STRING_H_
|
||||
#define _STDDEF_H
|
||||
@@ -11,9 +13,13 @@
|
||||
#include "c_types.h"
|
||||
#include "mem.h"
|
||||
#include "osapi.h"
|
||||
#include "heatshrink_config_httpd.h"
|
||||
|
||||
#define memset(x,y,z) os_memset(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"
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
CFLAGS=-I../lib/heatshrink -std=gnu99
|
||||
CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99
|
||||
OBJS=main.o heatshrink_encoder.o
|
||||
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
|
||||
#define AUTH_H
|
||||
|
||||
#include "httpdconfig.h"
|
||||
|
||||
#ifndef HTTP_AUTH_REALM
|
||||
#define HTTP_AUTH_REALM "Protected"
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,6 @@ flash as a binary. Also handles the hit counter on the main page.
|
||||
#include "io.h"
|
||||
#include <ip_addr.h>
|
||||
#include "espmissingincludes.h"
|
||||
#include "../include/httpdconfig.h"
|
||||
|
||||
|
||||
//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 <ip_addr.h>
|
||||
#include "espmissingincludes.h"
|
||||
#include "../include/httpdconfig.h"
|
||||
#include "espfs.h"
|
||||
|
||||
|
||||
//Cgi that reads the SPI flash. Assumes 512KByte flash.
|
||||
|
||||
@@ -19,10 +19,7 @@ Esp8266 http server - core routines
|
||||
#include "mem.h"
|
||||
#include "osapi.h"
|
||||
|
||||
#include "espconn.h"
|
||||
#include "httpd.h"
|
||||
#include "io.h"
|
||||
#include "espfs.h"
|
||||
|
||||
|
||||
//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 "mem.h"
|
||||
|
||||
#include "httpd.h"
|
||||
#include "espfs.h"
|
||||
#include "httpdespfs.h"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user