Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

adamwilt
Posts: 13
Joined: Sun Dec 06, 2020 1:54 am

Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby adamwilt » Sun Dec 06, 2020 2:15 am

I'm trying to make arduino-esp32 work as a component of esp-idf, without any luck.

I've done a clean install of esp-idf, branch "release/v4.2", and then installed arduino-esp32 for use as component as described at https://github.com/espressif/arduino-es ... mponent.md, again specifying branch "idf-release/v4.2". This after getting the same error discussed at viewtopic.php?f=13&t=18037&p=67353&hili ... UNT#p67353 and thinking I might have a version mismatch between esp-ifd and arduino-esp32.

However, I now get the error:

Code: Select all

In file included from ../components/arduino/cores/esp32/esp32-hal.h:74,
                 from ../components/arduino/cores/esp32/Arduino.h:36,
                 from ../components/arduino/cores/esp32/base64.cpp:25:
../components/arduino/cores/esp32/esp32-hal-gpio.h:78:44: error: 'SOC_GPIO_PIN_COUNT' was not declared in this scope
 extern const esp32_gpioMux_t esp32_gpioMux[SOC_GPIO_PIN_COUNT];
                                            ^~~~~~~~~~~~~~~~~~
../components/arduino/cores/esp32/esp32-hal-gpio.h:78:44: note: suggested alternative: 'GPIO_PIN_COUNT'
I'm using the new, CMake-based build system.

What am I doing wrong, and how do I fix it?

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby chegewara » Sun Dec 06, 2020 4:59 pm

Currently branch "release/v4.2" is working with master branch of esp-idf.
When you switch to master branch, you may also have issue with WifiProv and LittleFS. In that case just edit CMakeLists.txt in arduino and remove them.

adamwilt
Posts: 13
Joined: Sun Dec 06, 2020 1:54 am

Re: Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby adamwilt » Tue Dec 08, 2020 3:20 am

With esp-idf -b master, and arduino-esp32 -b idf-release/4.2, I get the reverse error:

Code: Select all

In file included from /Users/adamwilt/esp/esp-idf/components/soc/include/soc/rtc_periph.h:17,
                 from /Users/adamwilt/esp/esp-idf/components/soc/esp32/include/soc/rtc.h:20,
                 from /Users/adamwilt/esp/esp-idf/components/bootloader_support/src/bootloader_common_loader.c:31:
/Users/adamwilt/esp/esp-idf/components/soc/include/soc/rtc_io_periph.h:103:44: error: 'GPIO_PIN_COUNT' undeclared here (not in a function); did you mean 'SOC_GPIO_PIN_COUNT'?
 extern const rtc_gpio_desc_t rtc_gpio_desc[GPIO_PIN_COUNT];
                                            ^~~~~~~~~~~~~~
                                            SOC_GPIO_PIN_COUNT

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby chegewara » Tue Dec 08, 2020 9:20 am

Please check that you have clean version arduino-esp32. I know it works, because i am using that combination right now.
Arduino:
On branch idf-release/v4.2
Your branch is up to date with 'origin/idf-release/v4.2'.

Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: CMakeLists.txt

no changes added to commit (use "git add" and/or "git commit -a")
esp-idf:
commit 178b122c145c19e94ac896197a3a4a9d379cd618 (HEAD -> master, origin/master, origin/HEAD)
Merge: a22704a8f 85cb1e8ca
Author: Mahavir Jain <mahavir@espressif.com>
Date: Wed Nov 18 13:39:01 2020 +0800

Merge branch 'bugfix/protocomm_http_print' into 'master'

protocomm_httpd: Change an info print to debug print as it isn't really required in the logs

See merge request espressif/esp-idf!11223
I tested in this moment to confirm it build.

adamwilt
Posts: 13
Joined: Sun Dec 06, 2020 1:54 am

Re: Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby adamwilt » Tue Dec 08, 2020 8:05 pm

Before I clone the repositories I delete their local root directories, so I'm starting fresh; I don't know how to make my versions much more clean than that (grin). For arduino-esp-32:
adamwilt@macOS1015vm arduino % git status
On branch idf-release/v4.2
Your branch is up to date with 'origin/idf-release/v4.2'.
For esp-idf:
adamwilt@macOS1015vm esp-idf % git status
On branch master
Your branch is up to date with 'origin/master'.
Removing LITTLEFS and/or WiFiProv has no effect; I still get the same error:
rtc_io_periph.h:103:44: error: 'GPIO_PIN_COUNT' undeclared here (not in a function); did you mean 'SOC_GPIO_PIN_COUNT'?
(Working from a fresh macOS 10.15.7 virtual machine image so that I can really start clean when setting up a new toolchain, using either the default python 2.7 or homebrew-installed python 3.8.6: no difference. "Pure" esp-idf programs build, flash, and run without problems; "pure" Arduino programs build, flash, and install without problems.)

