A small script to demonstrate the usage of the mbed build service.
Example for using the mbed compile API
Prerequisites
- An account at developer.mbed.org (you will be asked for your password in order to compile) Get an account
- Python
- Python requests
On MacOS X you can install python requests as follows
install python requests on OS X
sudo easy_install requests
Usage
usage example for mbed API
python mbedapi.py --repo http://developer.mbed.org/users/dan/code/pubtest/ --user JonnyA --api http://developer.mbed.org --platform mbed-LPC1768 --destdir /tmp/ --debug 2
Diff: mbedapi.py
- Revision:
- 1:b9b05345596d
- Parent:
- 0:ac6e08cf16fe
- Child:
- 2:09e9170d8a4e
--- a/mbedapi.py Tue May 13 17:05:58 2014 +0100 +++ b/mbedapi.py Fri May 23 11:26:06 2014 +0100 @@ -6,7 +6,11 @@ #This will compile http://mbed.org/users/dan/code/pubtest/ for the 1768 and download the result. +Examples of options: +--extra_symbols "foo=bar,x=y" +--replace_file "main.cpp:/tmp/replace_main.cpp" +(can be repeated) """ import os, getpass, sys, json, time, requests, logging @@ -14,7 +18,7 @@ def build_repo(args): - payload = {'clean':args.clean, 'platform':args.platform, 'repo':args.repo} + payload = {'clean':args.clean, 'platform':args.platform, 'repo':args.repo, 'extra_symbols': args.extra_symbols} if args.replace_file: replace = [] @@ -91,6 +95,7 @@ parser.add_argument('--platform', type=str, help='Platform name', required=True) parser.add_argument('--destdir', type=str, help='Binary destination directory', required=True) parser.add_argument('--replace_file', type=str, help='Replace file and build. Can be repeated. Syntax: remotepath:localpath', required=False, action='append') + parser.add_argument('--extra_symbols', type=str, help='Provide extra symbols to build system', required=False, action='append') parser.add_argument('--clean', action='store_true', help='Force clean build') parser.add_argument('--debug', help='Show debugging info', required=False)