Skip to content

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

Closed
@JasonWong08

Description

@JasonWong08

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions