Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 """
switches 0:5c4d7b2438d3 2 mbed SDK
switches 0:5c4d7b2438d3 3 Copyright (c) 2011-2013 ARM Limited
switches 0:5c4d7b2438d3 4
switches 0:5c4d7b2438d3 5 Licensed under the Apache License, Version 2.0 (the "License");
switches 0:5c4d7b2438d3 6 you may not use this file except in compliance with the License.
switches 0:5c4d7b2438d3 7 You may obtain a copy of the License at
switches 0:5c4d7b2438d3 8
switches 0:5c4d7b2438d3 9 http://www.apache.org/licenses/LICENSE-2.0
switches 0:5c4d7b2438d3 10
switches 0:5c4d7b2438d3 11 Unless required by applicable law or agreed to in writing, software
switches 0:5c4d7b2438d3 12 distributed under the License is distributed on an "AS IS" BASIS,
switches 0:5c4d7b2438d3 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:5c4d7b2438d3 14 See the License for the specific language governing permissions and
switches 0:5c4d7b2438d3 15 limitations under the License.
switches 0:5c4d7b2438d3 16
switches 0:5c4d7b2438d3 17
switches 0:5c4d7b2438d3 18 One repository to update them all
switches 0:5c4d7b2438d3 19 On mbed.org the mbed SDK is split up in multiple repositories, this script takes
switches 0:5c4d7b2438d3 20 care of updating them all.
switches 0:5c4d7b2438d3 21 """
switches 0:5c4d7b2438d3 22 import sys
switches 0:5c4d7b2438d3 23 from copy import copy
switches 0:5c4d7b2438d3 24 from os import walk, remove, makedirs
switches 0:5c4d7b2438d3 25 from os.path import join, abspath, dirname, relpath, exists, isfile
switches 0:5c4d7b2438d3 26 from shutil import copyfile
switches 0:5c4d7b2438d3 27 from optparse import OptionParser
switches 0:5c4d7b2438d3 28 import re
switches 0:5c4d7b2438d3 29 import string
switches 0:5c4d7b2438d3 30
switches 0:5c4d7b2438d3 31 ROOT = abspath(join(dirname(__file__), ".."))
switches 0:5c4d7b2438d3 32 sys.path.insert(0, ROOT)
switches 0:5c4d7b2438d3 33
switches 0:5c4d7b2438d3 34 from tools.settings import MBED_ORG_PATH, MBED_ORG_USER, BUILD_DIR
switches 0:5c4d7b2438d3 35 from tools.paths import *
switches 0:5c4d7b2438d3 36 from tools.utils import run_cmd
switches 0:5c4d7b2438d3 37
switches 0:5c4d7b2438d3 38 MBED_URL = "mbed.org"
switches 0:5c4d7b2438d3 39 MBED_USER = "mbed_official"
switches 0:5c4d7b2438d3 40
switches 0:5c4d7b2438d3 41 changed = []
switches 0:5c4d7b2438d3 42 push_remote = True
switches 0:5c4d7b2438d3 43 quiet = False
switches 0:5c4d7b2438d3 44 commit_msg = ''
switches 0:5c4d7b2438d3 45
switches 0:5c4d7b2438d3 46 # Code that does have a mirror in the mbed SDK
switches 0:5c4d7b2438d3 47 # Tuple data: (repo_name, list_of_code_dirs, [team])
switches 0:5c4d7b2438d3 48 # team is optional - if not specified, the code is published under mbed_official
switches 0:5c4d7b2438d3 49 OFFICIAL_CODE = (
switches 0:5c4d7b2438d3 50 ("mbed-dev" , [MBED_DRIVERS, MBED_PLATFORM, MBED_HAL]),
switches 0:5c4d7b2438d3 51 ("mbed-rtos", RTOS),
switches 0:5c4d7b2438d3 52 ("mbed-dsp" , DSP),
switches 0:5c4d7b2438d3 53 ("mbed-rpc" , MBED_RPC),
switches 0:5c4d7b2438d3 54
switches 0:5c4d7b2438d3 55 ("lwip" , LWIP_SOURCES+"/lwip"),
switches 0:5c4d7b2438d3 56 ("lwip-sys", LWIP_SOURCES+"/lwip-sys"),
switches 0:5c4d7b2438d3 57 ("Socket" , LWIP_SOURCES+"/Socket"),
switches 0:5c4d7b2438d3 58
switches 0:5c4d7b2438d3 59 ("lwip-eth" , ETH_SOURCES+"/lwip-eth"),
switches 0:5c4d7b2438d3 60 ("EthernetInterface", ETH_SOURCES+"/EthernetInterface"),
switches 0:5c4d7b2438d3 61
switches 0:5c4d7b2438d3 62 ("USBDevice", USB),
switches 0:5c4d7b2438d3 63 ("USBHost" , USB_HOST),
switches 0:5c4d7b2438d3 64
switches 0:5c4d7b2438d3 65 ("CellularModem", CELLULAR_SOURCES),
switches 0:5c4d7b2438d3 66 ("CellularUSBModem", CELLULAR_USB_SOURCES),
switches 0:5c4d7b2438d3 67 ("UbloxUSBModem", UBLOX_SOURCES),
switches 0:5c4d7b2438d3 68 ("UbloxModemHTTPClientTest", [TEST_DIR+"/net/cellular/http/common", TEST_DIR+"/net/cellular/http/ubloxusb"]),
switches 0:5c4d7b2438d3 69 ("UbloxModemSMSTest", [TEST_DIR+"/net/cellular/sms/common", TEST_DIR+"/net/cellular/sms/ubloxusb"]),
switches 0:5c4d7b2438d3 70 ("FATFileSystem", FAT_FS, "mbed-official"),
switches 0:5c4d7b2438d3 71 )
switches 0:5c4d7b2438d3 72
switches 0:5c4d7b2438d3 73
switches 0:5c4d7b2438d3 74 # Code that does have dependencies to libraries should point to
switches 0:5c4d7b2438d3 75 # the latest revision. By default, they point to a specific revision.
switches 0:5c4d7b2438d3 76 CODE_WITH_DEPENDENCIES = (
switches 0:5c4d7b2438d3 77 # Libraries
switches 0:5c4d7b2438d3 78 "EthernetInterface",
switches 0:5c4d7b2438d3 79
switches 0:5c4d7b2438d3 80 # RTOS Examples
switches 0:5c4d7b2438d3 81 "rtos_basic",
switches 0:5c4d7b2438d3 82 "rtos_isr",
switches 0:5c4d7b2438d3 83 "rtos_mail",
switches 0:5c4d7b2438d3 84 "rtos_mutex",
switches 0:5c4d7b2438d3 85 "rtos_queue",
switches 0:5c4d7b2438d3 86 "rtos_semaphore",
switches 0:5c4d7b2438d3 87 "rtos_signals",
switches 0:5c4d7b2438d3 88 "rtos_timer",
switches 0:5c4d7b2438d3 89
switches 0:5c4d7b2438d3 90 # Net Examples
switches 0:5c4d7b2438d3 91 "TCPEchoClient",
switches 0:5c4d7b2438d3 92 "TCPEchoServer",
switches 0:5c4d7b2438d3 93 "TCPSocket_HelloWorld",
switches 0:5c4d7b2438d3 94 "UDPSocket_HelloWorld",
switches 0:5c4d7b2438d3 95 "UDPEchoClient",
switches 0:5c4d7b2438d3 96 "UDPEchoServer",
switches 0:5c4d7b2438d3 97 "BroadcastReceive",
switches 0:5c4d7b2438d3 98 "BroadcastSend",
switches 0:5c4d7b2438d3 99
switches 0:5c4d7b2438d3 100 # mbed sources
switches 0:5c4d7b2438d3 101 "mbed-src-program",
switches 0:5c4d7b2438d3 102 )
switches 0:5c4d7b2438d3 103
switches 0:5c4d7b2438d3 104 # A list of regular expressions that will be checked against each directory
switches 0:5c4d7b2438d3 105 # name and skipped if they match.
switches 0:5c4d7b2438d3 106 IGNORE_DIRS = (
switches 0:5c4d7b2438d3 107 )
switches 0:5c4d7b2438d3 108
switches 0:5c4d7b2438d3 109 IGNORE_FILES = (
switches 0:5c4d7b2438d3 110 'COPYING',
switches 0:5c4d7b2438d3 111 '\.md',
switches 0:5c4d7b2438d3 112 "\.lib",
switches 0:5c4d7b2438d3 113 "\.bld"
switches 0:5c4d7b2438d3 114 )
switches 0:5c4d7b2438d3 115
switches 0:5c4d7b2438d3 116 def ignore_path(name, reg_exps):
switches 0:5c4d7b2438d3 117 for r in reg_exps:
switches 0:5c4d7b2438d3 118 if re.search(r, name):
switches 0:5c4d7b2438d3 119 return True
switches 0:5c4d7b2438d3 120 return False
switches 0:5c4d7b2438d3 121
switches 0:5c4d7b2438d3 122 class MbedRepository:
switches 0:5c4d7b2438d3 123 @staticmethod
switches 0:5c4d7b2438d3 124 def run_and_print(command, cwd):
switches 0:5c4d7b2438d3 125 stdout, _, _ = run_cmd(command, work_dir=cwd, redirect=True)
switches 0:5c4d7b2438d3 126 print(stdout)
switches 0:5c4d7b2438d3 127
switches 0:5c4d7b2438d3 128 def __init__(self, name, team = None):
switches 0:5c4d7b2438d3 129 self.name = name
switches 0:5c4d7b2438d3 130 self.path = join(MBED_ORG_PATH, name)
switches 0:5c4d7b2438d3 131 if team is None:
switches 0:5c4d7b2438d3 132 self.url = "http://" + MBED_URL + "/users/" + MBED_USER + "/code/%s/"
switches 0:5c4d7b2438d3 133 else:
switches 0:5c4d7b2438d3 134 self.url = "http://" + MBED_URL + "/teams/" + team + "/code/%s/"
switches 0:5c4d7b2438d3 135 if not exists(self.path):
switches 0:5c4d7b2438d3 136 # Checkout code
switches 0:5c4d7b2438d3 137 if not exists(MBED_ORG_PATH):
switches 0:5c4d7b2438d3 138 makedirs(MBED_ORG_PATH)
switches 0:5c4d7b2438d3 139
switches 0:5c4d7b2438d3 140 self.run_and_print(['hg', 'clone', self.url % name], cwd=MBED_ORG_PATH)
switches 0:5c4d7b2438d3 141
switches 0:5c4d7b2438d3 142 else:
switches 0:5c4d7b2438d3 143 # Update
switches 0:5c4d7b2438d3 144 self.run_and_print(['hg', 'pull'], cwd=self.path)
switches 0:5c4d7b2438d3 145 self.run_and_print(['hg', 'update'], cwd=self.path)
switches 0:5c4d7b2438d3 146
switches 0:5c4d7b2438d3 147 def publish(self):
switches 0:5c4d7b2438d3 148 # The maintainer has to evaluate the changes first and explicitly accept them
switches 0:5c4d7b2438d3 149 self.run_and_print(['hg', 'addremove'], cwd=self.path)
switches 0:5c4d7b2438d3 150 stdout, _, _ = run_cmd(['hg', 'status'], work_dir=self.path)
switches 0:5c4d7b2438d3 151 if stdout == '':
switches 0:5c4d7b2438d3 152 print "No changes"
switches 0:5c4d7b2438d3 153 return False
switches 0:5c4d7b2438d3 154 print stdout
switches 0:5c4d7b2438d3 155 if quiet:
switches 0:5c4d7b2438d3 156 commit = 'Y'
switches 0:5c4d7b2438d3 157 else:
switches 0:5c4d7b2438d3 158 commit = raw_input(push_remote and "Do you want to commit and push? Y/N: " or "Do you want to commit? Y/N: ")
switches 0:5c4d7b2438d3 159 if commit == 'Y':
switches 0:5c4d7b2438d3 160 args = ['hg', 'commit', '-u', MBED_ORG_USER]
switches 0:5c4d7b2438d3 161 if commit_msg:
switches 0:5c4d7b2438d3 162 args = args + ['-m', commit_msg]
switches 0:5c4d7b2438d3 163 self.run_and_print(args, cwd=self.path)
switches 0:5c4d7b2438d3 164 if push_remote:
switches 0:5c4d7b2438d3 165 self.run_and_print(['hg', 'push'], cwd=self.path)
switches 0:5c4d7b2438d3 166 return True
switches 0:5c4d7b2438d3 167
switches 0:5c4d7b2438d3 168 # Check if a file is a text file or a binary file
switches 0:5c4d7b2438d3 169 # Taken from http://code.activestate.com/recipes/173220/
switches 0:5c4d7b2438d3 170 text_characters = "".join(map(chr, range(32, 127)) + list("\n\r\t\b"))
switches 0:5c4d7b2438d3 171 _null_trans = string.maketrans("", "")
switches 0:5c4d7b2438d3 172 def is_text_file(filename):
switches 0:5c4d7b2438d3 173 block_size = 1024
switches 0:5c4d7b2438d3 174 def istext(s):
switches 0:5c4d7b2438d3 175 if "\0" in s:
switches 0:5c4d7b2438d3 176 return 0
switches 0:5c4d7b2438d3 177
switches 0:5c4d7b2438d3 178 if not s: # Empty files are considered text
switches 0:5c4d7b2438d3 179 return 1
switches 0:5c4d7b2438d3 180
switches 0:5c4d7b2438d3 181 # Get the non-text characters (maps a character to itself then
switches 0:5c4d7b2438d3 182 # use the 'remove' option to get rid of the text characters.)
switches 0:5c4d7b2438d3 183 t = s.translate(_null_trans, text_characters)
switches 0:5c4d7b2438d3 184
switches 0:5c4d7b2438d3 185 # If more than 30% non-text characters, then
switches 0:5c4d7b2438d3 186 # this is considered a binary file
switches 0:5c4d7b2438d3 187 if float(len(t))/len(s) > 0.30:
switches 0:5c4d7b2438d3 188 return 0
switches 0:5c4d7b2438d3 189 return 1
switches 0:5c4d7b2438d3 190 with open(filename) as f:
switches 0:5c4d7b2438d3 191 res = istext(f.read(block_size))
switches 0:5c4d7b2438d3 192 return res
switches 0:5c4d7b2438d3 193
switches 0:5c4d7b2438d3 194 # Return the line ending type for the given file ('cr' or 'crlf')
switches 0:5c4d7b2438d3 195 def get_line_endings(f):
switches 0:5c4d7b2438d3 196 examine_size = 1024
switches 0:5c4d7b2438d3 197 try:
switches 0:5c4d7b2438d3 198 tf = open(f, "rb")
switches 0:5c4d7b2438d3 199 lines, ncrlf = tf.readlines(examine_size), 0
switches 0:5c4d7b2438d3 200 tf.close()
switches 0:5c4d7b2438d3 201 for l in lines:
switches 0:5c4d7b2438d3 202 if l.endswith("\r\n"):
switches 0:5c4d7b2438d3 203 ncrlf = ncrlf + 1
switches 0:5c4d7b2438d3 204 return 'crlf' if ncrlf > len(lines) >> 1 else 'cr'
switches 0:5c4d7b2438d3 205 except:
switches 0:5c4d7b2438d3 206 return 'cr'
switches 0:5c4d7b2438d3 207
switches 0:5c4d7b2438d3 208 # Copy file to destination, but preserve destination line endings if possible
switches 0:5c4d7b2438d3 209 # This prevents very annoying issues with huge diffs that appear because of
switches 0:5c4d7b2438d3 210 # differences in line endings
switches 0:5c4d7b2438d3 211 def copy_with_line_endings(sdk_file, repo_file):
switches 0:5c4d7b2438d3 212 if not isfile(repo_file):
switches 0:5c4d7b2438d3 213 copyfile(sdk_file, repo_file)
switches 0:5c4d7b2438d3 214 return
switches 0:5c4d7b2438d3 215 is_text = is_text_file(repo_file)
switches 0:5c4d7b2438d3 216 if is_text:
switches 0:5c4d7b2438d3 217 sdk_le = get_line_endings(sdk_file)
switches 0:5c4d7b2438d3 218 repo_le = get_line_endings(repo_file)
switches 0:5c4d7b2438d3 219 if not is_text or sdk_le == repo_le:
switches 0:5c4d7b2438d3 220 copyfile(sdk_file, repo_file)
switches 0:5c4d7b2438d3 221 else:
switches 0:5c4d7b2438d3 222 print "Converting line endings in '%s' to '%s'" % (abspath(repo_file), repo_le)
switches 0:5c4d7b2438d3 223 f = open(sdk_file, "rb")
switches 0:5c4d7b2438d3 224 data = f.read()
switches 0:5c4d7b2438d3 225 f.close()
switches 0:5c4d7b2438d3 226 f = open(repo_file, "wb")
switches 0:5c4d7b2438d3 227 data = data.replace("\r\n", "\n") if repo_le == 'cr' else data.replace('\n','\r\n')
switches 0:5c4d7b2438d3 228 f.write(data)
switches 0:5c4d7b2438d3 229 f.close()
switches 0:5c4d7b2438d3 230
switches 0:5c4d7b2438d3 231 def visit_files(path, visit):
switches 0:5c4d7b2438d3 232 for root, dirs, files in walk(path):
switches 0:5c4d7b2438d3 233 # Ignore hidden directories
switches 0:5c4d7b2438d3 234 for d in copy(dirs):
switches 0:5c4d7b2438d3 235 full = join(root, d)
switches 0:5c4d7b2438d3 236 if d.startswith('.'):
switches 0:5c4d7b2438d3 237 dirs.remove(d)
switches 0:5c4d7b2438d3 238 if ignore_path(full, IGNORE_DIRS):
switches 0:5c4d7b2438d3 239 print "Skipping '%s'" % full
switches 0:5c4d7b2438d3 240 dirs.remove(d)
switches 0:5c4d7b2438d3 241
switches 0:5c4d7b2438d3 242 for file in files:
switches 0:5c4d7b2438d3 243 if ignore_path(file, IGNORE_FILES):
switches 0:5c4d7b2438d3 244 continue
switches 0:5c4d7b2438d3 245
switches 0:5c4d7b2438d3 246 visit(join(root, file))
switches 0:5c4d7b2438d3 247
switches 0:5c4d7b2438d3 248
switches 0:5c4d7b2438d3 249 def update_repo(repo_name, sdk_paths, team_name):
switches 0:5c4d7b2438d3 250 repo = MbedRepository(repo_name, team_name)
switches 0:5c4d7b2438d3 251 # copy files from mbed SDK to mbed_official repository
switches 0:5c4d7b2438d3 252 def visit_mbed_sdk(sdk_file):
switches 0:5c4d7b2438d3 253 repo_file = join(repo.path, relpath(sdk_file, sdk_path))
switches 0:5c4d7b2438d3 254
switches 0:5c4d7b2438d3 255 repo_dir = dirname(repo_file)
switches 0:5c4d7b2438d3 256 if not exists(repo_dir):
switches 0:5c4d7b2438d3 257 makedirs(repo_dir)
switches 0:5c4d7b2438d3 258
switches 0:5c4d7b2438d3 259 copy_with_line_endings(sdk_file, repo_file)
switches 0:5c4d7b2438d3 260 for sdk_path in sdk_paths:
switches 0:5c4d7b2438d3 261 visit_files(sdk_path, visit_mbed_sdk)
switches 0:5c4d7b2438d3 262
switches 0:5c4d7b2438d3 263 # remove repository files that do not exist in the mbed SDK
switches 0:5c4d7b2438d3 264 def visit_repo(repo_file):
switches 0:5c4d7b2438d3 265 for sdk_path in sdk_paths:
switches 0:5c4d7b2438d3 266 sdk_file = join(sdk_path, relpath(repo_file, repo.path))
switches 0:5c4d7b2438d3 267 if exists(sdk_file):
switches 0:5c4d7b2438d3 268 break
switches 0:5c4d7b2438d3 269 else:
switches 0:5c4d7b2438d3 270 remove(repo_file)
switches 0:5c4d7b2438d3 271 print "remove: %s" % repo_file
switches 0:5c4d7b2438d3 272 visit_files(repo.path, visit_repo)
switches 0:5c4d7b2438d3 273
switches 0:5c4d7b2438d3 274 if repo.publish():
switches 0:5c4d7b2438d3 275 changed.append(repo_name)
switches 0:5c4d7b2438d3 276
switches 0:5c4d7b2438d3 277
switches 0:5c4d7b2438d3 278 def update_code(repositories):
switches 0:5c4d7b2438d3 279 for r in repositories:
switches 0:5c4d7b2438d3 280 repo_name, sdk_dir = r[0], r[1]
switches 0:5c4d7b2438d3 281 team_name = r[2] if len(r) == 3 else None
switches 0:5c4d7b2438d3 282 print '\n=== Updating "%s" ===' % repo_name
switches 0:5c4d7b2438d3 283 sdk_dirs = [sdk_dir] if type(sdk_dir) != type([]) else sdk_dir
switches 0:5c4d7b2438d3 284 update_repo(repo_name, sdk_dirs, team_name)
switches 0:5c4d7b2438d3 285
switches 0:5c4d7b2438d3 286 def update_single_repo(repo):
switches 0:5c4d7b2438d3 287 repos = [r for r in OFFICIAL_CODE if r[0] == repo]
switches 0:5c4d7b2438d3 288 if not repos:
switches 0:5c4d7b2438d3 289 print "Repository '%s' not found" % repo
switches 0:5c4d7b2438d3 290 else:
switches 0:5c4d7b2438d3 291 update_code(repos)
switches 0:5c4d7b2438d3 292
switches 0:5c4d7b2438d3 293 def update_dependencies(repositories):
switches 0:5c4d7b2438d3 294 for repo_name in repositories:
switches 0:5c4d7b2438d3 295 print '\n=== Updating "%s" ===' % repo_name
switches 0:5c4d7b2438d3 296 repo = MbedRepository(repo_name)
switches 0:5c4d7b2438d3 297
switches 0:5c4d7b2438d3 298 # point to the latest libraries
switches 0:5c4d7b2438d3 299 def visit_repo(repo_file):
switches 0:5c4d7b2438d3 300 with open(repo_file, "r") as f:
switches 0:5c4d7b2438d3 301 url = f.read()
switches 0:5c4d7b2438d3 302 with open(repo_file, "w") as f:
switches 0:5c4d7b2438d3 303 f.write(url[:(url.rindex('/')+1)])
switches 0:5c4d7b2438d3 304 visit_files(repo.path, visit_repo, None, MBED_REPO_EXT)
switches 0:5c4d7b2438d3 305
switches 0:5c4d7b2438d3 306 if repo.publish():
switches 0:5c4d7b2438d3 307 changed.append(repo_name)
switches 0:5c4d7b2438d3 308
switches 0:5c4d7b2438d3 309
switches 0:5c4d7b2438d3 310 def update_mbed():
switches 0:5c4d7b2438d3 311 update_repo("mbed", [join(BUILD_DIR, "mbed")], None)
switches 0:5c4d7b2438d3 312
switches 0:5c4d7b2438d3 313 def do_sync(options):
switches 0:5c4d7b2438d3 314 global push_remote, quiet, commit_msg, changed
switches 0:5c4d7b2438d3 315
switches 0:5c4d7b2438d3 316 push_remote = not options.nopush
switches 0:5c4d7b2438d3 317 quiet = options.quiet
switches 0:5c4d7b2438d3 318 commit_msg = options.msg
switches 0:5c4d7b2438d3 319 chnaged = []
switches 0:5c4d7b2438d3 320
switches 0:5c4d7b2438d3 321 if options.code:
switches 0:5c4d7b2438d3 322 update_code(OFFICIAL_CODE)
switches 0:5c4d7b2438d3 323
switches 0:5c4d7b2438d3 324 if options.dependencies:
switches 0:5c4d7b2438d3 325 update_dependencies(CODE_WITH_DEPENDENCIES)
switches 0:5c4d7b2438d3 326
switches 0:5c4d7b2438d3 327 if options.mbed:
switches 0:5c4d7b2438d3 328 update_mbed()
switches 0:5c4d7b2438d3 329
switches 0:5c4d7b2438d3 330 if options.repo:
switches 0:5c4d7b2438d3 331 update_single_repo(options.repo)
switches 0:5c4d7b2438d3 332
switches 0:5c4d7b2438d3 333 if changed:
switches 0:5c4d7b2438d3 334 print "Repositories with changes:", changed
switches 0:5c4d7b2438d3 335
switches 0:5c4d7b2438d3 336 return changed
switches 0:5c4d7b2438d3 337
switches 0:5c4d7b2438d3 338 if __name__ == '__main__':
switches 0:5c4d7b2438d3 339 parser = OptionParser()
switches 0:5c4d7b2438d3 340
switches 0:5c4d7b2438d3 341 parser.add_option("-c", "--code",
switches 0:5c4d7b2438d3 342 action="store_true", default=False,
switches 0:5c4d7b2438d3 343 help="Update the mbed_official code")
switches 0:5c4d7b2438d3 344
switches 0:5c4d7b2438d3 345 parser.add_option("-d", "--dependencies",
switches 0:5c4d7b2438d3 346 action="store_true", default=False,
switches 0:5c4d7b2438d3 347 help="Update the mbed_official code dependencies")
switches 0:5c4d7b2438d3 348
switches 0:5c4d7b2438d3 349 parser.add_option("-m", "--mbed",
switches 0:5c4d7b2438d3 350 action="store_true", default=False,
switches 0:5c4d7b2438d3 351 help="Release a build of the mbed library")
switches 0:5c4d7b2438d3 352
switches 0:5c4d7b2438d3 353 parser.add_option("-n", "--nopush",
switches 0:5c4d7b2438d3 354 action="store_true", default=False,
switches 0:5c4d7b2438d3 355 help="Commit the changes locally only, don't push them")
switches 0:5c4d7b2438d3 356
switches 0:5c4d7b2438d3 357 parser.add_option("", "--commit_message",
switches 0:5c4d7b2438d3 358 action="store", type="string", default='', dest='msg',
switches 0:5c4d7b2438d3 359 help="Commit message to use for all the commits")
switches 0:5c4d7b2438d3 360
switches 0:5c4d7b2438d3 361 parser.add_option("-r", "--repository",
switches 0:5c4d7b2438d3 362 action="store", type="string", default='', dest='repo',
switches 0:5c4d7b2438d3 363 help="Synchronize only the given repository")
switches 0:5c4d7b2438d3 364
switches 0:5c4d7b2438d3 365 parser.add_option("-q", "--quiet",
switches 0:5c4d7b2438d3 366 action="store_true", default=False,
switches 0:5c4d7b2438d3 367 help="Don't ask for confirmation before commiting or pushing")
switches 0:5c4d7b2438d3 368
switches 0:5c4d7b2438d3 369 (options, args) = parser.parse_args()
switches 0:5c4d7b2438d3 370
switches 0:5c4d7b2438d3 371 do_sync(options)
switches 0:5c4d7b2438d3 372