ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: Booting TS7300 from SDCard

To:
Subject: Re: [ts-7000] Re: Booting TS7300 from SDCard
From: "Breton M. Saunders" <>
Date: Fri, 23 Apr 2010 14:12:53 +0100
pkm_munot wrote:
> Thanks Brett,
>
> I am using gpio for Sdcard detect, CS. For tx, rx, clk i am using SPI port 
> signals. At this stage I have got the initial 2k bootloader working from 
> serial EEPROM/Flash. The current setup uses redboot => linux kernel => 
> Application. 
>   
Oh excellent.  That is a good idea.  So you're just running it in MMC 
mode then?

You will need to write a linux driver for the SD card at some point.  
You may be able to crook the MMC drivers in the kernel to use the 
M2M/SPI to do this.  I can likely upload an M2M driver I've been 
refactoring....

> As you have suggested to boot from sdcard it can be 2 options
> 1) 2K bootloader (eeprom) => second stage bootloader to initialize sdcard => 
> redboot (sdcrd)=> linux (sdcrd) => Appn (sdcrd).
>
>
> 2) 2K bootloader + redboot(eeprom) => linux (sdcrd) => Appn (sdcrd).
>
> Is it necessary to have redboot for loading linux kernel. Can we load the 
> kernel directly from second stage bootloader  without using redboot.
>
>   
> Can you please provide some pointers on this.
>   
You don't need redboot.  I'd recommend ditching it entirely.

Loading linux is easy. 

Load the kernel to 0x04000000.
Load the initrd (if your using one) to 0x01000000.
Fill in the initrd size into the correct location in the atags list.
Copy the atags to 0x0100.  I believe this address is special; as (from 
memory) it didn't work using other addresses (this isn't documented 
correctly in arm linux; but may have been fixed since).  Even more - you 
can see a bug in my code below where I load 0x0500 0000 into r2 (atags 
address).  I think this should be 0x0100; but is indicative that the 
linux kernel just loads atags from 0x0100 rather than the address you 
specify.  Note also, this may well have changed in the three years since 
I last worked on this.

This code is in Thumb; note that the bx r3 will branch exchange (e.g. 
switch to arm mode) on branch when calling the kernel.


startlinux:
        @ copy atags to 0x0000 0100
        mov     r1, #0x01
        lsl     r1, #8                  @ target address to r1
        adr     r2, atags
        adr     r3, atags_fin          
1:      ldr     r0, [r2]               
        str     r0, [r1]               
        add     r1, #4
        add     r2, #4
        cmp     r2, r3
        bne     1b

        mov     r2, #0x05
        lsl     r2, #24                 @ atags ptr
       
        mov     r1, #0x16
        lsl     r1, #4
        add     r1, #0x3                @ ts7400 mach id

        mov     r0, #0                 
       
        mov     r3, #04                 @ bootstrap address
        lsl     r3, #24                 @
        bx      r3                      @ start linux sw to arm
       

atags:          .word   5
                .word   ATAG_CORE
                .word   0               @flags
                .word   4096            @pagesize
                .word   0               @rootdev - unknown...

                .word   4               @ size of memory tag
                .word   ATAG_MEM
                .word   0x00800000      @ size
                .word   0x00000000      @ start

                .w+ord   4               @ size of memory tag
                .word   ATAG_MEM
                .word   0x00800000      @ size
                .word   0x01000000      @ start
       
                .word   4               @ size of memory tag
                .word   ATAG_MEM
                .word   0x00800000      @ size
                .word   0x04000000      @ start        

                .word   4               @ size of memory tag
                .word   ATAG_MEM
                .word   0x00800000      @ size
                .word   0x05000000      @ start
       
                .word   4
                .word   ATAG_INITRD2    @ second rev, physical mapped initrd
                .word   0x01000000      @ start in second physical page
initrd_size:    .word   0x00000000      @ filled in by loader!

