Skip to content

Commit dd5a509

Browse files
committed
Fix ESP-12E flash size // Resolve #333
1 parent 970ddd4 commit dd5a509

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

HISTORY.rst

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ PlatformIO 2.0
77
2.3.6 (2015-??-??)
88
~~~~~~~~~~~~~~~~~~
99

10+
* Fixed ESP-12E flash size
11+
(`pull #333 <https://github.com/platformio/platformio/pull/333>`_)
12+
1013
2.3.5 (2015-11-18)
1114
~~~~~~~~~~~~~~~~~~
1215

platformio/builder/scripts/espressif.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
103103
]
104104
)
105105

106+
_board_max_rom = int(
107+
env.get("BOARD_OPTIONS", {}).get("upload", {}).get("maximum_size", 0))
106108
env.Append(
107109
BUILDERS=dict(
108110
ElfToBin=Builder(
@@ -113,8 +115,9 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
113115
"-bo", "$TARGET",
114116
"-bm", "dio",
115117
"-bf", "${BOARD_OPTIONS['build']['f_cpu'][:2]}",
116-
"-bz", str(int(env.get("BOARD_OPTIONS", {}).get(
117-
"upload", {}).get("maximum_size") / 1024)) + "K",
118+
"-bz",
119+
"%dK" % (_board_max_rom / 1024) if _board_max_rom < 1048576
120+
else "%dM" % (_board_max_rom / 1048576),
118121
"-bs", ".text",
119122
"-bp", "4096",
120123
"-ec",

0 commit comments

Comments
 (0)