Skip to content

Commit b7a8115

Browse files
massonalfpistm
authored andcommitted
feat: handle bootloaders
This adds a new keyword, BOOTLOADER, in set_board(). Cmake-wise, the bootloader targets replace the board targets, they are not feature targets to plug in.
1 parent 01a1064 commit b7a8115

File tree

511 files changed

+70688
-19063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

511 files changed

+70688
-19063
lines changed

cmake/boards_db.cmake

Lines changed: 69950 additions & 18468 deletions
Large diffs are not rendered by default.

cmake/scripts/update_boarddb.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ def boardstxt_filter(key) :
2828
# Midatronics.menu.upload_method.MassStorage=Mass Storage
2929
return True
3030

31-
# Remove upload_method also, that's out of our scope and requires more logic
32-
if len(key) >= 3 and key[2] == "upload_method" :
31+
# keep bootloader flags that impact the build
32+
if len(key) >= 6 \
33+
and key[1] == "menu" \
34+
and key[2] == "upload_method" :
35+
if key[3] != "build" :
36+
return False
3337
return True
3438

3539
return False
@@ -96,8 +100,12 @@ def regenerate_template(config, infile, outfile) :
96100
inherit_fam["menu"] = inherit_fam["menu"].copy()
97101
# del what you iterate over (otherwise you get infinite nesting)
98102
del inherit_fam["menu"]["pnum"]
103+
for u_meth, u_meth_cfg in inherit_fam.menu.upload_method.copy().items() :
104+
if "build" not in u_meth_cfg.keys() :
105+
del inherit_fam.menu.upload_method[u_meth]
99106

100107
for board, boardcfg in famcfg.menu.pnum.items() :
108+
boardcfg["_fpconf"] = get_fpconf(boardcfg)
101109
boardcfg.set_default_entries(inherit_fam)
102110

103111
inherit_board = boardcfg.copy()
@@ -116,7 +124,10 @@ def regenerate_template(config, infile, outfile) :
116124

117125
boardcfg.evaluate_entries()
118126

119-
boardcfg["_fpconf"] = get_fpconf(boardcfg)
120127
allboards[board] = boardcfg
128+
for mth, mthcfg in boardcfg.menu.upload_method.items() :
129+
if mth.startswith(("hid", "dfuo", "dfu2")) :
130+
mth = mth.removesuffix("Method")
131+
allboards[f"{board}_{mth}"] = mthcfg
121132

122133
regenerate_template(allboards, shargs.template, shargs.outfile)

cmake/set_board.cmake

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ function(set_board BOARD_ID)
55
updatedb() # updates board_db if needed
66
include(boards_db)
77

8+
set(KEYWORDS SERIAL USB XUSB VIRTIO BOOTLOADER)
9+
cmake_parse_arguments(PARSE_ARGV 1 BOARD "" "${KEYWORDS}" "")
10+
11+
if(DEFINED BOARD_UNPARSED_ARGUMENTS OR DEFINED BOARD_KEYWORDS_MISSING_VALUES)
12+
message(SEND_ERROR "Invalid call to set_board(); some arguments went unparsed")
13+
endif()
14+
15+
if(DEFINED BOARD_BOOTLOADER)
16+
set(BOARD_ID "${BOARD_ID}_${BOARD_BOOTLOADER}")
17+
endif()
18+
819
if (NOT TARGET ${BOARD_ID})
920
message(SEND_ERROR "Board ${BOARD_ID} not found. Maybe the board database is not up-to-date?")
1021
return()
@@ -16,13 +27,6 @@ function(set_board BOARD_ID)
1627
set(MCU ${${BOARD_ID}_MCU} PARENT_SCOPE)
1728
set(FPCONF ${${BOARD_ID}_FPCONF} PARENT_SCOPE)
1829

19-
set(KEYWORDS SERIAL USB XUSB VIRTIO)
20-
cmake_parse_arguments(PARSE_ARGV 1 BOARD "" "${KEYWORDS}" "")
21-
22-
if(DEFINED BOARD_UNPARSED_ARGUMENTS OR DEFINED BOARD_KEYWORDS_MISSING_VALUES)
23-
message(SEND_ERROR "Invalid call to set_board(); some arguments went unparsed")
24-
endif()
25-
2630
# if the user passed in an invalid value, then the target won't be found
2731
# and cmake will output an error message
2832
if(DEFINED BOARD_SERIAL)

