espfsformat.h 956 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef ESPROFSFORMAT_H
  2. #define ESPROFSFORMAT_H
  3. /*
  4. Stupid cpio-like tool to make read-only 'filesystems' that live on the flash SPI chip of the module.
  5. Can (will) use lzf compression (when I come around to it) to make shit quicker. Aligns names, files,
  6. headers on 4-byte boundaries so the SPI abstraction hardware in the ESP8266 doesn't crap on itself
  7. when trying to do a <4byte or unaligned read.
  8. */
  9. /*
  10. The idea 'borrows' from cpio: it's basically a concatenation of {header, filename, file} data.
  11. Header, filename and file data is 32-bit aligned. The last file is indicated by data-less header
  12. with the FLAG_LASTFILE flag set.
  13. */
  14. #define FLAG_LASTFILE (1<<0)
  15. #define FLAG_GZIP (1<<1)
  16. #define COMPRESS_NONE 0
  17. #define COMPRESS_HEATSHRINK 1
  18. #define ESPFS_MAGIC 0x73665345
  19. typedef struct {
  20. int32_t magic;
  21. int8_t flags;
  22. int8_t compression;
  23. int16_t nameLen;
  24. int32_t fileLenComp;
  25. int32_t fileLenDecomp;
  26. } __attribute__((packed)) EspFsHeader;
  27. #endif