I'm new to this hardware and the NXP ecosystem, and it's a bit daunting to me so far so forgive my ignorance.
I have a program that's roughly 500kB.
I try to run it off of flash and the SPI bugs out and everything runs really slowly.
I try to place it in SDRAM (by editing Project Settings|Memory section and moving SDRAM to the top just under FLASH. It doesn't run. I tried the same thing with SRAM_OC1. No dice. Depending on my configuration it won't even flash. When it does flash I get no serial output, so it's not running.
In fact, the only way I've managed to successfully run this is to create a linker script (.ld) manually and then inject using the debugger with the FLASH not even mapped in the memory section.
Basically i think I need either Link Application to RAM to work with the SDRAM or OC sections somehow. Either that or Plain Load Image.
I don't even know where to begin. I've tried samples, and googling and I've gotten nowhere.
Hmm, you may be getting in trouble because, IIRC, the MIMXRT1170 OCRAM and ITCM banks aren't large enough to fit a 512kB program. Space can be dynamically reassigned between these banks via fuses or the IOMUXC_GPR registers, see the AN12077 application note for details. However, it may be a struggle to fit your entire application in RAM, especially because you will lose a lot of speed if you can't keep the stack and local variables in DTCM (this bank is approx. 3x faster than OCRAM for reading and writing data)
Rather than moving your entire application to RAM, it might be easier to find the specific functions that are being slowed down and move only those functions to RAM. MCUXpresso SDK provides a macro for this, AT_QUICKACCESS_SECTION_CODE, which will put your function in a special section that makes it get loaded to RAM. To use it, declare your function like this:
AT_QUICKACCESS_SECTION_CODE(void myFunction(void));
This makes sure it will run from RAM.
Another thing to note is, in my experience with MIMXRT, its instruction caching is usually pretty good. Commonly functions will run slower (5-10x slower) the first time they execute due to having to read the instructions from flash, but after that they will be in the I-cache so they will run quickly. Is it possible to update your code to "warm up" the cache with some sort of dry run, before the actual time sensitive code starts?