~
Dependencies: 4DGL-uLCD-SE SDFileSystem
README.md@14:2c2395937c57, 2016-10-18 (annotated)
- Committer:
- kswanson31
- Date:
- Tue Oct 18 18:34:44 2016 +0000
- Revision:
- 14:2c2395937c57
- Parent:
- 0:570683b2d0c9
Included majority of all lab code, formatted to show device names and pins, device purpose information
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fkhan39 | 0:570683b2d0c9 | 1 | # Getting started with Blinky on mbed OS |
fkhan39 | 0:570683b2d0c9 | 2 | |
fkhan39 | 0:570683b2d0c9 | 3 | This is a very simple guide, reviewing the steps required to get Blinky working on an mbed OS platform. |
fkhan39 | 0:570683b2d0c9 | 4 | |
fkhan39 | 0:570683b2d0c9 | 5 | Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
fkhan39 | 0:570683b2d0c9 | 6 | |
fkhan39 | 0:570683b2d0c9 | 7 | ## Get the example application! |
fkhan39 | 0:570683b2d0c9 | 8 | |
fkhan39 | 0:570683b2d0c9 | 9 | From the command line, import the example: |
fkhan39 | 0:570683b2d0c9 | 10 | |
fkhan39 | 0:570683b2d0c9 | 11 | ``` |
fkhan39 | 0:570683b2d0c9 | 12 | mbed import mbed-os-example-blinky |
fkhan39 | 0:570683b2d0c9 | 13 | cd mbed-os-example-blinky |
fkhan39 | 0:570683b2d0c9 | 14 | ``` |
fkhan39 | 0:570683b2d0c9 | 15 | |
fkhan39 | 0:570683b2d0c9 | 16 | ### Now compile |
fkhan39 | 0:570683b2d0c9 | 17 | |
fkhan39 | 0:570683b2d0c9 | 18 | Invoke `mbed compile` specifying the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5: |
fkhan39 | 0:570683b2d0c9 | 19 | |
fkhan39 | 0:570683b2d0c9 | 20 | ``` |
fkhan39 | 0:570683b2d0c9 | 21 | mbed compile -m K64F -t ARM |
fkhan39 | 0:570683b2d0c9 | 22 | ``` |
fkhan39 | 0:570683b2d0c9 | 23 | |
fkhan39 | 0:570683b2d0c9 | 24 | Your PC may take a few minutes to compile your code. At the end you should get the following result: |
fkhan39 | 0:570683b2d0c9 | 25 | |
fkhan39 | 0:570683b2d0c9 | 26 | ``` |
fkhan39 | 0:570683b2d0c9 | 27 | [snip] |
fkhan39 | 0:570683b2d0c9 | 28 | +----------------------------+-------+-------+------+ |
fkhan39 | 0:570683b2d0c9 | 29 | | Module | .text | .data | .bss | |
fkhan39 | 0:570683b2d0c9 | 30 | +----------------------------+-------+-------+------+ |
fkhan39 | 0:570683b2d0c9 | 31 | | Misc | 13939 | 24 | 1372 | |
fkhan39 | 0:570683b2d0c9 | 32 | | core/hal | 16993 | 96 | 296 | |
fkhan39 | 0:570683b2d0c9 | 33 | | core/rtos | 7384 | 92 | 4204 | |
fkhan39 | 0:570683b2d0c9 | 34 | | features/FEATURE_IPV4 | 80 | 0 | 176 | |
fkhan39 | 0:570683b2d0c9 | 35 | | frameworks/greentea-client | 1830 | 60 | 44 | |
fkhan39 | 0:570683b2d0c9 | 36 | | frameworks/utest | 2392 | 512 | 292 | |
fkhan39 | 0:570683b2d0c9 | 37 | | Subtotals | 42618 | 784 | 6384 | |
fkhan39 | 0:570683b2d0c9 | 38 | +----------------------------+-------+-------+------+ |
fkhan39 | 0:570683b2d0c9 | 39 | Allocated Heap: unknown |
fkhan39 | 0:570683b2d0c9 | 40 | Allocated Stack: unknown |
fkhan39 | 0:570683b2d0c9 | 41 | Total Static RAM memory (data + bss): 7168 bytes |
fkhan39 | 0:570683b2d0c9 | 42 | Total RAM memory (data + bss + heap + stack): 7168 bytes |
fkhan39 | 0:570683b2d0c9 | 43 | Total Flash memory (text + data + misc): 43402 bytes |
fkhan39 | 0:570683b2d0c9 | 44 | Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin |
fkhan39 | 0:570683b2d0c9 | 45 | ``` |
fkhan39 | 0:570683b2d0c9 | 46 | |
fkhan39 | 0:570683b2d0c9 | 47 | ### Program your board |
fkhan39 | 0:570683b2d0c9 | 48 | |
fkhan39 | 0:570683b2d0c9 | 49 | 1. Connect your mbed device to the computer over USB. |
fkhan39 | 0:570683b2d0c9 | 50 | 1. Copy the binary file to the mbed device . |
fkhan39 | 0:570683b2d0c9 | 51 | 1. Press the reset button to start the program. |
fkhan39 | 0:570683b2d0c9 | 52 | |
fkhan39 | 0:570683b2d0c9 | 53 | You should see the LED of your platform turning on and off. |
fkhan39 | 0:570683b2d0c9 | 54 | |
fkhan39 | 0:570683b2d0c9 | 55 | Congratulations if you managed to complete this test! |
fkhan39 | 0:570683b2d0c9 | 56 | |
fkhan39 | 0:570683b2d0c9 | 57 | ## Export the project to Keil MDK and debug your application |
fkhan39 | 0:570683b2d0c9 | 58 | |
fkhan39 | 0:570683b2d0c9 | 59 | From the command line, run the following command: |
fkhan39 | 0:570683b2d0c9 | 60 | |
fkhan39 | 0:570683b2d0c9 | 61 | ``` |
fkhan39 | 0:570683b2d0c9 | 62 | mbed export -m K64F -i uvision |
fkhan39 | 0:570683b2d0c9 | 63 | ``` |
fkhan39 | 0:570683b2d0c9 | 64 | |
fkhan39 | 0:570683b2d0c9 | 65 | You should see the following output: |
fkhan39 | 0:570683b2d0c9 | 66 | |
fkhan39 | 0:570683b2d0c9 | 67 | ``` |
fkhan39 | 0:570683b2d0c9 | 68 | Successful exports: |
fkhan39 | 0:570683b2d0c9 | 69 | * K64F::uvision .\projectfiles\uvision_K64F\Unnamed_Project |
fkhan39 | 0:570683b2d0c9 | 70 | ``` |
fkhan39 | 0:570683b2d0c9 | 71 | |
fkhan39 | 0:570683b2d0c9 | 72 | To debug the application: |
fkhan39 | 0:570683b2d0c9 | 73 | |
fkhan39 | 0:570683b2d0c9 | 74 | 1. Start uVision. |
fkhan39 | 0:570683b2d0c9 | 75 | 1. Import the uVision project generated earlier. |
fkhan39 | 0:570683b2d0c9 | 76 | 1. Compile your application and generate an `.axf` file. |
fkhan39 | 0:570683b2d0c9 | 77 | 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger). |
fkhan39 | 0:570683b2d0c9 | 78 | 1. Set breakpoints and start a debug session. |
fkhan39 | 0:570683b2d0c9 | 79 | |
fkhan39 | 0:570683b2d0c9 | 80 | ![Image of uVision](img/uvision.png) |
fkhan39 | 0:570683b2d0c9 | 81 | |
fkhan39 | 0:570683b2d0c9 | 82 | ## Troubleshooting |
fkhan39 | 0:570683b2d0c9 | 83 | |
fkhan39 | 0:570683b2d0c9 | 84 | 1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9` |
fkhan39 | 0:570683b2d0c9 | 85 | |
fkhan39 | 0:570683b2d0c9 | 86 | ``` |
fkhan39 | 0:570683b2d0c9 | 87 | mbed --version |
fkhan39 | 0:570683b2d0c9 | 88 | ``` |
fkhan39 | 0:570683b2d0c9 | 89 | |
fkhan39 | 0:570683b2d0c9 | 90 | If not, you can update it easily: |
fkhan39 | 0:570683b2d0c9 | 91 | |
fkhan39 | 0:570683b2d0c9 | 92 | ``` |
fkhan39 | 0:570683b2d0c9 | 93 | pip install mbed-cli --upgrade |
fkhan39 | 0:570683b2d0c9 | 94 | ``` |
fkhan39 | 0:570683b2d0c9 | 95 | |
fkhan39 | 0:570683b2d0c9 | 96 | 2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32KB restriction on code size. |