Skip to content

Commit 5129cd0

Browse files
committed
Merge branch 'upstream_master' into dev_gpio_irq_endis
2 parents b0537af + 1bb844c commit 5129cd0

File tree

10 files changed

+74
-48
lines changed

10 files changed

+74
-48
lines changed
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
11
#include "UBloxUSBGSMModem.h"
2-
#include "test_env.h"
32
#include "httptest.h"
43

54
#ifndef MODEM_APN
65
#warning APN not specified, using "internet"
7-
#define APN "internet"
6+
#define MODEM_APN "internet"
87
#endif
98

109
#ifndef MODEM_USERNAME
1110
#warning username not specified
12-
#define USERNAME NULL
11+
#define MODEM_USERNAME NULL
1312
#endif
1413

1514
#ifndef MODEM_PASSWORD
1615
#warning password not specified
17-
#define PASSWORD NULL
16+
#define MODEM_PASSWORD NULL
1817
#endif
1918

20-
int main()
19+
void test(void const* data)
2120
{
2221
UbloxUSBGSMModem modem;
22+
httptest(modem, MODEM_APN, MODEM_USERNAME, MODEM_PASSWORD);
23+
while (true);
24+
}
25+
26+
int main()
27+
{
28+
Thread testTask(test, NULL, osPriorityNormal, 1024 * 4);
29+
DigitalOut led(LED1);
2330

24-
notify_completion(httptest(modem, APN, USERNAME, PASSWORD));
31+
while (true)
32+
{
33+
led = !led;
34+
Thread::wait(1000);
35+
}
36+
return 0;
2537
}
38+

workspace_tools/build.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
default=False, help="Verbose diagnostic output")
5353
parser.add_option("-b", "--ublox", action="store_true", dest="ublox",
5454
default=False, help="Compile the u-blox library")
55+
parser.add_option("-D", "", action="append", dest="macros",
56+
help="Add a macro definition")
5557
(options, args) = parser.parse_args()
5658

5759
# Get target list
@@ -92,10 +94,12 @@
9294
try:
9395
mcu = TARGET_MAP[target]
9496
build_mbed_libs(mcu, toolchain, options=options.options,
95-
verbose=options.verbose, clean=options.clean)
97+
verbose=options.verbose, clean=options.clean,
98+
macros=options.macros)
9699
for lib_id in libraries:
97100
build_lib(lib_id, mcu, toolchain, options=options.options,
98-
verbose=options.verbose, clean=options.clean)
101+
verbose=options.verbose, clean=options.clean,
102+
macros=options.macros)
99103
successes.append(id)
100104
except Exception, e:
101105
if options.verbose:

workspace_tools/build_api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727
def build_project(src_path, build_path, target, toolchain_name,
2828
libraries_paths=None, options=None, linker_script=None,
29-
clean=False, notify=None, verbose=False, name=None):
29+
clean=False, notify=None, verbose=False, name=None, macros=None):
3030
# Toolchain instance
31-
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify)
31+
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros)
3232
toolchain.VERBOSE = verbose
3333
toolchain.build_all = clean
3434

