Skip to content
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

Build issues on esp-idf 5. #9

Open
r12f opened this issue Feb 11, 2023 · 2 comments
Open

Build issues on esp-idf 5. #9

r12f opened this issue Feb 11, 2023 · 2 comments

Comments

@r12f
Copy link
Contributor

r12f commented Feb 11, 2023

Hi Markus, really appreciate building this lib! I am trying to use this lib to make u8g2 working with esp32. And I am running into a few build issues.

Issue 1: I2C_NUM_1 is not defined, because esp32-c3 only have 1 i2c port.

Compiling .pio\build\seeed_xiao_esp32c3\components\u8g2-hal-esp-idf\src\u8g2_esp32_hal.o
components\u8g2-hal-esp-idf\src\u8g2_esp32_hal.c: In function 'u8g2_esp32_i2c_byte_cb':
components\u8g2-hal-esp-idf\include/u8g2_esp32_hal.h:20:24: error: 'I2C_NUM_1' undeclared (first use in this function); did you mean 'I2C_NUM_0'?
   20 | #define I2C_MASTER_NUM I2C_NUM_1     //  I2C port number for master dev

Issue 2: portTICK_RATE_MS is removed in later FreeRTOS.

Compiling .pio\build\seeed_xiao_esp32c3\u8g2_esp32_hal.o
X:\Code\homemon\firmwares\third_party\u8g2-hal-esp-idf\src\u8g2_esp32_hal.c: In function 'u8g2_esp32_i2c_byte_cb':
X:\Code\homemon\firmwares\third_party\u8g2-hal-esp-idf\src\u8g2_esp32_hal.c:185:61: error: 'portTICK_RATE_MS' undeclared (first use in this function); did you mean 'portTICK_PERIOD_MS'?
  185 |                                            I2C_TIMEOUT_MS / portTICK_RATE_MS));

Issue 3: HSPI_HOST is deprecated after esp32-s2.

components\u8g2-hal-esp-idf\src\u8g2_esp32_hal.c: In function 'u8g2_esp32_spi_byte_cb':
components\u8g2-hal-esp-idf\src\u8g2_esp32_hal.c:68:42: error: 'HSPI_HOST' undeclared (first use in this function); did you mean 'SPI3_HOST'?
   68 |       ESP_ERROR_CHECK(spi_bus_initialize(HSPI_HOST, &bus_config, 1));

Since these issues seems to be straight forward to fix, I directly went ahead and made a naïve PR here: #8. Please let me know how they looks and hopefully they makes sense to you!

@eehsx
Copy link

eehsx commented Mar 1, 2024

I had an issue when building u8g2 lib with ESP-IDF V5.2.

So I copy csrc and cppsrc into my components/u8g2.
And create CMakeLists.txt with :

set(COMPONENT_ADD_INCLUDEDIRS csrc)
file(GLOB COMPONENT_SRCS csrc/.c)
file(GLOB COMPONENT_HDRS csrc/
.h)

idf_component_register(SRCS ${COMPONENT_SRCS} ${COMPONENT_HDRS}
INCLUDE_DIRS "csrc" "cppsrc")

I hope this can help.

@thedeadliestcatch
Copy link

@eehsx Could you open a separate issue or even create a repo showcasing your working fix?

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

No branches or pull requests

3 participants