Skip to content

[BUG] MKS TinyBee build error: HAL.h: 'spinlock' was not declared in this scope #24440

@eduard-sukharev

Description

@eduard-sukharev

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

When attempting to build Marlin bugfix-2.1.x for MKS TinyBee board I get error

In file included from /home/kraplax/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/freertos/freertos/portable.h:94:0,
                 from /home/kraplax/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/freertos/freertos/FreeRTOS.h:105,
                 from /home/kraplax/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:32,
                 from Marlin/src/libs/../inc/../HAL/./ESP32/../shared/Marduino.h:36,
                 from Marlin/src/libs/../inc/../HAL/./ESP32/HAL.h:30,
                 from Marlin/src/libs/../inc/../HAL/HAL.h:30,
                 from Marlin/src/libs/../inc/MarlinConfig.h:31,
                 from Marlin/src/libs/buzzer.cpp:23:
Marlin/src/libs/buzzer.cpp: In static member function 'static void Buzzer::tick()':
Marlin/src/libs/../inc/../HAL/./ESP32/HAL.h:63:54: error: 'spinlock' was not declared in this scope
 #define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)
                                                      ^
/home/kraplax/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/freertos/freertos/portmacro.h:232:59: note: in definition of macro 'portENTER_CRITICAL'
 #define portENTER_CRITICAL(mux)        vTaskEnterCritical(mux)
                                                           ^
Marlin/src/libs/buzzer.cpp:73:9: note: in expansion of macro 'CRITICAL_SECTION_START'
         CRITICAL_SECTION_START();
         ^

I have tried with 2.1 and the error is pretty much the same.

Bug Timeline

MKS TinyBee support introduced in 2.0.9.3
Somewhere between 2.0.9.3 and 2.0.9.4 this extern was removed:
https://github.com/MarlinFirmware/Marlin/blame/2.0.9.3/Marlin/src/HAL/ESP32/HAL.h#L52 which, according to my understanding, led to this error.
I have hunted down the issue root cause and it seem to be this PR with HAL refactoring by @thinkyhead

Expected behavior

I expected Marlin firmware to either build, or provide me with hints on which config parameters to alter so that it can be built.

Actual behavior

Build failed with obscure compilation error

Steps to Reproduce

  1. Checkout bugfix-2.1.x
  2. set MOTHERBOARD to BOARD_MKS_TINYBEE
  3. enable MKS_MINI_12864 and SPEAKER support
  4. Set default_envs = mks_tinybee in platformio.ini
  5. Build with pio run

Version of Marlin Firmware

2.1, also bugfix-2.1.x

Don't forget to include

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions