Skip to content

Commit e35fd00

Browse files
author
Bogdan Marinescu
committed
Merge branch 'nordic_structure'
2 parents ccd7f2e + d88bcf2 commit e35fd00

File tree

120 files changed

+45
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+45
-21
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

libraries/ble/nordic_native/hw/nRF51822n/btle/btle.cpp renamed to libraries/ble/nRF51822/btle/btle.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#include "pstorage.h"
3434

3535
#include "hw/GapEvents.h"
36-
#include "hw/nRF51822n/nRF51Gap.h"
37-
#include "hw/nRF51822n/nRF51GattServer.h"
36+
#include "nRF51Gap.h"
37+
#include "nRF51GattServer.h"
3838

3939
static void service_error_callback(uint32_t nrf_error);
4040
void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name);

libraries/ble/nordic_native/hw/nRF51822n/nRF51822n.h renamed to libraries/ble/nRF51822/nRF51822n.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
#include "mbed.h"
2626
#include "blecommon.h"
2727
#include "hw/BLEDevice.h"
28-
#include "hw/nRF51822n/nRF51Gap.h"
29-
#include "hw/nRF51822n/nRF51GattServer.h"
28+
#include "nRF51Gap.h"
29+
#include "nRF51GattServer.h"
3030

3131
/**************************************************************************/
3232
/*!

workspace_tools/synch.py

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
from workspace_tools.utils import run_cmd
3737

3838
MBED_URL = "mbed.org"
39+
MBED_USER = "mbed_official"
3940

4041
changed = []
4142
push_remote = True
4243
quiet = False
4344
commit_msg = ''
4445

45-
# mbed_official code that does have a mirror in the mbed SDK
46+
# Code that does have a mirror in the mbed SDK
47+
# Tuple data: (repo_name, list_of_code_dirs, [team])
48+
# team is optional - if not specified, the code is published under mbed_official
4649
OFFICIAL_CODE = (
4750
("mbed-src" , "mbed"),
4851
("mbed-rtos", "rtos"),
@@ -64,10 +67,13 @@
6467
("UbloxUSBModem", "net/cellular/UbloxUSBModem"),
6568
("UbloxModemHTTPClientTest", ["tests/net/cellular/http/common", "tests/net/cellular/http/ubloxusb"]),
6669
("UbloxModemSMSTest", ["tests/net/cellular/sms/common", "tests/net/cellular/sms/ubloxusb"]),
70+
71+
("ble-api", "ble/ble-api"),
72+
("nRF51822", "ble/nRF51822", "Nordic-Semiconductor"),
6773
)
6874

6975

70-
# mbed_official code that does have dependencies to libraries should point to
76+
# Code that does have dependencies to libraries should point to
7177
# the latest revision. By default, they point to a specific revision.
7278
CODE_WITH_DEPENDENCIES = (
7379
# Libraries
@@ -115,24 +121,25 @@ def ignore_path(name, reg_exps):
115121
return True
116122
return False
117123

118-
class MbedOfficialRepository:
119-
URL = "http://" + MBED_URL + "/users/mbed_official/code/%s/"
120-
124+
class MbedRepository:
121125
@staticmethod
122126
def run_and_print(command, cwd):
123127
stdout, _, _ = run_cmd(command, wd=cwd, redirect=True)
124128
print(stdout)
125129

126-
def __init__(self, name):
130+
def __init__(self, name, team = None):
127131
self.name = name
128132
self.path = join(MBED_ORG_PATH, name)
129-
133+
if team is None:
134+
self.url = "http://" + MBED_URL + "/users/" + MBED_USER + "/code/%s/"
135+
else:
136+
self.url = "http://" + MBED_URL + "/teams/" + team + "/code/%s/"
130137
if not exists(self.path):
131138
# Checkout code
132139
if not exists(MBED_ORG_PATH):
133140
makedirs(MBED_ORG_PATH)
134141

135-
self.run_and_print(['hg', 'clone', MbedOfficialRepository.URL % name], cwd=MBED_ORG_PATH)
142+
self.run_and_print(['hg', 'clone', self.url % name], cwd=MBED_ORG_PATH)
136143

137144
else:
138145
# Update
@@ -241,8 +248,8 @@ def visit_files(path, visit):
241248
visit(join(root, file))
242249

243250

244-
def update_repo(repo_name, sdk_paths):
245-
repo = MbedOfficialRepository(repo_name)
251+
def update_repo(repo_name, sdk_paths, team_name):
252+
repo = MbedRepository(repo_name, team_name)
246253
# copy files from mbed SDK to mbed_official repository
247254
def visit_mbed_sdk(sdk_file):
248255
repo_file = join(repo.path, relpath(sdk_file, sdk_path))
@@ -271,17 +278,25 @@ def visit_repo(repo_file):
271278

272279

273280
def update_code(repositories):
274-
for repo_name, sdk_dir in repositories:
281+
for r in repositories:
282+
repo_name, sdk_dir = r[0], r[1]
283+
team_name = r[2] if len(r) == 3 else None
275284
print '\n=== Updating "%s" ===' % repo_name
276285
sdk_dirs = [sdk_dir] if type(sdk_dir) != type([]) else sdk_dir
277286
sdk_path = [join(LIB_DIR, d) for d in sdk_dirs]
278-
update_repo(repo_name, sdk_path)
287+
update_repo(repo_name, sdk_path, team_name)
279288

289+
def update_single_repo(repo):
290+
repos = [r for r in OFFICIAL_CODE if r[0] == repo]
291+
if not repos:
292+
print "Repository '%s' not found" % repo
293+
else:
294+
update_code(repos)
280295

281296
def update_dependencies(repositories):
282297
for repo_name in repositories:
283298
print '\n=== Updating "%s" ===' % repo_name
284-
repo = MbedOfficialRepository(repo_name)
299+
repo = MbedRepository(repo_name)
285300

286301
# point to the latest libraries
287302
def visit_repo(repo_file):
@@ -315,6 +330,9 @@ def do_sync(options):
315330
if options.mbed:
316331
update_mbed()
317332

333+
if options.repo:
334+
update_single_repo(options.repo)
335+
318336
if changed:
319337
print "Repositories with changes:", changed
320338

@@ -342,6 +360,11 @@ def do_sync(options):
342360
parser.add_option("", "--commit_message",
343361
action="store", type="string", default='', dest='msg',
344362
help="Commit message to use for all the commits")
363+
364+
parser.add_option("-r", "--repository",
365+
action="store", type="string", default='', dest='repo',
366+
help="Synchronize only the given repository")
367+
345368
parser.add_option("-q", "--quiet",
346369
action="store_true", default=False,
347370
help="Don't ask for confirmation before commiting or pushing")

workspace_tools/tests.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
SD = join(TEST_DIR, "sd")
2727
TMP102 = join(PERIPHERALS, 'TMP102')
28-
BLE_NORDIC_NATIVE = join(LIB_DIR, "ble", "nordic_native")
28+
BLE_API = join(LIB_DIR, "ble", "ble-api")
29+
BLE_NRF51822 = join(LIB_DIR, "ble", "nRF51822")
2930

3031
"""
3132
Wiring:
@@ -756,17 +757,17 @@
756757
{
757758
"id": "NORDIC_1", "description": "BLE Health Thermometer",
758759
"source_dir": join(TEST_DIR, "ble", "Health_Thermometer"),
759-
"dependencies": [MBED_LIBRARIES, TMP102, BLE_NORDIC_NATIVE],
760+
"dependencies": [MBED_LIBRARIES, TMP102, BLE_API, BLE_NRF51822],
760761
},
761762
{
762763
"id": "NORDIC_2", "description": "BLE Heart Rate Monitor",
763764
"source_dir": join(TEST_DIR, "ble", "HeartRate"),
764-
"dependencies": [MBED_LIBRARIES, BLE_NORDIC_NATIVE],
765+
"dependencies": [MBED_LIBRARIES, BLE_API, BLE_NRF51822],
765766
},
766767
{
767768
"id": "NORDIC_3", "description": "BLE iBeacon",
768769
"source_dir": join(TEST_DIR, "ble", "iBeacon"),
769-
"dependencies": [MBED_LIBRARIES, BLE_NORDIC_NATIVE],
770+
"dependencies": [MBED_LIBRARIES, BLE_API, BLE_NRF51822],
770771
},
771772
]
772773

0 commit comments

Comments
 (0)