Hi,
I was quite familiar with it few years ago but can give some hints.
Well, using non-XIP mode (copy all to RAM) with big DDR RAM makes sense. But using quite small on-chip SRAM I use XIP mode because the most of initialization routines and not time critical code can run happily from QSPI saving RAM space for data. Time critical code, also something like code to write some data back to QSPI memory is copied by C startup routine to RAM. You may initialize DCD struct with DDR RAM initialization commands, but if you have doubts about how QSPI boot initializes clocks and have even more doubts how this may interfere with DDR RAM setup, then you should rethink what's better for you, XIP boot followed by clocks reconfiguration for best possible CPU and DDR RAM speeds or non-XIP boot with not optimal clocks. I don't know if it's safe to reconfigure DDR without loosing code bits already copied to DDR?
-The QSPI clock is configured to run at 18 MHz. What speed is the processor clock?
Well, in XIP mode it doesn't matter, I reconfigure clocks in my code.
- -The QSPI pins are configured.
- -Do basic QSPI read operation starting at flash location 0 (318 bytes) to get configuration parameters
1k (0x400) is read with QSPI configuration settings like memory sizes, two chips parallel or single chip mode, CS hold/setup times etc. With parallel setup 1k is read from chip A.
- -Re-configure the QSPI controller per the parameters
Yes
- -Re-configure the clock to run the QSPI controller at 66 MHz (from parameter). What does this do to the processor clock?
Again, it doesn't matter for XIP boot.
I assume that the following (or something like it) is what happens next:
-The boot loader reads the first 4KB(??) from flash starting at location 0 into OCRAM memory starting at 0x3f00_0000(??). It then knows that the IVT will be at 0x3f00_0400.
It's not clear whether it is copied to OCRAM or handled at the fly, but next DCD table should be processed, else how could you perform for example DDR RAM setup before copying data to it? BTW, you may try using DCD to reconfigure device clocks for optimal setup!
- -Executes any instructions in the DCD (set processor clock to 396 MHz and enable the DDR cntlr).
-Using the info in the BOOT data struct Table 7-54 (start and length), “length” bytes (the code image) are loaded into memory starting at location “start”. How does the boot loader know where the image is in flash memory?
- -Boot loader “jumps” to the entry point “entry” given in the IVT.
Yes, something like this.
When the QSPI clock is at 66 MHz, what speed is the A5 core running at? (I assume 396 MHz)
I don't know, but it doesn't matter in XIP mode. Also you may craft your DCD table to reconfigure it like you wish.
You may have problems debugging DCD, try using device clock monitor pins. Yes, you need to setup them from the same DCD table. Since I used XIP, my DCD has 0 commands, just table size and DCD version.
What location is the “boot stuff” copied into in OCRAM? If it is 0x3f00_0000, what happens when the app code is also loaded into the same space? How many bytes are read in?
Since datasheets don't specify reserved boot locations in OCRAM -you shouldn't worry about it, i'm sure all RAM is available for your purposes.
How does the boot loader know where the app code is in flash memory?
Source is at least address of QSPI memory. Destination is specified in Boot data structure. (A little problem with source image in parallel mode. First kilobyte is read from A device 0..0x3FF. The rest is read in parallel mode, which means device address 0x400..0x4FF corresponds to destination offsets 0x??400..0x??5FF, 2x more data.)
Can the QSPI controller function properly in DDR mode during boot? I haven’t seen any of the examples use it. They all use SDR mode.
Yes, why not. You just need setup configuration struct accordingly. I tried to juice as much as possible from my QSPI memory, it has quad pin mode, also supports DDR mode, but at slower clock speed. 99MHz SDR performed faster than available fastest DDR mode.
Hope this helps
Edward