zorxx / bmp180

MIT License
0 stars 0 forks source link

__linux__ vs ESP_PLATFORM #2

Closed hOff007 closed 2 months ago

hOff007 commented 3 months ago

Working with bmp180 lib on Debian 12, the include file is always bmp180/i2c_linux.h, even though the ESP_PLATFORM is defined.

zorxx commented 3 months ago

What version of esp-idf are you using? Does this happen when building the application in the example/esp-idf directory in this repository?

hOff007 commented 3 months ago

Hello I'm using 5.2 version. I copy/paste the app_main func and define from your example and put it on my dev apps. Basically I guess the issue could be solved if you put, in the if-else defines, the ESP_PLATFORM first, to avoid the linux Thanks for your answer and ... time H+

Le mer. 3 juil. 2024 à 05:44, zorxx @.***> a écrit :

What version of esp-idf are you using? Does this happen when building the application in the example/esp-idf directory in this repository?

— Reply to this email directly, view it on GitHub https://github.com/zorxx/bmp180/issues/2#issuecomment-2205024707, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGTOE3AZGY4R5TDOXMTJYATZKNXTLAVCNFSM6AAAAABKIK7TJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBVGAZDINZQG4 . You are receiving this because you authored the thread.Message ID: @.***>

zorxx commented 3 months ago

I built the example/esp-idf application successfully under Debain 12 with esp-idf v5.2 using esp32 and esp32-s3 target devices, so I believe there is an issue with the way you are using the bmp180 component. To add bmp180 support to your application, add the component to your project with the idf.py add-component function. There are no additional #defines necessary. The esp-idf toolchain does not define linux, so it's getting defined somewhere else in your application.

hOff007 commented 2 months ago

Thanks a lot. The linux is defined by gcc on debian, I guess this is a standard definition. The issue is related to the struct i2c_lowlevel_config. "linux" and "esp_platform" files are different. The pin_sda, pin_scl and port aren't defined on i2c_linux.h. In fact the component can be used as is, as long as the compiler sent back only a warning

Le jeu. 4 juil. 2024 à 21:57, zorxx @.***> a écrit :

I built the example/esp-idf application successfully under Debain 12 with esp-idf v5.2 using esp32 and esp32-s3 target devices, so I believe there is an issue with the way you are using the bmp180 component. To add bmp180 support to your application, add the component to your project with the idf.py add-component function. There are no additional #defines necessary. The esp-idf toolchain does not define linux, so it's getting defined somewhere else in your application.

— Reply to this email directly, view it on GitHub https://github.com/zorxx/bmp180/issues/2#issuecomment-2209509030, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGTOE3DG34U2LZ6JNFTZVXDZKWSJ7AVCNFSM6AAAAABKIK7TJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBZGUYDSMBTGA . You are receiving this because you authored the thread.Message ID: @.***>

zorxx commented 2 months ago

The xtensa esp32 gcc does not define linux. This can be verified by running the command:

echo | ~/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc -dM -E -

The output of this command is a list of all preprocessor definitions for the xtensa esp32 compiler. linux is not in the list. As long as you're building under an esp-idf environment, the host toolchain (in your case, debian) is not involved in compiling the bmp180 library and linux is not defined.