This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Chain loading in RedBoot from MMC/SD (i.MX51)


So after some compiling, disassembling and reading over the result
I've found what I laid out was incorrect as far as a chain-loading
scenario.
IMX boot ROM code actually takes care of everything for you if you
define DCD data and associated info, which is taken care of in
'hal_platform_setup.h'.

Flash header + DCD data + proper board configuration leads to the
mystery I was trying to discover.  If someone comes across this
needing more information
I suggest referencing U-Boot since after all of this I was able to
come across some brief documentation that discusses what I found a bit
more in detail.

This also might clear up some confusion,
http://old.nabble.com/-U-Boot--Booting-from-NAND-on-MX51-td27529639.html


On Tue, Nov 9, 2010 at 5:38 PM, T.J. Staley <tucanoj@gmail.com> wrote:
> Hi All,
>
> EDIT:? Sorry for the ridiculously long message, I didn't start off with that
> intention, but I wanted to be thorough.
>
> I've been digging through Redboot source trying to get a feel for what is
> going on behind the scenes.? I'm interested in figuring out how Redboot
> handles, what I perceive, chain-loading from an SD Card.? Specifically, how
> does Redboot handle running/booting itself from an SD card?
>
> I have a platform I'm working with (Freescale i.MX51 EVK (babbage)) that
> uses an SD Card to load an image of Redboot.? I've gotten as far as looking
> into 'hal_platform_setup.h', which seems to be where all the magic happens,
> but I've yet to find where Redboot reads itself into DDR and continues
> execution.
>
> Here is what I've gathered so far, and feel free to correct me.
> Based on the pin configuration of the board, upon start/reset 2K of data is
> read from the beginning of the SD Card and stored in the SCC RAM (128K of
> SRAM).? The PC is pointed to the beginning of SCC RAM (Redboot refers to
> this is IRAM_BASE_ADDR) and execution continues from there.? From what I
> understand, this is boot ROM code from the CPU that handles all of this (out
> of my hands).? From this 2K of code I have an opportunity to initialize DDR,
> e-SDHC, and read another stage of the bootloader from the SD Card and place
> it in DDR and jump there and execute.
>
> If the above is true, then I am lost with what is happening in Redboot.? I
> notice the 'flash_header' (in hal_platform_setup.h) is initializing DDR for
> me via DCD code when the processor comes up.? Moving on from there, there is
> the following snippet,
>
> ------------------------------
> ------------- BEGIN -------------------------------------------------
> #ifdef CYG_HAL_STARTUP_ROMRAM???? /* enable running from RAM */
> ??? /* Check if need to copy image to Redboot ROM space */
> ??? ldr r0, =0xFFFFF000
> ??? and r0, r0, pc
> ??? ldr r1, MXC_REDBOOT_ROM_START
> ??? cmp r0, r1
> ??? beq HWInitialise_skip_SDRAM_copy
>
> ??? add r2, r0, #REDBOOT_IMAGE_SIZE
>
> 1:? ldmia r0!, {r3-r10}
> ??? stmia r1!, {r3-r10}
> ??? cmp r0, r2
> ??? ble 1b
> ??? /* Jump to SDRAM */
> ??? ldr r1, =0xFFFF
> ??? and r0, pc, r1???????? /* offset of pc */
> ??? ldr r1, =(SDRAM_BASE_ADDR + SDRAM_SIZE - 0x100000 + 0x8)
> ??? add pc, r0, r1
> ------------------------------------------- END
> -------------------------------------------------
>
> From this code, assuming I'm coming here from a cold-start and booting
> Redboot from an SD Card, I get the following.
> - We zero off the PC and check if we've been here before (i.e. already
> copied to DDR from a soft-reset)
> - This isn't true (again, assuming power up) so we don't execute the branch,
> and we fall through
> - We set the upper bounds of how much we'll be copying (i.e. add r2, r0,
> #REDBOOT_IMAGE_SIZE)
> - And the code below that we loop and copy data over to SDRAM and jump to
> there.
>
> What confuses me is that the copying is from SCC RAM (correct?), which is
> where the PC was pointing to based on what the boot ROM of the CPU (1st
> stage) should do when configured to boot from MMC/SD.? SCC RAM only
> contained the 2K pulled in from the SD Card, so in my mind only 2K of data
> was copied over to SDRAM.? This has to be wrong, or I'm missing something...
>
> Where, are how, does Redboot come up from an SD Card upon first applying
> power to the board?

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]