espressif / esp-matter

Espressif's SDK for Matter
Apache License 2.0
641 stars 149 forks source link

Link failure with BT (CON-1149) #926

Open jonsmirl opened 3 months ago

jonsmirl commented 3 months ago

I just updated my esp-matter and I can't link. This is because I am allowing BSS in external memory

/home/jonsmirl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/bt/libbt.a(bt.c.obj):(.literal.esp_bt_mem_release+0x0): undefined reference to `_bt_bss_start'
/home/jonsmirl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/bt/libbt.a(bt.c.obj):(.literal.esp_bt_mem_release+0x4): undefined reference to `_bt_bss_end'
/home/jonsmirl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/bt/libbt.a(bt.c.obj):(.literal.esp_bt_mem_release+0x20): undefined reference to `_bt_data_start'
/home/jonsmirl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20230928/xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/13.2.0/../../../../xtensa-esp-elf/bin/ld: esp-idf/bt/libbt.a(bt.c.obj):(.literal.esp_bt_mem_release+0x24): undefined reference to `_bt_data_end'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /home/jonsmirl/l6/build/log/idf_py_stderr_output_1242968 and /home/jonsmirl/l6/build/log/idf_py_stdout_output_1242968

I need this fix before I could link again

If you are having problems at link time, can you try removing the following lines from the component/bt/linker.lf file:

    if ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY = y:
        * (extram_bss)
and try compiling again.
shubhamdp commented 3 months ago

This is something that is broken in IDF and we somehow pulled this in when updating the connectedhomeip submodule to fix crashes during ble-deinit sequence.

Can you please try to disable ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY for short run? This will be fixed in next IDF release or I'll check how this can be fixed in connectedhomeip.

tanishqmanuja commented 3 months ago

I am also having same issue with light_switch example .. i am new to such big build systems, can someone point towards the right file to fix. Where should i define this ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY to 0 ?

EDIT: Got the symbol from search in menuconfig

shubhamdp commented 2 weeks ago

This is fixed with esp-idf v5.2.2, can be used with CONFIG_ ESP_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y. Please close the issue if resolved.