Added: user page sections to config folder

pull/193/head
Karai Csaba 9 years ago committed by Thorsten von Eicken
parent a85244d6fb
commit 31fa743d14
  1. 40
      esp-link/config.c
  2. 3
      esp-link/config.h

@ -204,3 +204,43 @@ getFlashSize() {
return 0;
return 1 << size_id;
}
const uint32_t getUserPageSectionStart()
{
enum flash_size_map map = system_get_flash_size_map();
switch(map)
{
case FLASH_SIZE_4M_MAP_256_256:
return FLASH_SECT + FIRMWARE_SIZE - 3*FLASH_SECT;// bootloader + firmware - 12KB (highly risky...)
case FLASH_SIZE_8M_MAP_512_512:
return FLASH_SECT + FIRMWARE_SIZE;
case FLASH_SIZE_16M_MAP_512_512:
case FLASH_SIZE_16M_MAP_1024_1024:
case FLASH_SIZE_32M_MAP_512_512:
case FLASH_SIZE_32M_MAP_1024_1024:
return 0x0FC000;
default:
return 0xFFFFFFFF;
}
}
const uint32_t getUserPageSectionEnd()
{
enum flash_size_map map = system_get_flash_size_map();
switch(map)
{
case FLASH_SIZE_4M_MAP_256_256:
return FLASH_SECT + FIRMWARE_SIZE - 2*FLASH_SECT;
case FLASH_SIZE_8M_MAP_512_512:
return FLASH_SECT + FIRMWARE_SIZE + 2*FLASH_SECT;
case FLASH_SIZE_16M_MAP_512_512:
case FLASH_SIZE_16M_MAP_1024_1024:
return 0x1FC000;
case FLASH_SIZE_32M_MAP_512_512:
case FLASH_SIZE_32M_MAP_1024_1024:
return 0x3FC000;
default:
return 0xFFFFFFFF;
}
}

@ -49,4 +49,7 @@ bool configRestore(void);
void configWipe(void);
const size_t getFlashSize();
const uint32_t getUserPageSectionStart();
const uint32_t getUserPageSectionEnd();
#endif

Loading…
Cancel
Save