summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-10-24 01:03:17 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-10-24 16:52:15 +0300
commite6af94d13b9cac617ca7976027726f84b2c69c30 (patch)
tree94a446dcead7e02dab42a030bf2bb9a3310ec8c7
parent266e4acdc23609dac6810a98e16d677aebe3bc53 (diff)
downloadmicropython-e6af94d13b9cac617ca7976027726f84b2c69c30.tar.gz
micropython-e6af94d13b9cac617ca7976027726f84b2c69c30.zip
esp8266/modesp: Add flash_user_start() function.
As we're looking towards adding OTA support, calculation of a FlashROM area which can be used for filesystem (etc.) may become complex, so introduce C function for that. So far it just hardcodes current value, 0x90000. In the future the function may be extended (and renamed) to return the size of area too.
-rw-r--r--esp8266/modesp.c6
-rw-r--r--esp8266/modules/flashbdev.py2
2 files changed, 7 insertions, 1 deletions
diff --git a/esp8266/modesp.c b/esp8266/modesp.c
index 515319c9e0..827907d42b 100644
--- a/esp8266/modesp.c
+++ b/esp8266/modesp.c
@@ -629,6 +629,11 @@ STATIC mp_obj_t esp_flash_size(void) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_size_obj, esp_flash_size);
+STATIC mp_obj_t esp_flash_user_start(void) {
+ return MP_OBJ_NEW_SMALL_INT(0x90000);
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(esp_flash_user_start_obj, esp_flash_user_start);
+
STATIC mp_obj_t esp_check_fw(void) {
MD5_CTX ctx;
uint32_t *sz_p = (uint32_t*)0x40208ffc;
@@ -706,6 +711,7 @@ STATIC const mp_map_elem_t esp_module_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_flash_write), (mp_obj_t)&esp_flash_write_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_flash_erase), (mp_obj_t)&esp_flash_erase_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_flash_size), (mp_obj_t)&esp_flash_size_obj },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_flash_user_start), (mp_obj_t)&esp_flash_user_start_obj },
#if MODESP_ESPCONN
{ MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&esp_socket_type },
{ MP_OBJ_NEW_QSTR(MP_QSTR_getaddrinfo), (mp_obj_t)&esp_getaddrinfo_obj },
diff --git a/esp8266/modules/flashbdev.py b/esp8266/modules/flashbdev.py
index 98b0208fb6..e879895fb0 100644
--- a/esp8266/modules/flashbdev.py
+++ b/esp8266/modules/flashbdev.py
@@ -3,7 +3,7 @@ import esp
class FlashBdev:
SEC_SIZE = 4096
- START_SEC = 0x90000 // SEC_SIZE
+ START_SEC = esp.flash_user_start() // SEC_SIZE
NUM_BLK = 0x6b
def __init__(self, blocks=NUM_BLK):