* initial ldscripts refactoring * add missing menu options * board for 2.3.0 and 2.4.2 * test with core 2.5.0 * typo * ...same typo in other boards.local.txt * generate boards.local.txt from common template * Depend on file presence instead of platform version * sdk selection * Override only relevant entries * generate ldscripts * formatting * unused * fix section scope * fix linker script comment and build getting stuck * py2 compat platformio from pip still does not support py3 * add TODO for py3 * chmod +x, remove leading newline * comment with real spiffs size * fixup! chmod +x, remove leading newline * regenerate all ldscripts * Preventive fix of spiffs_end calculation * update arg parsing * generate only 2.3.0 and latest * readme for boards.local.txt * Update ldscript readme * unique flash sizes * fix sub * line break * correct way to get framework path * Alias for _FS_... symbols * unused 2m1m1s * bump? * show travis logs * ensure latest toolchain for travis * check platform packages when buildingmaster
@ -1,19 +0,0 @@ | |||
/* Flash Split for 1M chips, no SPIFFS, 1 sector for EEPROM */ | |||
/* sketch 999KB */ | |||
/* eeprom 4KB */ | |||
/* reserved 16KB */ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xf9ff0 | |||
} | |||
PROVIDE ( _SPIFFS_start = 0x402FB000 ); | |||
PROVIDE ( _SPIFFS_end = 0x402FB000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
INCLUDE "../ld/eagle.app.v6.common.ld" |
@ -1,19 +0,0 @@ | |||
/* Flash Split for 1M chips, no SPIFFS, 2 sectors for EEPROM */ | |||
/* sketch 995KB */ | |||
/* eeprom 8KB */ | |||
/* reserved 16KB */ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xf8ff0 | |||
} | |||
PROVIDE ( _SPIFFS_start = 0x402FA000 ); | |||
PROVIDE ( _SPIFFS_end = 0x402FA000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
INCLUDE "../ld/eagle.app.v6.common.ld" |
@ -1,19 +0,0 @@ | |||
/* Flash Split for 512K chips, no SPIFFS, 1 sector for EEPROM */ | |||
/* sketch 487KB */ | |||
/* eeprom 4KB */ | |||
/* reserved 16KB */ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0x79ff0 | |||
} | |||
PROVIDE ( _SPIFFS_start = 0x4027B000 ); | |||
PROVIDE ( _SPIFFS_end = 0x4027B000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
INCLUDE "../ld/eagle.app.v6.common.ld" |
@ -0,0 +1,39 @@ | |||
#version=2.3.0 | |||
menu.float_support=scanf and printf float support | |||
generic.menu.FlashSize.1M1S=1M (1 EEPROM Sector, no SPIFFS) | |||
generic.menu.FlashSize.1M1S.build.flash_size=1M | |||
generic.menu.FlashSize.1M1S.build.flash_size_bytes=0x100000 | |||
generic.menu.FlashSize.1M1S.build.flash_ld=eagle.flash.1m0m1s.ld | |||
generic.menu.FlashSize.1M1S.build.spiffs_pagesize=256 | |||
generic.menu.FlashSize.1M1S.upload.maximum_size=1023984 | |||
generic.menu.FlashSize.1M1S.build.rfcal_addr=0xFC000 | |||
generic.menu.FlashSize.2M4S=2M (4 EEPROM Sectors, 1M SPIFFS) | |||
generic.menu.FlashSize.2M4S.build.flash_size=2M | |||
generic.menu.FlashSize.2M4S.build.flash_size_bytes=0x200000 | |||
generic.menu.FlashSize.2M4S.build.flash_ld=eagle.flash.2m1m4s.ld | |||
generic.menu.FlashSize.2M4S.build.spiffs_pagesize=256 | |||
generic.menu.FlashSize.2M4S.upload.maximum_size=1044464 | |||
generic.menu.FlashSize.2M4S.build.rfcal_addr=0x1FC000 | |||
generic.menu.FlashSize.4M1M4S=4M (4 EEPROM Sectors, 1M SPIFFS) | |||
generic.menu.FlashSize.4M1M4S.build.flash_size=4M | |||
generic.menu.FlashSize.4M1M4S.build.flash_size_bytes=0x400000 | |||
generic.menu.FlashSize.4M1M4S.build.flash_ld=eagle.flash.4m1m4s.ld | |||
generic.menu.FlashSize.4M1M4S.build.spiffs_pagesize=256 | |||
generic.menu.FlashSize.4M1M4S.upload.maximum_size=1044464 | |||
generic.menu.FlashSize.4M1M4S.build.rfcal_addr=0x3FC000 | |||
generic.menu.FlashSize.4M3M4S=4M (4 EEPROM Sectors, 3M SPIFFS) | |||
generic.menu.FlashSize.4M3M4S.build.flash_size=4M | |||
generic.menu.FlashSize.4M3M4S.build.flash_size_bytes=0x400000 | |||
generic.menu.FlashSize.4M3M4S.build.flash_ld=eagle.flash.4m3m4s.ld | |||
generic.menu.FlashSize.4M3M4S.build.spiffs_pagesize=256 | |||
generic.menu.FlashSize.4M3M4S.upload.maximum_size=1044464 | |||
generic.menu.FlashSize.4M3M4S.build.rfcal_addr=0x3FC000 | |||
generic.menu.float_support.disabled=Disabled (Recommended) | |||
generic.menu.float_support.disabled.build.float= | |||
generic.menu.float_support.enabled=Enabled | |||
generic.menu.float_support.enabled.build.float=-u _printf_float -u _scanf_float | |||
generic.compiler.cpp.extra_flags=-DNO_GLOBAL_EEPROM -DMQTT_MAX_PACKET_SIZE=400 |
@ -0,0 +1,24 @@ | |||
# boards.local.txt for ESPurna | |||
Additional flash layouts to support multiple EEPROM sectors | |||
### Installation | |||
Place boards.local.txt into Arduino hardware directory, in the same directory as the boards.txt file. Depending on platform and ESP8266 installation method, it is one of: | |||
- Linux (boards manager): `~/.arduino15/packages/esp8266/hardware/esp8266/<version>` | |||
- Linux (git): `~/Arduino/hardware/esp8266com/esp8266/` | |||
- Windows (boards manager): `%LOCALAPPDATA%\Arduino15\packages\esp8266\hardware\esp8266\<version>` | |||
- Windows (git): `~\Documents\Arduino\hardware\esp8266com\esp8266\` | |||
- macOS (boards manager): `~/Library/Arduino15/packages/esp2866/hardware/esp8266/<version>` | |||
- macOS (git): `<application-directory>/Arduino.app/Contents/Java/hardware/esp8266com/esp8266` | |||
Use `2.3.0/boards.local.txt` for Core version 2.3.0 | |||
Use `latest/boards.local.txt` for all the others | |||
### Arduino documentation | |||
https://arduino-esp8266.readthedocs.io/en/latest/installing.html | |||
https://www.arduino.cc/en/Hacking/Preferences | |||
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#boardslocaltxt |
@ -0,0 +1,39 @@ | |||
#version=latest | |||
menu.float_support=scanf and printf float support | |||
generic.menu.eesz.1M1S=1M (1 EEPROM Sector, no SPIFFS) | |||
generic.menu.eesz.1M1S.build.flash_size=1M | |||
generic.menu.eesz.1M1S.build.flash_size_bytes=0x100000 | |||
generic.menu.eesz.1M1S.build.flash_ld=eagle.flash.1m0m1s.ld | |||
generic.menu.eesz.1M1S.build.spiffs_pagesize=256 | |||
generic.menu.eesz.1M1S.upload.maximum_size=1023984 | |||
generic.menu.eesz.1M1S.build.rfcal_addr=0xFC000 | |||
generic.menu.eesz.2M4S=2M (4 EEPROM Sectors, 1M SPIFFS) | |||
generic.menu.eesz.2M4S.build.flash_size=2M | |||
generic.menu.eesz.2M4S.build.flash_size_bytes=0x200000 | |||
generic.menu.eesz.2M4S.build.flash_ld=eagle.flash.2m1m4s.ld | |||
generic.menu.eesz.2M4S.build.spiffs_pagesize=256 | |||
generic.menu.eesz.2M4S.upload.maximum_size=1044464 | |||
generic.menu.eesz.2M4S.build.rfcal_addr=0x1FC000 | |||
generic.menu.eesz.4M1M4S=4M (4 EEPROM Sectors, 1M SPIFFS) | |||
generic.menu.eesz.4M1M4S.build.flash_size=4M | |||
generic.menu.eesz.4M1M4S.build.flash_size_bytes=0x400000 | |||
generic.menu.eesz.4M1M4S.build.flash_ld=eagle.flash.4m1m4s.ld | |||
generic.menu.eesz.4M1M4S.build.spiffs_pagesize=256 | |||
generic.menu.eesz.4M1M4S.upload.maximum_size=1044464 | |||
generic.menu.eesz.4M1M4S.build.rfcal_addr=0x3FC000 | |||
generic.menu.eesz.4M3M4S=4M (4 EEPROM Sectors, 3M SPIFFS) | |||
generic.menu.eesz.4M3M4S.build.flash_size=4M | |||
generic.menu.eesz.4M3M4S.build.flash_size_bytes=0x400000 | |||
generic.menu.eesz.4M3M4S.build.flash_ld=eagle.flash.4m3m4s.ld | |||
generic.menu.eesz.4M3M4S.build.spiffs_pagesize=256 | |||
generic.menu.eesz.4M3M4S.upload.maximum_size=1044464 | |||
generic.menu.eesz.4M3M4S.build.rfcal_addr=0x3FC000 | |||
generic.menu.float_support.disabled=Disabled (Recommended) | |||
generic.menu.float_support.disabled.build.float= | |||
generic.menu.float_support.enabled=Enabled | |||
generic.menu.float_support.enabled.build.float=-u _printf_float -u _scanf_float | |||
generic.compiler.cpp.extra_flags=-DNO_GLOBAL_EEPROM -DMQTT_MAX_PACKET_SIZE=400 |
@ -0,0 +1,181 @@ | |||
#!/usr/bin/env python | |||
# adapted boards.txt.py from esp8266/Arduino | |||
# - single board definition, ldscripts | |||
# - portable boards.local.txt for 2.3.0 and up | |||
import os | |||
import argparse | |||
import sys | |||
import collections | |||
# TODO: drop after platform.io supports python 3 | |||
if sys.version < (3, 2): | |||
import string | |||
_format = string.Formatter().vformat | |||
def format_map(tmpl, f_map): | |||
return _format(tmpl, None, f_map) | |||
else: | |||
def format_map(tmpl, f_map): | |||
return tmpl.format_map(f_map) | |||
class VersionedSubstitution(collections.MutableMapping): | |||
def __init__(self, substitutions, targets, *args, **kwargs): | |||
self._targets = targets | |||
self._version = None | |||
self._store = substitutions.copy() | |||
self.update(dict(*args, **kwargs)) | |||
def set_version(self, version): | |||
self._version = version | |||
def __getitem__(self, key): | |||
if self._version in self._targets: | |||
return self._store[key] | |||
return key | |||
def __setitem__(self, key, value): | |||
self._store[key] = value | |||
def __delitem__(self, key): | |||
del self._store[key] | |||
def __iter__(self): | |||
return iter(self._store) | |||
def __len__(self): | |||
return len(self._store) | |||
BOARDS_LOCAL = { | |||
"global": collections.OrderedDict( | |||
[("menu.float_support", "scanf and printf float support")] | |||
), | |||
"flash_size": collections.OrderedDict( | |||
[ | |||
(".menu.{eesz}.1M1S", "1M (1 EEPROM Sector, no SPIFFS)"), | |||
(".menu.{eesz}.1M1S.build.flash_size", "1M"), | |||
(".menu.{eesz}.1M1S.build.flash_size_bytes", "0x100000"), | |||
(".menu.{eesz}.1M1S.build.flash_ld", "eagle.flash.1m0m1s.ld"), | |||
(".menu.{eesz}.1M1S.build.spiffs_pagesize", "256"), | |||
(".menu.{eesz}.1M1S.upload.maximum_size", "1023984"), | |||
(".menu.{eesz}.1M1S.build.rfcal_addr", "0xFC000"), | |||
(".menu.{eesz}.2M4S", "2M (4 EEPROM Sectors, 1M SPIFFS)"), | |||
(".menu.{eesz}.2M4S.build.flash_size", "2M"), | |||
(".menu.{eesz}.2M4S.build.flash_size_bytes", "0x200000"), | |||
(".menu.{eesz}.2M4S.build.flash_ld", "eagle.flash.2m1m4s.ld"), | |||
(".menu.{eesz}.2M4S.build.spiffs_pagesize", "256"), | |||
(".menu.{eesz}.2M4S.upload.maximum_size", "1044464"), | |||
(".menu.{eesz}.2M4S.build.rfcal_addr", "0x1FC000"), | |||
(".menu.{eesz}.4M1M4S", "4M (4 EEPROM Sectors, 1M SPIFFS)"), | |||
(".menu.{eesz}.4M1M4S.build.flash_size", "4M"), | |||
(".menu.{eesz}.4M1M4S.build.flash_size_bytes", "0x400000"), | |||
(".menu.{eesz}.4M1M4S.build.flash_ld", "eagle.flash.4m1m4s.ld"), | |||
(".menu.{eesz}.4M1M4S.build.spiffs_pagesize", "256"), | |||
(".menu.{eesz}.4M1M4S.upload.maximum_size", "1044464"), | |||
(".menu.{eesz}.4M1M4S.build.rfcal_addr", "0x3FC000"), | |||
(".menu.{eesz}.4M3M4S", "4M (4 EEPROM Sectors, 3M SPIFFS)"), | |||
(".menu.{eesz}.4M3M4S.build.flash_size", "4M"), | |||
(".menu.{eesz}.4M3M4S.build.flash_size_bytes", "0x400000"), | |||
(".menu.{eesz}.4M3M4S.build.flash_ld", "eagle.flash.4m3m4s.ld"), | |||
(".menu.{eesz}.4M3M4S.build.spiffs_pagesize", "256"), | |||
(".menu.{eesz}.4M3M4S.upload.maximum_size", "1044464"), | |||
(".menu.{eesz}.4M3M4S.build.rfcal_addr", "0x3FC000"), | |||
] | |||
), | |||
"float_support": collections.OrderedDict( | |||
[ | |||
(".menu.float_support.disabled", "Disabled (Recommended)"), | |||
(".menu.float_support.disabled.build.float", ""), | |||
(".menu.float_support.enabled", "Enabled"), | |||
( | |||
".menu.float_support.enabled.build.float", | |||
"-u _printf_float -u _scanf_float", | |||
), | |||
] | |||
), | |||
} | |||
BOARD = "generic" | |||
MENUS = ["flash_size", "float_support"] | |||
CORE_VERSIONS = ["2.3.0", "latest"] | |||
EXTRA_FLAGS = [ | |||
(".compiler.cpp.extra_flags", "-DNO_GLOBAL_EEPROM -DMQTT_MAX_PACKET_SIZE=400") | |||
] | |||
SUBSTITUTIONS = VersionedSubstitution( | |||
dict(eesz="FlashSize", wipe="FlashErase", baud="UploadSpeed", vt="VTable"), | |||
["2.3.0"], | |||
) | |||
def generate_boards_txt(args, sub=SUBSTITUTIONS): | |||
versions = args.versions | |||
if args.version: | |||
versions = [args.version] | |||
for version in versions: | |||
sub.set_version(version) | |||
result = ["#version={}\n\n".format(version)] | |||
result.extend("{}={}\n".format(k, v) for k, v in BOARDS_LOCAL["global"].items()) | |||
result.append("\n") | |||
# print("{} unused:".format(version, set(BOARDS_LOCAL.keys()) - set(MENUS[version]))) | |||
# continue | |||
for menu in MENUS: | |||
section = [] | |||
for k, v in BOARDS_LOCAL[menu].items(): | |||
k = format_map(k, sub) | |||
section.append(BOARD + "=".join([k, v])) | |||
result.append("\n".join(section)) | |||
result.append("\n\n") | |||
if EXTRA_FLAGS: | |||
result.extend(("{}{}={}".format(BOARD, k, v)) for k, v in EXTRA_FLAGS) | |||
f_path = os.path.join(args.directory, version, "boards.local.txt") | |||
f_dir, _ = os.path.split(f_path) | |||
if not os.path.exists(f_dir): | |||
os.makedirs(f_dir) | |||
with open(f_path, "w") as f: | |||
for part in result: | |||
f.write(part) | |||
f.write("\n") | |||
def print_versions(args): | |||
for version in CORE_VERSIONS: | |||
print("- {}".format(version)) | |||
if __name__ == "__main__": | |||
parser = argparse.ArgumentParser() | |||
parser.add_argument("-d", "--directory", default="arduino_ide") | |||
subparsers = parser.add_subparsers(title="commands") | |||
parser_versions = subparsers.add_parser("versions", help="list supported versions") | |||
parser_versions.set_defaults(command=print_versions) | |||
parser_generate = subparsers.add_parser("generate", help="") | |||
parser_generate.add_argument("version", nargs="?") | |||
parser_generate.set_defaults(command=generate_boards_txt, versions=CORE_VERSIONS) | |||
args = parser.parse_args() | |||
args.command(args) |
@ -0,0 +1,8 @@ | |||
# ESP8266 linker scripts with additional EEPROM sectors | |||
### Installation | |||
Depending on ESP8266 version, use files from either `Pre 2.5.0` or `latest` | |||
Reference [../arduino_ide/README.md](../arduino_ide/README.md) about ESP8266 package location | |||
Copy all \*.ld files into the `<esp8266-package>/tools/sdk/ld` directory |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 999KB | |||
fs: 0KB | |||
eeprom: 4KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xf9ff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x402fb000 ); | |||
PROVIDE ( _SPIFFS_end = 0x402fb000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "local.eagle.app.v6.common.ld" |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 995KB | |||
fs: 0KB | |||
eeprom: 8KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xf8ff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x402fa000 ); | |||
PROVIDE ( _SPIFFS_end = 0x402fa000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "local.eagle.app.v6.common.ld" |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 1019KB | |||
fs: 992KB | |||
eeprom: 16KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xfeff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x40300000 ); | |||
PROVIDE ( _SPIFFS_end = 0x403f8000 ); | |||
PROVIDE ( _SPIFFS_page = 0x100 ); | |||
PROVIDE ( _SPIFFS_block = 0x2000 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "local.eagle.app.v6.common.ld" |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 1019KB | |||
fs: 992KB | |||
eeprom: 16KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xfeff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x40500000 ); | |||
PROVIDE ( _SPIFFS_end = 0x405f8000 ); | |||
PROVIDE ( _SPIFFS_page = 0x100 ); | |||
PROVIDE ( _SPIFFS_block = 0x2000 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "local.eagle.app.v6.common.ld" |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 1019KB | |||
fs: 3040KB | |||
eeprom: 16KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xfeff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x40300000 ); | |||
PROVIDE ( _SPIFFS_end = 0x405f8000 ); | |||
PROVIDE ( _SPIFFS_page = 0x100 ); | |||
PROVIDE ( _SPIFFS_block = 0x2000 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "local.eagle.app.v6.common.ld" |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 487KB | |||
fs: 0KB | |||
eeprom: 4KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0x79ff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x4027b000 ); | |||
PROVIDE ( _SPIFFS_end = 0x4027b000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "local.eagle.app.v6.common.ld" |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 999KB | |||
fs: 0KB | |||
eeprom: 4KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xf9ff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x402fb000 ); | |||
PROVIDE ( _SPIFFS_end = 0x402fb000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "eagle.app.v6.common.ld" |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 995KB | |||
fs: 0KB | |||
eeprom: 8KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0xf8ff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x402fa000 ); | |||
PROVIDE ( _SPIFFS_end = 0x402fa000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "eagle.app.v6.common.ld" |
@ -0,0 +1,30 @@ | |||
/* | |||
sketch: 487KB | |||
fs: 0KB | |||
eeprom: 4KB | |||
*/ | |||
MEMORY | |||
{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = 0x79ff0 | |||
} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = 0x4027b000 ); | |||
PROVIDE ( _SPIFFS_end = 0x4027b000 ); | |||
PROVIDE ( _SPIFFS_page = 0x0 ); | |||
PROVIDE ( _SPIFFS_block = 0x0 ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE "eagle.app.v6.common.ld" |
@ -0,0 +1,181 @@ | |||
#!/usr/bin/env python | |||
import os | |||
import argparse | |||
import logging | |||
from collections import defaultdict | |||
from math import trunc | |||
FORMAT = "%(asctime)-15s %(message)s" | |||
log = logging.getLogger("ldscript-get") | |||
logging.basicConfig(format=FORMAT) | |||
# mapping from esp8266/tools/boards.txt.py: | |||
# sketch | reserved | empty | fs | eeprom | rf-cal | sdk-wifi-settings | |||
# ...... | 4112B | ..... | ...... | ...... | 16 KB | |||
IROM0_SPI_FLASH_START = 0x40200000 | |||
IROM0_RESERVED_SKETCH_SIZE = 0x1010 | |||
IROM0_RESERVED_SDK_SIZE = 0x4000 | |||
SIZE = {512: 0x80000, 1024: 0x100000, 2048: 0x200000, 3072: 0x300000, 4096: 0x400000} | |||
# supported sizes | |||
# flash (bytes), fs (bytes), eeprom (sectors) | |||
VARIANTS = [ | |||
[SIZE[512], 0, 1], | |||
[SIZE[1024], 0, 1], | |||
[SIZE[1024], 0, 2], | |||
[SIZE[2048], SIZE[1024], 4], | |||
[SIZE[4096], SIZE[1024], 4], | |||
[SIZE[4096], SIZE[3072], 4], | |||
] | |||
def size_suffix(size): | |||
if size >= SIZE[1024] or not size: | |||
size = trunc(size / SIZE[1024]) | |||
suffix = "m" | |||
else: | |||
size = trunc(size / 1024) | |||
suffix = "k" | |||
return size, suffix | |||
def variant_name(variant): | |||
tmpl = "{flash_size}{flash_suffix}{fs_size}{fs_suffix}{sectors}s" | |||
flash_size, fs_size, sectors = variant | |||
flash_size, flash_suffix = size_suffix(flash_size) | |||
fs_size, fs_suffix = size_suffix(fs_size) | |||
return tmpl.format( | |||
flash_size=flash_size, | |||
flash_suffix=flash_suffix, | |||
fs_size=fs_size, | |||
fs_suffix=fs_suffix, | |||
sectors=sectors, | |||
) | |||
TEMPLATE = """\ | |||
/* | |||
sketch: {size_kb}KB | |||
fs: {fs_size_kb}KB | |||
eeprom: {eeprom_size_kb}KB | |||
*/ | |||
MEMORY | |||
{{ | |||
dport0_0_seg : org = 0x3FF00000, len = 0x10 | |||
dram0_0_seg : org = 0x3FFE8000, len = 0x14000 | |||
iram1_0_seg : org = 0x40100000, len = 0x8000 | |||
irom0_0_seg : org = 0x40201010, len = {size:#x} | |||
}} | |||
/* | |||
Provide both _SPIFFS_ and _FS_ to be compatible with 2.3.0...2.6.0+ and | |||
any library that is using old _SPIFFS_... | |||
*/ | |||
PROVIDE ( _SPIFFS_start = {fs_start:#x} ); | |||
PROVIDE ( _SPIFFS_end = {fs_end:#x} ); | |||
PROVIDE ( _SPIFFS_page = {fs_page:#x} ); | |||
PROVIDE ( _SPIFFS_block = {fs_block:#x} ); | |||
PROVIDE ( _FS_start = _SPIFFS_start ); | |||
PROVIDE ( _FS_end = _SPIFFS_end ); | |||
PROVIDE ( _FS_page = _SPIFFS_page ); | |||
PROVIDE ( _FS_block = _SPIFFS_block ); | |||
INCLUDE \"{include}\" | |||
""" | |||
def flash_map(flashsize, fs, sectors): | |||
reserved = IROM0_RESERVED_SKETCH_SIZE | |||
sdk_reserved = IROM0_RESERVED_SDK_SIZE | |||
eeprom_size = 0x1000 * sectors | |||
fs_end = IROM0_SPI_FLASH_START + (flashsize - sdk_reserved - eeprom_size) | |||
fs_page = 0x100 | |||
if flashsize <= SIZE[1024]: | |||
max_upload_size = (flashsize - (fs + eeprom_size + sdk_reserved)) - reserved | |||
fs_start = IROM0_SPI_FLASH_START + fs_end - fs | |||
fs_block = 4096 | |||
else: | |||
max_upload_size = 1024 * 1024 - reserved | |||
fs_start = IROM0_SPI_FLASH_START + (flashsize - fs) | |||
if fs < SIZE[512]: | |||
fs_block = 4096 | |||
else: | |||
fs_block = 8192 | |||
if not fs: | |||
fs_block = 0 | |||
fs_page = 0 | |||
fs_start = fs_end | |||
# Adjust FS_end to be a multiple of the block size | |||
# ref: https://github.com/esp8266/Arduino/pull/5989 | |||
if fs: | |||
fs_end = fs_block * ((fs_end - fs_start) // fs_block) + fs_start | |||
result = { | |||
"size": max_upload_size, | |||
"size_kb": int(max_upload_size / 1024), | |||
"eeprom_size_kb": int(eeprom_size / 1024), | |||
"fs_size_kb": int((fs_end - fs_start) / 1024), | |||
"fs_start": fs_start, | |||
"fs_end": fs_end, | |||
"fs_page": fs_page, | |||
"fs_block": fs_block, | |||
} | |||
return result | |||
def render(variant, legacy): | |||
name = variant_name(variant) | |||
name = "eagle.flash.{}.ld".format(name) | |||
ld_include = "local.eagle.app.v6.common.ld" | |||
ld_dir = "ld/latest" | |||
if legacy: | |||
ld_include = "eagle.app.v6.common.ld" | |||
ld_dir = "ld/pre_2.5.0" | |||
path = os.path.join(ld_dir, name) | |||
log.info("render %s (INCLUDE %s)", name, ld_include) | |||
with open(path, "w") as f: | |||
f.write(TEMPLATE.format(include=ld_include, **flash_map(*variant))) | |||
def render_all(): | |||
for variant in VARIANTS: | |||
render(variant, True) | |||
render(variant, False) | |||
if __name__ == "__main__": | |||
variants = {variant_name(x): x for x in VARIANTS} | |||
choices = ["all"] | |||
choices.extend(variants.keys()) | |||
parser = argparse.ArgumentParser() | |||
parser.add_argument("--legacy", action="store_true", default=False) | |||
parser.add_argument("--verbose", action="store_true", default=False) | |||
parser.add_argument("variant", choices=choices) | |||
args = parser.parse_args() | |||
if args.verbose: | |||
log.setLevel(logging.DEBUG) | |||
if args.variant == "all": | |||
render_all() | |||
else: | |||
render(variants[args.variant], args.legacy) |