pull/39/head
Benjamin Runnels 9 years ago
commit ecafbf7485
  1. 3
      .gitignore
  2. 126
      esp-link.vcxproj
  3. 13
      espfs/espfstest/Makefile
  4. 67
      espfs/espfstest/main.c
  5. 45
      espfs/mkespfsimage/Makefile

3
.gitignore vendored

@ -11,3 +11,6 @@ esp-link.tgz
tve-patch/
yui
.localhistory/
espfs/mkespfsimage/mman-win32/mman.o
espfs/mkespfsimage/mman-win32/libmman.a
esp-link.sdf

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{A92F0CAA-F89B-4F78-AD2A-A042429BD87F}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
<ConfigurationType>Makefile</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<NMakeOutput />
<NMakePreprocessorDefinitions>__ets__;_STDINT_H;ICACHE_FLASH;__MINGW32__;__WIN32__</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath>.\cmd;.\serial;.\user;.\espfs;.\httpd;.\include;..\esp_iot_sdk_v1.3.0\include;..\xtensa-lx106-elf\xtensa-lx106-elf\include;c:\tools\mingw64\x86_64-w64-mingw32\include;c:\tools\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.3\include</NMakeIncludeSearchPath>
<ExecutablePath />
<ReferencePath />
<LibraryPath />
<LibraryWPath />
<ExcludePath />
<NMakeOutput />
<OutDir>bin</OutDir>
<IntDir>build</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<NMakeBuildCommandLine>espmake flash</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>espmake clean all</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>espmake clean</NMakeCleanCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<NMakeBuildCommandLine>espmake all wiflash</NMakeBuildCommandLine>
<NMakeReBuildCommandLine>espmake clean all</NMakeReBuildCommandLine>
<NMakeCleanCommandLine>espmake clean</NMakeCleanCommandLine>
</PropertyGroup>
<ItemDefinitionGroup>
<BuildLog>
<Path />
</BuildLog>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="espfs\mkespfsimage\Makefile" />
<None Include="espfs\mkespfsimage\mman-win32\config.mak" />
<None Include="espfs\mkespfsimage\mman-win32\configure" />
<None Include="espfs\mkespfsimage\mman-win32\Makefile" />
<None Include="espmake.cmd" />
<None Include="Makefile" />
<None Include="wiflash" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="cmd\cmd.c" />
<ClCompile Include="cmd\handlers.c" />
<ClCompile Include="cmd\rest.c" />
<ClCompile Include="cmd\tcpclient.c" />
<ClCompile Include="espfs\espfs.c" />
<ClCompile Include="espfs\mkespfsimage\main.c" />
<ClCompile Include="espfs\mkespfsimage\mman-win32\mman.c" />
<ClCompile Include="espfs\mkespfsimage\mman-win32\test.c" />
<ClCompile Include="httpd\auth.c" />
<ClCompile Include="httpd\base64.c" />
<ClCompile Include="httpd\httpd.c" />
<ClCompile Include="httpd\httpdespfs.c" />
<ClCompile Include="serial\console.c" />
<ClCompile Include="serial\crc16.c" />
<ClCompile Include="serial\serbridge.c" />
<ClCompile Include="serial\serled.c" />
<ClCompile Include="serial\slip.c" />
<ClCompile Include="serial\uart.c" />
<ClCompile Include="user\cgi.c" />
<ClCompile Include="user\cgiflash.c" />
<ClCompile Include="user\cgipins.c" />
<ClCompile Include="user\cgitcp.c" />
<ClCompile Include="user\cgiwifi.c" />
<ClCompile Include="user\config.c" />
<ClCompile Include="user\log.c" />
<ClCompile Include="user\status.c" />
<ClCompile Include="user\user_main.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cmd\cmd.h" />
<ClInclude Include="cmd\rest.h" />
<ClInclude Include="cmd\tcpclient.h" />
<ClInclude Include="espfs\espfs.h" />
<ClInclude Include="espfs\espfsformat.h" />
<ClInclude Include="espfs\mkespfsimage\mman-win32\mman.h" />
<ClInclude Include="httpd\auth.h" />
<ClInclude Include="httpd\base64.h" />
<ClInclude Include="httpd\httpd.h" />
<ClInclude Include="httpd\httpdespfs.h" />
<ClInclude Include="include\esp8266.h" />
<ClInclude Include="include\espmissingincludes.h" />
<ClInclude Include="include\uart_hw.h" />
<ClInclude Include="include\user_config.h" />
<ClInclude Include="serial\console.h" />
<ClInclude Include="serial\crc16.h" />
<ClInclude Include="serial\serbridge.h" />
<ClInclude Include="serial\serled.h" />
<ClInclude Include="serial\uart.h" />
<ClInclude Include="user\cgi.h" />
<ClInclude Include="user\cgiflash.h" />
<ClInclude Include="user\cgipins.h" />
<ClInclude Include="user\cgitcp.h" />
<ClInclude Include="user\cgiwifi.h" />
<ClInclude Include="user\config.h" />
<ClInclude Include="user\log.h" />
<ClInclude Include="user\status.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -1,13 +0,0 @@
CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99 -DESPFS_HEATSHRINK
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

