Skip to content

fix NodeMCU-32S .build.board property #812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2017
Merged

fix NodeMCU-32S .build.board property #812

merged 1 commit into from
Nov 6, 2017

Conversation

CONSULitAS
Copy link
Contributor

The .build.board=xx proptery is used for generating a macro named "ARDUINO_xxx".

C macro names should never have a "-" sign.

  • current: ARDUINO_NodeMCU-32S
  • should be: ARDUINO_=NodeMCU_32S

The .build.board=xx proptery is used for generating a macro named "ARDUINO_xxx".

C macro names should never have a "-" sign.

* current: ARDUINO_NodeMCU-32S
* should be: ARDUINO_=NodeMCU_32S
@stickbreaker
Copy link
Contributor

What about the variant field? Shouldn't it also be changed?
Chuck.

@CONSULitAS
Copy link
Contributor Author

What about the variant field? Shouldn't it also be changed?

Not necessary for correct board recognition in Arduino.

Compare ESP8266/Arduino boards.txt:

...
d1_mini.build.mcu=esp8266
d1_mini.build.f_cpu=80000000L
d1_mini.build.board=ESP8266_WEMOS_D1MINI
d1_mini.build.core=esp8266
d1_mini.build.variant=d1_mini
...

You can detect that board type in your code by

  // correct board in IDE selected?
  #ifndef ARDUINO_ESP8266_WEMOS_D1MINI
    #error Please select board "WeMos D1 R2 & mini"!
  #endif

With the current config you need

// NodeMCU ESP-32S - V1.1 LED is HIGH active
#ifdef ARDUINO_NodeMCU-32S
  #define LEDPIN 2
#endif

which is really weird because of the "-" sign in the used macro 😁 !

This really works (just tested half an hour ago with a generic blink sketch) but you could think its equivalent to ARDUINO_NodeMCU - 32S with spaces which is confusing and horribly error prone...

But I think it would be nice to clean up the config a bit.

@stickbreaker
Copy link
Contributor

Yes, I agree. fix all the small things and the big things will take care of themselves!

@CONSULitAS
Copy link
Contributor Author

What about the variant field? Shouldn't it also be changed?

Just one more thing:

The variant field is used to build the path to the variant config. For the mentioned WeMos D1 mini you get "-I/Users/xxx/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.0-rc2/variants/d1_mini" as an compiler option. Just switch on the detailed output while compiling.

Here you see the effect of the build.board parameter, too:
*-DARDUINO_ESP8266_WEMOS_D1MINI
*-DARDUINO_BOARD="ESP8266_WEMOS_D1MINI" (just forgot the ARDUINO_BOARD macro 😄 should be there, too)

For NodeMCU-32S we get:

  • -DARDUINO_NodeMCU-32S
  • -I/Users/xxx/Documents/Arduino/hardware/espressif/esp32/variants/nodemcu-32s"
  • -DARDUINO_BOARD="NodeMCU-32S" is missing if you compare to ESP8266/Arduino (see platform.txt) ➡️ other PR to come

BTW: The compiler throws <command-line>:0:16: warning: ISO C++11 requires whitespace after the macro name for each call. This seems to be because of the minus sign.

Conclusion: No, we should not change the variant field or we have to change the folder structure, too.

me-no-dev pushed a commit that referenced this pull request Nov 6, 2017
* fix NodeMCU-32S .build.board property

The .build.board=xx proptery is used for generating a macro named "ARDUINO_xxx".

C macro names should never have a "-" sign.

* current: ARDUINO_NodeMCU-32S
* should be: ARDUINO_=NodeMCU_32S

* fix compiler flags to be compatible to ESP8622/Arduino

see also "fix NodeMCU-32S .build.board property" #812 (#812 (comment))

`-DARDUINO_BOARD={build.board}` **is missing**

* Revert "fix NodeMCU-32S .build.board property"

This reverts commit ea57b14.
@me-no-dev me-no-dev merged commit 21026e2 into espressif:master Nov 6, 2017
blue-2357 pushed a commit to blue-2357/arduino-esp32 that referenced this pull request Jul 17, 2024
* fix NodeMCU-32S .build.board property

The .build.board=xx proptery is used for generating a macro named "ARDUINO_xxx".

C macro names should never have a "-" sign.

* current: ARDUINO_NodeMCU-32S
* should be: ARDUINO_=NodeMCU_32S

* fix compiler flags to be compatible to ESP8622/Arduino

see also "fix NodeMCU-32S .build.board property" #812 (espressif/arduino-esp32#812 (comment))

`-DARDUINO_BOARD={build.board}` **is missing**

* Revert "fix NodeMCU-32S .build.board property"

This reverts commit ea57b1496a2e87d3977a31a29a4cf7d63216f008.
dash0820 added a commit to dash0820/arduino-esp32-stripped that referenced this pull request Mar 10, 2025
* fix NodeMCU-32S .build.board property

The .build.board=xx proptery is used for generating a macro named "ARDUINO_xxx".

C macro names should never have a "-" sign.

* current: ARDUINO_NodeMCU-32S
* should be: ARDUINO_=NodeMCU_32S

* fix compiler flags to be compatible to ESP8622/Arduino

see also "fix NodeMCU-32S .build.board property" #812 (espressif/arduino-esp32#812 (comment))

`-DARDUINO_BOARD={build.board}` **is missing**

* Revert "fix NodeMCU-32S .build.board property"

This reverts commit ea57b1496a2e87d3977a31a29a4cf7d63216f008.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants