zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.92k stars 6.65k forks source link

samples: Bluetooth: Reduce heap for hci_ipc #81728

Open Thalley opened 22 hours ago

Thalley commented 22 hours ago

Reducing the heap requirement for the hci_ipc sample from 8KiB to 4KiB. It has been tested in various configurations to work with 2300, but 4KiB was used to provide some leeway for future updates.

The heap requirement is not documented, and it is unclear why values lower than 2300 (not exact number) won't boot, and should be investigated further.

Memory has become a very scarce resource for especially the ISO builds for the nRF5340, which is why this is getting reduced.

Thalley commented 21 hours ago

AutoPTS run zephyr nrf53 BAP/UCL/STR/BV-523-C

codecoup-tester commented 21 hours ago

Scheduled PR https://github.com/zephyrproject-rtos/zephyr/pull/81728#issuecomment-2491697760, board: nrf53, estimated start time: 17:27:45, test case count: 1, estimated duration: 0:01:30

Test cases to be runBAP/UCL/STR/BV-523-C

codecoup-tester commented 21 hours ago

AutoPTS Bot results: No failed test found.

Successful tests (1)BAP BAP/UCL/STR/BV-523-C PASS
kartben commented 19 hours ago

it would be nice if it could instead rely on the HEAP_MEM_POOL_ADD_SIZE_ construct (but that might not be possible?) https://docs.zephyrproject.org/latest/kernel/memory_management/heap.html#defining-the-heap-memory-pool

jhedberg commented 16 hours ago

it would be nice if it could instead rely on the HEAP_MEM_POOL_ADD_SIZE_ (but that might not be possible?) https://docs.zephyrproject.org/latest/kernel/memory_management/heap.html#defining-the-heap-memory-pool

Agreed. There's actually a related issue that's been open for the other side of the IPC HCI transport for quite some time: #66698

Thalley commented 16 hours ago

it would be nice if it could instead rely on the HEAP_MEM_POOL_ADD_SIZE_ (but that might not be possible?) https://docs.zephyrproject.org/latest/kernel/memory_management/heap.html#defining-the-heap-memory-pool

Agreed. There's actually a related issue that's been open for the other side of the IPC HCI transport for quite some time: #66698

Agreed. There are multiple cases of subsystems and similar that simply has HEAP_MEM_POOL_SIZE > 0. From a quick look at openamp, it also seems that it's missing some checks when dynamically allocating memory, so it may fail silently due to missing memory allocation.

Thalley commented 3 hours ago

I can also mentioned that due to this bug https://github.com/zephyrproject-rtos/zephyr/issues/81044, the sample may build and flash, but without the necessary memory available, which breaks it silently.