NuMaker mbed RTOS basic (Thread)

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