Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


vPortFree() Hangs due to Assertion Failure

I have difficulty with the below code which I have paired down to it’s essentials:


  1. define malloc(size) pvPortMalloc(size)
  2. define free(ptr) vPortFree(ptr)


typedef uint8_t Msg_Itr_t;
typedef struct
{ Msg_Itr_t itr;
int32_t strln;
char *pstr;
} Msg_t;

typedef Msg_t* pMsg_t;

pMsg_t pEchoMsg;
pEchoMsg = malloc( sizeof( pMsg_t ) );

if( pEchoMsg )
{ pEchoMsg->pstr = malloc( sizeof( uint8_t ) );
if( pEchoMsg->pstr )
{ free( pEchoMsg->pstr ); // Hangs here
}
free( pEchoMsg );
}



Please note that I have redefined malloc() and free() with the macros included in the above code.

On the call to the first free() it hangs because in vPortFree() the below assertion fails, causing it to go into an infinite loop:

configASSERT( pxLink->pxNextFreeBlock == NULL );

If I free pEchoMsg right after it is allocated it works. But if I free the allocation pointed within pEchoMsg as shown in the code above it fails. What is going wrong here?

I found it. This line should have been:

pEchoMsg = malloc( sizeof( Msg_t ) );

Not enough memory was allocated.