cmake/templates/easy_cmake.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ set_board("{{"${BOARDNAME}"}}"
4040
# USB none / CDCgen / CDC / HID
4141
# XUSB FS / HS / HSFS
4242
# VIRTIO disable / generic / enabled
43+
# BOOTLOADER dfuo / dfu2 / hid
4344
)
4445

4546
include(overall_settings)

cores/arduino/CMakeLists.txt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,18 @@ target_link_libraries(core INTERFACE core_usage)
1919

2020

2121
add_library(core_bin STATIC EXCLUDE_FROM_ALL
22-
HardwareSerial.cpp
23-
IPAddress.cpp
24-
Print.cpp
25-
RingBuffer.cpp
26-
Stream.cpp
27-
Tone.cpp
28-
USBSerial.cpp
29-
VirtIOSerial.cpp
30-
WInterrupts.cpp
31-
WMath.cpp
32-
WSerial.cpp
33-
WString.cpp
3422
abi.cpp
3523
avr/dtostrf.c
3624
board.c
25+
core_debug.c
26+
HardwareSerial.cpp
3727
hooks.c
28+
IPAddress.cpp
3829
itoa.c
3930
main.cpp
4031
pins_arduino.c
32+
Print.cpp
33+
RingBuffer.cpp
4134
stm32/OpenAMP/libmetal/device.c
4235
stm32/OpenAMP/libmetal/generic/condition.c
4336
stm32/OpenAMP/libmetal/generic/cortexm/sys.c
@@ -74,11 +67,19 @@ add_library(core_bin STATIC EXCLUDE_FROM_ALL
7467
stm32/usb/usbd_desc.c
7568
stm32/usb/usbd_ep_conf.c
7669
stm32/usb/usbd_if.c
70+
Stream.cpp
71+
Tone.cpp
72+
USBSerial.cpp
73+
VirtIOSerial.cpp
74+
WInterrupts.cpp
7775
wiring_analog.c
7876
wiring_digital.c
7977
wiring_pulse.cpp
8078
wiring_shift.c
8179
wiring_time.c
80+
WMath.cpp
81+
WSerial.cpp
82+
WString.cpp
8283
)
8384
target_link_libraries(core_bin PUBLIC core_usage)
8485

libraries/SrcWrapper/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,4 @@ target_link_libraries(SrcWrapper INTERFACE
194194
SrcWrapper_bin
195195
$<TARGET_OBJECTS:SrcWrapper_bin>
196196
)
197+

variants/STM32F0xx/F030C6T/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ target_link_libraries(variant INTERFACE variant_usage)
1919

2020

2121
add_library(variant_bin STATIC EXCLUDE_FROM_ALL
22-
PeripheralPins.c
2322
generic_clock.c
23+
PeripheralPins.c
2424
variant_generic.cpp
2525
)
2626
target_link_libraries(variant_bin PUBLIC variant_usage)

variants/STM32F0xx/F030C8T/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ target_link_libraries(variant INTERFACE variant_usage)
1919

2020

2121
add_library(variant_bin STATIC EXCLUDE_FROM_ALL
22+
generic_clock.c
2223
PeripheralPins.c
2324
PeripheralPins_EEXTR_F030_V1.c
24-
generic_clock.c
2525
variant_EEXTR_F030_V1.cpp
2626
variant_generic.cpp
2727
)

variants/STM32F0xx/F030CCT/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ target_link_libraries(variant INTERFACE variant_usage)
1919

2020

2121
add_library(variant_bin STATIC EXCLUDE_FROM_ALL
22-
PeripheralPins.c
2322
generic_clock.c
23+
PeripheralPins.c
2424
variant_generic.cpp
2525
)
2626
target_link_libraries(variant_bin PUBLIC variant_usage)

variants/STM32F0xx/F030F4P/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ target_link_libraries(variant INTERFACE variant_usage)
1919

2020

2121
add_library(variant_bin STATIC EXCLUDE_FROM_ALL
22-
PeripheralPins.c
2322
generic_clock.c
23+
PeripheralPins.c
2424
variant_DEMO_F030F4.cpp
2525
variant_generic.cpp
2626
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy