Includes library modifications to allow access to AIN_4 (AIN_0 / 5)

Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

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