NuMaker PWM0 play notes (to speaker)

Committer:
shliu1
Date:
Tue Dec 13 12:00:03 2016 +0800
Revision:
3:c7ff2d693bf4
Child:
4:cf951fa65c75
Add README.md and sync mbed-os library to mbed-os 5.2.3

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shliu1 3:c7ff2d693bf4 1
shliu1 3:c7ff2d693bf4 2 # Getting started with NuMaker-mbed-PWM0_playnote on mbed OS
shliu1 3:c7ff2d693bf4 3
shliu1 3:c7ff2d693bf4 4 The code works on an mbed OS platform. It uses the thread of OS to show LED.
shliu1 3:c7ff2d693bf4 5
shliu1 3:c7ff2d693bf4 6 Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli).
shliu1 3:c7ff2d693bf4 7
shliu1 3:c7ff2d693bf4 8 ## Get the example application!
shliu1 3:c7ff2d693bf4 9
shliu1 3:c7ff2d693bf4 10 Ontain the mbed-OS library from Windows command prompt
shliu1 3:c7ff2d693bf4 11
shliu1 3:c7ff2d693bf4 12 git clone https://github.com/ARMmbed/mbed-os
shliu1 3:c7ff2d693bf4 13
shliu1 3:c7ff2d693bf4 14
shliu1 3:c7ff2d693bf4 15 From the command line of Git Bash, for example:
shliu1 3:c7ff2d693bf4 16
shliu1 3:c7ff2d693bf4 17 ```
shliu1 3:c7ff2d693bf4 18 hg clone https://developer.mbed.org/teams/Nuvoton/code/NuMaker-mbed-PWM0_playnote/
shliu1 3:c7ff2d693bf4 19 cd NuMaker-mbed-PWM0_playnote
shliu1 3:c7ff2d693bf4 20
shliu1 3:c7ff2d693bf4 21 ```
shliu1 3:c7ff2d693bf4 22
shliu1 3:c7ff2d693bf4 23 Make shortcut for mbed-os library within the folder NuMaker-mbed-PWM0_playnote
shliu1 3:c7ff2d693bf4 24
shliu1 3:c7ff2d693bf4 25 ### Now compile
shliu1 3:c7ff2d693bf4 26
shliu1 3:c7ff2d693bf4 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:c7ff2d693bf4 28
shliu1 3:c7ff2d693bf4 29 ```
shliu1 3:c7ff2d693bf4 30 mbed compile -m NUMAKER_PFM_NUC472 -t ARM
shliu1 3:c7ff2d693bf4 31 ```
shliu1 3:c7ff2d693bf4 32
shliu1 3:c7ff2d693bf4 33 Your PC may take a few minutes to compile your code. At the end you should get the following result:
shliu1 3:c7ff2d693bf4 34
shliu1 3:c7ff2d693bf4 35 ```
shliu1 3:c7ff2d693bf4 36 +------------------------+-------+-------+---------+
shliu1 3:c7ff2d693bf4 37 | Module | .text | .data | .bss |
shliu1 3:c7ff2d693bf4 38 +------------------------+-------+-------+---------+
shliu1 3:c7ff2d693bf4 39 | Misc | 12587 | 16 | 1051616 |
shliu1 3:c7ff2d693bf4 40 | drivers | 444 | 4 | 28 |
shliu1 3:c7ff2d693bf4 41 | features/FEATURE_LWIP | 162 | 16 | 16 |
shliu1 3:c7ff2d693bf4 42 | hal | 358 | 8 | 0 |
shliu1 3:c7ff2d693bf4 43 | platform | 1565 | 16 | 92 |
shliu1 3:c7ff2d693bf4 44 | rtos | 130 | 8 | 0 |
shliu1 3:c7ff2d693bf4 45 | rtos/rtx | 6702 | 100 | 8396 |
shliu1 3:c7ff2d693bf4 46 | targets/TARGET_NUVOTON | 8100 | 276 | 104 |
shliu1 3:c7ff2d693bf4 47 | Subtotals | 30048 | 444 | 1060252 |
shliu1 3:c7ff2d693bf4 48 +------------------------+-------+-------+---------+
shliu1 3:c7ff2d693bf4 49 Allocated Heap: unknown
shliu1 3:c7ff2d693bf4 50 Allocated Stack: unknown
shliu1 3:c7ff2d693bf4 51 Total Static RAM memory (data + bss): 1060696 bytes
shliu1 3:c7ff2d693bf4 52 Total RAM memory (data + bss + heap + stack): 1060696 bytes
shliu1 3:c7ff2d693bf4 53 Total Flash memory (text + data + misc): 30492 bytes
shliu1 3:c7ff2d693bf4 54
shliu1 3:c7ff2d693bf4 55 ```
shliu1 3:c7ff2d693bf4 56
shliu1 3:c7ff2d693bf4 57 ### Program your board
shliu1 3:c7ff2d693bf4 58
shliu1 3:c7ff2d693bf4 59 1. Connect your mbed device to the computer over USB.
shliu1 3:c7ff2d693bf4 60 1. Copy the binary file to the mbed device .
shliu1 3:c7ff2d693bf4 61 1. Press the reset button to start the program.
shliu1 3:c7ff2d693bf4 62
shliu1 3:c7ff2d693bf4 63 Please refer to the documents at the path https://github.com/OpenNuvoton/NuMaker_NuWicam_Samples/
shliu1 3:c7ff2d693bf4 64
shliu1 3:c7ff2d693bf4 65 ## Export the project to Keil MDK and debug your application
shliu1 3:c7ff2d693bf4 66
shliu1 3:c7ff2d693bf4 67 From the command line, run the following command:
shliu1 3:c7ff2d693bf4 68
shliu1 3:c7ff2d693bf4 69 ```
shliu1 3:c7ff2d693bf4 70 mbed export -m NUMAKER_PFM_NUC472 -i uvision
shliu1 3:c7ff2d693bf4 71 ```
shliu1 3:c7ff2d693bf4 72
shliu1 3:c7ff2d693bf4 73 To debug the application:
shliu1 3:c7ff2d693bf4 74
shliu1 3:c7ff2d693bf4 75 1. Start uVision.
shliu1 3:c7ff2d693bf4 76 1. Import the uVision project generated earlier.
shliu1 3:c7ff2d693bf4 77 1. Compile your application and generate an `.axf` file.
shliu1 3:c7ff2d693bf4 78 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:c7ff2d693bf4 79 1. Set breakpoints and start a debug session.
shliu1 3:c7ff2d693bf4 80
shliu1 3:c7ff2d693bf4 81 ![Image of uVision](img/uvision.png)
shliu1 3:c7ff2d693bf4 82
shliu1 3:c7ff2d693bf4 83 ## Troubleshooting
shliu1 3:c7ff2d693bf4 84
shliu1 3:c7ff2d693bf4 85 1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9`
shliu1 3:c7ff2d693bf4 86
shliu1 3:c7ff2d693bf4 87 ```
shliu1 3:c7ff2d693bf4 88 mbed --version
shliu1 3:c7ff2d693bf4 89 ```
shliu1 3:c7ff2d693bf4 90
shliu1 3:c7ff2d693bf4 91 If not, you can update it easily:
shliu1 3:c7ff2d693bf4 92
shliu1 3:c7ff2d693bf4 93 ```
shliu1 3:c7ff2d693bf4 94 pip install mbed-cli --upgrade
shliu1 3:c7ff2d693bf4 95 ```
shliu1 3:c7ff2d693bf4 96
shliu1 3:c7ff2d693bf4 97 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:c7ff2d693bf4 98
shliu1 3:c7ff2d693bf4 99