Nuvoton
/
NuMaker-mbed-GPIO-button-buzzer-rgbled
NuMaker GPIO button with LED and buzzer
README.md@3:bd71797f939d, 2016-12-13 (annotated)
- Committer:
- shliu1
- Date:
- Tue Dec 13 09:40:16 2016 +0800
- Revision:
- 3:bd71797f939d
- Child:
- 4:8c02c5014a91
Add README.md and sync mbed-os library to mbed-os 5.2.3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shliu1 |
3:bd71797f939d | 1 | |
shliu1 |
3:bd71797f939d | 2 | # Getting started with NuMaker-mbed-GPIO-button-buzzer-rgbled on mbed OS |
shliu1 |
3:bd71797f939d | 3 | |
shliu1 |
3:bd71797f939d | 4 | The code works on an mbed OS platform. Press the button SW1 to turn on LED, press the button SW2 to turn on buzzer. |
shliu1 |
3:bd71797f939d | 5 | |
shliu1 |
3:bd71797f939d | 6 | Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
shliu1 |
3:bd71797f939d | 7 | |
shliu1 |
3:bd71797f939d | 8 | ## Get the example application! |
shliu1 |
3:bd71797f939d | 9 | |
shliu1 |
3:bd71797f939d | 10 | Ontain the mbed-OS library from Windows command prompt |
shliu1 |
3:bd71797f939d | 11 | |
shliu1 |
3:bd71797f939d | 12 | git clone https://github.com/ARMmbed/mbed-os |
shliu1 |
3:bd71797f939d | 13 | |
shliu1 |
3:bd71797f939d | 14 | |
shliu1 |
3:bd71797f939d | 15 | From the command line of Git Bash, for example: |
shliu1 |
3:bd71797f939d | 16 | |
shliu1 |
3:bd71797f939d | 17 | ``` |
shliu1 |
3:bd71797f939d | 18 | hg clone https://developer.mbed.org/teams/Nuvoton/code/NuMaker-mbed-GPIO-button-buzzer-rgbled/ |
shliu1 |
3:bd71797f939d | 19 | cd NuMaker-mbed-GPIO-button-buzzer-rgbled |
shliu1 |
3:bd71797f939d | 20 | |
shliu1 |
3:bd71797f939d | 21 | ``` |
shliu1 |
3:bd71797f939d | 22 | |
shliu1 |
3:bd71797f939d | 23 | Make shortcut for mbed-os library within the folder NuMaker-mbed-GPIO-button-buzzer-rgbled |
shliu1 |
3:bd71797f939d | 24 | |
shliu1 |
3:bd71797f939d | 25 | ### Now compile |
shliu1 |
3:bd71797f939d | 26 | |
shliu1 |
3:bd71797f939d | 27 | Invoke `mbed compile` specifying the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5: |
shliu1 |
3:bd71797f939d | 28 | |
shliu1 |
3:bd71797f939d | 29 | ``` |
shliu1 |
3:bd71797f939d | 30 | mbed compile -m NUMAKER_PFM_NUC472 -t ARM |
shliu1 |
3:bd71797f939d | 31 | ``` |
shliu1 |
3:bd71797f939d | 32 | |
shliu1 |
3:bd71797f939d | 33 | Your PC may take a few minutes to compile your code. At the end you should get the following result: |
shliu1 |
3:bd71797f939d | 34 | |
shliu1 |
3:bd71797f939d | 35 | ``` |
shliu1 |
3:bd71797f939d | 36 | Link: NuMaker-mbed-GPIO-button-buzzer-rgbled |
shliu1 |
3:bd71797f939d | 37 | Elf2Bin: NuMaker-mbed-GPIO-button-buzzer-rgbled |
shliu1 |
3:bd71797f939d | 38 | +------------------------+-------+-------+---------+ |
shliu1 |
3:bd71797f939d | 39 | | Module | .text | .data | .bss | |
shliu1 |
3:bd71797f939d | 40 | +------------------------+-------+-------+---------+ |
shliu1 |
3:bd71797f939d | 41 | | Misc | 12937 | 72 | 1051604 | |
shliu1 |
3:bd71797f939d | 42 | | drivers | 444 | 4 | 28 | |
shliu1 |
3:bd71797f939d | 43 | | features/FEATURE_LWIP | 162 | 16 | 16 | |
shliu1 |
3:bd71797f939d | 44 | | hal | 670 | 8 | 0 | |
shliu1 |
3:bd71797f939d | 45 | | platform | 1565 | 16 | 92 | |
shliu1 |
3:bd71797f939d | 46 | | rtos | 130 | 8 | 0 | |
shliu1 |
3:bd71797f939d | 47 | | rtos/rtx | 6702 | 100 | 8396 | |
shliu1 |
3:bd71797f939d | 48 | | targets/TARGET_NUVOTON | 6254 | 264 | 104 | |
shliu1 |
3:bd71797f939d | 49 | | Subtotals | 28864 | 488 | 1060240 | |
shliu1 |
3:bd71797f939d | 50 | +------------------------+-------+-------+---------+ |
shliu1 |
3:bd71797f939d | 51 | Allocated Heap: unknown |
shliu1 |
3:bd71797f939d | 52 | Allocated Stack: unknown |
shliu1 |
3:bd71797f939d | 53 | Total Static RAM memory (data + bss): 1060728 bytes |
shliu1 |
3:bd71797f939d | 54 | Total RAM memory (data + bss + heap + stack): 1060728 bytes |
shliu1 |
3:bd71797f939d | 55 | Total Flash memory (text + data + misc): 29352 bytes |
shliu1 |
3:bd71797f939d | 56 | |
shliu1 |
3:bd71797f939d | 57 | ``` |
shliu1 |
3:bd71797f939d | 58 | |
shliu1 |
3:bd71797f939d | 59 | ### Program your board |
shliu1 |
3:bd71797f939d | 60 | |
shliu1 |
3:bd71797f939d | 61 | 1. Connect your mbed device to the computer over USB. |
shliu1 |
3:bd71797f939d | 62 | 1. Copy the binary file to the mbed device . |
shliu1 |
3:bd71797f939d | 63 | 1. Press the reset button to start the program. |
shliu1 |
3:bd71797f939d | 64 | |
shliu1 |
3:bd71797f939d | 65 | Please refer to the documents at the path https://github.com/OpenNuvoton/NuMaker_NuWicam_Samples/ |
shliu1 |
3:bd71797f939d | 66 | |
shliu1 |
3:bd71797f939d | 67 | ## Export the project to Keil MDK and debug your application |
shliu1 |
3:bd71797f939d | 68 | |
shliu1 |
3:bd71797f939d | 69 | From the command line, run the following command: |
shliu1 |
3:bd71797f939d | 70 | |
shliu1 |
3:bd71797f939d | 71 | ``` |
shliu1 |
3:bd71797f939d | 72 | mbed export -m NUMAKER_PFM_NUC472 -i uvision |
shliu1 |
3:bd71797f939d | 73 | ``` |
shliu1 |
3:bd71797f939d | 74 | |
shliu1 |
3:bd71797f939d | 75 | To debug the application: |
shliu1 |
3:bd71797f939d | 76 | |
shliu1 |
3:bd71797f939d | 77 | 1. Start uVision. |
shliu1 |
3:bd71797f939d | 78 | 1. Import the uVision project generated earlier. |
shliu1 |
3:bd71797f939d | 79 | 1. Compile your application and generate an `.axf` file. |
shliu1 |
3:bd71797f939d | 80 | 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger). |
shliu1 |
3:bd71797f939d | 81 | 1. Set breakpoints and start a debug session. |
shliu1 |
3:bd71797f939d | 82 | |
shliu1 |
3:bd71797f939d | 83 | ![Image of uVision](img/uvision.png) |
shliu1 |
3:bd71797f939d | 84 | |
shliu1 |
3:bd71797f939d | 85 | ## Troubleshooting |
shliu1 |
3:bd71797f939d | 86 | |
shliu1 |
3:bd71797f939d | 87 | 1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9` |
shliu1 |
3:bd71797f939d | 88 | |
shliu1 |
3:bd71797f939d | 89 | ``` |
shliu1 |
3:bd71797f939d | 90 | mbed --version |
shliu1 |
3:bd71797f939d | 91 | ``` |
shliu1 |
3:bd71797f939d | 92 | |
shliu1 |
3:bd71797f939d | 93 | If not, you can update it easily: |
shliu1 |
3:bd71797f939d | 94 | |
shliu1 |
3:bd71797f939d | 95 | ``` |
shliu1 |
3:bd71797f939d | 96 | pip install mbed-cli --upgrade |
shliu1 |
3:bd71797f939d | 97 | ``` |
shliu1 |
3:bd71797f939d | 98 | |
shliu1 |
3:bd71797f939d | 99 | 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. |
shliu1 |
3:bd71797f939d | 100 | |
shliu1 |
3:bd71797f939d | 101 |