diff --git a/embedded8266/Makefile b/embedded8266/Makefile index 30eceb9..c608f16 100644 --- a/embedded8266/Makefile +++ b/embedded8266/Makefile @@ -80,13 +80,20 @@ $(FW_FILE_2): $(TARGET_OUT) @echo "FW $@" $(FW_TOOL) -eo $(TARGET_OUT) -es .irom0.text $@ -ec - -IP?=192.168.4.1 - burn : $(FW_FILE_1) $(FW_FILE_2) ($(ESPTOOL_PY) --port $(PORT) write_flash 0x00000 0x00000.bin 0x40000 0x40000.bin)||(true) +#If you have space, MFS should live at 0x100000, if you don't it can also live at +#0x10000. But, then it is limited to 180kB. You might need to do this if you have a 512kB +#ESP variant. + +burnweb : web/page.mpfs + ($(ESPTOOL_PY) --port $(PORT) write_flash 0x10000 web/page.mpfs)||(true) + + + +IP?=192.168.4.1 netburn : image.elf $(FW_FILE_1) $(FW_FILE_2) web/execute_reflash $(IP) 0x00000.bin 0x40000.bin diff --git a/embedded8266/common/mfs.c b/embedded8266/common/mfs.c index 6b9f6d2..a2d0c27 100644 --- a/embedded8266/common/mfs.c +++ b/embedded8266/common/mfs.c @@ -6,6 +6,26 @@ #include "spi_flash.h" #include "ets_sys.h" +uint32 mfs_at = 0; + +void FindMPFS() +{ + uint32 mfs_check[2]; + EnterCritical(); + flashchip->chip_size = 0x01000000; + + spi_flash_read( MFS_START, mfs_check, sizeof( mfs_check ) ); + if( strncmp( "MPFSPFS", mfs_check ) == 0 ) { mfs_at = MFS_START; goto done; } + + spi_flash_read( MFS_ALTERNATIVE_START, mfs_check, sizeof( mfs_check ) ); + if( strncmp( "MPFSPFS", mfs_check ) == 0 ) { mfs_at = MFS_ALTERNATIVE_START; goto done; } + + +done: + flashchip->chip_size = 0x00080000; + ExitCritical(); +} + extern SpiFlashChip * flashchip; //Returns 0 on succses. @@ -14,9 +34,18 @@ extern SpiFlashChip * flashchip; //Returns -1 if can't find file or reached end of file list. int8_t MFSOpenFile( const char * fname, struct MFSFileInfo * mfi ) { + if( mfs_at == 0 ) + { + FindMPFS(); + } + if( mfs_at == 0 ) + { + return -1; + } + EnterCritical(); flashchip->chip_size = 0x01000000; - uint32 ptr = MFS_START; + uint32 ptr = mfs_at; struct MFSFileEntry e; while(1) { @@ -51,7 +80,7 @@ int32_t MFSReadSector( uint8_t* data, struct MFSFileInfo * mfi ) EnterCritical(); flashchip->chip_size = 0x01000000; - spi_flash_read( MFS_START+mfi->offset, (uint32*)data, MFS_SECTOR ); + spi_flash_read( mfs_at+mfi->offset, (uint32*)data, MFS_SECTOR ); flashchip->chip_size = 0x00080000; ExitCritical(); diff --git a/embedded8266/common/mfs.h b/embedded8266/common/mfs.h index 8f9d526..019d891 100644 --- a/embedded8266/common/mfs.h +++ b/embedded8266/common/mfs.h @@ -11,6 +11,10 @@ #include "mystuff.h" //SPI_FLASH_SEC_SIZE 4096 + +//If you are on a chip with limited space, MFS can alternatively live here, with a max size of 180kB. +#define MFS_ALTERNATIVE_START 0x10000 + #define MFS_STARTFLASHSECTOR 0x100 #define MFS_START (MFS_STARTFLASHSECTOR*SPI_FLASH_SEC_SIZE) #define MFS_SECTOR 256 diff --git a/embedded8266/image.elf b/embedded8266/image.elf index 08656c6..680e677 100755 Binary files a/embedded8266/image.elf and b/embedded8266/image.elf differ diff --git a/embedded8266/web/mfsmaker.c b/embedded8266/web/mfsmaker.c index cd7d027..f2915c2 100644 --- a/embedded8266/web/mfsmaker.c +++ b/embedded8266/web/mfsmaker.c @@ -49,6 +49,13 @@ int main( int argc, char ** argv ) return -2; } + + memcpy( mfsfat[fatpointer].name, "MPFSMPFS", 8 ); + mfsfat[fatpointer].start = 0; + mfsfat[fatpointer].len = 0; + fatpointer++; + + while ((dir = readdir(d)) != NULL) { if( dir->d_type & DT_REG ) diff --git a/embedded8266/web/page/main.js b/embedded8266/web/page/main.js index 7769d07..b4d473f 100644 --- a/embedded8266/web/page/main.js +++ b/embedded8266/web/page/main.js @@ -7,6 +7,11 @@ globalParams = {}; function mainticker() { + KickOscilloscope(); + KickDFT(); + KickNotes(); + KickLEDs(); + QueueOperation( "CVR", ReceiveParameters ); setTimeout( mainticker, 1000 ); } @@ -14,10 +19,6 @@ function mainticker() function maininit() { setTimeout( mainticker, 1000 ); - KickOscilloscope(); - KickDFT(); - KickNotes(); - KickLEDs(); } @@ -89,7 +90,7 @@ pause_oscilloscope = false; function KickOscilloscope() { $( "#OScopePauseButton" ).css( "background-color", (is_oscilloscope_running&&pause_oscilloscope)?"green":"red" ); - if( !is_oscilloscope_running && !pause_oscilloscope) + if( !pause_oscilloscope) OScopeDataTicker(); } @@ -169,7 +170,7 @@ pause_dft = false; function KickDFT() { $( "#DFTPauseButton" ).css( "background-color", (is_dft_running&&!pause_dft)?"green":"red" ); - if( !is_dft_running && !pause_dft ) + if( !pause_dft ) DFTDataTicker(); } @@ -246,9 +247,8 @@ function KickLEDs() { $( "#LEDPauseButton" ).css( "background-color", (is_leds_running&&!pause_led)?"green":"red" ); - if( !is_leds_running && !pause_led ) + if( !pause_led ) LEDDataTicker(); - } function ToggleLEDPause()