I need to move to RTX5 And I think I have it set up right based on the migration notes. My code in app_main never runs?
void app_main (void const *argument) { //this code never runs uint8_t buf[2]; USBD_Initialize(0); /* USB Device 0 Initialization */ USBD_Connect (0); /* USB Device 0 Connect */ //init OBDGenie device = getDevice(); device->init(); device->probeForGW(); while (1) //usb loop { device->setData(); } } osThreadDef(app_main, osPriorityNormal, 1, 0); int main (void) { HAL_Init(); /* Initialize the HAL Library */ SystemClock_Config(); /* Configure the System Clock */ SystemCoreClockUpdate(); // Update system clock4 osKernelInitialize(); osThreadCreate(osThread(app_main), NULL); osKernelStart(); for (;;); }
[/pre]
You initially stated that code in app_main never runs and my previous comments focused on that.
However after debugging you confirmed that app_main is executed until “USBD_Initialize” is called.
What happens when USBD_Initizalize is called?
If the function returns then check the return value. www.keil.com/.../group__usbd__core_functions__api.html
Correct, I'm not sure what changed this though, the debug was having issue yesterday. I'm not sure how to troubleshoot this USBD_Initialize code. If i hit f10 or f11 it does not step. If I add
int y; y=USBD_Initialize(0);
y is never in scope.
From what I know, this code is not exposed so there is no way to step in to it.
Define the variable as global and add ‘volatile’ so that it does not get optimized (also decrease optimization level if needed).
If you are still not able to see the return value then go to disassembly (look for something like “BL.W USBD_Initialize”) and step over that call. After that the return value is in register R0.
That helped, looks like a USB stack size issue with the migration.