implicit declaration of function

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

implicit declaration of function

Postby TomasCZ » Fri Jun 09, 2023 7:14 am

Dear all, I am trying to make working this example code for the slave: https://esp32tutorials.com/esp32-i2c-co ... Y2RHFZRQj8

But when trying to Build I receive the following error:
C:/Users/konec/sniffer_test2/main/main.c:51:5: error: implicit declaration of function 'gpio_pad_select_gpio'; did you mean 'esp_rom_gpio_pad_select_gpio'? [-Werror=implicit-function-declaration]
51 | gpio_pad_select_gpio(LED_PIN);
| ^~~~~~~~~~~~~~~~~~~~
| esp_rom_gpio_pad_select_gpio
C:/Users/konec/sniffer_test2/main/main.c:49:14: warning: unused variable 'on_command' [-Wunused-variable]
49 | uint8_t on_command[] = "LED_ON";
| ^~~~~~~~~~
cc1.exe: some warnings being treated as errors
[8/102] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D C:\Users\konec\sniffer_test2\build\bootloader\esp-idf\esptool_py && c:\Espressif\python_env\idf5.0_py3.8_env\Scripts\python.exe C:/Espressif/frameworks/esp-idf-v5.0.2-2/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 C:/Users/konec/sniffer_test2/build/bootloader/bootloader.bin"
Bootloader binary size 0x6700 bytes. 0x900 bytes (8%) free.
[24/101] Building C object esp-idf/protocomm/CMakeFiles/__idf_protocomm.dir/src/security/security1.c.obj
ninja: build stopped: subcommand failed.

* The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command ninja " terminated with exit code: 1.

Could someone help me what am I doing wrong, please ?

MicroController
Posts: 1136
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: implicit declaration of function

Postby MicroController » Fri Jun 09, 2023 8:53 am

Code: Select all

#include "rom/gpio.h"
will provide the declaration for the function.

However, using the higher-level GPIO API instead of the ROM function is likely the better option.

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

Re: implicit declaration of function

Postby TomasCZ » Fri Jun 09, 2023 1:52 pm

Thank youo. Looks it helped. I just replaced the "driver/gpio.h" with "rom/gpio.h".

Now I haveone one issue in Problmes saying "identifier "CONFIG_FREERTOS_HZ" is undefined C/C++(20) {LN 59, Col 86]" which is:

i2c_slave_read_buffer(i2c_slave_port, received_data, I2C_SLAVE_RX_BUF_LEN, 100 / portTICK_PERIOD_MS);

But that's probably a different story.

MicroController
Posts: 1136
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: implicit declaration of function

Postby MicroController » Fri Jun 09, 2023 2:25 pm

Try

Code: Select all

#include "freertos/FreeRTOS.h"
.

TomasCZ
Posts: 39
Joined: Tue Apr 25, 2023 5:19 am

Re: implicit declaration of function

Postby TomasCZ » Sat Jun 10, 2023 8:04 am

Sorry for beginners questions. I tried to add

Code: Select all

#include "freertos/FreeRTOS.h"
but the issue still persist.
IDF_1.jpg
IDF_1.jpg (20.61 KiB) Viewed 4070 times
When I click the yellow bulb I am redirected to the IntelliSense Configurations and when scrolling bit lower I see there is some issue with the path:
IDF_2.jpg
IDF_2.jpg (151.6 KiB) Viewed 4070 times

MicroController
Posts: 1136
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: implicit declaration of function

Postby MicroController » Sat Jun 10, 2023 10:00 am

Notice that there is a distinction to be made between what the compiler/build toolchain "sees" and what the IDE (/Intellisense) sees.
If you can successfully build your application then the build environment is set up correctly. Intellisense should be configured identically to the toolchain, otherwise it may show false warnings like in your case. - But even if Intellisense is set up correctly, it still won't see everything the way the compiler sees it during build, so spurious warnings in the IDE will keep popping up here and there.

That said, I don't know how the wrong paths ended up in your Intellisense configuration, or how to correct them and make sure they won't creep in again.

Who is online

Users browsing this forum: No registered users and 128 guests