Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:27:58 2016 +0000
Revision:
0:6c56fb4bc5f0
Moving to library for sharing updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:6c56fb4bc5f0 1 # Mbed SDK build script environment
nexpaq 0:6c56fb4bc5f0 2 ## Introduction
nexpaq 0:6c56fb4bc5f0 3 Mbed test framework allows users to test their mbed devices’ applications, build mbed SDK library, re-run tests, run mbed SDK regression, add new tests and get all this results automatically. Everything is done on your machine so you have a full control over compilation, and tests you run.
nexpaq 0:6c56fb4bc5f0 4
nexpaq 0:6c56fb4bc5f0 5 It's is using Python 2.7 programming language to drive all tests so make sure Python 2.7 is installed on your system and included in your system PATH. To compile mbed SDK and tests you will need one or more supported compilers installed on your system.
nexpaq 0:6c56fb4bc5f0 6
nexpaq 0:6c56fb4bc5f0 7 To follow this short introduction you should already:
nexpaq 0:6c56fb4bc5f0 8 * Know what mbed SDK is in general.
nexpaq 0:6c56fb4bc5f0 9 * Know how to install Python 2.7, ARM target cross compilers.
nexpaq 0:6c56fb4bc5f0 10 * You have C/C++ programming experience and at least willingness to learn a bit about Python.
nexpaq 0:6c56fb4bc5f0 11
nexpaq 0:6c56fb4bc5f0 12 ## Test automation
nexpaq 0:6c56fb4bc5f0 13 Currently our simple test framework allows users to run tests on their machines (hosts) in a fully automated manner. All you need to do is to prepare two configuration files.
nexpaq 0:6c56fb4bc5f0 14
nexpaq 0:6c56fb4bc5f0 15 ## Test automation limitations
nexpaq 0:6c56fb4bc5f0 16 Note that for tests which require connected external peripherals, for example Ethernet, SD flash cards, external EEPROM tests, loops etc. you need to:
nexpaq 0:6c56fb4bc5f0 17
nexpaq 0:6c56fb4bc5f0 18 * Modify test source code to match components' pin names to actual mbed board pins where peripheral is connected or
nexpaq 0:6c56fb4bc5f0 19 * Wire your board the same way test defines it.
nexpaq 0:6c56fb4bc5f0 20
nexpaq 0:6c56fb4bc5f0 21 ## Prerequisites
nexpaq 0:6c56fb4bc5f0 22 mbed test suite and build scripts are Python 2.7 applications and require Python 2.7 runtime environment and [setuptools](https://pythonhosted.org/an_example_pypi_project/setuptools.html) to install dependencies.
nexpaq 0:6c56fb4bc5f0 23
nexpaq 0:6c56fb4bc5f0 24 What we need:
nexpaq 0:6c56fb4bc5f0 25 * Installed [Python 2.7](https://www.python.org/download/releases/2.7) programming language.
nexpaq 0:6c56fb4bc5f0 26 * Installed [setuptools](https://pythonhosted.org/an_example_pypi_project/setuptools.html#installing-setuptools-and-easy-install)
nexpaq 0:6c56fb4bc5f0 27 * Optionally you can install [pip](https://pip.pypa.io/en/latest/installing.html) which is the PyPA recommended tool for installing Python packages from command line.
nexpaq 0:6c56fb4bc5f0 28
nexpaq 0:6c56fb4bc5f0 29 mbed SDK in its repo root directory specifies ```setup.py``` file which holds information about all packages which are dependencies for it. Bear in mind only few simple steps are required to install all dependencies.
nexpaq 0:6c56fb4bc5f0 30
nexpaq 0:6c56fb4bc5f0 31 First, clone mbed SDK repo and go to mbed SDk repo's directory:
nexpaq 0:6c56fb4bc5f0 32 ```
nexpaq 0:6c56fb4bc5f0 33 $ git clone https://github.com/mbedmicro/mbed.git
nexpaq 0:6c56fb4bc5f0 34 $ cd mbed
nexpaq 0:6c56fb4bc5f0 35 ```
nexpaq 0:6c56fb4bc5f0 36
nexpaq 0:6c56fb4bc5f0 37 Second, invoke ```setup.py``` so ```setuptools``` can install mbed SDK's dependencies (external Python modules required by mbed SDK):
nexpaq 0:6c56fb4bc5f0 38 ```
nexpaq 0:6c56fb4bc5f0 39 $ python setup.py install
nexpaq 0:6c56fb4bc5f0 40 ```
nexpaq 0:6c56fb4bc5f0 41 or
nexpaq 0:6c56fb4bc5f0 42 ```
nexpaq 0:6c56fb4bc5f0 43 $ sudo python setup.py install
nexpaq 0:6c56fb4bc5f0 44 ```
nexpaq 0:6c56fb4bc5f0 45 when your system requires administrator rights to install new Python packages.
nexpaq 0:6c56fb4bc5f0 46
nexpaq 0:6c56fb4bc5f0 47 ### Manual Python package dependency installation
nexpaq 0:6c56fb4bc5f0 48 In case you do not want to install whole mbed package using ```setuptools```, you can use ```requirements.txt``` file and with help of ```pip`` package manager install only mbed's Python package dependencies:
nexpaq 0:6c56fb4bc5f0 49 ```
nexpaq 0:6c56fb4bc5f0 50 $ pip install -r requirements.txt
nexpaq 0:6c56fb4bc5f0 51 ```
nexpaq 0:6c56fb4bc5f0 52 ## Prerequisites (manual Python package dependency installation)
nexpaq 0:6c56fb4bc5f0 53 **Please only read this chapter if you had problems installing mbed SDK dependencies to Python packages**.
nexpaq 0:6c56fb4bc5f0 54
nexpaq 0:6c56fb4bc5f0 55 Below you can find the list of mbed SDK dependencies to Python modules with instructions how to install them manually.
nexpaq 0:6c56fb4bc5f0 56
nexpaq 0:6c56fb4bc5f0 57 You can skip this part if you've already install [Python 2.7](https://www.python.org/download/releases/2.7) and [setuptools](https://pythonhosted.org/an_example_pypi_project/setuptools.html) and successfully [installed all dependencies](#prerequisites).
nexpaq 0:6c56fb4bc5f0 58
nexpaq 0:6c56fb4bc5f0 59 * Please make sure you've installed [pip](https://pip.pypa.io/en/latest/installing.html) or [easy_install](https://pythonhosted.org/setuptools/easy_install.html#installing-easy-install)
nexpaq 0:6c56fb4bc5f0 60 Note: Easy Install is a python module (easy_install) bundled with [setuptools](https://pythonhosted.org/an_example_pypi_project/setuptools.html#installing-setuptools-and-easy-install) that lets you automatically download, build, install, and manage Python packages.
nexpaq 0:6c56fb4bc5f0 61
nexpaq 0:6c56fb4bc5f0 62 * Installed [pySerial](https://pypi.python.org/pypi/pyserial) module for Python 2.7.
nexpaq 0:6c56fb4bc5f0 63 pySerial can be installed from PyPI, either manually downloading the files and installing as described below or using:
nexpaq 0:6c56fb4bc5f0 64 ```
nexpaq 0:6c56fb4bc5f0 65 $ pip install pyserial
nexpaq 0:6c56fb4bc5f0 66 ```
nexpaq 0:6c56fb4bc5f0 67 or:
nexpaq 0:6c56fb4bc5f0 68 ```
nexpaq 0:6c56fb4bc5f0 69 easy_install -U pyserial
nexpaq 0:6c56fb4bc5f0 70 ```
nexpaq 0:6c56fb4bc5f0 71 * Installed [prettytable](https://code.google.com/p/prettytable/wiki/Installation) module for Python 2.7.
nexpaq 0:6c56fb4bc5f0 72 prettytable can be installed from PyPI, either manually downloading the files and installing as described below or using:
nexpaq 0:6c56fb4bc5f0 73 ```
nexpaq 0:6c56fb4bc5f0 74 $ pip install prettytable
nexpaq 0:6c56fb4bc5f0 75 ```
nexpaq 0:6c56fb4bc5f0 76 * Installed [IntelHex](https://pypi.python.org/pypi/IntelHex) module.
nexpaq 0:6c56fb4bc5f0 77 IntelHex may be downloaded from https://launchpad.net/intelhex/+download or http://www.bialix.com/intelhex/.
nexpaq 0:6c56fb4bc5f0 78 Assuming Python is properly installed on your platform, installation should just require running the following command from the root directory of the archive:
nexpaq 0:6c56fb4bc5f0 79 ```
nexpaq 0:6c56fb4bc5f0 80 sudo python setup.py install
nexpaq 0:6c56fb4bc5f0 81 ```
nexpaq 0:6c56fb4bc5f0 82 This will install the intelhex package into your system’s site-packages directory. After that is done, any other Python scripts or modules should be able to import the package using:
nexpaq 0:6c56fb4bc5f0 83 ```
nexpaq 0:6c56fb4bc5f0 84 $ python
nexpaq 0:6c56fb4bc5f0 85 Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
nexpaq 0:6c56fb4bc5f0 86 Type "help", "copyright", "credits" or "license" for more information.
nexpaq 0:6c56fb4bc5f0 87 >>> from intelhex import IntelHex
nexpaq 0:6c56fb4bc5f0 88 >>>
nexpaq 0:6c56fb4bc5f0 89 ```
nexpaq 0:6c56fb4bc5f0 90 * You can check if you have correctly installed the above modules (or you already have them) by starting Python and importing both modules.
nexpaq 0:6c56fb4bc5f0 91 ```
nexpaq 0:6c56fb4bc5f0 92 $ python
nexpaq 0:6c56fb4bc5f0 93 Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
nexpaq 0:6c56fb4bc5f0 94 Type "help", "copyright", "credits" or "license" for more information.
nexpaq 0:6c56fb4bc5f0 95 >>> import serial
nexpaq 0:6c56fb4bc5f0 96 >>> import prettytable
nexpaq 0:6c56fb4bc5f0 97 >>> from intelhex import IntelHex
nexpaq 0:6c56fb4bc5f0 98 >>>
nexpaq 0:6c56fb4bc5f0 99 ```
nexpaq 0:6c56fb4bc5f0 100 * Installed Git open source distributed version control system.
nexpaq 0:6c56fb4bc5f0 101 * Installed at least one of the supported by Mbed SDK workspace tools compilers:
nexpaq 0:6c56fb4bc5f0 102
nexpaq 0:6c56fb4bc5f0 103 Compiler | Mbed SDK Abbreviation | Example Version
nexpaq 0:6c56fb4bc5f0 104 -----------------------|-----------------------|-----------
nexpaq 0:6c56fb4bc5f0 105 Keil ARM Compiler | ARM, uARM | ARM C/C++ Compiler, 5.03 [Build 117]
nexpaq 0:6c56fb4bc5f0 106 GCC ARM | GCC_ARM | gcc version 4.8.3 20131129 (release)
nexpaq 0:6c56fb4bc5f0 107 GCC CodeRed | GCC_CR | gcc version 4.6.2 20121016 (release)
nexpaq 0:6c56fb4bc5f0 108 IAR Embedded Workbench | IAR | IAR ANSI C/C++ Compiler V6.70.1.5641/W32 for ARM
nexpaq 0:6c56fb4bc5f0 109
nexpaq 0:6c56fb4bc5f0 110 * Mbed board. You can find list of supported platforms [here](https://mbed.org/platforms/).
nexpaq 0:6c56fb4bc5f0 111
nexpaq 0:6c56fb4bc5f0 112 ### Getting Mbed SDK sources with test suite
nexpaq 0:6c56fb4bc5f0 113 So you have already installed Python (with required modules) together with at least one supported compiler you will use with your mbed board. Great!
nexpaq 0:6c56fb4bc5f0 114
nexpaq 0:6c56fb4bc5f0 115 Now let's go further and try to get Mbed SDK with test suite together. So let's clone latest Mbed SDK source code and configure path to our compiler(s) in next few steps.
nexpaq 0:6c56fb4bc5f0 116
nexpaq 0:6c56fb4bc5f0 117 * Open console and run command below to clone Mbed SDK repository hosted on [Github](https://github.com/mbedmicro/mbed).
nexpaq 0:6c56fb4bc5f0 118 ```
nexpaq 0:6c56fb4bc5f0 119 $ git clone https://github.com/mbedmicro/mbed.git
nexpaq 0:6c56fb4bc5f0 120 Cloning into 'mbed'...
nexpaq 0:6c56fb4bc5f0 121 remote: Counting objects: 37221, done.
nexpaq 0:6c56fb4bc5f0 122 remote: Compressing objects: 100% (3/3), done.
nexpaq 0:6c56fb4bc5f0 123 remote: Total 37221 (delta 0), reused 0 (delta 0), pack-reused 37218
nexpaq 0:6c56fb4bc5f0 124 Receiving objects: 100% (37221/37221), 20.38 MiB | 511.00 KiB/s, done.
nexpaq 0:6c56fb4bc5f0 125 Resolving deltas: 100% (24455/24455), done.
nexpaq 0:6c56fb4bc5f0 126 Checking connectivity... done.
nexpaq 0:6c56fb4bc5f0 127 Checking out files: 100% (3994/3994), done.
nexpaq 0:6c56fb4bc5f0 128 ```
nexpaq 0:6c56fb4bc5f0 129 * Now you can go to mbed directory you've just cloned and you can see root directory structure of our Mbed SDK library sources. Just type following commands:
nexpaq 0:6c56fb4bc5f0 130 ```
nexpaq 0:6c56fb4bc5f0 131 $ cd mbed
nexpaq 0:6c56fb4bc5f0 132 $ ls
nexpaq 0:6c56fb4bc5f0 133 LICENSE MANIFEST.in README.md libraries setup.py travis tools
nexpaq 0:6c56fb4bc5f0 134 ```
nexpaq 0:6c56fb4bc5f0 135 Directory structure we are interested in:
nexpaq 0:6c56fb4bc5f0 136 ```
nexpaq 0:6c56fb4bc5f0 137 mbed/tools/ - test suite scripts, build scripts etc.
nexpaq 0:6c56fb4bc5f0 138 mbed/libraries/tests/ - mbed SDK tests,
nexpaq 0:6c56fb4bc5f0 139 mbed/libraries/tests/mbed/ - tests for mbed SDK and peripherals tests,
nexpaq 0:6c56fb4bc5f0 140 mbed/libraries/tests/net/echo/ - tests for Ethernet interface,
nexpaq 0:6c56fb4bc5f0 141 mbed/libraries/tests/rtos/mbed/ - tests for RTOS.
nexpaq 0:6c56fb4bc5f0 142 ```
nexpaq 0:6c56fb4bc5f0 143
nexpaq 0:6c56fb4bc5f0 144 ### Workspace tools
nexpaq 0:6c56fb4bc5f0 145 Workspace tools are set of Python scripts used off-line by Mbed SDK team to:
nexpaq 0:6c56fb4bc5f0 146 * Compile and build mbed SDK,
nexpaq 0:6c56fb4bc5f0 147 * Compile and build libraries included in mbed SDK repo like e.g. ETH (Ethernet), USB, RTOS or CMSIS,
nexpaq 0:6c56fb4bc5f0 148 * Compile, build and run mbed SDK tests,
nexpaq 0:6c56fb4bc5f0 149 * Run test regression locally and in CI server,
nexpaq 0:6c56fb4bc5f0 150 * Get library, target, test configuration (paths, parameters, names etc.).
nexpaq 0:6c56fb4bc5f0 151
nexpaq 0:6c56fb4bc5f0 152 ### Configure workspace tools to work with your compilers
nexpaq 0:6c56fb4bc5f0 153 Before we can run our first test we need to configure our test environment a little!
nexpaq 0:6c56fb4bc5f0 154 Now we need to tell workspace tools where our compilers are.
nexpaq 0:6c56fb4bc5f0 155
nexpaq 0:6c56fb4bc5f0 156 * Please to go ```mbed``` directory and create empty file called ```mbed_settings.py```.
nexpaq 0:6c56fb4bc5f0 157 ```
nexpaq 0:6c56fb4bc5f0 158 $ touch mbed_settings.py
nexpaq 0:6c56fb4bc5f0 159 ```
nexpaq 0:6c56fb4bc5f0 160 * Populate this file the Python code below:
nexpaq 0:6c56fb4bc5f0 161 ```python
nexpaq 0:6c56fb4bc5f0 162 from os.path import join
nexpaq 0:6c56fb4bc5f0 163
nexpaq 0:6c56fb4bc5f0 164 # ARMCC
nexpaq 0:6c56fb4bc5f0 165 ARM_PATH = "C:/Work/toolchains/ARMCompiler_5.03_117_Windows"
nexpaq 0:6c56fb4bc5f0 166 ARM_BIN = join(ARM_PATH, "bin")
nexpaq 0:6c56fb4bc5f0 167 ARM_INC = join(ARM_PATH, "include")
nexpaq 0:6c56fb4bc5f0 168 ARM_LIB = join(ARM_PATH, "lib")
nexpaq 0:6c56fb4bc5f0 169
nexpaq 0:6c56fb4bc5f0 170 ARM_CPPLIB = join(ARM_LIB, "cpplib")
nexpaq 0:6c56fb4bc5f0 171 MY_ARM_CLIB = join(ARM_PATH, "lib", "microlib")
nexpaq 0:6c56fb4bc5f0 172
nexpaq 0:6c56fb4bc5f0 173 # GCC ARM
nexpaq 0:6c56fb4bc5f0 174 GCC_ARM_PATH = "C:/Work/toolchains/gcc_arm_4_8/4_8_2013q4/bin"
nexpaq 0:6c56fb4bc5f0 175
nexpaq 0:6c56fb4bc5f0 176 # GCC CodeRed
nexpaq 0:6c56fb4bc5f0 177 GCC_CR_PATH = "C:/Work/toolchains/LPCXpresso_6.1.4_194/lpcxpresso/tools/bin"
nexpaq 0:6c56fb4bc5f0 178
nexpaq 0:6c56fb4bc5f0 179 # IAR
nexpaq 0:6c56fb4bc5f0 180 IAR_PATH = "C:/Work/toolchains/iar_6_5/arm"
nexpaq 0:6c56fb4bc5f0 181
nexpaq 0:6c56fb4bc5f0 182 SERVER_ADDRESS = "127.0.0.1"
nexpaq 0:6c56fb4bc5f0 183 LOCALHOST = "127.0.0.1"
nexpaq 0:6c56fb4bc5f0 184
nexpaq 0:6c56fb4bc5f0 185 # This is moved to separate JSON configuration file used by singletest.py
nexpaq 0:6c56fb4bc5f0 186 MUTs = {
nexpaq 0:6c56fb4bc5f0 187 }
nexpaq 0:6c56fb4bc5f0 188 ```
nexpaq 0:6c56fb4bc5f0 189
nexpaq 0:6c56fb4bc5f0 190 Note: You need to provide the absolute path to your compiler(s) installed on your host machine. Replace corresponding variable values with paths to compilers installed in your system:
nexpaq 0:6c56fb4bc5f0 191 * ```ARM_PATH``` for armcc compiler.
nexpaq 0:6c56fb4bc5f0 192 * ```GCC_ARM_PATH``` for GCC ARM compiler.
nexpaq 0:6c56fb4bc5f0 193 * ```GCC_CR_PATH``` for GCC CodeRed compiler.
nexpaq 0:6c56fb4bc5f0 194 * ```IAR_PATH``` for IAR compiler.
nexpaq 0:6c56fb4bc5f0 195
nexpaq 0:6c56fb4bc5f0 196 If for example you do not use ```IAR``` compiler you do not have to modify anything. Workspace tools will use ```IAR_PATH`` variable only if you explicit ask for it from command line. So do not worry and replace only paths for your installed compilers.
nexpaq 0:6c56fb4bc5f0 197
nexpaq 0:6c56fb4bc5f0 198 Note: Because this is a Python script and ```ARM_PATH```, ```GCC_ARM_PATH```, ```GCC_CR_PATH```, ```IAR_PATH``` are Python string variables please use double backlash or single slash as path's directories delimiter to avoid incorrect path format. For example:
nexpaq 0:6c56fb4bc5f0 199 ```python
nexpaq 0:6c56fb4bc5f0 200 ARM_PATH = "C:/Work/toolchains/ARMCompiler_5.03_117_Windows"
nexpaq 0:6c56fb4bc5f0 201 GCC_ARM_PATH = "C:/Work/toolchains/gcc_arm_4_8/4_8_2013q4/bin"
nexpaq 0:6c56fb4bc5f0 202 GCC_CR_PATH = "C:/Work/toolchains/LPCXpresso_6.1.4_194/lpcxpresso/tools/bin"
nexpaq 0:6c56fb4bc5f0 203 IAR_PATH = "C:/Work/toolchains/iar_6_5/arm"
nexpaq 0:6c56fb4bc5f0 204 ```
nexpaq 0:6c56fb4bc5f0 205
nexpaq 0:6c56fb4bc5f0 206 Note: Settings in ```mbed_settings.py``` will overwrite variables with default values in ```mbed/default_settings.py``` file.
nexpaq 0:6c56fb4bc5f0 207
nexpaq 0:6c56fb4bc5f0 208 ## Build Mbed SDK library from sources
nexpaq 0:6c56fb4bc5f0 209 Let's build mbed SDK library off-line from sources using your compiler. We've already cloned mbed SDK sources, we've also installed compilers and added their paths to ```mbed_settings.py```.
nexpaq 0:6c56fb4bc5f0 210 We now should be ready to use workspace tools script ```build.py``` to compile and build mbed SDK from sources.
nexpaq 0:6c56fb4bc5f0 211
nexpaq 0:6c56fb4bc5f0 212 We are still using console. You should be already in ```mbed/tools/``` directory if not go to ```mbed/tools/``` and type below command:
nexpaq 0:6c56fb4bc5f0 213 ```
nexpaq 0:6c56fb4bc5f0 214 $ python build.py -m LPC1768 -t ARM
nexpaq 0:6c56fb4bc5f0 215 ```
nexpaq 0:6c56fb4bc5f0 216 or if you want to take advantage from multi-threaded compilation please use option ```-j X``` where ```X``` is number of cores you want to use to compile mbed SDK. See below:
nexpaq 0:6c56fb4bc5f0 217 ```
nexpaq 0:6c56fb4bc5f0 218 $ python build.py -m LPC1768 -t ARM -j 4
nexpaq 0:6c56fb4bc5f0 219 Building library CMSIS (LPC1768, ARM)
nexpaq 0:6c56fb4bc5f0 220 Copy: core_ca9.h
nexpaq 0:6c56fb4bc5f0 221 Copy: core_caFunc.h
nexpaq 0:6c56fb4bc5f0 222 ...
nexpaq 0:6c56fb4bc5f0 223 Compile: us_ticker_api.c
nexpaq 0:6c56fb4bc5f0 224 Compile: wait_api.c
nexpaq 0:6c56fb4bc5f0 225 Library: mbed.ar
nexpaq 0:6c56fb4bc5f0 226 Creating archive 'C:\temp\x\mbed\build\mbed\TARGET_LPC1768\TOOLCHAIN_ARM_STD\mbed.ar'
nexpaq 0:6c56fb4bc5f0 227 Copy: board.o
nexpaq 0:6c56fb4bc5f0 228 Copy: retarget.o
nexpaq 0:6c56fb4bc5f0 229
nexpaq 0:6c56fb4bc5f0 230 Completed in: (42.58)s
nexpaq 0:6c56fb4bc5f0 231
nexpaq 0:6c56fb4bc5f0 232 Build successes:
nexpaq 0:6c56fb4bc5f0 233 * ARM::LPC1768
nexpaq 0:6c56fb4bc5f0 234 ```
nexpaq 0:6c56fb4bc5f0 235 Above command will build mbed SDK for [LPC1768](http://developer.mbed.org/platforms/mbed-LPC1768/) platform using ARM compiler.
nexpaq 0:6c56fb4bc5f0 236
nexpaq 0:6c56fb4bc5f0 237 Let's have a look at directory structure under ```mbed/build/```. We can see for ```LPC1768``` new directory ```TARGET_LPC1768``` was created. This directory contains all build primitives.
nexpaq 0:6c56fb4bc5f0 238 Directory ```mbed/TARGET_LPC1768/TOOLCHAIN_ARM_STD/``` contains mbed SDK library ```mbed.ar```. This directory structure also stores all needed headers which you should use with ```mbed.ar``` when building your own software.
nexpaq 0:6c56fb4bc5f0 239 ```
nexpaq 0:6c56fb4bc5f0 240 $ tree ./mbed/build/
nexpaq 0:6c56fb4bc5f0 241 Folder PATH listing
nexpaq 0:6c56fb4bc5f0 242 Volume serial number is 006C006F 6243:3EA9
nexpaq 0:6c56fb4bc5f0 243 ./MBED/BUILD
nexpaq 0:6c56fb4bc5f0 244 +---mbed
nexpaq 0:6c56fb4bc5f0 245 +---.temp
nexpaq 0:6c56fb4bc5f0 246 ¦ +---TARGET_LPC1768
nexpaq 0:6c56fb4bc5f0 247 ¦ +---TOOLCHAIN_ARM_STD
nexpaq 0:6c56fb4bc5f0 248 ¦ +---TARGET_NXP
nexpaq 0:6c56fb4bc5f0 249 ¦ +---TARGET_LPC176X
nexpaq 0:6c56fb4bc5f0 250 ¦ +---TOOLCHAIN_ARM_STD
nexpaq 0:6c56fb4bc5f0 251 +---TARGET_LPC1768
nexpaq 0:6c56fb4bc5f0 252 +---TARGET_NXP
nexpaq 0:6c56fb4bc5f0 253 ¦ +---TARGET_LPC176X
nexpaq 0:6c56fb4bc5f0 254 ¦ +---TARGET_MBED_LPC1768
nexpaq 0:6c56fb4bc5f0 255 +---TOOLCHAIN_ARM_STD
nexpaq 0:6c56fb4bc5f0 256 ```
nexpaq 0:6c56fb4bc5f0 257
nexpaq 0:6c56fb4bc5f0 258 Note: Why ```LCP1768```? For this example we are using ```LPC1768``` because this platform supports all compilers so you are sure you only need to specify proper compiler.
nexpaq 0:6c56fb4bc5f0 259
nexpaq 0:6c56fb4bc5f0 260 If you are not using ARM Compiler replace ```ARM``` with your compiler nickname: ```GCC_ARM```, ```GCC_CR``` or ```IAR```. For example if you are using IAR type command:
nexpaq 0:6c56fb4bc5f0 261 ```
nexpaq 0:6c56fb4bc5f0 262 $ python build.py -m LPC1768 -t IAR
nexpaq 0:6c56fb4bc5f0 263 ```
nexpaq 0:6c56fb4bc5f0 264
nexpaq 0:6c56fb4bc5f0 265 Note: Workspace tools track changes in source code. So if for example mbed SDK or test source code changes ```build.py``` script will recompile project with all dependencies. If there are no changes in code consecutive mbed SDK re-builds using build.py will not rebuild project if this is not necessary. Try to run last command once again, we can see script ```build.py``` will not recompile project (there are no changes):
nexpaq 0:6c56fb4bc5f0 266 ```
nexpaq 0:6c56fb4bc5f0 267 $ python build.py -m LPC1768 -t ARM
nexpaq 0:6c56fb4bc5f0 268 Building library CMSIS (LPC1768, ARM)
nexpaq 0:6c56fb4bc5f0 269 Building library MBED (LPC1768, ARM)
nexpaq 0:6c56fb4bc5f0 270
nexpaq 0:6c56fb4bc5f0 271 Completed in: (0.15)s
nexpaq 0:6c56fb4bc5f0 272
nexpaq 0:6c56fb4bc5f0 273 Build successes:
nexpaq 0:6c56fb4bc5f0 274 * ARM::LPC1768
nexpaq 0:6c56fb4bc5f0 275 ```
nexpaq 0:6c56fb4bc5f0 276
nexpaq 0:6c56fb4bc5f0 277 ### build.py script
nexpaq 0:6c56fb4bc5f0 278
nexpaq 0:6c56fb4bc5f0 279 Build script located in mbed/tools/ is our core script solution to drive compilation, linking and building process for:
nexpaq 0:6c56fb4bc5f0 280
nexpaq 0:6c56fb4bc5f0 281 * mbed SDK (with libs like Ethernet, RTOS, USB, USB host).
nexpaq 0:6c56fb4bc5f0 282 * Tests which also can be linked with libraries like RTOS or Ethernet.
nexpaq 0:6c56fb4bc5f0 283
nexpaq 0:6c56fb4bc5f0 284 Note: Test suite also uses the same build script, inheriting the same properties like auto dependency tracking and project rebuild in case of source code changes.
nexpaq 0:6c56fb4bc5f0 285
nexpaq 0:6c56fb4bc5f0 286 Build.py script is a powerful tool to build mbed SDK for all available platforms using all supported by mbed cross-compilers. Script is using our workspace tools build API to create desired platform-compiler builds. Use script option ```--h``` (help) to check all script parameters.
nexpaq 0:6c56fb4bc5f0 287 ```
nexpaq 0:6c56fb4bc5f0 288 $ python build.py --help
nexpaq 0:6c56fb4bc5f0 289 ```
nexpaq 0:6c56fb4bc5f0 290
nexpaq 0:6c56fb4bc5f0 291 * The command line parameter ```-m``` specifies the MCUs/platforms for which you want to build the mbed SDK. More than one MCU(s)/platform(s) may be specified with this parameter using comma as delimiter.
nexpaq 0:6c56fb4bc5f0 292 Example for one platform build:
nexpaq 0:6c56fb4bc5f0 293 ```
nexpaq 0:6c56fb4bc5f0 294 $ python build.py -m LPC1768 -t ARM
nexpaq 0:6c56fb4bc5f0 295 ```
nexpaq 0:6c56fb4bc5f0 296 or for many platforms:
nexpaq 0:6c56fb4bc5f0 297 ```
nexpaq 0:6c56fb4bc5f0 298 $ python build.py -m LPC1768,NUCLEO_L152RE -t ARM
nexpaq 0:6c56fb4bc5f0 299 ```
nexpaq 0:6c56fb4bc5f0 300
nexpaq 0:6c56fb4bc5f0 301 * Parameter ```-t``` defined which toolchain should be used for mbed SDK build. You can build Mbed SDK for multiple toolchains using one command.
nexpaq 0:6c56fb4bc5f0 302 Below example (note there is no space after commas) will compile mbed SDK for Freescale Freedom KL25Z platform using ARM and GCC_ARM compilers:
nexpaq 0:6c56fb4bc5f0 303 ```
nexpaq 0:6c56fb4bc5f0 304 $ python build.py -m KL25Z -t ARM,GCC_ARM
nexpaq 0:6c56fb4bc5f0 305 ```
nexpaq 0:6c56fb4bc5f0 306
nexpaq 0:6c56fb4bc5f0 307 * You can combine this technique to compile multiple targets with multiple compilers.
nexpaq 0:6c56fb4bc5f0 308 Below example will compile mbed SDK for Freescale's KL25Z and KL46Z platforms using ARM and GCC_ARM compilers:
nexpaq 0:6c56fb4bc5f0 309 ```
nexpaq 0:6c56fb4bc5f0 310 $ python build.py -m KL25Z,KL46Z -t ARM,GCC_ARM
nexpaq 0:6c56fb4bc5f0 311 ```
nexpaq 0:6c56fb4bc5f0 312
nexpaq 0:6c56fb4bc5f0 313 * Building libraries included in mbed SDK's source code. Parameters ```-r```, ```-e```, ```-u```, ```-U```, ```-d```, ```-b``` will add ```RTOS```, ```Ethernet```, ```USB```, ```USB Host```, ```DSP```, ```U-Blox``` libraries respectively.
nexpaq 0:6c56fb4bc5f0 314 Below example will build Mbed SDK library for for NXP LPC1768 platform together with RTOS (```-r``` switch) and Ethernet (```-e``` switch) libraries.
nexpaq 0:6c56fb4bc5f0 315 ```
nexpaq 0:6c56fb4bc5f0 316 $ python build.py -m LPC1768 -t ARM -r -e
nexpaq 0:6c56fb4bc5f0 317 Building library CMSIS (LPC1768, ARM)
nexpaq 0:6c56fb4bc5f0 318 Building library MBED (LPC1768, ARM)
nexpaq 0:6c56fb4bc5f0 319 Building library RTX (LPC1768, ARM)
nexpaq 0:6c56fb4bc5f0 320 Building library RTOS (LPC1768, ARM)
nexpaq 0:6c56fb4bc5f0 321 Building library ETH (LPC1768, ARM)
nexpaq 0:6c56fb4bc5f0 322
nexpaq 0:6c56fb4bc5f0 323 Completed in: (0.48)s
nexpaq 0:6c56fb4bc5f0 324
nexpaq 0:6c56fb4bc5f0 325 Build successes:
nexpaq 0:6c56fb4bc5f0 326 * ARM::LPC1768
nexpaq 0:6c56fb4bc5f0 327 ```
nexpaq 0:6c56fb4bc5f0 328
nexpaq 0:6c56fb4bc5f0 329 * If you’re unsure which platforms and toolchains are supported please use switch ```-S``` to print simple matrix of platform to compiler dependencies.
nexpaq 0:6c56fb4bc5f0 330 ```
nexpaq 0:6c56fb4bc5f0 331 $ python build.py -S
nexpaq 0:6c56fb4bc5f0 332 +-------------------------+-----------+-----------+-----------+-----------+-----------+
nexpaq 0:6c56fb4bc5f0 333 | Platform | ARM | uARM | GCC_ARM | IAR | GCC_CR |
nexpaq 0:6c56fb4bc5f0 334 +-------------------------+-----------+-----------+-----------+-----------+-----------+
nexpaq 0:6c56fb4bc5f0 335 | APPNEARME_MICRONFCBOARD | Supported | Default | Supported | - | - |
nexpaq 0:6c56fb4bc5f0 336 | ARCH_BLE | Default | - | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 337 | ARCH_GPRS | Supported | Default | Supported | Supported | Supported |
nexpaq 0:6c56fb4bc5f0 338 ...
nexpaq 0:6c56fb4bc5f0 339 | UBLOX_C029 | Supported | Default | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 340 | WALLBOT_BLE | Default | - | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 341 | XADOW_M0 | Supported | Default | Supported | Supported | Supported |
nexpaq 0:6c56fb4bc5f0 342 +-------------------------+-----------+-----------+-----------+-----------+-----------+
nexpaq 0:6c56fb4bc5f0 343 *Default - default on-line compiler
nexpaq 0:6c56fb4bc5f0 344 *Supported - supported off-line compiler
nexpaq 0:6c56fb4bc5f0 345
nexpaq 0:6c56fb4bc5f0 346 Total platforms: 90
nexpaq 0:6c56fb4bc5f0 347 Total permutations: 297
nexpaq 0:6c56fb4bc5f0 348 ```
nexpaq 0:6c56fb4bc5f0 349
nexpaq 0:6c56fb4bc5f0 350 Above list can be overwhelming so please do not hesitate to use switch ```-f``` to filter ```Platform``` column.
nexpaq 0:6c56fb4bc5f0 351 ```
nexpaq 0:6c56fb4bc5f0 352 $ python build.py -S -f ^K
nexpaq 0:6c56fb4bc5f0 353 +--------------+-----------+---------+-----------+-----------+--------+
nexpaq 0:6c56fb4bc5f0 354 | Platform | ARM | uARM | GCC_ARM | IAR | GCC_CR |
nexpaq 0:6c56fb4bc5f0 355 +--------------+-----------+---------+-----------+-----------+--------+
nexpaq 0:6c56fb4bc5f0 356 | K20D50M | Default | - | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 357 | K22F | Default | - | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 358 | K64F | Default | - | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 359 | KL05Z | Supported | Default | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 360 | KL25Z | Default | - | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 361 | KL43Z | Default | - | Supported | - | - |
nexpaq 0:6c56fb4bc5f0 362 | KL46Z | Default | - | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 363 | NRF51_DK | Default | - | Supported | Supported | - |
nexpaq 0:6c56fb4bc5f0 364 | NRF51_DK_OTA | Default | - | Supported | - | - |
nexpaq 0:6c56fb4bc5f0 365 +--------------+-----------+---------+-----------+-----------+--------+
nexpaq 0:6c56fb4bc5f0 366 *Default - default on-line compiler
nexpaq 0:6c56fb4bc5f0 367 *Supported - supported off-line compiler
nexpaq 0:6c56fb4bc5f0 368
nexpaq 0:6c56fb4bc5f0 369 Total platforms: 9
nexpaq 0:6c56fb4bc5f0 370 Total permutations: 28
nexpaq 0:6c56fb4bc5f0 371 ```
nexpaq 0:6c56fb4bc5f0 372 or just give platform name:
nexpaq 0:6c56fb4bc5f0 373 ```
nexpaq 0:6c56fb4bc5f0 374 $ python build.py -S -f LPC1768
nexpaq 0:6c56fb4bc5f0 375 +----------+---------+-----------+-----------+-----------+-----------+
nexpaq 0:6c56fb4bc5f0 376 | Platform | ARM | uARM | GCC_ARM | IAR | GCC_CR |
nexpaq 0:6c56fb4bc5f0 377 +----------+---------+-----------+-----------+-----------+-----------+
nexpaq 0:6c56fb4bc5f0 378 | LPC1768 | Default | Supported | Supported | Supported | Supported |
nexpaq 0:6c56fb4bc5f0 379 +----------+---------+-----------+-----------+-----------+-----------+
nexpaq 0:6c56fb4bc5f0 380 *Default - default on-line compiler
nexpaq 0:6c56fb4bc5f0 381 *Supported - supported off-line compiler
nexpaq 0:6c56fb4bc5f0 382
nexpaq 0:6c56fb4bc5f0 383 Total platforms: 1
nexpaq 0:6c56fb4bc5f0 384 Total permutations: 6
nexpaq 0:6c56fb4bc5f0 385 ```
nexpaq 0:6c56fb4bc5f0 386
nexpaq 0:6c56fb4bc5f0 387 * You can be more verbose ```-v``` especially if you want to see each compilation / linking command build.py is executing:
nexpaq 0:6c56fb4bc5f0 388 ```
nexpaq 0:6c56fb4bc5f0 389 $ python build.py -t GCC_ARM -m LPC1768 -j 8 -v
nexpaq 0:6c56fb4bc5f0 390 Building library CMSIS (LPC1768, GCC_ARM)
nexpaq 0:6c56fb4bc5f0 391 Copy: LPC1768.ld
nexpaq 0:6c56fb4bc5f0 392 Compile: startup_LPC17xx.s
nexpaq 0:6c56fb4bc5f0 393 [DEBUG] Command: C:/Work/toolchains/gcc_arm_4_8/4_8_2013q4/bin\arm-none-eabi-gcc
nexpaq 0:6c56fb4bc5f0 394 -x assembler-with-cpp -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
nexpaq 0:6c56fb4bc5f0 395 -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -MMD
nexpaq 0:6c56fb4bc5f0 396 -fno-delete-null-pointer-checks -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -O2
nexpaq 0:6c56fb4bc5f0 397 -DTARGET_LPC1768 -DTARGET_M3 -DTARGET_CORTEX_M -DTARGET_NXP -DTARGET_LPC176X
nexpaq 0:6c56fb4bc5f0 398 -DTARGET_MBED_LPC1768 -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M3 -DARM_MATH_CM3
nexpaq 0:6c56fb4bc5f0 399 -DMBED_BUILD_TIMESTAMP=1424903604.77 -D__MBED__=1 -IC:\Work\mbed\libraries\mbed\targets\cmsis
nexpaq 0:6c56fb4bc5f0 400 -IC:\Work\mbed\libraries\mbed\targets\cmsis\TARGET_NXP
nexpaq 0:6c56fb4bc5f0 401 -IC:\Work\mbed\libraries\mbed\targets\cmsis\TARGET_NXP\TARGET_LPC176X -IC:\Work\mbed\libraries\mbed\targets\cmsis\TARGET_NXP\TARGET_LPC176X\TOOLCHAIN_GCC_ARM
nexpaq 0:6c56fb4bc5f0 402 -o C:\Work\mbed\build\mbed\.temp\TARGET_LPC1768\TOOLCHAIN_GCC_ARM\TARGET_NXP\TARGET_LPC176X\TOOLCHAIN_GCC_ARM\startup_LPC17xx.o
nexpaq 0:6c56fb4bc5f0 403 C:\Work\mbed\libraries\mbed\targets\cmsis\TARGET_NXP\TARGET_LPC176X\TOOLCHAIN_GCC_ARM\startup_LPC17xx.s
nexpaq 0:6c56fb4bc5f0 404 [DEBUG] Return: 0
nexpaq 0:6c56fb4bc5f0 405 ...
nexpaq 0:6c56fb4bc5f0 406 ```
nexpaq 0:6c56fb4bc5f0 407
nexpaq 0:6c56fb4bc5f0 408 ## CppCheck analysis
nexpaq 0:6c56fb4bc5f0 409 [Cppcheck](http://cppcheck.sourceforge.net/) is a static analysis tool for C/C++ code. Unlike C/C++ compilers and many other analysis tools it does not detect syntax errors in the code. Cppcheck primarily detects the types of bugs that the compilers normally do not detect. The goal is to detect only real errors in the code (i.e. have zero false positives).
nexpaq 0:6c56fb4bc5f0 410
nexpaq 0:6c56fb4bc5f0 411 Prerequisites:
nexpaq 0:6c56fb4bc5f0 412 * Please install ```CppCheck``` on your system before you want to use it with build scripts.
nexpaq 0:6c56fb4bc5f0 413 * You should also add Cppcheck to your system path.
nexpaq 0:6c56fb4bc5f0 414
nexpaq 0:6c56fb4bc5f0 415 ```build.py``` script supports switching between compilation, building and just static code analysis testing. You can use switch ```--cppcheck``` to perform CppCheck static code analysis.
nexpaq 0:6c56fb4bc5f0 416
nexpaq 0:6c56fb4bc5f0 417 * When you are using --cppcheck switch all macros, toolchain dependencies etc. are preserved so you are sure you are checking exactly the same code you would compile for your application.
nexpaq 0:6c56fb4bc5f0 418
nexpaq 0:6c56fb4bc5f0 419 * Cppcheck analysis can take up to few minutes on slower machines.
nexpaq 0:6c56fb4bc5f0 420
nexpaq 0:6c56fb4bc5f0 421 * Usually you will use switches ```-t``` and ```-m``` to define toolchain and MCU (platform) respectively. You should do the same in case of CppCheck analysis. Please note that build script can also compile and build RTOS, Ethernet library etc. If you want to check those just use corresponding build script switches (e.g. ```-r```, ```-e```, ...).
nexpaq 0:6c56fb4bc5f0 422
nexpaq 0:6c56fb4bc5f0 423 Example:
nexpaq 0:6c56fb4bc5f0 424 ```
nexpaq 0:6c56fb4bc5f0 425 $ python build.py -t uARM -m NUCLEO_F334R8 --cppcheck
nexpaq 0:6c56fb4bc5f0 426 ```
nexpaq 0:6c56fb4bc5f0 427
nexpaq 0:6c56fb4bc5f0 428 # make.py script
nexpaq 0:6c56fb4bc5f0 429 ```make.py``` is a ```mbed/tools/``` script used to build tests (we call them sometimes 'programs') one by one manually. This script allows you to flash board, execute and test it. However, this script is deprecated and will not be described here. Instead please use ```singletest.py``` file to build mbed SDK, tests and run automation for test cases included in ```mbedmicro/mbed```.
nexpaq 0:6c56fb4bc5f0 430 Note: ```make.py``` script depends on existing already built mbed SDK and library sources so you need to pre-build mbed SDK and other libraries (such as RTOS library) to link 'program' (test) with mbed SDK and RTOS library. To pre-build mbed SDK please use ```build.py``` script.
nexpaq 0:6c56fb4bc5f0 431
nexpaq 0:6c56fb4bc5f0 432 Just for sake of example please see few ways to use ```make.py``` together with Freedom K64F board.
nexpaq 0:6c56fb4bc5f0 433
nexpaq 0:6c56fb4bc5f0 434 * We need to build mbed SDK (in directory ```mbed/build/```:
nexpaq 0:6c56fb4bc5f0 435 ```
nexpaq 0:6c56fb4bc5f0 436 $ python build.py -t GCC_ARM -m K64F -j 8
nexpaq 0:6c56fb4bc5f0 437 Building library CMSIS (K64F, GCC_ARM)
nexpaq 0:6c56fb4bc5f0 438 Building library MBED (K64F, GCC_ARM)
nexpaq 0:6c56fb4bc5f0 439
nexpaq 0:6c56fb4bc5f0 440 Completed in: (0.59)s
nexpaq 0:6c56fb4bc5f0 441
nexpaq 0:6c56fb4bc5f0 442 Build successes:
nexpaq 0:6c56fb4bc5f0 443 * GCC_ARM::K64F
nexpaq 0:6c56fb4bc5f0 444 ```
nexpaq 0:6c56fb4bc5f0 445 * We can print all 'programs' (test cases) ```make.py``` can build for us:
nexpaq 0:6c56fb4bc5f0 446 ```
nexpaq 0:6c56fb4bc5f0 447 $ python make.py -L
nexpaq 0:6c56fb4bc5f0 448 .
nexpaq 0:6c56fb4bc5f0 449 [ 0] MBED_A1: Basic
nexpaq 0:6c56fb4bc5f0 450 [ 1] MBED_A2: Semihost file system
nexpaq 0:6c56fb4bc5f0 451 [ 2] MBED_A3: C++ STL
nexpaq 0:6c56fb4bc5f0 452 [ 3] MBED_A4: I2C TMP102
nexpaq 0:6c56fb4bc5f0 453 .
nexpaq 0:6c56fb4bc5f0 454 ```
nexpaq 0:6c56fb4bc5f0 455 For example 'program' under index ```2``` is ```MBED_A3``` test case we can build and flash onto K64F board.
nexpaq 0:6c56fb4bc5f0 456 * Building test with ```make.py``` by specifying test case name with ```-n``` option:
nexpaq 0:6c56fb4bc5f0 457 ```
nexpaq 0:6c56fb4bc5f0 458 $ python make.py -t GCC_ARM -m K64F -n MBED_A3
nexpaq 0:6c56fb4bc5f0 459 Building project STL (K64F, GCC_ARM)
nexpaq 0:6c56fb4bc5f0 460 Compile: main.cpp
nexpaq 0:6c56fb4bc5f0 461 [Warning] main.cpp@76: In function 'int main()': deprecated conversion from string constant to 'char*' [-Wwrite-strings]
nexpaq 0:6c56fb4bc5f0 462 .
nexpaq 0:6c56fb4bc5f0 463 .
nexpaq 0:6c56fb4bc5f0 464 .
nexpaq 0:6c56fb4bc5f0 465 [Warning] main.cpp@76: In function 'int main()': deprecated conversion from string constant to 'char*' [-Wwrite-strings]
nexpaq 0:6c56fb4bc5f0 466 Compile: test_env.cpp
nexpaq 0:6c56fb4bc5f0 467 Link: stl
nexpaq 0:6c56fb4bc5f0 468 Elf2Bin: stl
nexpaq 0:6c56fb4bc5f0 469 Image: C:\Work\mbed\build\test\K64F\GCC_ARM\MBED_A3\stl.bin
nexpaq 0:6c56fb4bc5f0 470 ```
nexpaq 0:6c56fb4bc5f0 471 Because we previously have built mbed SDK we are now able to drive test case compilation and linking with mbed SDK and produce ```MBED_A3``` test case binary in build directory:
nexpaq 0:6c56fb4bc5f0 472 ```
nexpaq 0:6c56fb4bc5f0 473 C:\Work\mbed\build\test\K64F\GCC_ARM\MBED_A3\stl.bin
nexpaq 0:6c56fb4bc5f0 474 ```
nexpaq 0:6c56fb4bc5f0 475
nexpaq 0:6c56fb4bc5f0 476 For more help type ```$ python make.py --help``` in your command line.
nexpaq 0:6c56fb4bc5f0 477
nexpaq 0:6c56fb4bc5f0 478 # project.py script
nexpaq 0:6c56fb4bc5f0 479 ```project.py``` script is used to export test cases ('programs') from test case portfolio to off-line IDE. This is a easy way to export test project to IDEs such as:
nexpaq 0:6c56fb4bc5f0 480 * codesourcery.
nexpaq 0:6c56fb4bc5f0 481 * coide.
nexpaq 0:6c56fb4bc5f0 482 * ds5_5.
nexpaq 0:6c56fb4bc5f0 483 * emblocks.
nexpaq 0:6c56fb4bc5f0 484 * gcc_arm.
nexpaq 0:6c56fb4bc5f0 485 * iar.
nexpaq 0:6c56fb4bc5f0 486 * kds.
nexpaq 0:6c56fb4bc5f0 487 * lpcxpresso.
nexpaq 0:6c56fb4bc5f0 488 * uvision.
nexpaq 0:6c56fb4bc5f0 489
nexpaq 0:6c56fb4bc5f0 490 You can export project using command line. All you need to do is to specify mbed platform name (option ```-m```), your IDE (option ```-i```) and project name you want to export (option ```-n``` or (option ```-p```).
nexpaq 0:6c56fb4bc5f0 491
nexpaq 0:6c56fb4bc5f0 492 In below example we export our project so we can work on it using GCC ARM cross-compiler. Building mechanism used to drive exported build will be ```Make```.
nexpaq 0:6c56fb4bc5f0 493 ```
nexpaq 0:6c56fb4bc5f0 494 $ python project.py -m K64F -n MBED_A3 -i gcc_arm
nexpaq 0:6c56fb4bc5f0 495 Copy: test_env.h
nexpaq 0:6c56fb4bc5f0 496 Copy: AnalogIn.h
nexpaq 0:6c56fb4bc5f0 497 Copy: AnalogOut.h
nexpaq 0:6c56fb4bc5f0 498 .
nexpaq 0:6c56fb4bc5f0 499 .
nexpaq 0:6c56fb4bc5f0 500 .
nexpaq 0:6c56fb4bc5f0 501 Copy: K64FN1M0xxx12.ld
nexpaq 0:6c56fb4bc5f0 502 Copy: main.cpp
nexpaq 0:6c56fb4bc5f0 503
nexpaq 0:6c56fb4bc5f0 504 Successful exports:
nexpaq 0:6c56fb4bc5f0 505 * K64F::gcc_arm C:\Work\mbed\build\export\MBED_A3_gcc_arm_K64F.zip
nexpaq 0:6c56fb4bc5f0 506 ```
nexpaq 0:6c56fb4bc5f0 507 You can see exporter placed compressed project export in ```zip``` file in ```mbed/build/export/``` directory.
nexpaq 0:6c56fb4bc5f0 508
nexpaq 0:6c56fb4bc5f0 509 Example export file ```MBED_A3_gcc_arm_K64F.zip``` structure:
nexpaq 0:6c56fb4bc5f0 510 ```
nexpaq 0:6c56fb4bc5f0 511 MBED_A3
nexpaq 0:6c56fb4bc5f0 512 ├───env
nexpaq 0:6c56fb4bc5f0 513 └───mbed
nexpaq 0:6c56fb4bc5f0 514 ├───api
nexpaq 0:6c56fb4bc5f0 515 ├───common
nexpaq 0:6c56fb4bc5f0 516 ├───hal
nexpaq 0:6c56fb4bc5f0 517 └───targets
nexpaq 0:6c56fb4bc5f0 518 ├───cmsis
nexpaq 0:6c56fb4bc5f0 519 │ └───TARGET_Freescale
nexpaq 0:6c56fb4bc5f0 520 │ └───TARGET_MCU_K64F
nexpaq 0:6c56fb4bc5f0 521 │ └───TOOLCHAIN_GCC_ARM
nexpaq 0:6c56fb4bc5f0 522 └───hal
nexpaq 0:6c56fb4bc5f0 523 └───TARGET_Freescale
nexpaq 0:6c56fb4bc5f0 524 └───TARGET_KPSDK_MCUS
nexpaq 0:6c56fb4bc5f0 525 ├───TARGET_KPSDK_CODE
nexpaq 0:6c56fb4bc5f0 526 │ ├───common
nexpaq 0:6c56fb4bc5f0 527 │ │ └───phyksz8081
nexpaq 0:6c56fb4bc5f0 528 │ ├───drivers
nexpaq 0:6c56fb4bc5f0 529 │ │ ├───clock
nexpaq 0:6c56fb4bc5f0 530 │ │ ├───enet
nexpaq 0:6c56fb4bc5f0 531 │ │ │ └───src
nexpaq 0:6c56fb4bc5f0 532 │ │ ├───interrupt
nexpaq 0:6c56fb4bc5f0 533 │ │ └───pit
nexpaq 0:6c56fb4bc5f0 534 │ │ ├───common
nexpaq 0:6c56fb4bc5f0 535 │ │ └───src
nexpaq 0:6c56fb4bc5f0 536 │ ├───hal
nexpaq 0:6c56fb4bc5f0 537 │ │ ├───adc
nexpaq 0:6c56fb4bc5f0 538 │ │ ├───can
nexpaq 0:6c56fb4bc5f0 539 │ │ ├───dac
nexpaq 0:6c56fb4bc5f0 540 │ │ ├───dmamux
nexpaq 0:6c56fb4bc5f0 541 │ │ ├───dspi
nexpaq 0:6c56fb4bc5f0 542 │ │ ├───edma
nexpaq 0:6c56fb4bc5f0 543 │ │ ├───enet
nexpaq 0:6c56fb4bc5f0 544 │ │ ├───flextimer
nexpaq 0:6c56fb4bc5f0 545 │ │ ├───gpio
nexpaq 0:6c56fb4bc5f0 546 │ │ ├───i2c
nexpaq 0:6c56fb4bc5f0 547 │ │ ├───llwu
nexpaq 0:6c56fb4bc5f0 548 │ │ ├───lptmr
nexpaq 0:6c56fb4bc5f0 549 │ │ ├───lpuart
nexpaq 0:6c56fb4bc5f0 550 │ │ ├───mcg
nexpaq 0:6c56fb4bc5f0 551 │ │ ├───mpu
nexpaq 0:6c56fb4bc5f0 552 │ │ ├───osc
nexpaq 0:6c56fb4bc5f0 553 │ │ ├───pdb
nexpaq 0:6c56fb4bc5f0 554 │ │ ├───pit
nexpaq 0:6c56fb4bc5f0 555 │ │ ├───pmc
nexpaq 0:6c56fb4bc5f0 556 │ │ ├───port
nexpaq 0:6c56fb4bc5f0 557 │ │ ├───rcm
nexpaq 0:6c56fb4bc5f0 558 │ │ ├───rtc
nexpaq 0:6c56fb4bc5f0 559 │ │ ├───sai
nexpaq 0:6c56fb4bc5f0 560 │ │ ├───sdhc
nexpaq 0:6c56fb4bc5f0 561 │ │ ├───sim
nexpaq 0:6c56fb4bc5f0 562 │ │ ├───smc
nexpaq 0:6c56fb4bc5f0 563 │ │ ├───uart
nexpaq 0:6c56fb4bc5f0 564 │ │ └───wdog
nexpaq 0:6c56fb4bc5f0 565 │ └───utilities
nexpaq 0:6c56fb4bc5f0 566 │ └───src
nexpaq 0:6c56fb4bc5f0 567 └───TARGET_MCU_K64F
nexpaq 0:6c56fb4bc5f0 568 ├───device
nexpaq 0:6c56fb4bc5f0 569 │ ├───device
nexpaq 0:6c56fb4bc5f0 570 │ │ └───MK64F12
nexpaq 0:6c56fb4bc5f0 571 │ └───MK64F12
nexpaq 0:6c56fb4bc5f0 572 ├───MK64F12
nexpaq 0:6c56fb4bc5f0 573 └───TARGET_FRDM
nexpaq 0:6c56fb4bc5f0 574 ```
nexpaq 0:6c56fb4bc5f0 575
nexpaq 0:6c56fb4bc5f0 576 After unpacking exporter ```zip``` file we can go to directory and see files inside MBED_A3 directory:
nexpaq 0:6c56fb4bc5f0 577 ```
nexpaq 0:6c56fb4bc5f0 578 $ ls
nexpaq 0:6c56fb4bc5f0 579 GettingStarted.htm Makefile env main.cpp mbed
nexpaq 0:6c56fb4bc5f0 580 ```
nexpaq 0:6c56fb4bc5f0 581 Exporter generated for us ```Makefile``` so now we can build our software:
nexpaq 0:6c56fb4bc5f0 582 ```
nexpaq 0:6c56fb4bc5f0 583 $ make -j 8
nexpaq 0:6c56fb4bc5f0 584 .
nexpaq 0:6c56fb4bc5f0 585 .
nexpaq 0:6c56fb4bc5f0 586 .
nexpaq 0:6c56fb4bc5f0 587 text data bss dec hex filename
nexpaq 0:6c56fb4bc5f0 588 29336 184 336 29856 74a0 MBED_A3.elf
nexpaq 0:6c56fb4bc5f0 589 ```
nexpaq 0:6c56fb4bc5f0 590
nexpaq 0:6c56fb4bc5f0 591 We can see root directory of exporter project is now populated with binary files:
nexpaq 0:6c56fb4bc5f0 592 * MBED_A3.bin.
nexpaq 0:6c56fb4bc5f0 593 * MBED_A3.elf .
nexpaq 0:6c56fb4bc5f0 594 * MBED_A3.hex.
nexpaq 0:6c56fb4bc5f0 595 You have also map file ```MBED_A3.map``` for your disposal.
nexpaq 0:6c56fb4bc5f0 596 ```
nexpaq 0:6c56fb4bc5f0 597 $ ls
nexpaq 0:6c56fb4bc5f0 598 GettingStarted.htm MBED_A3.bin MBED_A3.elf MBED_A3.hex MBED_A3.map Makefile env main.cpp main.d main.o mbed
nexpaq 0:6c56fb4bc5f0 599 ```
nexpaq 0:6c56fb4bc5f0 600