Skip to content

Commit 57b0f58

Browse files
authored
Merge pull request #346 from LeeLeahy2/makefile
Use a common partition file during the build
2 parents b08bb9c + 78b0996 commit 57b0f58

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

Firmware/RTK_Everywhere/makefile

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,28 @@
1010

1111
# Uncomment all five lines for a complete update
1212
#EXECUTABLES = arduino-config lib-update
13-
EXECUTABLES += partition
14-
EXECUTABLES += patch
15-
EXECUTABLES += form
1613
EXECUTABLES += RTK
1714

15+
PARTITION_CSV_FILE=RTKEverywhere
16+
17+
# Windows NT
18+
ifeq ($(OS),Windows_NT)
19+
BLE_PATCH_DST_PATH=C:\Users\$(USERNAME)\Documents\Arduino\libraries\ESP32_BleSerial\src\BleSerial.cpp
20+
BLE_PATCH_SRC_PATH=Patch\BleSerial.cpp
21+
COPY=copy
22+
PARTITION_DST_PATH=C:\Users\$(USERNAME)\AppData\Local\Arduino15\packages\esp32\hardware\esp32\$(ESP_CORE_VERSION)\tools\partitions\$(PARTITION_CSV_FILE).csv
23+
PARTITION_SRC_PATH=..\$(PARTITION_CSV_FILE).csv
24+
25+
# Linux
26+
else
27+
BLE_PATCH_DST_PATH=~/Arduino/libraries/ESP32_BleSerial/src/BleSerial.cpp
28+
BLE_PATCH_SRC_PATH=Patch/BleSerial.cpp
29+
COPY=cp
30+
PARTITION_DST_PATH=~/.arduino15/packages/esp32/hardware/esp32/$(ESP_CORE_VERSION)/tools/partitions/$(PARTITION_CSV_FILE).csv
31+
PARTITION_SRC_PATH=../$(PARTITION_CSV_FILE).csv
32+
33+
endif
34+
1835
##########
1936
# Buid tools and rules
2037
##########
@@ -53,7 +70,7 @@ lib-update:
5370
5471
"SdFat"@2.1.1 \
5572
"SparkFun BQ40Z50 Battery Manager Arduino Library"@1.0.0 \
56-
"SparkFun Extensible Message Parser"@1.0.0 \
73+
"SparkFun Extensible Message Parser"@1.0.1 \
5774
"SparkFun IM19 IMU Arduino Library"@1.0.1 \
5875
"SparkFun LIS2DH12 Arduino Library"@1.0.3 \
5976
"SparkFun MAX1704x Fuel Gauge Arduino Library"@1.0.4 \
@@ -63,38 +80,27 @@ lib-update:
6380
"SparkFun UM980 Triband RTK GNSS Arduino Library"@1.0.4 \
6481
6582

66-
.PHONY: partition
6783

68-
partition:
69-
ifeq ($(OS),Windows_NT)
70-
copy ..\RTKEverywhere.csv C:\Users\$(USERNAME)\AppData\Local\Arduino15\packages\esp32\hardware\esp32\$(ESP_CORE_VERSION)\tools\partitions\RTKEverywhere.csv
71-
else
72-
# Linux may need something like:
73-
cp ../RTKEverywhere.csv ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_CORE_VERSION)/tools/partitions/RTKEverywhere.csv
74-
endif
84+
$(PARTITION_DST_PATH): $(PARTITION_SRC_PATH)
85+
$(COPY) $(PARTITION_SRC_PATH) $(PARTITION_DST_PATH)
7586

76-
patch: Patch/*
77-
ifeq ($(OS),Windows_NT)
78-
copy Patch\BleSerial.cpp C:\Users\$(USERNAME)\Documents\Arduino\libraries\ESP32_BleSerial\src\BleSerial.cpp
79-
else
80-
# Linux may need something like:
81-
cp Patch/BleSerial.cpp ~/Arduino/libraries/ESP32_BleSerial/src/BleSerial.cpp
82-
endif
87+
$(BLE_PATCH_DST_PATH): $(BLE_PATCH_SRC_PATH)
88+
$(COPY) $(BLE_PATCH_SRC_PATH) $(BLE_PATCH_DST_PATH)
8389

8490
DEBUG_LEVEL=debug
8591
ENABLE_DEVELOPER=false
8692
FIRMWARE_VERSION_MAJOR=99
8793
FIRMWARE_VERSION_MINOR=99
8894
POINTPERFECT_TOKEN=
8995

90-
form: AP-Config/* AP-Config/src/* AP-Config/src/fonts/*
96+
form.h: AP-Config/* AP-Config/src/* AP-Config/src/fonts/*
9197
python ../Tools/index_html_zipper.py AP-Config/index.html form.h
9298
python ../Tools/main_js_zipper.py AP-Config/src/main.js form.h
9399

94-
RTK: RTK_Everywhere.ino *.ino *.h
100+
RTK: RTK_Everywhere.ino *.ino *.h $(PARTITION_DST_PATH) $(BLE_PATCH_DST_PATH)
95101
arduino-cli compile --fqbn "esp32:esp32:esp32":DebugLevel=$(DEBUG_LEVEL),PSRAM=enabled RTK_Everywhere.ino \
96102
--warnings default \
97-
--build-property build.partitions=RTKEverywhere \
103+
--build-property build.partitions=$(PARTITION_CSV_FILE) \
98104
--build-property upload.maximum_size=6291456 \
99105
--build-property "compiler.cpp.extra_flags=-MMD -c \"-DPOINTPERFECT_TOKEN=$(POINTPERFECT_TOKEN)\" \"-DFIRMWARE_VERSION_MAJOR=$(FIRMWARE_VERSION_MAJOR)\" \"-DFIRMWARE_VERSION_MINOR=$(FIRMWARE_VERSION_MINOR)\" \"-DENABLE_DEVELOPER=$(ENABLE_DEVELOPER)\"" \
100106
--export-binaries
@@ -126,6 +132,7 @@ upload: build/esp32.esp32.esp32/$(SKETCH).bin
126132
0x8000 $(BOOT_LOADER_PATH)/RTK_Surveyor_Partitions_16MB.bin \
127133
0xe000 $(BOOT_LOADER_PATH)/boot_app0.bin \
128134
0x10000 $<
135+
~/SparkFun/serial-115200.sh ttyUSB0
129136

130137
########
131138
# Clean the build directory

0 commit comments

Comments
 (0)