Merge branch 'upstream_master' into dev_gpio_irq_endis

pull/88/head
0xc0170 2013-10-21 12:29:43 +02:00
commit 5129cd05f3
10 changed files with 74 additions and 48 deletions

View File

@ -1,25 +1,38 @@
#include "UBloxUSBGSMModem.h" #include "UBloxUSBGSMModem.h"
#include "test_env.h"
#include "httptest.h" #include "httptest.h"
#ifndef MODEM_APN #ifndef MODEM_APN
#warning APN not specified, using "internet" #warning APN not specified, using "internet"
#define APN "internet" #define MODEM_APN "internet"
#endif #endif
#ifndef MODEM_USERNAME #ifndef MODEM_USERNAME
#warning username not specified #warning username not specified
#define USERNAME NULL #define MODEM_USERNAME NULL
#endif #endif
#ifndef MODEM_PASSWORD #ifndef MODEM_PASSWORD
#warning password not specified #warning password not specified
#define PASSWORD NULL #define MODEM_PASSWORD NULL
#endif #endif
void test(void const* data)
{
UbloxUSBGSMModem modem;
httptest(modem, MODEM_APN, MODEM_USERNAME, MODEM_PASSWORD);
while (true);
}
int main() 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;
}

View File

@ -52,6 +52,8 @@ if __name__ == '__main__':
default=False, help="Verbose diagnostic output") default=False, help="Verbose diagnostic output")
parser.add_option("-b", "--ublox", action="store_true", dest="ublox", parser.add_option("-b", "--ublox", action="store_true", dest="ublox",
default=False, help="Compile the u-blox library") 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() (options, args) = parser.parse_args()
# Get target list # Get target list
@ -92,10 +94,12 @@ if __name__ == '__main__':
try: try:
mcu = TARGET_MAP[target] mcu = TARGET_MAP[target]
build_mbed_libs(mcu, toolchain, options=options.options, 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: for lib_id in libraries:
build_lib(lib_id, mcu, toolchain, options=options.options, 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) successes.append(id)
except Exception, e: except Exception, e:
if options.verbose: if options.verbose:

View File

@ -26,9 +26,9 @@ from workspace_tools.libraries import Library
def build_project(src_path, build_path, target, toolchain_name, def build_project(src_path, build_path, target, toolchain_name,
libraries_paths=None, options=None, linker_script=None, 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 instance
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify) toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros)
toolchain.VERBOSE = verbose toolchain.VERBOSE = verbose
toolchain.build_all = clean 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 # Scan src_path and libraries_paths for resources
resources = toolchain.scan_resources(src_paths[0]) resources = toolchain.scan_resources(src_paths[0])
for path in src_paths[1:]: for path in src_paths[1:]:
print "PATH:", path
resources.add(toolchain.scan_resources(path)) resources.add(toolchain.scan_resources(path))
if libraries_paths is not None: if libraries_paths is not None:
src_paths.extend(libraries_paths) 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, def build_library(src_paths, build_path, target, toolchain_name,
dependencies_paths=None, options=None, name=None, clean=False, 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] if type(src_paths) != ListType: src_paths = [src_paths]
for src_path in 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) raise Exception("The library source folder does not exist: %s", src_path)
# Toolchain instance # Toolchain instance
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify) toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros)
toolchain.VERBOSE = verbose toolchain.VERBOSE = verbose
toolchain.build_all = clean 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 # 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 # Check toolchain support
if toolchain_name not in target.supported_toolchains: if toolchain_name not in target.supported_toolchains:
print '\n%s target is not yet supported by toolchain %s' % (target.name, toolchain_name) print '\n%s target is not yet supported by toolchain %s' % (target.name, toolchain_name)
return return
# Toolchain # Toolchain
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options) toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros)
toolchain.VERBOSE = verbose toolchain.VERBOSE = verbose
toolchain.build_all = clean toolchain.build_all = clean
@ -192,3 +191,4 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
objects.remove(retargeting) objects.remove(retargeting)
toolchain.build_library(objects, BUILD_TOOLCHAIN, "mbed") toolchain.build_library(objects, BUILD_TOOLCHAIN, "mbed")
toolchain.copy_files(retargeting, BUILD_TOOLCHAIN) toolchain.copy_files(retargeting, BUILD_TOOLCHAIN)

View File

