2014-09-03 10:43 AM
I created a very simple project targetting a STM32F042K6 processor. It includes a USB Device with CDC class as the only Middleware selected. No other items are enabled. When I go to compile the STM32Cube output in Atollic, the output cannot fit due to RAM overflow, by 1512 bytes. This can't be right. Can anyone tell me where to look for excess ram usage?
I am also getting this warning:#warning ''Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)'' [-Wcpp]2014-09-04 02:35 AM
Hi,
Thanks for the feedback. We understand that this is limitation that some of you are experiencing. We’ll pass it along to our STM32CubeMX team.You have just to change your project properties following these instructions:Once deactivation the FPU use, normally the stack usage will be reduced. Let's try it and keep us informed about your finding.
Regards.2014-09-04 05:32 AM
That fixed the warning, but the memory usage remains the same. Any other ideas?
How much ram should I expect the USB Device with CDC to consume? I see too 512 byte buffers in the CDC code, but nothing else looks substantial.2014-09-04 07:02 AM
OK, good.
To reduce the example footprint, andsince only one allocation is handled in the CDC classdriver,the toolchain dynamic allocation is replaced by a static allocationby returning the address of a pre-defined static buffer with the CDC class structure size. You've only to define within the usbd_conf.h file:#define MAX_STATIC_ALLOC_SIZE 140
/*CDC Class Driver Structure size*/
#define USBD_malloc (uint32_t *)USBD_static_malloc
#define USBD_free USBD_static_free
And within the
usbd_conf.cfile:
/**
* @brief static single allocation.
* @param size: size of allocated memory
* @retval None
*/
void *USBD_static_malloc(uint32_t size)
{
static uint32_t mem[MAX_STATIC_ALLOC_SIZE];
return mem;
}
/**
* @brief Dummy memory free
* @param *p pointer to allocated memory address
* @retval None
*/
void USBD_static_free(void *p)
{
}
For more details you can refer to the STM32CubeF3 firmware package available
.
Let's try it and keep us informed about your finding.
Regards.
2014-09-04 10:10 AM
Thanks, that worked. However, now I am hitting a code-size limitation from Atollic Lite... Ah well, off to look for another IDE/Compiler.
2014-09-08 01:29 AM
Great !
___________________________________________________________
Do, click ''
Mark as helpful post
'', if any of my replies helps solve your problem.