2024-05-12 10:57 PM
Sorry, Google Translate changed my previous post to Polish. That's probably why no one answered me.
Now the post is correct.
This code was generated by STM322CubeIde
UINT MX_USBX_Device_Init (VOID *memory_ptr)
{
UINT ret = UX_SUCCESS;
UCHAR *pointer;
TX_BYTE_POOL *byte_pool = ( TX_BYTE_POOL *)ptr_memory;
/* BEGIN USER CODE MX_USBX_Device_Init0 */
/* USER CODE END MX_USBX_Device_Init0 */
/* Allocate stack for main device application thread */
if (tx_byte_allocate(byte_pool, (VOID**) &pointer, UX_DEVICE_APP_THREAD_STACK_SIZE,
TX_NO_WAIT) != TX_SUCCESS)
{
/* USER CODE BEGIN MAIN_THREAD_ALLOCATE_STACK_ERROR */
return TX_POOL_ERROR;
/* USER CODE END MAIN_THREAD_ALLOCATE_STACK_ERROR */
}
/* Create the main device application thread */
if (tx_thread_create(&ux_device_app_thread, UX_DEVICE_APP_THREAD_NAME, app_ux_device_thread_entry,
0, pointer, UX_DEVICE_APP_THREAD_STACK_SIZE, UX_DEVICE_APP_THREAD_PRIO,
UX_DEVICE_APP_THREAD_PREEMPTION_THRESHOLD, UX_DEVICE_APP_THREAD_TIME_SLICE,
UX_DEVICE_APP_THREAD_START_OPTION) != TX_SUCCESS)
{
/* USER CODE BEGIN MAIN_THREAD_CREATE_ERROR */
return TX_THREAD_ERROR;
/* USER CODE END MAIN_THREAD_CREATE_ERROR */
}
/* BEGIN USER CODE MX_USBX_Device_Init1 */
/* USER CODE END MX_USBX_Device_Init1 */
return
}
The problem is that this is an initialization and the main thread is created, but
Then there is the code in the _txe_byte_allocate function
TX_THREAD_GET_CURRENT(wątek_ptr);
Of course thread_ptr is always equal to 0x0,
which is logical since there is no thread yet.
the problem comes later
basen_ptr -> tx_byte_pool_owner = wątek_ptr;
work_ptr = _tx_byte_pool_search(pool_ptr, rozmiar_pamięci);
//work_ptr = 0x0
next
if (work_ptr != TX_NULL),
which ends up with .refusing to allocate memory
status = TX_NO_MEMORY;
Is this normal? Maybe I'm generating something wrong?
Solved! Go to Solution.
2024-08-01 06:28 AM
Hi @konsul41
It seems like
/* No memory of sufficient size was found... */
Try to increase the heap/stack size.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-08-01 06:28 AM
Hi @konsul41
It seems like
/* No memory of sufficient size was found... */
Try to increase the heap/stack size.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.