Hi,
As you know that the SDRAM is RAM,the code is lost after power off, so you have to save code and constant data in spifi flash.
If you want to want to save code in SDRAM and run the code in SDRAM, you have to initialize the SDRAM, then copy the code from spifi flash to SDRAM. If you run the code, I suppose that you have to configure the MPU module.
Pls refer to the AN12432.pdf
https://www.nxp.com.cn/docs/en/application-note/AN12423.pdf
Hope it can help you
BR
XiangJun Rong