Skip to content

Commit 8e797a8

Browse files
committed
Break firmware update page into parts
1 parent 2037a4e commit 8e797a8

7 files changed

+596
-580
lines changed

docs/firmware_compile.md

Lines changed: 302 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,302 @@
1+
# Compiling Source
2+
3+
### Windows
4+
5+
The SparkFun RTK Everywhere Firmware is compiled using Arduino CLI (currently [v0.35.3](https://github.com/arduino/arduino-cli/releases)). To compile:
6+
7+
1. Install [Arduino CLI](https://github.com/arduino/arduino-cli/releases).
8+
9+
2. Install the ESP32 core for Arduino:
10+
11+
arduino-cli core install esp32:[email protected]
12+
13+
**Note**: Use v3.0.1 of the core.
14+
15+
**Note:** We use the 'ESP32 Dev Module' for pin numbering.
16+
17+
3. Obtain each of the libraries listed in [the workflow](https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware/blob/main/.github/workflows/compile-rtk-everywhere.yml#L72) either by using git or the Arduino CLI [library manager](https://arduino.github.io/arduino-cli/0.21/commands/arduino-cli_lib_install/). Be sure to obtain the version of the library reflected in the [workflow](https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware/blob/main/.github/workflows/compile-rtk-everywhere.yml#L72). Be sure to include the external libraries (You may have to enable external library support in the CLI).
18+
19+
4. RTK Everywhere uses a custom partition file. Download the [RTKEverywhere.csv](https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware/blob/main/Firmware/RTKEverywhere.csv) file.
20+
21+
5. Add *RTKEverywhere.csv* partition table to the Arduino partitions folder. It should look something like
22+
23+
C:\Users\\[user name]\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.1\tools\partitions\RTKEverywhere.csv
24+
25+
This will increase the program partitions, as well as the SPIFFs partition to utilize the full 16MB of flash.
26+
27+
6. Compile using the following command
28+
29+
arduino-cli compile 'Firmware/RTK_Everywhere' --build-property build.partitions=RTKEverywhere --build-property upload.maximum_size=3145728 --fqbn esp32:esp32:esp32:FlashSize=16M,PSRAM=enabled
30+
31+
8. Once compiled, upload to the device using the following command where `[COM_PORT]` is the COM port on which the RTK device is located (ie `COM42`).
32+
33+
arduino-cli upload -p [COM_PORT] --fqbn esp32:esp32:esp32:UploadSpeed=512000,FlashSize=16M 'Firmware/RTK_Everywhere'
34+
35+
If you are seeing the error:
36+
37+
> text section exceeds available space ...
38+
39+
You have either not replaced the partition file correctly or failed to include the 'upload.maximum_size' argument in your compile command. See steps 4 through 6 above.
40+
41+
**Note:** There are a variety of compile guards (COMPILE_WIFI, COMPILE_AP, etc) at the top of RTK_Everywhere.ino that can be commented out to remove them from compilation. This will greatly reduce the firmware size and allow for faster development of functions that do not rely on these features (serial menus, system configuration, logging, etc).
42+
43+
### Ubuntu 20.04
44+
45+
#### Virtual Machine
46+
47+
Execute the following commands to create the Linux virtual machine:
48+
49+
1. Using a browser, download the Ubuntu 20.04 Desktop image
50+
51+
2. virtualbox
52+
53+
1. Click on the new button
54+
2. Specify the machine Name, e.g.: Sparkfun_RTK_20.04
55+
3. Select Type: Linux
56+
4. Select Version: Ubuntu (64-bit)
57+
5. Click the Next> button
58+
6. Select the memory size: 7168
59+
7. Click the Next> button
60+
8. Click on Create a virtual hard disk now
61+
9. Click the Create button
62+
10. Select VDI (VirtualBox Disk Image)
63+
11. Click the Next> button
64+
12. Select Dynamically allocated
65+
13. Click the Next> button
66+
14. Select the disk size: 128 GB
67+
15. Click the Create button
68+
16. Click on Storage
69+
17. Click the empty CD icon
70+
18. On the right-hand side, click the CD icon
71+
19. Click on Choose a disk file...
72+
20. Choose the ubuntu-20.04... iso file
73+
21. Click the Open button
74+
22. Click on Network
75+
23. Under 'Attached to:' select Bridged Adapter
76+
24. Click the OK button
77+
25. Click the Start button
78+
79+
3. Install Ubuntu 20.04
80+
81+
4. Log into Ubuntu
82+
83+
5. Click on Activities
84+
85+
6. Type terminal into the search box
86+
87+
7. Optionally install the SSH server
88+
89+
1. In the terminal window
90+
1. sudo apt install -y net-tools openssh-server
91+
2. ifconfig
92+
93+
Write down the IP address
94+
95+
2. On the PC
96+
1. ssh-keygen -t rsa -f ~/.ssh/Sparkfun_RTK_20.04
97+
2. ssh-copy-id -o IdentitiesOnly=yes -i ~/.ssh/Sparkfun_RTK_20.04 <username>@<IP address>
98+
3. ssh -Y <username>@<IP address>
99+
100+
#### Build Environment
101+
102+
Execute the following commands to create the build environment for the SparkFun RTK Everywhere Firmware:
103+
104+
1. sudo adduser $USER dialout
105+
2. sudo shutdown -r 0
106+
107+
Reboot to ensure that the dialout privilege is available to the user
108+
109+
3. sudo apt update
110+
4. sudo apt install -y git gitk git-cola minicom python3-pip
111+
5. sudo pip3 install pyserial
112+
6. mkdir ~/SparkFun
113+
7. mkdir ~/SparkFun/esptool
114+
8. cd ~/SparkFun/esptool
115+
9. git clone https://github.com/espressif/esptool .
116+
10. cd ~/SparkFun
117+
11. nano serial-port.sh
118+
119+
Insert the following text into the file:
120+
121+
```C++
122+
#!/bin/bash
123+
# serial-port.sh
124+
#
125+
# Shell script to read the serial data from the RTK Express ESP32 port
126+
#
127+
# Parameters:
128+
# 1: ttyUSBn
129+
#
130+
sudo minicom -b 115200 -8 -D /dev/$1 < /dev/tty
131+
```
132+
133+
12. chmod +x serial-port.sh
134+
13. nano new-firmware.sh
135+
136+
Insert the following text into the file:
137+
138+
```C++
139+
#!/bin/bash
140+
# new-firmware.sh
141+
#
142+
# Shell script to load firmware into the RTK Express via the ESP32 port
143+
#
144+
# Parameters:
145+
# 1: ttyUSBn
146+
# 2: Firmware file
147+
#
148+
sudo python3 ~/SparkFun/RTK_Binaries/Uploader_GUI/esptool.py --chip esp32 --port /dev/$1 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect \
149+
0x1000 ~/SparkFun/RTK_Binaries/bin/RTK_Surveyor.ino.bootloader.bin \
150+
0x8000 ~/SparkFun/RTK_Binaries/bin/RTK_Surveyor_Partitions_16MB.bin \
151+
0xe000 ~/SparkFun/RTK_Binaries/bin/boot_app0.bin \
152+
0x10000 $2
153+
```
154+
155+
14. chmod +x new-firmware.sh
156+
15. nano new-firmware-4mb.sh
157+
158+
Insert the following text into the file:
159+
160+
```C++
161+
#!/bin/bash
162+
# new-firmware-4mb.sh
163+
#
164+
# Shell script to load firmware into the 4MB RTK Express via the ESP32 port
165+
#
166+
# Parameters:
167+
# 1: ttyUSBn
168+
# 2: Firmware file
169+
#
170+
sudo python3 ~/SparkFun/RTK_Binaries/Uploader_GUI/esptool.py --chip esp32 --port /dev/$1 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect \
171+
0x1000 ~/SparkFun/RTK_Binaries/bin/RTK_Surveyor.ino.bootloader.bin \
172+
0x8000 ~/SparkFun/RTK_Binaries/bin/RTK_Surveyor_Partitions_4MB.bin \
173+
0xe000 ~/SparkFun/RTK_Binaries/bin/boot_app0.bin \
174+
0x10000 $2
175+
```
176+
177+
16. chmod +x new-firmware-4mb.sh
178+
179+
Get the SparkFun RTK Everywhere Firmware sources
180+
181+
17. mkdir ~/SparkFun/RTK
182+
18. cd ~/SparkFun/RTK
183+
19. git clone https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware .
184+
185+
Get the SparkFun RTK binaries
186+
187+
20. mkdir ~/SparkFun/RTK_Binaries
188+
21. cd ~/SparkFun/RTK_Binaries
189+
22. git clone https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware_Binaries.git .
190+
191+
Install the Arduino IDE
192+
193+
23. mkdir ~/SparkFun/arduino
194+
24. cd ~/SparkFun/arduino
195+
25. wget https://downloads.arduino.cc/arduino-1.8.15-linux64.tar.xz
196+
26. tar -xvf ./arduino-1.8.15-linux64.tar.xz
197+
27. cd arduino-1.8.15/
198+
28. sudo ./install.sh
199+
200+
Add the ESP32 support
201+
202+
29. Arduino
203+
204+
1. Click on File in the menu bar
205+
2. Click on Preferences
206+
3. Go down to the Additional Boards Manager URLs text box
207+
4. Only if the textbox already has a value, go to the end of the value or values and add a comma
208+
5. Add the link: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
209+
6. Note the value in Sketchbook location
210+
7. Click the OK button
211+
8. Click on File in the menu bar
212+
9. Click on Quit
213+
214+
Get the required external libraries, then add to the Sketchbook location from above
215+
216+
30. cd ~/Arduino/libraries
217+
31. mkdir AsyncTCP
218+
32. cd AsyncTCP/
219+
33. git clone https://github.com/me-no-dev/AsyncTCP.git .
220+
34. cd ..
221+
35. mkdir ESPAsyncWebServer
222+
36. cd ESPAsyncWebServer
223+
37. git clone https://github.com/me-no-dev/ESPAsyncWebServer .
224+
225+
Connect the Config ESP32 port of the RTK to a USB port on the computer
226+
227+
38. ls /dev/ttyUSB*
228+
229+
Enable the libraries in the Arduino IDE
230+
231+
39. Arduino
232+
233+
1. From the menu, click on File
234+
2. Click on Open...
235+
3. Select the ~/SparkFun/RTK/Firmware/RTK_Surveyor/RTK_Surveyor.ino file
236+
4. Click on the Open button
237+
238+
Select the ESP32 development module
239+
240+
5. From the menu, click on Tools
241+
6. Click on Board
242+
7. Click on Board Manager…
243+
8. Click on esp32
244+
9. Select version 2.0.2
245+
10. Click on the Install button in the lower right
246+
11. Close the Board Manager...
247+
12. From the menu, click on Tools
248+
13. Click on Board
249+
14. Click on ESP32 Arduino
250+
15. Click on ESP32 Dev Module
251+
252+
Load the required libraries
253+
254+
16. From the menu, click on Tools
255+
17. Click on Manage Libraries…
256+
18. For each of the following libraries:
257+
258+
1. Locate the library
259+
2. Click on the library
260+
3. Select the version listed in the compile-rtk-firmware.yml file for the [main](https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware/blob/main/.github/workflows/compile-rtk-firmware.yml) or the [release_candidate](https://github.com/sparkfun/SparkFun_RTK_Everywhere_Firmware/blob/release_candidate/.github/workflows/compile-rtk-firmware.yml) branch
261+
4. Click on the Install button in the lower right
262+
263+
Library List:
264+
265+
* ArduinoJson
266+
* ESP32Time
267+
* ESP32-OTA-Pull
268+
* ESP32_BleSerial
269+
* Ethernet
270+
* JC_Button
271+
* MAX17048 - Used for “Test Sketch/Batt_Monitor”
272+
* PubSubClient
273+
* SdFat
274+
* SparkFun LIS2DH12 Arduino Library
275+
* SparkFun MAX1704x Fuel Gauge Arduino Library
276+
* SparkFun Qwiic OLED Graphics Library
277+
* SparkFun u-blox GNSS v3
278+
* SparkFun_WebServer_ESP32_W5500
279+
280+
19. Click on the Close button
281+
282+
Select the terminal port
283+
284+
20. From the menu, click on Tools
285+
21. Click on Port, Select the port that was displayed in step 38 above
286+
22. Select /dev/ttyUSB0
287+
23. Click on Upload Speed
288+
24. Select 230400
289+
290+
Setup the partitions for the 16 MB flash
291+
292+
25. From the menu, click on Tools
293+
26. Click on Flash Size
294+
27. Select 16MB
295+
28. From the menu, click on Tools
296+
29. Click on Partition Scheme
297+
30. Click on 16M Flash (3MB APP/9MB FATFS)
298+
31. From the menu click on File
299+
32. Click on Quit
300+
301+
40. cd ~/SparkFun/RTK/
302+
41. cp Firmware/app3M_fat9M_16MB.csv ~/.arduino15/packages/esp32/hardware/esp32/2.0.2/tools/partitions/app3M_fat9M_16MB.csv

0 commit comments

Comments
 (0)