STM32F7: USBH_malloc fails (despite 8 KB heap)
In my project, which uses FatFs and a couple of peripherals, I always used a heap size of 0x100 bytes, with no apparent problems.
After activating the USB Host for HID Class, I increased the heap size to 0x2000 bytes (8 KB), but still the USBH_malloc call for 52 bytes in USBH_HID_InterfaceInit() fails, i.e., returns NULL.
USBH_malloc seems defined as plain malloc, but alas, I cannot debug into the malloc function.
The heap section in the linker file is
_Min_Heap_Size = 0x2000; /* required amount of heap */
...
/* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = ALIGN(8);
} >RAMat the end of the declarations. The map file shows the position of the heap as intended:
...
0x0000000020019848 __bss_end__ = _ebss
._user_heap_stack
0x0000000020019848 0x2000 load address 0x0000000000217308
0x0000000020019848 . = ALIGN (0x8)
0x0000000020019848 PROVIDE (end, .)
[!provide] PROVIDE (_end, .)
0x000000002001b848 . = (. + _Min_Heap_Size)
*fill* 0x0000000020019848 0x2000
0x000000002001b848 . = ALIGN (0x8)What can cause malloc to fail here? Is 8 KB still not enough for 1 USB class/interface/endpoint/configuration each?
