NUMAKER CAN sample

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