Wiki source code of Firmware Compile Instruction -- STM32
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
20.2 | 1 | |
![]() |
1.1 | 2 | |
![]() |
23.15 | 3 | **~ Table of Contents:** |
![]() |
20.2 | 4 | |
![]() |
2.6 | 5 | {{toc/}} |
![]() |
1.2 | 6 | |
7 | |||
8 | = 1. Introduction = | ||
9 | |||
![]() |
23.15 | 10 | |
![]() |
1.1 | 11 | This introduction is to show how to compile the source code for Dragino's stm32 base products. |
12 | |||
![]() |
3.2 | 13 | |
![]() |
24.2 | 14 | |
![]() |
1.2 | 15 | = 2. Set Up Build Environment = |
![]() |
1.1 | 16 | |
![]() |
24.2 | 17 | |
![]() |
1.2 | 18 | == 2.1 Set up Keil Compile Environment == |
![]() |
1.1 | 19 | |
![]() |
23.15 | 20 | |
![]() |
1.2 | 21 | ((( |
![]() |
1.1 | 22 | 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. |
![]() |
23.26 | 23 | |
24 | |||
![]() |
1.2 | 25 | ))) |
![]() |
1.1 | 26 | |
![]() |
1.2 | 27 | ((( |
![]() |
23.25 | 28 | (% style="color:blue" %)**1.**(%%) Open the Webpage: [[http:~~/~~/www2.keil.com/stmicroelectronics-stm32/mdk>>url:http://www2.keil.com/stmicroelectronics-stm32/mdk]] |
![]() |
23.26 | 29 | |
30 | |||
![]() |
1.2 | 31 | ))) |
![]() |
1.1 | 32 | |
![]() |
1.2 | 33 | ((( |
![]() |
23.25 | 34 | (% style="color:blue" %)**2.** (%%) Download the (% style="color:blue" %)**Keil MDK**(%%), record the (% style="color:blue" %)**PSN**(%%) here, we will use it later. |
![]() |
24.2 | 35 | |
36 | |||
![]() |
1.2 | 37 | ))) |
![]() |
1.1 | 38 | |
![]() |
3.2 | 39 | [[image:image-20220526180802-1.png]] |
![]() |
1.1 | 40 | |
![]() |
1.2 | 41 | ((( |
![]() |
1.1 | 42 | Download Keil MDK |
![]() |
3.2 | 43 | |
![]() |
23.6 | 44 | |
![]() |
3.2 | 45 | |
![]() |
1.2 | 46 | ))) |
![]() |
1.1 | 47 | |
![]() |
1.2 | 48 | ((( |
![]() |
2.2 | 49 | ((( |
![]() |
23.25 | 50 | (% style="color:blue" %)**3.**(%%) Login with an account that has administration rights. |
![]() |
23.26 | 51 | |
52 | |||
![]() |
1.2 | 53 | ))) |
![]() |
2.2 | 54 | ))) |
![]() |
1.1 | 55 | |
![]() |
1.2 | 56 | ((( |
![]() |
2.2 | 57 | ((( |
![]() |
23.26 | 58 | (% style="color:blue" %)**4.**(%%) Right-click the µVision icon and select (% style="color:blue" %)**Run as Administrator**(%%)… from the context menu. |
59 | |||
60 | |||
61 | (% style="color:blue" %)**5.**(%%) Open the dialog (% style="color:blue" %)**File — License Management…**(%%) and select the (% style="color:blue" %)**Single-User License** (%%)tab. | ||
![]() |
24.2 | 62 | |
63 | |||
![]() |
1.2 | 64 | ))) |
![]() |
2.2 | 65 | ))) |
![]() |
1.1 | 66 | |
![]() |
4.2 | 67 | [[image:image-20220526180902-2.png]] |
![]() |
1.1 | 68 | |
69 | Install Keil | ||
70 | |||
![]() |
5.2 | 71 | |
![]() |
23.5 | 72 | |
![]() |
23.26 | 73 | (% style="color:blue" %)**6. **(%%)Click the button (% style="color:blue" %)**Get LIC via Internet...**(%%), then click the button (% style="color:blue" %)**OK**(%%) to register the product. This action opens the License Management page on the Keil web site. |
![]() |
1.1 | 74 | |
![]() |
5.2 | 75 | [[image:image-20220526180942-3.png]] |
![]() |
1.1 | 76 | |
77 | Install Keil | ||
78 | |||
![]() |
6.2 | 79 | |
![]() |
23.4 | 80 | |
![]() |
23.25 | 81 | (% style="color:blue" %)**7.** (%%) Enter the (% style="color:blue" %)**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. |
![]() |
1.1 | 82 | |
![]() |
24.2 | 83 | |
![]() |
6.2 | 84 | [[image:image-20220526181014-4.png]] |
![]() |
1.1 | 85 | |
86 | Input PSN | ||
87 | |||
88 | |||
![]() |
23.3 | 89 | |
![]() |
8.2 | 90 | [[image:image-20220526181041-5.png||height="619" width="1223"]] |
91 | |||
![]() |
1.1 | 92 | Active via mail |
93 | |||
94 | |||
![]() |
8.2 | 95 | |
![]() |
23.2 | 96 | |
97 | [[image:image-20220601135048-3.png]] | ||
98 | |||
![]() |
1.1 | 99 | Active via mail |
100 | |||
![]() |
8.2 | 101 | |
![]() |
1.1 | 102 | |
![]() |
23.26 | 103 | (% style="color:blue" %)**8.** (%%) To activate the Software Product, (% style="color:blue" %)**enter the LIC**(%%) in the field (% style="color:blue" %)**New License ID Code (LIC)**(%%) of the dialog (% style="color:blue" %)**License Management…**(%%) and click (% style="color:blue" %)**Add LIC**. |
104 | |||
![]() |
24.2 | 105 | |
![]() |
10.2 | 106 | [[image:image-20220526181138-7.png]] |
![]() |
1.1 | 107 | |
108 | Add LIC | ||
109 | |||
![]() |
10.2 | 110 | |
![]() |
23.7 | 111 | |
![]() |
23.25 | 112 | (% style="color:blue" %)**9. **(%%)Finish Install Keil |
![]() |
1.1 | 113 | |
![]() |
24.2 | 114 | |
![]() |
10.2 | 115 | [[image:image-20220526181207-8.png]] |
![]() |
1.1 | 116 | |
117 | Finish install Keil | ||
118 | |||
119 | |||
![]() |
24.2 | 120 | |
![]() |
2.1 | 121 | == 2.2 Install STM32L0 Series Device in Keil == |
![]() |
1.1 | 122 | |
![]() |
23.16 | 123 | |
![]() |
2.3 | 124 | ((( |
![]() |
23.25 | 125 | (% style="color:blue" %)**1. **(%%) Open the webpage: [[https:~~/~~/www.keil.com/dd2/stmicroelectronics/stm32l072cztx/#/eula-container>>url:https://www.keil.com/dd2/stmicroelectronics/stm32l072cztx/#/eula-container]]; |
![]() |
2.3 | 126 | ))) |
![]() |
1.1 | 127 | |
![]() |
2.3 | 128 | ((( |
![]() |
23.25 | 129 | (% style="color:blue" %)**2.** (%%) Find STMicroelectronics (% style="color:blue" %)**STM32L0 Series Device**(%%) and download it. |
![]() |
14.2 | 130 | |
![]() |
23.8 | 131 | |
![]() |
14.2 | 132 | [[image:image-20220526181351-11.png]] |
![]() |
2.3 | 133 | ))) |
![]() |
1.1 | 134 | |
135 | Finish install Keil | ||
136 | |||
![]() |
14.2 | 137 | |
![]() |
23.9 | 138 | |
![]() |
23.25 | 139 | (% style="color:blue" %)**3. **(%%) Find the Software Pack and install it. |
![]() |
1.1 | 140 | |
![]() |
14.2 | 141 | [[image:image-20220526181302-10.png]] |
![]() |
1.1 | 142 | |
![]() |
14.2 | 143 | |
![]() |
23.10 | 144 | |
![]() |
1.1 | 145 | Install the downloaded pack in Keil |
146 | |||
![]() |
14.2 | 147 | [[image:image-20220526181434-12.png]] |
148 | |||
![]() |
1.1 | 149 | Install the downloaded pack in Keil |
150 | |||
![]() |
14.2 | 151 | |
![]() |
23.12 | 152 | |
![]() |
23.25 | 153 | (% style="color:blue" %)**4. ** (%%)Add the Device, then you can (% style="color:blue" %)**rebuild**(%%) the project. |
![]() |
1.1 | 154 | |
![]() |
24.2 | 155 | |
![]() |
16.2 | 156 | [[image:image-20220526181509-13.png]] |
![]() |
1.1 | 157 | |
158 | rebuild project | ||
159 | |||
![]() |
16.2 | 160 | |
![]() |
23.13 | 161 | |
![]() |
23.25 | 162 | (% style="color:red" %)**Note: If you don't add the Device, then Keil will report this error:** |
![]() |
1.1 | 163 | |
![]() |
16.2 | 164 | [[image:image-20220526181543-14.png]] |
![]() |
1.1 | 165 | |
166 | Error without Device | ||
167 | |||
168 | |||
![]() |
24.2 | 169 | |
![]() |
2.1 | 170 | = 3. Get and compile Source Code = |
![]() |
1.1 | 171 | |
![]() |
23.17 | 172 | |
![]() |
1.1 | 173 | * Get the source code for the product. |
174 | * Use Keil to open the project file. | ||
175 | * You can see the libraries related for example NBSN50 project as below: | ||
176 | |||
![]() |
17.2 | 177 | [[image:image-20220526181605-15.png]] |
![]() |
1.1 | 178 | |
179 | project files | ||
180 | |||
181 | |||
![]() |
24.2 | 182 | |
![]() |
2.1 | 183 | = 4. Video Reference = |
![]() |
1.1 | 184 | |
![]() |
23.17 | 185 | |
![]() |
1.1 | 186 | [[https:~~/~~/youtu.be/ctdUNx4XCEg>>url:https://youtu.be/ctdUNx4XCEg]] |
187 | |||
188 | |||
![]() |
24.2 | 189 | |
![]() |
2.1 | 190 | = 5. Frequency Ask Questiones (FAQ) = |
![]() |
1.1 | 191 | |
![]() |
24.2 | 192 | |
![]() |
2.1 | 193 | == 5.1 How to change the frequency band for LoRaWAN source code == |
![]() |
1.1 | 194 | |
![]() |
23.17 | 195 | |
![]() |
1.1 | 196 | In Keil, you can see what frequency band the code support. |
197 | |||
![]() |
18.2 | 198 | [[image:image-20220526181628-16.png]] |
![]() |
1.1 | 199 | |
200 | Support Frequency | ||
201 | |||
202 | |||
![]() |
23.14 | 203 | |
![]() |
1.1 | 204 | If you want to change frequency, modify the Preprocessor Symbols. For example, change EU868 to US915 to complie a US915 firmware. |
205 | |||
![]() |
19.2 | 206 | [[image:image-20220526181651-17.png]] |
![]() |
1.1 | 207 | |
208 | Change Marco for frequency | ||
![]() |
24.2 | 209 | |
210 |