Chat about current Lua tools and IDEs

User avatar
By hamishcunningham
#7128 Hi,

Is there a way I can create a .bin containing a spiffs filesystem and then flash it to the chip (e.g. using esptool.py)?

I know the filesystem lives in the flash somewhere, but I don't know what format it is in or how I might recreate it... Perhaps if I downloaded an example from the ESP I could poke around in it, but I'm not sure what address it lives at.

Or is there a better way?

Thanks, best

Hamish
User avatar
By zeroday
#7163
hamishcunningham wrote:Hi,

Is there a way I can create a .bin containing a spiffs filesystem and then flash it to the chip (e.g. using esptool.py)?

I know the filesystem lives in the flash somewhere, but I don't know what format it is in or how I might recreate it... Perhaps if I downloaded an example from the ESP I could poke around in it, but I'm not sure what address it lives at.

Or is there a better way?

Thanks, best

Hamish


https://github.com/xlfe/spiffy
User avatar
By joe
#9202 If it is of any help, I wrote this little ruby script that will build the flash binaries to ease downloads when you want to include a spiffy file system in your flash image:

Code: Select all#!/usr/bin/env ruby

NODEMCU = "../nodemcu-firmware"
NODEBIN = "#{NODEMCU}/bin"
TOOLS   = "#{NODEMCU}/tools"
SPIFFY  = "../spiffy/build/spiffy"
DEST    = "./flash"
PORT    = "/dev/tty.usbserial-A9QHXRVN"

# cp lua app
system "mkdir -p #{DEST}"
system "cp #{NODEBIN}/0x00000.bin #{DEST}"
system "cp #{NODEBIN}/0x10000.bin #{DEST}"

# build file system
system "#{SPIFFY}"

# calculate address of files sys and place the file with new name
flashaddr = (0x10000 + File.stat("#{DEST}/0x10000.bin").size + 0x4000) & (0xFFFFC000)
system "mv spiff_rom.bin #{DEST}/0x#{flashaddr.to_s(16)}.bin"

# create download command
printf "python #{TOOLS}/esptool.py --port #{PORT} write_flash"
Dir["#{DEST}/*"].each do |file|
  printf " #{File.basename(file, '.bin')} " + file
end
print "\n"