mbed-os-examples
/
mbed-os-example-bootloader-blinky
.
README.md@2:78445cb0f9d7, 2017-03-24 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Mar 24 10:30:30 2017 +0000
- Revision:
- 2:78445cb0f9d7
- Parent:
- 0:32997aac176c
Merge pull request #6 from 0xc0170/dev_fix_docs
Readme: add specific binary name a user should use
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-bootloader-blinky
Who changed what in which revision?
User | Revision | Line number | New 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 | 2:78445cb0f9d7 | 5 | To read more about the bootloader, please visit [bootloader tutorial](https://docs.mbed.com/docs/mbed-os-handbook/en/latest/advanced/bootloader/). |
mbed_official | 2:78445cb0f9d7 | 6 | |
mbed_official | 0:32997aac176c | 7 | ## Required hardware |
mbed_official | 0:32997aac176c | 8 | * 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 | 9 | * CI test shield. |
mbed_official | 0:32997aac176c | 10 | * SD card. |
mbed_official | 0:32997aac176c | 11 | |
mbed_official | 0:32997aac176c | 12 | ## Import the example application |
mbed_official | 0:32997aac176c | 13 | |
mbed_official | 0:32997aac176c | 14 | From the command-line, import the example: |
mbed_official | 0:32997aac176c | 15 | |
mbed_official | 0:32997aac176c | 16 | ``` |
mbed_official | 0:32997aac176c | 17 | mbed import mbed-os-example-bootloader-blinky |
mbed_official | 0:32997aac176c | 18 | cd mbed-os-example-bootloader-blinky |
mbed_official | 0:32997aac176c | 19 | ``` |
mbed_official | 0:32997aac176c | 20 | |
mbed_official | 0:32997aac176c | 21 | ## Set up application to use bootloader |
mbed_official | 0:32997aac176c | 22 | |
mbed_official | 0:32997aac176c | 23 | All supported boards mentioned above are set up to use bootloader with a CI test shield. |
mbed_official | 0:32997aac176c | 24 | |
mbed_official | 0:32997aac176c | 25 | 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 | 26 | To do this: |
mbed_official | 0:32997aac176c | 27 | |
mbed_official | 2:78445cb0f9d7 | 28 | 1. Create a bootloader for your board in the project [mbed-os-example-bootloader](https://github.com/ARMmbed/mbed-os-example-bootloader). The bootloader image is named ``mbed-os-example-bootloader.bin``. |
mbed_official | 2:78445cb0f9d7 | 29 | 2. Update your board to use the newly created bootloader image. To do this, set the target (replace ``<TARGET_NAME>`` with your target name) value `bootloader_img` to the file path of the bootloader image. |
mbed_official | 0:32997aac176c | 30 | |
mbed_official | 0:32997aac176c | 31 | ``` |
mbed_official | 0:32997aac176c | 32 | "target_overrides": { |
mbed_official | 0:32997aac176c | 33 | ... |
mbed_official | 2:78445cb0f9d7 | 34 | "<TARGET_NAME>": { |
mbed_official | 2:78445cb0f9d7 | 35 | "target.bootloader_img": "bootloader/<TARGET_NAME>.bin" |
mbed_official | 0:32997aac176c | 36 | }, |
mbed_official | 0:32997aac176c | 37 | ... |
mbed_official | 0:32997aac176c | 38 | ``` |
mbed_official | 0:32997aac176c | 39 | |
mbed_official | 0:32997aac176c | 40 | ## Now compile |
mbed_official | 0:32997aac176c | 41 | |
mbed_official | 0:32997aac176c | 42 | 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 | 43 | |
mbed_official | 0:32997aac176c | 44 | ``` |
mbed_official | 2:78445cb0f9d7 | 45 | mbed compile -m <TARGET_NAME> -t ARM |
mbed_official | 0:32997aac176c | 46 | ``` |
mbed_official | 0:32997aac176c | 47 | |
mbed_official | 0:32997aac176c | 48 | Your PC may take a few minutes to compile your code. At the end, you see the following result: |
mbed_official | 0:32997aac176c | 49 | |
mbed_official | 0:32997aac176c | 50 | ``` |
mbed_official | 0:32997aac176c | 51 | Merging Regions: |
mbed_official | 2:78445cb0f9d7 | 52 | Filling region bootloader with bootloader/<TARGET_NAME>.bin |
mbed_official | 2:78445cb0f9d7 | 53 | Filling region application with .\BUILD\<TARGET_NAME>\GCC_ARM\mbed-os-example-bootloader-blinky_application.bin |
mbed_official | 0:32997aac176c | 54 | Space used after regions merged: 0x296f4 |
mbed_official | 0:32997aac176c | 55 | +-----------------------+-------+-------+-------+ |
mbed_official | 0:32997aac176c | 56 | | Module | .text | .data | .bss | |
mbed_official | 0:32997aac176c | 57 | +-----------------------+-------+-------+-------+ |
mbed_official | 0:32997aac176c | 58 | | Fill | 70 | 4 | 9 | |
mbed_official | 0:32997aac176c | 59 | | Misc | 20952 | 2184 | 112 | |
mbed_official | 0:32997aac176c | 60 | | drivers | 118 | 4 | 100 | |
mbed_official | 0:32997aac176c | 61 | | features/FEATURE_LWIP | 44 | 0 | 12536 | |
mbed_official | 0:32997aac176c | 62 | | hal | 418 | 0 | 8 | |
mbed_official | 0:32997aac176c | 63 | | platform | 1148 | 4 | 269 | |
mbed_official | 0:32997aac176c | 64 | | rtos | 38 | 4 | 4 | |
mbed_official | 0:32997aac176c | 65 | | rtos/rtx | 6089 | 20 | 6870 | |
mbed_official | 0:32997aac176c | 66 | | targets/TARGET_STM | 6511 | 4 | 700 | |
mbed_official | 0:32997aac176c | 67 | | Subtotals | 35388 | 2224 | 20608 | |
mbed_official | 0:32997aac176c | 68 | +-----------------------+-------+-------+-------+ |
mbed_official | 0:32997aac176c | 69 | Allocated Heap: 24576 bytes |
mbed_official | 0:32997aac176c | 70 | Allocated Stack: unknown |
mbed_official | 0:32997aac176c | 71 | Total Static RAM memory (data + bss): 22832 bytes |
mbed_official | 0:32997aac176c | 72 | Total RAM memory (data + bss + heap + stack): 47408 bytes |
mbed_official | 0:32997aac176c | 73 | Total Flash memory (text + data + misc): 37612 bytes |
mbed_official | 0:32997aac176c | 74 | |
mbed_official | 0:32997aac176c | 75 | Image: .\BUILD\NUCLEO_F429ZI\GCC_ARM\mbed-os-example-bootloader-blinky.bin |
mbed_official | 0:32997aac176c | 76 | ``` |
mbed_official | 0:32997aac176c | 77 | |
mbed_official | 0:32997aac176c | 78 | ## Program bootloader and application |
mbed_official | 0:32997aac176c | 79 | |
mbed_official | 0:32997aac176c | 80 | 1. Connect your mbed device to the computer over USB. |
mbed_official | 2:78445cb0f9d7 | 81 | 1. Copy the mbed-os-example-bootloader-blinky binary file to the mbed device. |
mbed_official | 0:32997aac176c | 82 | 1. Press the reset button to start the program. |
mbed_official | 0:32997aac176c | 83 | |
mbed_official | 0:32997aac176c | 84 | The LED on your platform turns on and off. |
mbed_official | 0:32997aac176c | 85 | |
mbed_official | 0:32997aac176c | 86 | ## Program application using SD card |
mbed_official | 0:32997aac176c | 87 | |
mbed_official | 0:32997aac176c | 88 | 1. Connect the SD card to your computer. |
mbed_official | 0:32997aac176c | 89 | 1. Copy the application binary (mbed-os-example-bootloader-blinky_application.bin) to the root of the SD card. |
mbed_official | 0:32997aac176c | 90 | 1. Remove the SD card from your PC, and plug it into the mbed board. |
mbed_official | 0:32997aac176c | 91 | 1. Press the reset button to start the firmware update. |
mbed_official | 0:32997aac176c | 92 | |
mbed_official | 0:32997aac176c | 93 | If a terminal is open, the following prints: |
mbed_official | 0:32997aac176c | 94 | |
mbed_official | 0:32997aac176c | 95 | ``` |
mbed_official | 0:32997aac176c | 96 | Firmware update found |
mbed_official | 0:32997aac176c | 97 | Starting application |
mbed_official | 0:32997aac176c | 98 | ``` |
mbed_official | 0:32997aac176c | 99 | |
mbed_official | 0:32997aac176c | 100 | You then see the LED on your platform turning on and off. |
mbed_official | 0:32997aac176c | 101 | |
mbed_official | 0:32997aac176c | 102 | ## Troubleshooting |
mbed_official | 0:32997aac176c | 103 | |
mbed_official | 0:32997aac176c | 104 | 1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0`. |
mbed_official | 0:32997aac176c | 105 | |
mbed_official | 0:32997aac176c | 106 | ``` |
mbed_official | 0:32997aac176c | 107 | mbed --version |
mbed_official | 0:32997aac176c | 108 | ``` |
mbed_official | 0:32997aac176c | 109 | |
mbed_official | 0:32997aac176c | 110 | If not, you can update it: |
mbed_official | 0:32997aac176c | 111 | |
mbed_official | 0:32997aac176c | 112 | ``` |
mbed_official | 0:32997aac176c | 113 | pip install mbed-cli --upgrade |
mbed_official | 0:32997aac176c | 114 | ``` |
mbed_official | 0:32997aac176c | 115 | |
mbed_official | 0:32997aac176c | 116 | 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. |