Skip to content

Commit

Permalink
Merge pull request #299 from valeros/develop
Browse files Browse the repository at this point in the history
Update espressif platform // Resolve #296, #297
  • Loading branch information
ivankravets committed Oct 2, 2015
2 parents 12b29a7 + 4dcef89 commit 948b75a
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 26 deletions.
2 changes: 1 addition & 1 deletion platformio/boards/espressif.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"build": {
"core": "esp8266",
"extra_flags": "-DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266",
"f_cpu": "80000000L",
"f_cpu": "40000000L",
"ldscript": "esp8266.flash.512k.ld",
"mcu": "esp8266",
"variant": "generic"
Expand Down
91 changes: 67 additions & 24 deletions platformio/builder/scripts/espressif.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
ASPPFLAGS=["-x", "assembler-with-cpp"],

CFLAGS=[
"-std=c99",
"-std=gnu99",
"-Wpointer-arith",
"-Wno-implicit-function-declaration",
"-Wl,-EL",
Expand Down Expand Up @@ -76,33 +76,43 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
"-cb", "$UPLOAD_SPEED",
"-cp", "$UPLOAD_PORT",
"-ca", "0x00000",
"-cf", "${SOURCES[0]}",
"-ca", "0x40000" if "FRAMEWORK" not in env else "0x10000",
"-cf", "${SOURCES[1]}"
"-cf", "$SOURCE"
],
UPLOADCMD='$UPLOADER $UPLOADERFLAGS',

PROGNAME="firmware",
PROGSUFFIX=".elf"
)

if "FRAMEWORK" in env:
env.Append(
LINKFLAGS=[
"-Wl,-wrap,system_restart_local",
"-Wl,-wrap,register_chipv6_phy"
]
)

env.Append(
BUILDERS=dict(
ElfToBin=Builder(
action=" ".join([
"$UPLOADER",
"-eo", join("$PLATFORMFW_DIR", "bootloaders",
"eboot", "eboot.elf"),
"-bo", "$TARGET",
"-bm", "dio",
"-bf", "${BOARD_OPTIONS['build']['f_cpu'][:2]}",
"-bz", str(int(env.get("BOARD_OPTIONS", {}).get(
"upload", {}).get("maximum_size") / 1024)) + "K",
"-bs", ".text",
"-bp", "4096",
"-ec",
"-eo", "$SOURCES",
"-bo", "${TARGETS[0]}",
"-bm", "qio",
"-bf", "40",
"-bz", "512K",
"-bs", ".irom0.text",
"-bs", ".text",
"-bs", ".data",
"-bs", ".rodata",
"-bc", "-ec",
"-eo", "$SOURCES",
"-es", ".irom0.text", "${TARGETS[1]}",
"-ec", "-v"
"-bc", "-ec"
]),
suffix=".bin"
)
Expand All @@ -119,13 +129,43 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
join("$PIOPACKAGES_DIR", "sdk-esp8266", "include"),
"$PROJECTSRC_DIR"
],
LIBPATH=[join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib")]
LIBPATH=[join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib")],
BUILDERS=dict(
ElfToBin=Builder(
action=" ".join([
"$UPLOADER",
"-eo", "$SOURCES",
"-bo", "${TARGETS[0]}",
"-bm", "qio",
"-bf", "40",
"-bz", "512K",
"-bs", ".text",
"-bs", ".data",
"-bs", ".rodata",
"-bc", "-ec",
"-eo", "$SOURCES",
"-es", ".irom0.text", "${TARGETS[1]}",
"-ec", "-v"
]),
suffix=".bin"
)
)
)
env.Replace(
LDSCRIPT_PATH=join(
"$PIOPACKAGES_DIR", "sdk-esp8266", "ld", "eagle.app.v6.ld"),
LIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main",
"json", "upgrade", "smartconfig", "pwm", "at", "ssl"]
"json", "upgrade", "smartconfig", "pwm", "at", "ssl"],
UPLOADERFLAGS=[
"-vv",
"-cd", "ck",
"-cb", "$UPLOAD_SPEED",
"-cp", "$UPLOAD_PORT",
"-ca", "0x00000",
"-cf", "${SOURCES[0]}",
"-ca", "0x40000",
"-cf", "${SOURCES[1]}"
]
)

#
Expand All @@ -139,17 +179,20 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
#

if "uploadlazy" in COMMAND_LINE_TARGETS:
target_firm = [
join("$BUILD_DIR", "firmware_00000.bin"),
join("$BUILD_DIR", "firmware_%s.bin" %
("40000" if "FRAMEWORK" not in env else "10000"))
]
if "FRAMEWORK" not in env:
target_firm = [
join("$BUILD_DIR", "firmware_00000.bin"),
join("$BUILD_DIR", "firmware_40000.bin")
]
else:
target_firm = join("$BUILD_DIR", "firmware.bin")
else:
target_firm = env.ElfToBin(
[join("$BUILD_DIR", "firmware_00000"),
join("$BUILD_DIR", "firmware_%s" %
("40000" if "FRAMEWORK" not in env else "10000"))], target_elf)

if "FRAMEWORK" not in env:
target_firm = env.ElfToBin(
[join("$BUILD_DIR", "firmware_00000"),
join("$BUILD_DIR", "firmware_40000")], target_elf)
else:
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)

#
# Target: Print binary size
Expand Down
2 changes: 1 addition & 1 deletion platformio/builder/scripts/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
CPPPATH=[join("$PLATFORMFW_DIR", "sdk", "include")],
LIBPATH=[join("$PLATFORMFW_DIR", "sdk", "lib")],
LIBS=["smartconfig", "pp", "main", "wpa", "lwip",
"net80211", "phy", "hal", "gcc", "m"]
"net80211", "wps", "crypto", "phy", "hal", "gcc", "m"]
)

env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR)
Expand Down

0 comments on commit 948b75a

Please sign in to comment.