Statistics: Posted by blubb — Sun Sep 27, 2015 10:20 pm
Code:
python2 ~/esptool.py write_flash 0x00000 ../bin/boot_v1.4\(b1\).bin 0x01000 ../bin/upgrade/user1.4096.new.6.bin 0xFC000 user_params.bin
Code:
make COMPILE=gcc BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=6
Statistics: Posted by renze — Sun Sep 27, 2015 10:00 pm
Code:
/* Bankswitching: Choose which 1MB part of flash is mapped to 0x40200000-0x40300000 */
/* Note: Always switch back before calling any sdk function!! */
void flash_switch(uint8_t which)
{
uint8 odd_even = 0;
uint8 mb_count = 0;
if (which==1) { odd_even = 1; }
if (which==2) { mb_count = 1; }
if (which==3) { odd_even = 1; mb_count = 1; }
Cache_Read_Enable(odd_even, mb_count, 1);
}[
/* Read sector: Reads <amount> bytes from the sector <sector> of the flash mapped to the CPU into <buffer>. */
/* Using remap the 1MB area mapped to the CPU can be set to a different area */
void flash_read_sector_switch(uint32 sector, char* buffer, uint16 amount, uint8_t remap)
{
uint32 addr;
addr = sector * SPI_FLASH_SEC_SIZE + 0x40200000;
if ( remap!=FLASH_MAP_INITIAL_VALUE ) flash_switch( remap );
os_memcpy( buffer, addr, amount );
if ( remap!=FLASH_MAP_INITIAL_VALUE ) flash_switch( FLASH_MAP_INITIAL_VALUE );
}
/* Read sector: Reads <amount> bytes from the sector <sector> of the flash into <buffer>. */
/* Automatically maps the right area to the CPU */
void flash_read_sector(uint32 sector, char* buffer, uint16 amount)
{
if (sector<0x100) { flash_read_sector_switch(sector, buffer, amount, 0); }
if ((sector>=0x100)&&(sector<0x200)) { flash_read_sector_switch(sector-0x100, buffer, amount, 1); }
if ((sector>=0x200)&&(sector<0x300)) { flash_read_sector_switch(sector-0x200, buffer, amount, 2); }
if (sector>=0x300) { flash_read_sector_switch(sector-0x300, buffer, amount, 3); }
}
Statistics: Posted by renze — Sun Sep 27, 2015 5:24 pm
Statistics: Posted by eriksl — Sun Sep 27, 2015 3:26 pm
Statistics: Posted by renze — Sun Sep 27, 2015 7:57 am