I am seeing some odd behaviour with i.MX RT 1050 while implementing USB Host Mass Storage.
When I use SDK example on the EVK with Armcc compiler, I dont see a problem which is great but when I try to port it to our project it somehow does not work, cannot detect the USB device.
Our project is a C++14 project and we use GCC compiler.
If I create .c file and put everything inside, it works well. The reset ISR calls the main() function which initialises MCU and USB Host and everything works.
But If I call the main() function from C++ main() function which called from ResetISR, it does not work.
ResetISR -> main() in main.c : works
ResetISR -> main() in main.cpp -> main() in main.c : USB Host Mass Storage does not work (I rename the main() in main.c if I call from the main() in main.cpp).
Actually, main.cpp does not do anything, just calls the main() function in main.c, so everything is almost identical.
I was having a similar issue with a variadic function as well. Even when I call an empty variadic function, USB Host Mass Storage does not work. If I don't call the empty variadic function, it works.
I know, it is really odd. I am wondering can it be about unaligned instructions in our implementation, or a compiler bugs (C++14 for the CM7 MCUs).
I don't enable D/I Caches.