tiritomba
Posts: 3
Joined: Thu Dec 10, 2020 6:31 pm

Re: Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby tiritomba » Thu Dec 10, 2020 6:41 pm

Hello!

I'm using Ubuntu and fighting with the exact same issue since a few days. Trying out several different combinations of branches for esp-idf and arduino-esp32. Currently it's the both on version 4.2 (release/v4.2, idf-release/v4.2) and the build results in:

Code: Select all

In file included from ../components/arduino/cores/esp32/esp32-hal.h:74,
                 from ../components/arduino/cores/esp32/Arduino.h:36,
                 from ../components/arduino/libraries/SD/src/sd_diskio.h:17,
                 from ../components/arduino/libraries/SD/src/sd_diskio.cpp:14:
../components/arduino/cores/esp32/esp32-hal-gpio.h:78:44: error: 'SOC_GPIO_PIN_COUNT' was not declared in this scope
 extern const esp32_gpioMux_t esp32_gpioMux[SOC_GPIO_PIN_COUNT];
                                            ^~~~~~~~~~~~~~~~~~
../components/arduino/cores/esp32/esp32-hal-gpio.h:78:44: note: suggested alternative: 'GPIO_PIN_COUNT'
 extern const esp32_gpioMux_t esp32_gpioMux[SOC_GPIO_PIN_COUNT];
                                            ^~~~~~~~~~~~~~~~~~
                                            GPIO_PIN_COUNT
[12/383] Building C object esp-idf/...nsole.dir/argtable3/argtable3.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
The missing declaration of SOC_GPIO_PIN_COUNT is in components/arduino/tools/sdk/esp32/include/soc/esp32/include/soc/soc_caps.h (for esp32). What I'm not getting yet is how this file should be included in the build, i.e. which mechanism takes care to make it known to the compiler? I could not find anything in this regards.

Certainly adding all missing includes manually - and I assume it won't be only a single one ... - could also lead to a final build. But this is for sure not the way it's supposed to work.

Any hint is appreciated!

cqh963852
Posts: 10
Joined: Fri Dec 11, 2020 1:17 pm

Re: Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby cqh963852 » Fri Dec 11, 2020 1:28 pm

I have meet the same problem.I didn't resolve it unitil now.

SOC_GPIO_PIN_COUNT is defined at soc_caps.h

and

esp32-hal-gpio.h has include soc_caps.h

esp32-hal.h has include esp32-hal-gpio.h

Code: Select all

SOC_GPIO_PIN_COUNT ->  soc_caps.h -> esp32-hal-gpio.h -> esp32-hal.h -> Arduino.h
but esp32-hal-gpio.h has also include esp32-hal.h .It looks strange.

tiritomba
Posts: 3
Joined: Thu Dec 10, 2020 6:31 pm

Re: Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby tiritomba » Sat Dec 12, 2020 7:41 am

Yes, but be careful. I just found out that "soc/soc_caps.h" is ambiguous:

1) in the arduino component
<projectfolder>/components/arduino/tools/sdk/esp32/include/soc/esp32/include/soc/soc_caps.h
(Here SOC_GPIO_PIN_COUNT is defined)

2) in esp-idf
/esp-idf/components/soc/soc/esp32/include/soc/soc_caps.h
(This one does not define SOC_GPIO_PIN_COUNT)

So, this name clash might be the problem. Eventually it depends on the order of the include directories for the compiler?

Maybe here a (diligent) renaming of the soc -dirs (e.g. to soc-arduino) could help? Or am I maybe completely wrong and this is not the problem at all?

Will try further, when time allows.


tiritomba
Posts: 3
Joined: Thu Dec 10, 2020 6:31 pm

Re: Using arduino-esp32 as a component: 'SOC_GPIO_PIN_COUNT' was not declared in this scope

Postby tiritomba » Sun Dec 13, 2020 6:48 pm

I'm not sure how this fact helps in fixing the problem that SOC_GPIO_PIN_COUNT is not defined.

Who is online

Users browsing this forum: No registered users and 62 guests