Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Replace macro names of board variants containing dashes (-) with underscores (_) #7466

supcik started this conversation in Ideas
Discussion options

There are still many Arduino board variants with a dash in the name. For example, "ttgo-lora32-v1" or "lolin32-lite".

In CMakeLists.txt, this variant name is capitalized and then a macro -DARDUINO_${idf_target_caps}_DEV is defined. However, the C preprocessor does not like macro names with dashes. According to the documentation : "An identifier is the same as an identifier in C: any sequence of letters, digits, or underscores, which begins with a letter or underscore."

So, my suggestion is to replace the dashed (-) with an underscore (_) in the macro definition. This could be implemented in the CMakeLists.txt file as :

string(REPLACE "-" "_" idf_target_for_macro "${idf_target_caps}")
target_compile_options(${COMPONENT_TARGET} PUBLIC
    ...
    -DARDUINO_${idf_target_for_macro}_DEV
    ...

I already made some tests, and it seems to work. Does someone see a problem with this idea? If no, I would be happy to propose a pull request with this change.

Note that this problem was also addresses in PlatformIO : platformio/platform-espressif32#81

You must be logged in to vote

Replies: 2 comments · 3 replies

Comment options

Any feedback to this @SuGlider / @me-no-dev?

You must be logged in to vote
0 replies
Comment options

Shall I create an issue from this discussion and offer a Pull Request?

You must be logged in to vote
3 replies
@me-no-dev
Comment options

yes, please do so :)

@supcik
Comment options

OK. See issue #7499.

@supcik
Comment options

and PR #7500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💡
Ideas
Labels
None yet
3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.