Make colorchord work with W25Q40 memory, using the window of flash after the IRAM loaded section.

This commit is contained in:
cnlohr 2015-08-28 02:36:36 -04:00
parent c90a00e290
commit 997ad27cc2
6 changed files with 60 additions and 13 deletions

View file

@ -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

View file

@ -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();

View file

@ -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

Binary file not shown.

View file

@ -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 )

View file

@ -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()