Skip to content

Commit

Permalink
increase irom0 from 0x3C000 to 0x6B000 (+192KB) space
Browse files Browse the repository at this point in the history
  • Loading branch information
Links2004 committed May 3, 2015
1 parent 915eb45 commit 3406b47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
21 changes: 14 additions & 7 deletions libraries/EEPROM/EEPROM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "spi_flash.h"
}

#define CONFIG_START_SECTOR 0x3C
#define CONFIG_START_SECTOR 0x7b
#define CONFIG_SECTOR (CONFIG_START_SECTOR + 0)
#define CONFIG_ADDR (SPI_FLASH_SEC_SIZE * CONFIG_SECTOR)

Expand Down Expand Up @@ -82,16 +82,23 @@ void EEPROMClass::write(int address, uint8_t value)
_dirty = true;
}

void EEPROMClass::commit()
bool EEPROMClass::commit()
{
if (!_size || !_dirty)
return;
bool ret = false;
if (!_size)
return false;
if(!_dirty)
return true;

ETS_UART_INTR_DISABLE();
spi_flash_erase_sector(CONFIG_SECTOR);
spi_flash_write(CONFIG_ADDR, reinterpret_cast<uint32_t*>(_data), _size);
if(spi_flash_erase_sector(CONFIG_SECTOR) == SPI_FLASH_RESULT_OK) {
if(spi_flash_write(CONFIG_ADDR, reinterpret_cast<uint32_t*>(_data), _size) == SPI_FLASH_RESULT_OK) {
_dirty = false;
ret = true;
}
}
ETS_UART_INTR_ENABLE();
_dirty = false;
return ret;
}


Expand Down
2 changes: 1 addition & 1 deletion libraries/EEPROM/EEPROM.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class EEPROMClass
void begin(size_t size);
uint8_t read(int address);
void write(int address, uint8_t val);
void commit();
bool commit();
void end();

template<typename T> T &get(int address, T &t)
Expand Down
4 changes: 2 additions & 2 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ recipe.objcopy.eep.pattern=
## Create hex
#recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"

recipe.objcopy.hex.pattern="{compiler.tools.path}{compiler.esptool.cmd}" -eo "{build.path}/{build.project_name}.elf" -bo "{build.path}/{build.project_name}_00000.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bs .data -bs .rodata -bc -ec -eo "{build.path}/{build.project_name}.elf" -es .irom0.text "{build.path}/{build.project_name}_40000.bin" -ec
recipe.objcopy.hex.pattern="{compiler.tools.path}{compiler.esptool.cmd}" -eo "{build.path}/{build.project_name}.elf" -bo "{build.path}/{build.project_name}_00000.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bs .data -bs .rodata -bc -ec -eo "{build.path}/{build.project_name}.elf" -es .irom0.text "{build.path}/{build.project_name}_10000.bin" -ec

## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
Expand All @@ -91,4 +91,4 @@ tools.esptool.path={runtime.ide.path}/hardware/tools/esp8266
tools.esptool.upload.protocol=esp
tools.esptool.upload.params.verbose=-vv
tools.esptool.upload.params.quiet=
tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" -ca 0x00000 -cf "{build.path}/{build.project_name}_00000.bin" -ca 0x40000 -cf "{build.path}/{build.project_name}_40000.bin"
tools.esptool.upload.pattern="{path}/{cmd}" {upload.verbose} -cd {upload.resetmethod} -cb {upload.speed} -cp "{serial.port}" -ca 0x00000 -cf "{build.path}/{build.project_name}_00000.bin" -ca 0x10000 -cf "{build.path}/{build.project_name}_10000.bin"

0 comments on commit 3406b47

Please sign in to comment.