Skip to content

Commit 06f34ed

Browse files
authored
Board ID as build flag (#8634)
* Board ID as build flag When using IDE or `arduino-cli board list`, show full board name and FQBN ``` $ arduino-cli.exe board list Port Protocol Type Board Name FQBN Core xxx.xxx.x.xxx network Network Port LOLIN(WEMOS) D1 R2 & mini esp8266com:esp8266:d1_mini esp8266com:esp8266 ``` Also add `description` field to the mDNS response containing the original `{build.board}` string value. resolve #7759 * does not work with recent ide (?) * fixup! does not work with recent ide (?)
1 parent e149829 commit 06f34ed

File tree

4 files changed

+10
-19
lines changed

4 files changed

+10
-19
lines changed

libraries/ESP8266mDNS/src/LEAmDNS.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
#include <lwip/igmp.h>
3232
#include <lwip/prot/dns.h>
3333

34+
// should be defined at build time
35+
#ifndef ARDUINO_BOARD_ID
36+
#define ARDUINO_BOARD_ID "generic"
37+
#endif
38+
3439
namespace esp8266
3540
{
3641

@@ -40,16 +45,6 @@ namespace esp8266
4045
namespace MDNSImplementation
4146
{
4247

43-
/**
44-
STRINGIZE
45-
*/
46-
#ifndef STRINGIZE
47-
#define STRINGIZE(x) #x
48-
#endif
49-
#ifndef STRINGIZE_VALUE_OF
50-
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
51-
#endif
52-
5348
/**
5449
INTERFACE
5550
*/
@@ -1258,7 +1253,7 @@ namespace MDNSImplementation
12581253
{
12591254
if ((!addServiceTxt(hService, "tcp_check", "no"))
12601255
|| (!addServiceTxt(hService, "ssh_upload", "no"))
1261-
|| (!addServiceTxt(hService, "board", STRINGIZE_VALUE_OF(ARDUINO_BOARD)))
1256+
|| (!addServiceTxt(hService, "board", ARDUINO_BOARD_ID))
12621257
|| (!addServiceTxt(hService, "auth_upload", (p_bAuthUpload) ? "yes" : "no")))
12631258
{
12641259
removeService(hService);

libraries/ESP8266mDNS/src/LEAmDNS.h

-5
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,6 @@ namespace esp8266
132132
namespace MDNSImplementation
133133
{
134134

135-
// this should be defined at build time
136-
#ifndef ARDUINO_BOARD
137-
#define ARDUINO_BOARD "generic"
138-
#endif
139-
140135
#define MDNS_IP4_SUPPORT
141136
#if LWIP_IPV6
142137
//#define MDNS_IP6_SUPPORT

platform.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ recipe.hooks.linking.prelink.3.pattern="{compiler.path}{compiler.c.cmd}" -CC -E
128128
recipe.hooks.linking.prelink.4.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} {build.mmuflags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld"
129129

130130
## Compile c files
131-
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
131+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_BOARD_ID="{_id}" {build.led} {build.flash_flags} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
132132

133133
## Compile c++ files
134-
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
134+
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_BOARD_ID="{_id}" {build.led} {build.flash_flags} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
135135

136136
## Compile S files
137-
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" {build.led} {build.flash_flags} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
137+
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -D{build.sdk}=1 -DF_CPU={build.f_cpu} {build.lwip_flags} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_BOARD_ID="{_id}" {build.led} {build.flash_flags} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
138138

139139
## Create archives
140140
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"

tools/platformio-build.py

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def scons_patched_match_splitext(path, suffixes=None):
127127
"_GNU_SOURCE",
128128
("ARDUINO", 10805),
129129
("ARDUINO_BOARD", '\\"PLATFORMIO_%s\\"' % env.BoardConfig().id.upper()),
130+
("ARDUINO_BOARD_ID", '\\"%s\\"' % env.BoardConfig().id),
130131
"FLASHMODE_${BOARD_FLASH_MODE.upper()}",
131132
"LWIP_OPEN_SRC"
132133
],

0 commit comments

Comments
 (0)