Added: user page sections to config folder

pull/183/head
Karai Csaba 9 years ago committed by cskarai
parent 9ff4488610
commit c5e2587e12
  1. 40
      esp-link/config.c
  2. 3
      esp-link/config.h

@ -195,3 +195,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;
}
}

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

Loading…
Cancel
Save