@ -1,67 +0,0 @@
/*
Simple and stupid file decompressor for an espfs image. Mostly used as a testbed for espfs.c and
the decompressors: code compiled natively is way easier to debug using gdb et all :)
*/
#include <stdio.h>
#include <stdint.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include "espfs.h"
char *espFsData;
int main(int argc, char **argv) {
int f, out;
int len;
char buff[128];
EspFsFile *ef;
off_t size;
EspFsInitResult ir;
if (argc!=3) {
printf("Usage: %s espfs-image file\nExpands file from the espfs-image archive.\n", argv[0]);
exit(0);
}
f=open(argv[1], O_RDONLY);
if (f<=0) {
perror(argv[1]);
exit(1);
}
size=lseek(f, 0, SEEK_END);
espFsData=mmap(NULL, size, PROT_READ, MAP_SHARED, f, 0);
if (espFsData==MAP_FAILED) {
perror("mmap");
exit(1);
}
ir=espFsInit(espFsData);
if (ir != ESPFS_INIT_RESULT_OK) {
printf("Couldn't init espfs filesystem (code %d)\n", ir);
exit(1);
}
ef=espFsOpen(argv[2]);
if (ef==NULL) {
printf("Couldn't find %s in image.\n", argv[2]);
exit(1);
}
out=open(argv[2], O_WRONLY|O_CREAT|O_TRUNC, 0644);
if (out<=0) {
perror(argv[2]);
exit(1);
}
while ((len=espFsRead(ef, buff, 128))!=0) {
write(out, buff, len);
}
espFsClose(ef);
//munmap, close, ... I can't be bothered.
}

@ -1,16 +1,45 @@
GZIP_COMPRESSION ?= no
USE_HEATSHRINK ?= yes
CFLAGS=-I../../lib/heatshrink -I.. -std=gnu99
ifeq ($(OS),Windows_NT)
TARGET = mkespfsimage.exe
CC = gcc
LD = $(CC)
CFLAGS=-c -I.. -Imman-win32 -std=gnu99
LDFLAGS=-Lmman-win32 -lmman
ifeq ("$(GZIP_COMPRESSION)","yes")
CFLAGS += -DESPFS_GZIP
CFLAGS += -DESPFS_GZIP
LDFLAGS += -lz
endif
ifeq ("$(USE_HEATSHRINK)","yes")
CFLAGS += -DESPFS_HEATSHRINK
OBJECTS = main.o
all: libmman $(TARGET)
libmman:
$(Q) make -C mman-win32
$(TARGET): $(OBJECTS)
$(LD) -o $@ $^ $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -o $@ $^
clean:
rm -f $(OBJECTS) $(TARGET) ./mman-win32/libmman.a ./mman-win32/mman.o
.PHONY: all clean
else
CFLAGS=-I.. -std=gnu99
ifeq ("$(GZIP_COMPRESSION)","yes")
CFLAGS += -DESPFS_GZIP
endif
OBJS=main.o heatshrink_encoder.o
OBJS=main.o
TARGET=mkespfsimage
$(TARGET): $(OBJS)
@ -21,4 +50,6 @@ else
endif
clean:
rm -f $(TARGET) $(OBJS)
rm -f $(TARGET) $(OBJS)
endif
Loading…
Cancel
Save