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