I am trying to port the MK22F version of the KSDK v2.0 over for a MKL26Z part. I think I have most of the porting complete and have been trying to enumerate a device. I can see in the USB_HostNotifyDevice routine the correct deviceInstance information is read. I can see that the configuration information is correct with the device having 1 interface. Notice the interfaceCount member of the configuration struct is a value of 1 at location 0x200004DA in memory. This configuration pointer gets passed to the top level USBHost_Event handler I have defined and what is initialized in USB_HostInit.
When I step into the callback and assign a configuration to the handle using:
usb_status_t USBHost_Event(usb_device_handle deviceHandle,usb_host_configuration_handle configurationHandle,uint32_t eventCode)
usb_status_t status = kStatus_USB_Success;
configuration = (usb_host_configuration_t *)configurationHandle;
I see that the configuration struct address is correct but somewhere in the endpoint list for each possible interface there is memory issues such that it throws off the information in the struct. Notice in the second image that the interfaceCount member is not at location 0x200004DA in memory. Finding the error I see that there is some memory overlapping. In the third image you can see at the end of the epList in each interface, the epExtension is at address 0x200003BC and the interfaceDesc should be at 0x200003C0 as it is in the USB_HostNotifyDevice. But it is jumping backward in memory at those points.
If I place the USBHost_Event function inside of the usb_host_devices.c file it works correctly. If I look at the disassembly I can see that no matter where I place the function the call in USB_HostNotifyDevice loads the same values in the registers before it branches to the callback and also in both cases to set the configuration pointer to the value passed it is doing the same instructions. I am using IAR IDE.
I am trying to figure out how this can be happening. Any help would be appreciated.