AnsweredAssumed Answered

How to change USBH_malloc

Question asked by tekampe.jens on Nov 6, 2017
Latest reply on Dec 20, 2017 by tekampe.jens

Hello,

 

I`m using the CubeMX 4.23 and want to use the HAL USB Driver. In the usbh:conf.h is the code:

/* Memory management macros */
#define USBH_malloc malloc
#define USBH_free free
#define USBH_memset memset
#define USBH_memcpy memcpy

But i want to use the FreeRTOS functions for malloc and free. So i changed the code to:

 

/* Memory management macros */
#define USBH_malloc pvPortMalloc
#define USBH_free vPortFree
#define USBH_memset memset
#define USBH_memcpy memcpy

This works fine, but as soon as i generate code with the CubeMX the change is gone. Is it possible to add something similar to the ffconf.h to the usbh:conf.h or make it configurable in the CubeMX?

 

/* define the ff_malloc ff_free macros as standard malloc free */
#if !defined(ff_malloc) && !defined(ff_free)
#include <stdlib.h>
#define ff_malloc malloc
#define ff_free free
#endif

 

I hope you can help me with a solution 

Outcomes