cmdln_start:    .word   (cmdln_fin-cmdln_start)/4
                .word   ATAG_CMDLINE
                .asciz  "console=ttyAM0,230400 root=/dev/ram"
                .align  4
cmdln_fin:      .word   0               @ buggy terminator criterion in 
setup.h
                .word   ATAG_NONE
       
               
                .word   0x00000000
atags_fin:      .word   0x00000000


Enjoy,

    -bms

> Cheers
> Tama
>
>
>
>
>
>
> --- In  "Breton M. Saunders" <> 
> wrote:
>   
>> I wrote the original linux loader for the alertme hub - fit the entire 
>> NAND flash loader into about 1.2k of eeprom space, including CRC codes.  
>> The development board for it was a ts7400.
>>
>> When I was looking at the sdcard last year I figured that it would be 
>> quite difficult to fit the boot loader into the 2k eeprom on the 
>> ts7400.  With about 5k I think its possible; but you'll need at least 3 
>> stages of loader.
>>
>> Incidentally, since you have done your own board, how have you connected 
>> the sdcard to the ep9307 - are you gpio banging it?
>>
>> The TS boards have a pretty simple 4 bit interface onto the sdcard that 
>> is implemented in the CPLD.
>>
>> If I remember correctly, they do something like a 3 stage loader on the 
>> ts7400:
>>  Stage 1: 2k loaded from eeprom into cirrus's ethernet buffer to start 
>> the system and load the 1st page  (which are supposed to be reliable) 
>> from NAND and call it.
>>  Stage 2: Load the first 16k from NAND using CRC and call it.
>>  Stage 3: Load Linux from NAND or load Linux from partition 0 of the 
>> sdcard (tsfastboot vs tssdboot).
>>
>> Loading linux itself is quite easy - just copy the data into ram, setup 
>> the registers correctly and jump to the start address.
>>
>> Oh yeah - since you've done your own board, have you correctly managed 
>> the ep93xx lockup-on-reset bug?  About 1/3 of the chips have this 
>> problem.  TS works around it using their CPLD and watchdog.
>>
>>    -Brett
>>
>>
>> pkm_munot wrote:
>>     
>>> --- In  Jason Stahls <jason@> wrote:
>>>   
>>>       
>>>> pkm_munot wrote:
>>>>     
>>>>         
>>>>> Hi Guys,
>>>>>
>>>>> As per the manual under boot section. This board as a initial bootloader 
>>>>> in EEPROM which is loaded at power up and later talks to SDcard. Apter 
>>>>> initializing of SDcard the boards boots from SDcard directly. I am trying 
>>>>> to implement a similar boot sequence for my board based on EP9307 chip.
>>>>>
>>>>> Can anyone please provide some pointers to the source code for EEPROM 
>>>>> bootloader and TS_SDBOOT. 
>>>>>       
>>>>>           
>>>> I doubt TS will release the code for their bootloader but the best way 
>>>> to get it would call them and ask for it.  Now for SD boot, I believe 
>>>> the SD interface is implemented in the FPGA so that would hose using 
>>>> TS's boot loader anyways :(
>>>>
>>>> -- 
>>>> Jason Stahls
>>>>
>>>>     
>>>>         
>>> Thanks Jason,
>>>
>>> I will trying calling them and see if I can get any pointers from them. As 
>>> per the current design for TS7300 I guess the sdcard interface is 
>>> implemented in FPGA. In my case I dont have a FPGA but I have a serial 
>>> flash. I have downloaded spi_boot example from Cirrus logic website and its 
>>> working successfully on my board. 
>>>
>>> Now I am trying to write a second stage bootloader which will initialize 
>>> the sdcard and load redboot from sdcard. This in turn will load rest of the 
>>> bits from SDcard. 
>>>
>>> Its this approach right? 
>>> Cheers
>>> Tama
>>>
>>>
>>>  
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------
>>>
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>       
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU