mirror of https://github.com/ARMmbed/mbed-os.git
Merge branch 'upstream_master' into dev_gpio_irq_endis
commit
5129cd05f3
|
@ -1,25 +1,38 @@
|
|||
#include "UBloxUSBGSMModem.h"
|
||||
#include "test_env.h"
|
||||
#include "httptest.h"
|
||||
|
||||
#ifndef MODEM_APN
|
||||
#warning APN not specified, using "internet"
|
||||
#define APN "internet"
|
||||
#define MODEM_APN "internet"
|
||||
#endif
|
||||
|
||||
#ifndef MODEM_USERNAME
|
||||
#warning username not specified
|
||||
#define USERNAME NULL
|
||||
#define MODEM_USERNAME NULL
|
||||
#endif
|
||||
|
||||
#ifndef MODEM_PASSWORD
|
||||
#warning password not specified
|
||||
#define PASSWORD NULL
|
||||
#define MODEM_PASSWORD NULL
|
||||
#endif
|
||||
|
||||
void test(void const* data)
|
||||
{
|
||||
UbloxUSBGSMModem modem;
|
||||
httptest(modem, MODEM_APN, MODEM_USERNAME, MODEM_PASSWORD);
|
||||
while (true);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
UbloxUSBGSMModem modem;
|
||||
Thread testTask(test, NULL, osPriorityNormal, 1024 * 4);
|
||||
DigitalOut led(LED1);
|
||||
|
||||
notify_completion(httptest(modem, APN, USERNAME, PASSWORD));
|
||||
while (true)
|
||||
{
|
||||
led = !led;
|
||||
Thread::wait(1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ if __name__ == '__main__':
|
|||
default=False, help="Verbose diagnostic output")
|
||||
parser.add_option("-b", "--ublox", action="store_true", dest="ublox",
|
||||
default=False, help="Compile the u-blox library")
|
||||
parser.add_option("-D", "", action="append", dest="macros",
|
||||
help="Add a macro definition")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# Get target list
|
||||
|
@ -92,10 +94,12 @@ if __name__ == '__main__':
|
|||
try:
|
||||
mcu = TARGET_MAP[target]
|
||||
build_mbed_libs(mcu, toolchain, options=options.options,
|
||||
verbose=options.verbose, clean=options.clean)
|
||||
verbose=options.verbose, clean=options.clean,
|
||||
macros=options.macros)
|
||||
for lib_id in libraries:
|
||||
build_lib(lib_id, mcu, toolchain, options=options.options,
|
||||
verbose=options.verbose, clean=options.clean)
|
||||
verbose=options.verbose, clean=options.clean,
|
||||
macros=options.macros)
|
||||
successes.append(id)
|
||||
except Exception, e:
|
||||
if options.verbose:
|
||||
|
|
|
@ -26,9 +26,9 @@ from workspace_tools.libraries import Library
|
|||
|
||||
def build_project(src_path, build_path, target, toolchain_name,
|
||||
libraries_paths=None, options=None, linker_script=None,
|
||||
clean=False, notify=None, verbose=False, name=None):
|
||||
clean=False, notify=None, verbose=False, name=None, macros=None):
|
||||
# Toolchain instance
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify)
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros)
|
||||
toolchain.VERBOSE = verbose
|
||||
toolchain.build_all = clean
|
||||
|
||||
|
@ -40,7 +40,6 @@ def build_project(src_path, build_path, target, toolchain_name,
|
|||
# Scan src_path and libraries_paths for resources
|
||||
resources = toolchain.scan_resources(src_paths[0])
|
||||
for path in src_paths[1:]:
|
||||
print "PATH:", path
|
||||
resources.add(toolchain.scan_resources(path))
|
||||
if libraries_paths is not None:
|
||||
src_paths.extend(libraries_paths)
|
||||
|
@ -78,7 +77,7 @@ verbose: Write the actual tools command lines if True
|
|||
"""
|
||||
def build_library(src_paths, build_path, target, toolchain_name,
|
||||
dependencies_paths=None, options=None, name=None, clean=False,
|
||||
notify=None, verbose=False):
|
||||
notify=None, verbose=False, macros=None):
|
||||
if type(src_paths) != ListType: src_paths = [src_paths]
|
||||
|
||||
for src_path in src_paths:
|
||||
|
@ -86,7 +85,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
|||
raise Exception("The library source folder does not exist: %s", src_path)
|
||||
|
||||
# Toolchain instance
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify)
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros)
|
||||
toolchain.VERBOSE = verbose
|
||||
toolchain.build_all = clean
|
||||
|
||||
|
@ -136,14 +135,14 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
|
|||
|
||||
|
||||
# We do have unique legacy conventions about how we build and package the mbed library
|
||||
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False):
|
||||
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None):
|
||||
# Check toolchain support
|
||||
if toolchain_name not in target.supported_toolchains:
|
||||
print '\n%s target is not yet supported by toolchain %s' % (target.name, toolchain_name)
|
||||
return
|
||||
|
||||
# Toolchain
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options)
|
||||
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros)
|
||||
toolchain.VERBOSE = verbose
|
||||
toolchain.build_all = clean
|
||||
|
||||
|
@ -192,3 +191,4 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
|
|||
objects.remove(retargeting)
|
||||
toolchain.build_library(objects, BUILD_TOOLCHAIN, "mbed")
|
||||
toolchain.copy_files(retargeting, BUILD_TOOLCHAIN)
|
||||
|
||||
|
|
|
@ -48,7 +48,9 @@ if __name__ == '__main__':
|
|||
help="The name of the desired test program")
|
||||
parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
|
||||
default=False, help="Verbose diagnostic output")
|
||||
|
||||
parser.add_option("-D", "", action="append", dest="macros",
|
||||
help="Add a macro definition")
|
||||
|
||||
# Local run
|
||||
parser.add_option("-d", "--disk", dest="disk",
|
||||
default=None, help="The mbed disk")
|
||||
|
@ -114,7 +116,8 @@ if __name__ == '__main__':
|
|||
bin = build_project(test.source_dir, build_dir, target, toolchain,
|
||||
test.dependencies, options.options,
|
||||
linker_script=options.linker_script,
|
||||
clean=options.clean, verbose=options.verbose)
|
||||
clean=options.clean, verbose=options.verbose,
|
||||
macros=options.macros)
|
||||
print 'Image: %s' % bin
|
||||
|
||||
if options.disk:
|
||||
|
|
|
@ -62,6 +62,7 @@ OFFICIAL_CODE = (
|
|||
("CellularModem", "net/cellular/CellularModem"),
|
||||
("CellularUSBModem", "net/cellular/CellularUSBModem"),
|
||||
("UbloxUSBModem", "net/cellular/UbloxUSBModem"),
|
||||
("UbloxModemHTTPClientTest", ["tests/net/cellular/http/common", "tests/net/cellular/http/ubloxusbgsm"]),
|
||||
)
|
||||
|
||||
|
||||
|
@ -239,7 +240,7 @@ def visit_files(path, visit):
|
|||
visit(join(root, file))
|
||||
|
||||
|
||||
def update_repo(repo_name, sdk_path):
|
||||
def update_repo(repo_name, sdk_paths):
|
||||
repo = MbedOfficialRepository(repo_name)
|
||||
# copy files from mbed SDK to mbed_official repository
|
||||
def visit_mbed_sdk(sdk_file):
|
||||
|
@ -250,12 +251,16 @@ def update_repo(repo_name, sdk_path):
|
|||
makedirs(repo_dir)
|
||||
|
||||
copy_with_line_endings(sdk_file, repo_file)
|
||||
visit_files(sdk_path, visit_mbed_sdk)
|
||||
for sdk_path in sdk_paths:
|
||||
visit_files(sdk_path, visit_mbed_sdk)
|
||||
|
||||
# remove repository files that do not exist in the mbed SDK
|
||||
def visit_repo(repo_file):
|
||||
sdk_file = join(sdk_path, relpath(repo_file, repo.path))
|
||||
if not exists(sdk_file):
|
||||
for sdk_path in sdk_paths:
|
||||
sdk_file = join(sdk_path, relpath(repo_file, repo.path))
|
||||
if exists(sdk_file):
|
||||
break
|
||||
else:
|
||||
remove(repo_file)
|
||||
print "remove: %s" % repo_file
|
||||
visit_files(repo.path, visit_repo)
|
||||
|
@ -267,7 +272,8 @@ def update_repo(repo_name, sdk_path):
|
|||
def update_code(repositories):
|
||||
for repo_name, sdk_dir in repositories:
|
||||
print '\n=== Updating "%s" ===' % repo_name
|
||||
sdk_path = join(LIB_DIR, sdk_dir)
|
||||
sdk_dirs = [sdk_dir] if type(sdk_dir) != type([]) else sdk_dir
|
||||
sdk_path = [join(LIB_DIR, d) for d in sdk_dirs]
|
||||
update_repo(repo_name, sdk_path)
|
||||
|
||||
|
||||
|
|
|
@ -569,9 +569,8 @@ TESTS = [
|
|||
{
|
||||
"id": "UB_1", "description": "u-blox USB GSM modem: HTTP client",
|
||||
"source_dir": [join(TEST_DIR, "net", "cellular", "http", "ubloxusbgsm"), join(TEST_DIR, "net", "cellular", "http", "common")],
|
||||
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, RTOS_LIBRARIES, USB_HOST_LIBRARIES, UBLOX_LIBRARY],
|
||||
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES, UBLOX_LIBRARY],
|
||||
"supported": CORTEX_ARM_SUPPORT,
|
||||
"automated": True,
|
||||
},
|
||||
{
|
||||
"id": "UB_2", "description": "u-blox USB GSM modem: SMS test",
|
||||
|
|
|
@ -146,7 +146,7 @@ class mbedToolchain:
|
|||
GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%"
|
||||
GOANNA_DIAGNOSTIC_PATTERN = re.compile(r'"\[Goanna\] (?P<severity>warning) \[(?P<file>[^:]+):(?P<line>\d+)\] \- (?P<message>.*)"')
|
||||
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
self.target = target
|
||||
self.name = self.__class__.__name__
|
||||
self.hook = hooks.Hook(target, self)
|
||||
|
@ -162,6 +162,7 @@ class mbedToolchain:
|
|||
self.options = []
|
||||
else:
|
||||
self.options = options
|
||||
self.macros = macros or []
|
||||
self.options.extend(BUILD_OPTIONS)
|
||||
if self.options:
|
||||
self.info("Build Options: %s" % (', '.join(self.options)))
|
||||
|
@ -347,7 +348,7 @@ class mbedToolchain:
|
|||
self.progress("compile", source, build_update=True)
|
||||
|
||||
# Compile
|
||||
command = cc + ['-D%s' % s for s in self.get_symbols()] + ["-I%s" % i for i in includes] + ["-o", object, source]
|
||||
command = cc + ['-D%s' % s for s in self.get_symbols() + self.macros] + ["-I%s" % i for i in includes] + ["-o", object, source]
|
||||
if hasattr(self, "get_dep_opt"):
|
||||
command.extend(self.get_dep_opt(dep_path))
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ class ARM(mbedToolchain):
|
|||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+): (?P<severity>Warning|Error): (?P<message>.+)')
|
||||
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
|
||||
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
mbedToolchain.__init__(self, target, options, notify)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
||||
|
||||
if target.core == "Cortex-M0+":
|
||||
cpu = "Cortex-M0"
|
||||
|
@ -123,16 +123,16 @@ class ARM(mbedToolchain):
|
|||
|
||||
|
||||
class ARM_STD(ARM):
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
ARM.__init__(self, target, options, notify)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
ARM.__init__(self, target, options, notify, macros)
|
||||
self.ld.append("--libpath=%s" % ARM_LIB)
|
||||
|
||||
|
||||
class ARM_MICRO(ARM):
|
||||
PATCHED_LIBRARY = False
|
||||
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
ARM.__init__(self, target, notify)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
ARM.__init__(self, target, options, notify, macros)
|
||||
|
||||
# Compiler
|
||||
self.asm += ["-D__MICROLIB"]
|
||||
|
|
|
@ -29,8 +29,8 @@ class GCC(mbedToolchain):
|
|||
CIRCULAR_DEPENDENCIES = True
|
||||
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
|
||||
|
||||
def __init__(self, target, options=None, notify=None, tool_path=""):
|
||||
mbedToolchain.__init__(self, target, options, notify)
|
||||
def __init__(self, target, options=None, notify=None, macros=None, tool_path=""):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
||||
|
||||
if target.core == "Cortex-M0+":
|
||||
cpu = "cortex-m0"
|
||||
|
@ -162,8 +162,8 @@ class GCC(mbedToolchain):
|
|||
|
||||
|
||||
class GCC_ARM(GCC):
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
GCC.__init__(self, target, options, notify, GCC_ARM_PATH)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC.__init__(self, target, options, notify, macros, GCC_ARM_PATH)
|
||||
|
||||
# Use latest gcc nanolib
|
||||
self.ld.append("--specs=nano.specs")
|
||||
|
@ -174,8 +174,8 @@ class GCC_ARM(GCC):
|
|||
|
||||
|
||||
class GCC_CR(GCC):
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
GCC.__init__(self, target, options, notify, GCC_CR_PATH)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC.__init__(self, target, options, notify, macros, GCC_CR_PATH)
|
||||
|
||||
additional_compiler_flags = [
|
||||
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
|
||||
|
@ -187,8 +187,8 @@ class GCC_CR(GCC):
|
|||
|
||||
|
||||
class GCC_CS(GCC):
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
GCC.__init__(self, target, options, notify, GCC_CS_PATH)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC.__init__(self, target, options, notify, macros, GCC_CS_PATH)
|
||||
|
||||
|
||||
class GCC_CW(GCC):
|
||||
|
@ -196,13 +196,13 @@ class GCC_CW(GCC):
|
|||
"Cortex-M0+": "armv6-m",
|
||||
}
|
||||
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
GCC.__init__(self, target, options, notify, CW_GCC_PATH)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC.__init__(self, target, options, notify, macros, CW_GCC_PATH)
|
||||
|
||||
|
||||
class GCC_CW_EWL(GCC_CW):
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
GCC_CW.__init__(self, target, options, notify)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC_CW.__init__(self, target, options, notify, macros)
|
||||
|
||||
# Compiler
|
||||
common = [
|
||||
|
@ -230,5 +230,5 @@ class GCC_CW_EWL(GCC_CW):
|
|||
|
||||
|
||||
class GCC_CW_NEWLIB(GCC_CW):
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
GCC_CW.__init__(self, target, options, notify)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
GCC_CW.__init__(self, target, options, notify, macros)
|
||||
|
|
|
@ -29,8 +29,8 @@ class IAR(mbedToolchain):
|
|||
|
||||
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)')
|
||||
|
||||
def __init__(self, target, options=None, notify=None):
|
||||
mbedToolchain.__init__(self, target, options, notify)
|
||||
def __init__(self, target, options=None, notify=None, macros=None):
|
||||
mbedToolchain.__init__(self, target, options, notify, macros)
|
||||
|
||||
c_flags = [
|
||||
"-Oh",
|
||||
|
|
Loading…
Reference in New Issue