@@ -40,7 +40,6 @@ def build_project(src_path, build_path, target, toolchain_name,
4040
# Scan src_path and libraries_paths for resources
4141
resources = toolchain.scan_resources(src_paths[0])
4242
for path in src_paths[1:]:
43-
print "PATH:", path
4443
resources.add(toolchain.scan_resources(path))
4544
if libraries_paths is not None:
4645
src_paths.extend(libraries_paths)
@@ -78,15 +77,15 @@ def build_project(src_path, build_path, target, toolchain_name,
7877
"""
7978
def build_library(src_paths, build_path, target, toolchain_name,
8079
dependencies_paths=None, options=None, name=None, clean=False,
81-
notify=None, verbose=False):
80+
notify=None, verbose=False, macros=None):
8281
if type(src_paths) != ListType: src_paths = [src_paths]
8382

8483
for src_path in src_paths:
8584
if not exists(src_path):
8685
raise Exception("The library source folder does not exist: %s", src_path)
8786

8887
# Toolchain instance
89-
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify)
88+
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, notify, macros)
9089
toolchain.VERBOSE = verbose
9190
toolchain.build_all = clean
9291

@@ -136,14 +135,14 @@ def build_lib(lib_id, target, toolchain, options=None, verbose=False, clean=Fals
136135

137136

138137
# We do have unique legacy conventions about how we build and package the mbed library
139-
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False):
138+
def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=False, macros=None):
140139
# Check toolchain support
141140
if toolchain_name not in target.supported_toolchains:
142141
print '\n%s target is not yet supported by toolchain %s' % (target.name, toolchain_name)
143142
return
144143

145144
# Toolchain
146-
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options)
145+
toolchain = TOOLCHAIN_CLASSES[toolchain_name](target, options, macros=macros)
147146
toolchain.VERBOSE = verbose
148147
toolchain.build_all = clean
149148

@@ -192,3 +191,4 @@ def build_mbed_libs(target, toolchain_name, options=None, verbose=False, clean=F
192191
objects.remove(retargeting)
193192
toolchain.build_library(objects, BUILD_TOOLCHAIN, "mbed")
194193
toolchain.copy_files(retargeting, BUILD_TOOLCHAIN)
194+

workspace_tools/make.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
help="The name of the desired test program")
4949
parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
5050
default=False, help="Verbose diagnostic output")
51-
51+
parser.add_option("-D", "", action="append", dest="macros",
52+
help="Add a macro definition")
53+
5254
# Local run
5355
parser.add_option("-d", "--disk", dest="disk",
5456
default=None, help="The mbed disk")
@@ -114,7 +116,8 @@
114116
bin = build_project(test.source_dir, build_dir, target, toolchain,
115117
test.dependencies, options.options,
116118
linker_script=options.linker_script,
117-
clean=options.clean, verbose=options.verbose)
119+
clean=options.clean, verbose=options.verbose,
120+
macros=options.macros)
118121
print 'Image: %s' % bin
119122

120123
if options.disk:

workspace_tools/synch.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
("CellularModem", "net/cellular/CellularModem"),
6363
("CellularUSBModem", "net/cellular/CellularUSBModem"),
6464
("UbloxUSBModem", "net/cellular/UbloxUSBModem"),
65+
("UbloxModemHTTPClientTest", ["tests/net/cellular/http/common", "tests/net/cellular/http/ubloxusbgsm"]),
6566
)
6667

6768

@@ -239,7 +240,7 @@ def visit_files(path, visit):
239240
visit(join(root, file))
240241

241242

242-
def update_repo(repo_name, sdk_path):
243+
def update_repo(repo_name, sdk_paths):
243244
repo = MbedOfficialRepository(repo_name)
244245
# copy files from mbed SDK to mbed_official repository
245246
def visit_mbed_sdk(sdk_file):
@@ -250,12 +251,16 @@ def visit_mbed_sdk(sdk_file):
250251
makedirs(repo_dir)
251252

252253
copy_with_line_endings(sdk_file, repo_file)
253-
visit_files(sdk_path, visit_mbed_sdk)
254+
for sdk_path in sdk_paths:
255+
visit_files(sdk_path, visit_mbed_sdk)
254256

255257
# remove repository files that do not exist in the mbed SDK
256258
def visit_repo(repo_file):
257-
sdk_file = join(sdk_path, relpath(repo_file, repo.path))
258-
if not exists(sdk_file):
259+
for sdk_path in sdk_paths:
260+
sdk_file = join(sdk_path, relpath(repo_file, repo.path))
261+
if exists(sdk_file):
262+
break
263+
else:
259264
remove(repo_file)
260265
print "remove: %s" % repo_file
261266
visit_files(repo.path, visit_repo)
@@ -267,7 +272,8 @@ def visit_repo(repo_file):
267272
def update_code(repositories):
268273
for repo_name, sdk_dir in repositories:
269274
print '\n=== Updating "%s" ===' % repo_name
270-
sdk_path = join(LIB_DIR, sdk_dir)
275+
sdk_dirs = [sdk_dir] if type(sdk_dir) != type([]) else sdk_dir
276+
sdk_path = [join(LIB_DIR, d) for d in sdk_dirs]
271277
update_repo(repo_name, sdk_path)
272278

273279

workspace_tools/tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,9 +569,8 @@
569569
{
570570
"id": "UB_1", "description": "u-blox USB GSM modem: HTTP client",
571571
"source_dir": [join(TEST_DIR, "net", "cellular", "http", "ubloxusbgsm"), join(TEST_DIR, "net", "cellular", "http", "common")],
572-
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB, RTOS_LIBRARIES, USB_HOST_LIBRARIES, UBLOX_LIBRARY],
572+
"dependencies": [MBED_LIBRARIES, RTOS_LIBRARIES, USB_HOST_LIBRARIES, UBLOX_LIBRARY],
573573
"supported": CORTEX_ARM_SUPPORT,
574-
"automated": True,
575574
},
576575
{
577576
"id": "UB_2", "description": "u-blox USB GSM modem: SMS test",

workspace_tools/toolchains/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class mbedToolchain:
146146
GOANNA_FORMAT = "[Goanna] warning [%FILENAME%:%LINENO%] - [%CHECKNAME%(%SEVERITY%)] %MESSAGE%"
147147
GOANNA_DIAGNOSTIC_PATTERN = re.compile(r'"\[Goanna\] (?P<severity>warning) \[(?P<file>[^:]+):(?P<line>\d+)\] \- (?P<message>.*)"')
148148

149-
def __init__(self, target, options=None, notify=None):
149+
def __init__(self, target, options=None, notify=None, macros=None):
150150
self.target = target
151151
self.name = self.__class__.__name__
152152
self.hook = hooks.Hook(target, self)
@@ -162,6 +162,7 @@ def __init__(self, target, options=None, notify=None):
162162
self.options = []
163163
else:
164164
self.options = options
165+
self.macros = macros or []
165166
self.options.extend(BUILD_OPTIONS)
166167
if self.options:
167168
self.info("Build Options: %s" % (', '.join(self.options)))
@@ -347,7 +348,7 @@ def compile(self, cc, source, object, includes):
347348
self.progress("compile", source, build_update=True)
348349

349350
# Compile
350-
command = cc + ['-D%s' % s for s in self.get_symbols()] + ["-I%s" % i for i in includes] + ["-o", object, source]
351+
command = cc + ['-D%s' % s for s in self.get_symbols() + self.macros] + ["-I%s" % i for i in includes] + ["-o", object, source]
351352
if hasattr(self, "get_dep_opt"):
352353
command.extend(self.get_dep_opt(dep_path))
353354

workspace_tools/toolchains/arm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class ARM(mbedToolchain):
3030
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)", line (?P<line>\d+): (?P<severity>Warning|Error): (?P<message>.+)')
3131
DEP_PATTERN = re.compile('\S+:\s(?P<file>.+)\n')
3232

33-
def __init__(self, target, options=None, notify=None):
34-
mbedToolchain.__init__(self, target, options, notify)
33+
def __init__(self, target, options=None, notify=None, macros=None):
34+
mbedToolchain.__init__(self, target, options, notify, macros)
3535

3636
if target.core == "Cortex-M0+":
3737
cpu = "Cortex-M0"
@@ -123,16 +123,16 @@ def binary(self, elf, bin):
123123

124124

125125
class ARM_STD(ARM):
126-
def __init__(self, target, options=None, notify=None):
127-
ARM.__init__(self, target, options, notify)
126+
def __init__(self, target, options=None, notify=None, macros=None):
127+
ARM.__init__(self, target, options, notify, macros)
128128
self.ld.append("--libpath=%s" % ARM_LIB)
129129

130130

131131
class ARM_MICRO(ARM):
132132
PATCHED_LIBRARY = False
133133

134-
def __init__(self, target, options=None, notify=None):
135-
ARM.__init__(self, target, notify)
134+
def __init__(self, target, options=None, notify=None, macros=None):
135+
ARM.__init__(self, target, options, notify, macros)
136136

137137
# Compiler
138138
self.asm += ["-D__MICROLIB"]

workspace_tools/toolchains/gcc.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class GCC(mbedToolchain):
2929
CIRCULAR_DEPENDENCIES = True
3030
DIAGNOSTIC_PATTERN = re.compile('((?P<line>\d+):)(\d+:)? (?P<severity>warning|error): (?P<message>.+)')
3131

32-
def __init__(self, target, options=None, notify=None, tool_path=""):
33-
mbedToolchain.__init__(self, target, options, notify)
32+
def __init__(self, target, options=None, notify=None, macros=None, tool_path=""):
33+
mbedToolchain.__init__(self, target, options, notify, macros)
3434

3535
if target.core == "Cortex-M0+":
3636
cpu = "cortex-m0"
@@ -162,8 +162,8 @@ def binary(self, elf, bin):
162162

163163

164164
class GCC_ARM(GCC):
165-
def __init__(self, target, options=None, notify=None):
166-
GCC.__init__(self, target, options, notify, GCC_ARM_PATH)
165+
def __init__(self, target, options=None, notify=None, macros=None):
166+
GCC.__init__(self, target, options, notify, macros, GCC_ARM_PATH)
167167

168168
# Use latest gcc nanolib
169169
self.ld.append("--specs=nano.specs")
@@ -174,8 +174,8 @@ def __init__(self, target, options=None, notify=None):
174174

175175

176176
class GCC_CR(GCC):
177-
def __init__(self, target, options=None, notify=None):
178-
GCC.__init__(self, target, options, notify, GCC_CR_PATH)
177+
def __init__(self, target, options=None, notify=None, macros=None):
178+
GCC.__init__(self, target, options, notify, macros, GCC_CR_PATH)
179179

180180
additional_compiler_flags = [
181181
"-D__NEWLIB__", "-D__CODE_RED", "-D__USE_CMSIS", "-DCPP_USE_HEAP",
@@ -187,22 +187,22 @@ def __init__(self, target, options=None, notify=None):
187187

188188

189189
class GCC_CS(GCC):
190-
def __init__(self, target, options=None, notify=None):
191-
GCC.__init__(self, target, options, notify, GCC_CS_PATH)
190+
def __init__(self, target, options=None, notify=None, macros=None):
191+
GCC.__init__(self, target, options, notify, macros, GCC_CS_PATH)
192192

193193

194194
class GCC_CW(GCC):
195195
ARCH_LIB = {
196196
"Cortex-M0+": "armv6-m",
197197
}
198198

199-
def __init__(self, target, options=None, notify=None):
200-
GCC.__init__(self, target, options, notify, CW_GCC_PATH)
199+
def __init__(self, target, options=None, notify=None, macros=None):
200+
GCC.__init__(self, target, options, notify, macros, CW_GCC_PATH)
201201

202202

203203
class GCC_CW_EWL(GCC_CW):
204-
def __init__(self, target, options=None, notify=None):
205-
GCC_CW.__init__(self, target, options, notify)
204+
def __init__(self, target, options=None, notify=None, macros=None):
205+
GCC_CW.__init__(self, target, options, notify, macros)
206206

207207
# Compiler
208208
common = [
@@ -230,5 +230,5 @@ def __init__(self, target, options=None, notify=None):
230230

231231

232232
class GCC_CW_NEWLIB(GCC_CW):
233-
def __init__(self, target, options=None, notify=None):
234-
GCC_CW.__init__(self, target, options, notify)
233+
def __init__(self, target, options=None, notify=None, macros=None):
234+
GCC_CW.__init__(self, target, options, notify, macros)

workspace_tools/toolchains/iar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class IAR(mbedToolchain):
2929

3030
DIAGNOSTIC_PATTERN = re.compile('"(?P<file>[^"]+)",(?P<line>[\d]+)\s+(?P<severity>Warning|Error)(?P<message>.+)')
3131

32-
def __init__(self, target, options=None, notify=None):
33-
mbedToolchain.__init__(self, target, options, notify)
32+
def __init__(self, target, options=None, notify=None, macros=None):
33+
mbedToolchain.__init__(self, target, options, notify, macros)
3434

3535
c_flags = [
3636
"-Oh",

0 commit comments

Comments
 (0)