Use variable name for EEPROM length
This commit is contained in:
parent
47ad4e9090
commit
ab1e380b64
@ -149,16 +149,19 @@ def fetch_fs_size(env):
|
|||||||
flash_size = board.get("upload.maximum_size")
|
flash_size = board.get("upload.maximum_size")
|
||||||
filesystem_size = board.get("build.filesystem_size", "0MB")
|
filesystem_size = board.get("build.filesystem_size", "0MB")
|
||||||
filesystem_size_int = convert_size_expression_to_int(filesystem_size)
|
filesystem_size_int = convert_size_expression_to_int(filesystem_size)
|
||||||
|
# last 4K are allocated for EEPROM emulation in flash.
|
||||||
|
# see https://github.com/earlephilhower/arduino-pico/blob/3414b73172d307e9dc901f7fee83b41112f73457/libraries/EEPROM/EEPROM.cpp#L43-L46
|
||||||
|
eeprom_size = 4096
|
||||||
|
|
||||||
maximum_sketch_size = flash_size - 4096 - filesystem_size_int
|
maximum_sketch_size = flash_size - eeprom_size - filesystem_size_int
|
||||||
|
|
||||||
print("Flash size: %.2fMB" % (flash_size / 1024.0 / 1024.0))
|
print("Flash size: %.2fMB" % (flash_size / 1024.0 / 1024.0))
|
||||||
print("Sketch size: %.2fMB" % (maximum_sketch_size / 1024.0 / 1024.0))
|
print("Sketch size: %.2fMB" % (maximum_sketch_size / 1024.0 / 1024.0))
|
||||||
print("Filesystem size: %.2fMB" % (filesystem_size_int / 1024.0 / 1024.0))
|
print("Filesystem size: %.2fMB" % (filesystem_size_int / 1024.0 / 1024.0))
|
||||||
|
|
||||||
eeprom_start = 0x10000000 + flash_size - 4096
|
eeprom_start = 0x10000000 + flash_size - eeprom_size
|
||||||
fs_start = 0x10000000 + flash_size - 4096 - filesystem_size_int
|
fs_start = 0x10000000 + flash_size - eeprom_size - filesystem_size_int
|
||||||
fs_end = 0x10000000 + flash_size - 4096
|
fs_end = 0x10000000 + flash_size - eeprom_size
|
||||||
|
|
||||||
if maximum_sketch_size <= 0:
|
if maximum_sketch_size <= 0:
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
@ -173,7 +176,7 @@ def fetch_fs_size(env):
|
|||||||
env["PICO_EEPROM_START"] = eeprom_start
|
env["PICO_EEPROM_START"] = eeprom_start
|
||||||
env["FS_START"] = fs_start
|
env["FS_START"] = fs_start
|
||||||
env["FS_END"] = fs_end
|
env["FS_END"] = fs_end
|
||||||
# LittleFS configuration paramters taken from
|
# LittleFS configuration parameters taken from
|
||||||
# https://github.com/earlephilhower/arduino-pico-littlefs-plugin/blob/master/src/PicoLittleFS.java
|
# https://github.com/earlephilhower/arduino-pico-littlefs-plugin/blob/master/src/PicoLittleFS.java
|
||||||
env["FS_PAGE"] = 256
|
env["FS_PAGE"] = 256
|
||||||
env["FS_BLOCK"] = 4096
|
env["FS_BLOCK"] = 4096
|
||||||
|
Loading…
x
Reference in New Issue
Block a user