forked from platformio/platformio-core
Show error for invalid LD script
This commit is contained in:
@ -42,7 +42,7 @@ The list with preconfigured LD scripts is located in public repository
|
|||||||
* ``esp8266.flash.1m256.ld`` 1M (256K SPIFFS)
|
* ``esp8266.flash.1m256.ld`` 1M (256K SPIFFS)
|
||||||
* ``esp8266.flash.1m512.ld`` 1M (512K SPIFFS)
|
* ``esp8266.flash.1m512.ld`` 1M (512K SPIFFS)
|
||||||
* ``esp8266.flash.2m.ld`` 2M (1M SPIFFS)
|
* ``esp8266.flash.2m.ld`` 2M (1M SPIFFS)
|
||||||
* ``esp8266.flash.4m1.ld`` 4M (1M SPIFFS)
|
* ``esp8266.flash.4m1m.ld`` 4M (1M SPIFFS)
|
||||||
* ``esp8266.flash.4m.ld`` 4M (3M SPIFFS)
|
* ``esp8266.flash.4m.ld`` 4M (3M SPIFFS)
|
||||||
|
|
||||||
To override default LD script please use :ref:`projectconf_build_flags` from
|
To override default LD script please use :ref:`projectconf_build_flags` from
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (2, 7, "0.dev4")
|
VERSION = (2, 7, "0.dev5")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -20,7 +20,7 @@ import platform
|
|||||||
from os.path import isfile, join
|
from os.path import isfile, join
|
||||||
|
|
||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
||||||
DefaultEnvironment, Exit, SConscript)
|
DefaultEnvironment, SConscript)
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
env = DefaultEnvironment()
|
||||||
|
|
||||||
@ -28,8 +28,8 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
|||||||
|
|
||||||
if env.subst("$UPLOAD_PROTOCOL") == "gdb":
|
if env.subst("$UPLOAD_PROTOCOL") == "gdb":
|
||||||
if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")):
|
if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")):
|
||||||
Exit(
|
env.Exit(
|
||||||
"You are using GDB as firmware uploader. "
|
"Error: You are using GDB as firmware uploader. "
|
||||||
"Please specify upload commands in upload.gdb "
|
"Please specify upload commands in upload.gdb "
|
||||||
"file in project directory!"
|
"file in project directory!"
|
||||||
)
|
)
|
||||||
|
@ -191,6 +191,7 @@ def GetCompilerType(env):
|
|||||||
|
|
||||||
|
|
||||||
def GetActualLDScript(env):
|
def GetActualLDScript(env):
|
||||||
|
script = None
|
||||||
for f in env.get("LINKFLAGS", []):
|
for f in env.get("LINKFLAGS", []):
|
||||||
if f.startswith("-Wl,-T"):
|
if f.startswith("-Wl,-T"):
|
||||||
script = env.subst(f[6:].replace('"', "").strip())
|
script = env.subst(f[6:].replace('"', "").strip())
|
||||||
@ -200,6 +201,11 @@ def GetActualLDScript(env):
|
|||||||
path = join(env.subst(d), script)
|
path = join(env.subst(d), script)
|
||||||
if isfile(path):
|
if isfile(path):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
if script:
|
||||||
|
env.Exit("Error: Could not find '%s' LD script in LDPATH '%s'" % (
|
||||||
|
script, env.subst("$LIBPATH")))
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,10 +18,8 @@ from os.path import isfile, join
|
|||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from SCons.Script import Exit
|
|
||||||
from serial import Serial
|
|
||||||
|
|
||||||
from platformio.util import get_logicaldisks, get_serialports, get_systype
|
from platformio.util import get_logicaldisks, get_serialports, get_systype
|
||||||
|
from serial import Serial
|
||||||
|
|
||||||
|
|
||||||
def FlushSerialBuffer(env, port):
|
def FlushSerialBuffer(env, port):
|
||||||
@ -48,7 +46,7 @@ def TouchSerialPort(env, port, baudrate):
|
|||||||
sleep(0.4)
|
sleep(0.4)
|
||||||
|
|
||||||
|
|
||||||
def WaitForNewSerialPort(_, before):
|
def WaitForNewSerialPort(env, before):
|
||||||
new_port = None
|
new_port = None
|
||||||
elapsed = 0
|
elapsed = 0
|
||||||
while elapsed < 10:
|
while elapsed < 10:
|
||||||
@ -63,10 +61,10 @@ def WaitForNewSerialPort(_, before):
|
|||||||
elapsed += 0.25
|
elapsed += 0.25
|
||||||
|
|
||||||
if not new_port:
|
if not new_port:
|
||||||
Exit("Error: Couldn't find a board on the selected port. "
|
env.Exit("Error: Couldn't find a board on the selected port. "
|
||||||
"Check that you have the correct port selected. "
|
"Check that you have the correct port selected. "
|
||||||
"If it is correct, try pressing the board's reset "
|
"If it is correct, try pressing the board's reset "
|
||||||
"button after initiating the upload.")
|
"button after initiating the upload.")
|
||||||
|
|
||||||
return new_port
|
return new_port
|
||||||
|
|
||||||
@ -100,10 +98,10 @@ def AutodetectUploadPort(env):
|
|||||||
if "UPLOAD_PORT" in env:
|
if "UPLOAD_PORT" in env:
|
||||||
print "Auto-detected UPLOAD_PORT/DISK: %s" % env['UPLOAD_PORT']
|
print "Auto-detected UPLOAD_PORT/DISK: %s" % env['UPLOAD_PORT']
|
||||||
else:
|
else:
|
||||||
Exit("Error: Please specify `upload_port` for environment or use "
|
env.Exit("Error: Please specify `upload_port` for environment or use "
|
||||||
"global `--upload-port` option.\n"
|
"global `--upload-port` option.\n"
|
||||||
"For some development platforms this can be a USB flash drive "
|
"For some development platforms this can be a USB flash "
|
||||||
"(i.e. /media/<user>/<device name>)\n")
|
"drive (i.e. /media/<user>/<device name>)\n")
|
||||||
|
|
||||||
|
|
||||||
def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621
|
def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621
|
||||||
@ -113,8 +111,8 @@ def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621
|
|||||||
if not isfile(fpath):
|
if not isfile(fpath):
|
||||||
continue
|
continue
|
||||||
copyfile(fpath, join(env.subst("$UPLOAD_PORT"), "firmware.%s" % ext))
|
copyfile(fpath, join(env.subst("$UPLOAD_PORT"), "firmware.%s" % ext))
|
||||||
print ("Firmware has been successfully uploaded.\n"
|
print("Firmware has been successfully uploaded.\n"
|
||||||
"Please restart your board.")
|
"Please restart your board.")
|
||||||
|
|
||||||
|
|
||||||
def exists(_):
|
def exists(_):
|
||||||
|
@ -19,11 +19,9 @@ from glob import glob
|
|||||||
from os import getenv, listdir, sep, walk
|
from os import getenv, listdir, sep, walk
|
||||||
from os.path import basename, dirname, isdir, isfile, join, normpath, realpath
|
from os.path import basename, dirname, isdir, isfile, join, normpath, realpath
|
||||||
|
|
||||||
from SCons.Script import (COMMAND_LINE_TARGETS, DefaultEnvironment, Exit,
|
|
||||||
SConscript)
|
|
||||||
from SCons.Util import case_sensitive_suffixes
|
|
||||||
|
|
||||||
from platformio.util import pioversion_to_intstr
|
from platformio.util import pioversion_to_intstr
|
||||||
|
from SCons.Script import COMMAND_LINE_TARGETS, DefaultEnvironment, SConscript
|
||||||
|
from SCons.Util import case_sensitive_suffixes
|
||||||
|
|
||||||
SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"]
|
SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"]
|
||||||
SRC_HEADER_EXT = ["h", "hpp"]
|
SRC_HEADER_EXT = ["h", "hpp"]
|
||||||
@ -183,7 +181,7 @@ def BuildFrameworks(env, frameworks):
|
|||||||
if board_frameworks:
|
if board_frameworks:
|
||||||
frameworks.insert(0, board_frameworks[0])
|
frameworks.insert(0, board_frameworks[0])
|
||||||
else:
|
else:
|
||||||
Exit("Error: Please specify board type")
|
env.Exit("Error: Please specify board type")
|
||||||
|
|
||||||
for f in frameworks:
|
for f in frameworks:
|
||||||
if f in ("arduino", "energia"):
|
if f in ("arduino", "energia"):
|
||||||
@ -193,7 +191,7 @@ def BuildFrameworks(env, frameworks):
|
|||||||
SConscript(env.subst(
|
SConscript(env.subst(
|
||||||
join("$PIOBUILDER_DIR", "scripts", "frameworks", "%s.py" % f)))
|
join("$PIOBUILDER_DIR", "scripts", "frameworks", "%s.py" % f)))
|
||||||
else:
|
else:
|
||||||
Exit("Error: This board doesn't support %s framework!" % f)
|
env.Exit("Error: This board doesn't support %s framework!" % f)
|
||||||
|
|
||||||
|
|
||||||
def BuildLibrary(env, variant_dir, src_dir, src_filter=None):
|
def BuildLibrary(env, variant_dir, src_dir, src_filter=None):
|
||||||
|
Reference in New Issue
Block a user