.

Committer:
mbed_official
Date:
Thu Mar 09 17:44:20 2017 +0000
Revision:
0:32997aac176c
Child:
2:78445cb0f9d7
Initial commit.
Commit copied from https://github.com/ARMmbed/mbed-os-example-bootloader-blinky

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:32997aac176c 1 # Getting started with Bootloader Blinky on mbed OS
mbed_official 0:32997aac176c 2
mbed_official 0:32997aac176c 3 This example shows how to build and use an application with a prebuilt bootloader. For steps on how to create the bootloader, see [mbed-os-example-bootloader](https://github.com/ARMmbed/mbed-os-example-bootloader).
mbed_official 0:32997aac176c 4
mbed_official 0:32997aac176c 5 ## Required hardware
mbed_official 0:32997aac176c 6 * A supported board - [u-blox EVK-ODIN-W2](https://developer.mbed.org/platforms/ublox-EVK-ODIN-W2/), [Nucleo F429ZI](https://developer.mbed.org/platforms/ST-Nucleo-F429ZI/) or [K64F](https://developer.mbed.org/platforms/FRDM-K64F/).
mbed_official 0:32997aac176c 7 * CI test shield.
mbed_official 0:32997aac176c 8 * SD card.
mbed_official 0:32997aac176c 9
mbed_official 0:32997aac176c 10 ## Import the example application
mbed_official 0:32997aac176c 11
mbed_official 0:32997aac176c 12 From the command-line, import the example:
mbed_official 0:32997aac176c 13
mbed_official 0:32997aac176c 14 ```
mbed_official 0:32997aac176c 15 mbed import mbed-os-example-bootloader-blinky
mbed_official 0:32997aac176c 16 cd mbed-os-example-bootloader-blinky
mbed_official 0:32997aac176c 17 ```
mbed_official 0:32997aac176c 18
mbed_official 0:32997aac176c 19 ## Set up application to use bootloader
mbed_official 0:32997aac176c 20
mbed_official 0:32997aac176c 21 All supported boards mentioned above are set up to use bootloader with a CI test shield.
mbed_official 0:32997aac176c 22
mbed_official 0:32997aac176c 23 To either use a different board or a different SD card slot, you must rebuild the bootloader and update the application.
mbed_official 0:32997aac176c 24 To do this:
mbed_official 0:32997aac176c 25
mbed_official 0:32997aac176c 26 1. Create a bootloader for your board in the project [mbed-os-example-bootloader](https://github.com/ARMmbed/mbed-os-example-bootloader).
mbed_official 0:32997aac176c 27 2. Update your board to use the newly created booloader image. To do this, set the target value `bootloader_img` to the file path of the bootloader image.
mbed_official 0:32997aac176c 28
mbed_official 0:32997aac176c 29 ```
mbed_official 0:32997aac176c 30 "target_overrides": {
mbed_official 0:32997aac176c 31 ...
mbed_official 0:32997aac176c 32 "NUCLEO_F429ZI": {
mbed_official 0:32997aac176c 33 "target.bootloader_img": "bootloader/NUCLEO_F429ZI.bin"
mbed_official 0:32997aac176c 34 },
mbed_official 0:32997aac176c 35 ...
mbed_official 0:32997aac176c 36 ```
mbed_official 0:32997aac176c 37
mbed_official 0:32997aac176c 38 ## Now compile
mbed_official 0:32997aac176c 39
mbed_official 0:32997aac176c 40 Invoke `mbed compile`, and specify the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5:
mbed_official 0:32997aac176c 41
mbed_official 0:32997aac176c 42 ```
mbed_official 0:32997aac176c 43 mbed compile -m NUCLEO_F429ZI -t ARM
mbed_official 0:32997aac176c 44 ```
mbed_official 0:32997aac176c 45
mbed_official 0:32997aac176c 46 Your PC may take a few minutes to compile your code. At the end, you see the following result:
mbed_official 0:32997aac176c 47
mbed_official 0:32997aac176c 48 ```
mbed_official 0:32997aac176c 49 Merging Regions:
mbed_official 0:32997aac176c 50 Filling region bootloader with bootloader/NUCLEO_F429ZI.bin
mbed_official 0:32997aac176c 51 Filling region application with .\BUILD\NUCLEO_F429ZI\GCC_ARM\mbed-os-example-bootloader-blinky_application.bin
mbed_official 0:32997aac176c 52 Space used after regions merged: 0x296f4
mbed_official 0:32997aac176c 53 +-----------------------+-------+-------+-------+
mbed_official 0:32997aac176c 54 | Module | .text | .data | .bss |
mbed_official 0:32997aac176c 55 +-----------------------+-------+-------+-------+
mbed_official 0:32997aac176c 56 | Fill | 70 | 4 | 9 |
mbed_official 0:32997aac176c 57 | Misc | 20952 | 2184 | 112 |
mbed_official 0:32997aac176c 58 | drivers | 118 | 4 | 100 |
mbed_official 0:32997aac176c 59 | features/FEATURE_LWIP | 44 | 0 | 12536 |
mbed_official 0:32997aac176c 60 | hal | 418 | 0 | 8 |
mbed_official 0:32997aac176c 61 | platform | 1148 | 4 | 269 |
mbed_official 0:32997aac176c 62 | rtos | 38 | 4 | 4 |
mbed_official 0:32997aac176c 63 | rtos/rtx | 6089 | 20 | 6870 |
mbed_official 0:32997aac176c 64 | targets/TARGET_STM | 6511 | 4 | 700 |
mbed_official 0:32997aac176c 65 | Subtotals | 35388 | 2224 | 20608 |
mbed_official 0:32997aac176c 66 +-----------------------+-------+-------+-------+
mbed_official 0:32997aac176c 67 Allocated Heap: 24576 bytes
mbed_official 0:32997aac176c 68 Allocated Stack: unknown
mbed_official 0:32997aac176c 69 Total Static RAM memory (data + bss): 22832 bytes
mbed_official 0:32997aac176c 70 Total RAM memory (data + bss + heap + stack): 47408 bytes
mbed_official 0:32997aac176c 71 Total Flash memory (text + data + misc): 37612 bytes
mbed_official 0:32997aac176c 72
mbed_official 0:32997aac176c 73 Image: .\BUILD\NUCLEO_F429ZI\GCC_ARM\mbed-os-example-bootloader-blinky.bin
mbed_official 0:32997aac176c 74 ```
mbed_official 0:32997aac176c 75
mbed_official 0:32997aac176c 76 ## Program bootloader and application
mbed_official 0:32997aac176c 77
mbed_official 0:32997aac176c 78 1. Connect your mbed device to the computer over USB.
mbed_official 0:32997aac176c 79 1. Copy the binary file to the mbed device.
mbed_official 0:32997aac176c 80 1. Press the reset button to start the program.
mbed_official 0:32997aac176c 81
mbed_official 0:32997aac176c 82 The LED on your platform turns on and off.
mbed_official 0:32997aac176c 83
mbed_official 0:32997aac176c 84 ## Program application using SD card
mbed_official 0:32997aac176c 85
mbed_official 0:32997aac176c 86 1. Connect the SD card to your computer.
mbed_official 0:32997aac176c 87 1. Copy the application binary (mbed-os-example-bootloader-blinky_application.bin) to the root of the SD card.
mbed_official 0:32997aac176c 88 1. Remove the SD card from your PC, and plug it into the mbed board.
mbed_official 0:32997aac176c 89 1. Press the reset button to start the firmware update.
mbed_official 0:32997aac176c 90
mbed_official 0:32997aac176c 91 If a terminal is open, the following prints:
mbed_official 0:32997aac176c 92
mbed_official 0:32997aac176c 93 ```
mbed_official 0:32997aac176c 94 Firmware update found
mbed_official 0:32997aac176c 95 Starting application
mbed_official 0:32997aac176c 96 ```
mbed_official 0:32997aac176c 97
mbed_official 0:32997aac176c 98 You then see the LED on your platform turning on and off.
mbed_official 0:32997aac176c 99
mbed_official 0:32997aac176c 100 ## Troubleshooting
mbed_official 0:32997aac176c 101
mbed_official 0:32997aac176c 102 1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0`.
mbed_official 0:32997aac176c 103
mbed_official 0:32997aac176c 104 ```
mbed_official 0:32997aac176c 105 mbed --version
mbed_official 0:32997aac176c 106 ```
mbed_official 0:32997aac176c 107
mbed_official 0:32997aac176c 108 If not, you can update it:
mbed_official 0:32997aac176c 109
mbed_official 0:32997aac176c 110 ```
mbed_official 0:32997aac176c 111 pip install mbed-cli --upgrade
mbed_official 0:32997aac176c 112 ```
mbed_official 0:32997aac176c 113
mbed_official 0:32997aac176c 114 2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32 KB restriction on code size.