espressif / esp-adf

Espressif Audio Development Framework
Other
1.52k stars 669 forks source link

Example player bt_source cannot build a2dp iram0_0_seg' overflowed by 1356 bytes (AUD-4850) #1065

Closed 0x0fe closed 12 months ago

0x0fe commented 1 year ago

Target : ESP32D0WDR2 (infernal 2MB PSRAM)

IDF version :

ADF version : latest (2.6)

The example player bt_source cannot build, due to IRAM being overflowed, even though all SPIRAM options are enabled in menuconfig. Also i want to point out that most of the menuconfig options shown in the demo project do not exist anymore in menuconfig, https://github.com/espressif/esp-adf/blob/49f80aafefc31642ea98db78bf024e18688b8de9/examples/player/pipeline_bt_source/sdkconfig.defaults#L12C1-L14C40 so it would be very useful to update the example project menuconfig files file to match IDF 5, at least.

The only option i could find which finally allowed me to build and flash is CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH

But i suspect i am very close to full IRAM occupancy, despite the external PSRAM has a lot of free space.

image

Also i very much doubt that only setting CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH can free up 90% of the IRAM magically. Clearly the IDF RAM usage report is very wrong.

As a side note, i wonder what is the proper way to change volume in a2dp-source mode, of course we could change the level in the bit stream but that would be pretty bad, due to loss of resolution, and also a2dp has mechanism to propoerly modify the volume on the attached a2dp-sink device. I tried esp_err_t periph_bt_volume_up(esp_periph_handle_t periph) and esp_err_t periph_bt_volume_down(esp_periph_handle_t periph) from a2dp_stream but it did not change the volume at all, i also noticed bt_avrc_volume_set_by_local but its static and cannot be accessed from outside. So i am not sure what we are supposed to use.

jason-mao commented 12 months ago

@0x0fe Same as https://github.com/espressif/esp-adf/issues/1070, BTW you should also select the -Os to save IRAM.