I'm trying to get a project set up with a USB CDC virtual com port on a SAME70. I started with Atmel START, generated some code, and verified that it works.
Rather than work directly with the project/folder structure generated by Atmel START I decided to create my own empty project. I then added everything that Atmel start generated as a sub-folder in my project. I modified all the Tool chain settings accordingly (include folders & path to linker script). I have also retained the original Atmel START project/solution files so I can edit/add components as needed.
At this point, my project is almost exactly identical to what Atmel START generated, except that I have all the Atmel START source in a sub-folder. Everything compiles and links OK. The code runs through the driver initialisations OK, but hard faults as soon as I plug in the USB. The hard fault occurs at line 672 in hpl_usbhs.c;
memcpy(ptr_dest, ptr_src, trans_next);
The address passed to memcpy look ok to me (dest=0xa0100000, src=0x2040008a), so I'm not even sure why it is hard faulting.
Any idea why the original project would work, but my custom project with exactly the same source files causes a hard fault? I've been working on this issue for 2 days and still haven't been able to solve it.