2025-02-19 03:30 PM - edited 2025-02-19 03:47 PM
I have a project that is using AzRTOS, ThreadX, NetX, FileX, UsbX, and i'm still using cubeMX to reconfigure the hardware and drivers. I understand that users need to put code between the "USER CODE BEGIN" and "USER CODE END" comments, if you're still updating with CubeMX.
But there are several issues with AzRtos and FileX (even the STM examples provided don't work properly), so to fix some of these issues, I want to add code to AZURE_RTOS/App/app_azure_rtos.c. At the beginning of the file I can add user code:
VOID tx_application_define(VOID *first_unused_memory) {
/* USER CODE BEGIN tx_application_define_1*/
/* USER CODE END tx_application_define_1 */
but there is no provision to add user code at the end of this routine (after the memory pools have been allocated). Also note that this routine is called from Middlewares, and I don't want to start modifying that code.
So my question is:
Is there a way to add code to a file that is outside "User code" comments? If I add my own "USER CODE BEGIN" and "USER CODE END*/, will CubeMX ignore that section and update the files without touching that section?
thanks
Matthew
2025-02-20 02:44 PM
I think CubeMX is using a template or list of USER CODE xxx defines that it matches, else it'll delete code outside of the USER CODE xxx. So adding a new USER CODE xxx doesn't seem to work.
I'm not sure what tx_application_define is doing since you didn't show the whole function. But maybe you can create a function that you can call after tx_application_define is called? A little less desirable, but a temporary work around.