@ -48,6 +48,8 @@ if __name__ == '__main__':
help="The name of the desired test program") help="The name of the desired test program")
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
default=False, help="Verbose diagnostic output") default=False, help="Verbose diagnostic output")
parser.add_option("-D", "", action="append", dest="macros",
help="Add a macro definition")
# Local run # Local run
parser.add_option("-d", "--disk", dest="disk", parser.add_option("-d", "--disk", dest="disk",
@ -114,7 +116,8 @@ if __name__ == '__main__':
bin = build_project(test.source_dir, build_dir, target, toolchain, bin = build_project(test.source_dir, build_dir, target, toolchain,
test.dependencies, options.options, test.dependencies, options.options,
linker_script=options.linker_script, linker_script=options.linker_script,
clean=options.clean, verbose=options.verbose) clean=options.clean, verbose=options.verbose,
macros=options.macros)
print 'Image: %s' % bin print 'Image: %s' % bin
if options.disk: if options.disk:

View File

@ -62,6 +62,7 @@ OFFICIAL_CODE = (
("CellularModem", "net/cellular/CellularModem"), ("CellularModem", "net/cellular/CellularModem"),
("CellularUSBModem", "net/cellular/CellularUSBModem"), ("CellularUSBModem", "net/cellular/CellularUSBModem"),
("UbloxUSBModem", "net/cellular/UbloxUSBModem"), ("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)) visit(join(root, file))
def update_repo(repo_name, sdk_path): def update_repo(repo_name, sdk_paths):
repo = MbedOfficialRepository(repo_name) repo = MbedOfficialRepository(repo_name)
# copy files from mbed SDK to mbed_official repository # copy files from mbed SDK to mbed_official repository
def visit_mbed_sdk(sdk_file): def visit_mbed_sdk(sdk_file):
@ -250,12 +251,16 @@ def update_repo(repo_name, sdk_path):
makedirs(repo_dir) makedirs(repo_dir)
copy_with_line_endings(sdk_file, repo_file) copy_with_line_endings(sdk_file, repo_file)
for sdk_path in sdk_paths:
visit_files(sdk_path, visit_mbed_sdk) visit_files(sdk_path, visit_mbed_sdk)
# remove repository files that do not exist in the mbed SDK # remove repository files that do not exist in the mbed SDK
def visit_repo(repo_file): def visit_repo(repo_file):
for sdk_path in sdk_paths:
sdk_file = join(sdk_path, relpath(repo_file, repo.path)) sdk_file = join(sdk_path, relpath(repo_file, repo.path))
if not exists(sdk_file): if exists(sdk_file):
break
else:
remove(repo_file) remove(repo_file)
print "remove: %s" % repo_file print "remove: %s" % repo_file
visit_files(repo.path, visit_repo) visit_files(repo.path, visit_repo)
@ -267,7 +272,8 @@ def update_repo(repo_name, sdk_path):
def update_code(repositories): def update_code(repositories):
for repo_name, sdk_dir in repositories: for repo_name, sdk_dir in repositories:
print '\n=== Updating "%s" ===' % repo_name 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) update_repo(repo_name, sdk_path)

View File

@ -569,9 +569,8 @@ TESTS = [
{ {
"id": "UB_1", "description": "u-blox USB GSM modem: HTTP client", "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")], "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, "supported": CORTEX_ARM_SUPPORT,
"automated": True,
}, },
{ {
"id": "UB_2", "description": "u-blox USB GSM modem: SMS test", "id": "UB_2", "description": "u-blox USB GSM modem: SMS test",

View File

@ -146,7 +146,7 @@ class mbedToolchain:
GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%" 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>.*)"') 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.target = target
self.name = self.__class__.__name__ self.name = self.__class__.__name__
self.hook = hooks.Hook(target, self) self.hook = hooks.Hook(target, self)
@ -162,6 +162,7 @@ class mbedToolchain:
self.options = [] self.options = []
else: else:
self.options = options self.options = options
self.macros = macros or []
self.options.extend(BUILD_OPTIONS) self.options.extend(BUILD_OPTIONS)
if self.options: if self.options:
self.info("Build Options: %s" % (', '.join(self.options))) self.info("Build Options: %s" % (', '.join(self.options)))
@ -347,7 +348,7 @@ class mbedToolchain:
self.progress("compile", source, build_update=True) self.progress("compile", source, build_update=True)
# Compile # 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"): if hasattr(self, "get_dep_opt"):
command.extend(self.get_dep_opt(dep_path)) command.extend(self.get_dep_opt(dep_path))

View File

@ -30,8 +30,8 @@ class ARM(mbedToolchain):
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+): (?P<severity>Warning|Error): (?P<message>.+)') 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') DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
mbedToolchain.__init__(self, target, options, notify) mbedToolchain.__init__(self, target, options, notify, macros)
if target.core == "Cortex-M0+": if target.core == "Cortex-M0+":
cpu = "Cortex-M0" cpu = "Cortex-M0"
@ -123,16 +123,16 @@ class ARM(mbedToolchain):
class ARM_STD(ARM): class ARM_STD(ARM):
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
ARM.__init__(self, target, options, notify) ARM.__init__(self, target, options, notify, macros)
self.ld.append("--libpath=%s" % ARM_LIB) self.ld.append("--libpath=%s" % ARM_LIB)
class ARM_MICRO(ARM): class ARM_MICRO(ARM):
PATCHED_LIBRARY = False PATCHED_LIBRARY = False
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
ARM.__init__(self, target, notify) ARM.__init__(self, target, options, notify, macros)
# Compiler # Compiler
self.asm += ["-D__MICROLIB"] self.asm += ["-D__MICROLIB"]

View File

@ -29,8 +29,8 @@ class GCC(mbedToolchain):
CIRCULAR_DEPENDENCIES = True CIRCULAR_DEPENDENCIES = True
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)') DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
def __init__(self, target, options=None, notify=None, tool_path=""): def __init__(self, target, options=None, notify=None, macros=None, tool_path=""):
mbedToolchain.__init__(self, target, options, notify) mbedToolchain.__init__(self, target, options, notify, macros)
if target.core == "Cortex-M0+": if target.core == "Cortex-M0+":
cpu = "cortex-m0" cpu = "cortex-m0"
@ -162,8 +162,8 @@ class GCC(mbedToolchain):
class GCC_ARM(GCC): class GCC_ARM(GCC):
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
GCC.__init__(self, target, options, notify, GCC_ARM_PATH) GCC.__init__(self, target, options, notify, macros, GCC_ARM_PATH)
# Use latest gcc nanolib # Use latest gcc nanolib
self.ld.append("--specs=nano.specs") self.ld.append("--specs=nano.specs")
@ -174,8 +174,8 @@ class GCC_ARM(GCC):
class GCC_CR(GCC): class GCC_CR(GCC):
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
GCC.__init__(self, target, options, notify, GCC_CR_PATH) GCC.__init__(self, target, options, notify, macros, GCC_CR_PATH)
additional_compiler_flags = [ additional_compiler_flags = [
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP", "-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
@ -187,8 +187,8 @@ class GCC_CR(GCC):
class GCC_CS(GCC): class GCC_CS(GCC):
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
GCC.__init__(self, target, options, notify, GCC_CS_PATH) GCC.__init__(self, target, options, notify, macros, GCC_CS_PATH)
class GCC_CW(GCC): class GCC_CW(GCC):
@ -196,13 +196,13 @@ class GCC_CW(GCC):
"Cortex-M0+": "armv6-m", "Cortex-M0+": "armv6-m",
} }
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
GCC.__init__(self, target, options, notify, CW_GCC_PATH) GCC.__init__(self, target, options, notify, macros, CW_GCC_PATH)
class GCC_CW_EWL(GCC_CW): class GCC_CW_EWL(GCC_CW):
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
GCC_CW.__init__(self, target, options, notify) GCC_CW.__init__(self, target, options, notify, macros)
# Compiler # Compiler
common = [ common = [
@ -230,5 +230,5 @@ class GCC_CW_EWL(GCC_CW):
class GCC_CW_NEWLIB(GCC_CW): class GCC_CW_NEWLIB(GCC_CW):
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
GCC_CW.__init__(self, target, options, notify) GCC_CW.__init__(self, target, options, notify, macros)

View File

@ -29,8 +29,8 @@ class IAR(mbedToolchain):
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)') DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)')
def __init__(self, target, options=None, notify=None): def __init__(self, target, options=None, notify=None, macros=None):
mbedToolchain.__init__(self, target, options, notify) mbedToolchain.__init__(self, target, options, notify, macros)
c_flags = [ c_flags = [
"-Oh", "-Oh",