Version 2.6 by Xiaoling on 2022/05/11 17:22

Hide last authors
Xiaoling 2.6 1 = Contents: =
Xiaoling 1.1 2
Xiaoling 2.6 3 {{toc/}}
Xiaoling 1.2 4
5
6 = 1. Introduction =
7
Xiaoling 1.1 8 This introduction is to show how to compile the source code for Dragino's stm32 base products.
9
Xiaoling 1.2 10 = 2. Set Up Build Environment =
Xiaoling 1.1 11
Xiaoling 1.2 12 == 2.1 Set up Keil Compile Environment ==
Xiaoling 1.1 13
Xiaoling 1.2 14 (((
Xiaoling 1.1 15 Assuming you already have [[Keil uVision5>>url:https://www.keil.com/demo/eval/arm.htm]] installed, the steps below show how to install the MDK support and get a license.
Xiaoling 1.2 16 )))
Xiaoling 1.1 17
Xiaoling 1.2 18 (((
Xiaoling 1.1 19 ~1. Open the Webpage: [[http:~~/~~/www2.keil.com/stmicroelectronics-stm32/mdk>>url:http://www2.keil.com/stmicroelectronics-stm32/mdk]]
Xiaoling 1.2 20 )))
Xiaoling 1.1 21
Xiaoling 1.2 22 (((
Xiaoling 1.1 23 2. Download the **Keil MDK**, record the **PSN** here, we will use it later.
Xiaoling 1.2 24 )))
Xiaoling 1.1 25
Xiaoling 1.2 26 [[image:https://wiki.dragino.com/images/thumb/6/66/Keil_1.png/600px-Keil_1.png||height="293" width="600"]]
Xiaoling 1.1 27
Xiaoling 1.2 28 (((
Xiaoling 1.1 29 Download Keil MDK
Xiaoling 1.2 30 )))
Xiaoling 1.1 31
Xiaoling 1.2 32 (((
Xiaoling 2.2 33 (((
Xiaoling 1.1 34 3. Login with an account that has administration rights.
Xiaoling 1.2 35 )))
Xiaoling 2.2 36 )))
Xiaoling 1.1 37
Xiaoling 1.2 38 (((
Xiaoling 2.2 39 (((
Xiaoling 1.1 40 4. Right-click the µVision icon and select **Run as Administrator**… from the context menu.
41 5: Open the dialog **File — License Management…** and select the **Single-User License** tab.
Xiaoling 1.2 42 )))
Xiaoling 2.2 43 )))
Xiaoling 1.1 44
Xiaoling 1.2 45 [[image:https://wiki.dragino.com/images/thumb/4/44/Keil_2.png/600px-Keil_2.png||height="279" width="600"]]
Xiaoling 1.1 46
47 Install Keil
48
49 6: Click the button **Get LIC via Internet...**, then click the button **OK** to register the product. This action opens the License Management page on the Keil web site.
50
Xiaoling 1.2 51 [[image:https://wiki.dragino.com/images/thumb/f/fd/Keil_3.png/600px-Keil_3.png||height="297" width="600"]]
Xiaoling 1.1 52
53 Install Keil
54
55 7.Enter the **Product Serial Number** (from step 2.) 4RMW3-A8FIW-TUBLG along with your contact information and click the button Submit. An e-mail is sent back with the License ID Code (LIC) within a few minutes.
56
Xiaoling 2.1 57 [[image:https://wiki.dragino.com/images/thumb/c/c5/Keil_4.png/600px-Keil_4.png||height="307" width="600"]]
Xiaoling 1.1 58
59 Input PSN
60
Xiaoling 2.1 61 [[image:https://wiki.dragino.com/images/thumb/7/7e/Keil_5.png/600px-Keil_5.png||height="287" width="600"]]
Xiaoling 1.1 62
63 Active via mail
64
Xiaoling 2.1 65 [[image:https://wiki.dragino.com/images/thumb/b/b0/Keil_6.png/600px-Keil_6.png||height="248" width="600"]]
Xiaoling 1.1 66
67 Active via mail
68
69 8. To activate the Software Product, **enter the LIC** in the field **New License ID Code (LIC)** of the dialog **License Management…** and click **Add LIC**.
70
Xiaoling 2.1 71 [[image:https://wiki.dragino.com/images/thumb/b/b2/Keil_7.png/600px-Keil_7.png||height="440" width="600"]]
Xiaoling 1.1 72
73 Add LIC
74
75 9. Finish Install Keil
76
Xiaoling 2.1 77 [[image:https://wiki.dragino.com/images/thumb/c/c4/Keil_8.png/600px-Keil_8.png||height="345" width="600"]]
Xiaoling 1.1 78
79 Finish install Keil
80
81
Xiaoling 2.1 82 == 2.2 Install STM32L0 Series Device in Keil ==
Xiaoling 1.1 83
Xiaoling 2.3 84 (((
Xiaoling 1.1 85 1: Open the webpage: [[https:~~/~~/www.keil.com/dd2/stmicroelectronics/stm32l072cztx/#/eula-container>>url:https://www.keil.com/dd2/stmicroelectronics/stm32l072cztx/#/eula-container]];
Xiaoling 2.3 86 )))
Xiaoling 1.1 87
Xiaoling 2.3 88 (((
Xiaoling 1.1 89 2: Find STMicroelectronics **STM32L0 Series Device** and download it.
Xiaoling 2.3 90 )))
Xiaoling 1.1 91
Xiaoling 2.1 92 [[image:https://wiki.dragino.com/images/thumb/3/32/Keil_9.png/600px-Keil_9.png||height="461" width="547"]]
Xiaoling 1.1 93
94 Finish install Keil
95
96 3: Find the Software Pack and install it.
97
Xiaoling 2.1 98 [[image:https://wiki.dragino.com/images/thumb/9/94/Keil_10.png/600px-Keil_10.png||height="368" width="552"]]
Xiaoling 1.1 99
100 Install the downloaded pack in Keil
101
Xiaoling 2.1 102 [[image:https://wiki.dragino.com/images/thumb/6/66/Keil_11.png/600px-Keil_11.png||height="346" width="560"]]
Xiaoling 1.1 103
104 Install the downloaded pack in Keil
105
106 4: Add the Device, then you can **rebuild** the project.
107
Xiaoling 2.1 108 [[image:https://wiki.dragino.com/images/thumb/3/35/Keil_12.png/600px-Keil_12.png||height="349" width="569"]]
Xiaoling 1.1 109
110 rebuild project
111
112 Note: If you don’t add the Device, then Keil will report this error:
113
Xiaoling 2.1 114 [[image:https://wiki.dragino.com/images/thumb/4/42/Keil_13.png/600px-Keil_13.png||height="366" width="565"]]
Xiaoling 1.1 115
116 Error without Device
117
118
Xiaoling 2.1 119 = 3. Get and compile Source Code =
Xiaoling 1.1 120
121 * Get the source code for the product.
122 * Use Keil to open the project file.
123 * You can see the libraries related for example NBSN50 project as below:
124
Xiaoling 2.1 125 [[image:https://wiki.dragino.com/images/b/b7/Keil_14.png||height="143" width="197"]]
Xiaoling 1.1 126
127 project files
128
129
Xiaoling 2.1 130 = 4. Video Reference =
Xiaoling 1.1 131
132 [[https:~~/~~/youtu.be/ctdUNx4XCEg>>url:https://youtu.be/ctdUNx4XCEg]]
133
134
Xiaoling 2.1 135 = 5. Frequency Ask Questiones (FAQ) =
Xiaoling 1.1 136
Xiaoling 2.1 137 == 5.1 How to change the frequency band for LoRaWAN source code ==
Xiaoling 1.1 138
139 In Keil, you can see what frequency band the code support.
140
Xiaoling 2.1 141 [[image:https://wiki.dragino.com/images/0/00/STM32_FAQ_1.png||height="259" width="208"]]
Xiaoling 1.1 142
143 Support Frequency
144
145
146 If you want to change frequency, modify the Preprocessor Symbols. For example, change EU868 to US915 to complie a US915 firmware.
147
Xiaoling 2.1 148 [[image:https://wiki.dragino.com/images/7/7b/STM32_FAQ_2.png||height="291" width="400"]]
Xiaoling 1.1 149
150 Change Marco for frequency