Skip to content

Define the macro CONFIG_DISABLE_HAL_LOCKS in sdkconfig.h, cause compilation error #6000

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

Closed
JasonWong08 opened this issue Dec 10, 2021 · 5 comments
Labels
Resolution: Duplicate Issue is a duplicate of another issue Status: Solved

Comments

@JasonWong08
Copy link

Hardware:

Board: ESP32 Dev Module
Core Installation version: 2.0.1
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 10

Description:

Define the macro CONFIG_DISABLE_HAL_LOCKS in sdkconfig.h as following:
#define CONFIG_DISABLE_HAL_LOCKS 1

It will cause compilation error:
C:\Users\wjf-1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32\esp32-hal-i2c-slave.c: In function 'i2cSlaveDeinit':
C:\Users\wjf-1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32\esp32-hal-i2c-slave.c:363:12: error: 'i2c_slave_struct_t' {aka 'struct i2c_slave_struct_t'} has no member named 'lock'
if(!i2c->lock){
^~
C:\Users\wjf-1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32\esp32-hal-i2c-slave.c: In function 'i2cSlaveWrite':
C:\Users\wjf-1\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.1\cores\esp32\esp32-hal-i2c-slave.c:380:12: error: 'i2c_slave_struct_t' {aka 'struct i2c_slave_struct_t'} has no member named 'lock'
if(!i2c->lock){
^~

So I suggest add conditional compilation as following:

#if !CONFIG_DISABLE_HAL_LOCKS    //Line 363
    if(!i2c->lock){
        log_e("Lock is not initialized! Did you call i2c_slave_init()?");
        return ESP_ERR_NO_MEM;
    }
#endif

#if !CONFIG_DISABLE_HAL_LOCKS    //Line 382
    if(!i2c->lock){
        log_e("Lock is not initialized! Did you call i2c_slave_init()?");
        return ESP_ERR_NO_MEM;
    }
#endif
@atanisoft
Copy link
Collaborator

duplicate of #5943. Fixed on master but not in a release yet.

@VojtechBartoska VojtechBartoska added the Resolution: Duplicate Issue is a duplicate of another issue label Dec 10, 2021
@JasonWong08
Copy link
Author

Thanks a lot.

@JasonWong08
Copy link
Author

I checked the latest release (Core Installation version: 2.0.2), the following conditional compilation is not added yet, as follows:

#if !CONFIG_DISABLE_HAL_LOCKS    // in the function esp_err_t i2cSlaveDeinit(uint8_t num)
    if(!i2c->lock){
        log_e("Lock is not initialized! Did you call i2c_slave_init()?");
        return ESP_ERR_NO_MEM;
    }
#endif

#if !CONFIG_DISABLE_HAL_LOCKS    // in the function size_t i2cSlaveWrite(uint8_t num, const uint8_t *buf, uint32_t len, uint32_t timeout_ms)
    if(!i2c->lock){
        log_e("Lock is not initialized! Did you call i2c_slave_init()?");
        return ESP_ERR_NO_MEM;
    }
#endif

@JasonWong08 JasonWong08 reopened this Jan 14, 2022
@mrengineer7777
Copy link
Collaborator

See #6108. It should be in the next release.

@VojtechBartoska
Copy link
Contributor

Closing as duplicate which is already solved. Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Duplicate Issue is a duplicate of another issue Status: Solved
Projects
None yet
Development

No branches or pull requests

4 participants