ts-7000
[Top] [All Lists]

Re: [ts-7000] TS-7800 Wiki

To:
Subject: Re: [ts-7000] TS-7800 Wiki
From: Michael Schmidt <>
Date: Mon, 16 Mar 2009 14:01:04 -0700
Catalin Ionescu wrote:
> Hi all,
> 
> We can finally officially announce the TS-7800 specialized Wiki page. It 
> can be found at http://ts78xx.digriz.org.uk and it is maintained by Alex 
> Clouter and myself. In order to keep "noise" to a minimum possible, only 
> few are/will be allowed to actually put info on it, but we will try to 
> add there anything that comes up as interesting/important based on your 
> questions/experience and our own experience.

  ____________
< Excellent! >
  ------------
         \   ^__^
          \  (oo)\_______
             (__)\       )\/\
                 ||----w |
                 ||     ||


> It contains practically all oddities we have discovered while developing 
> software for the board, and possible workarounds whenever necessary.
> 

You are very kind... I'm sure there are a lot more oddities than you 
have listed! ;-)

Anyway, since the wiki is not editable I am responding to a few places 
on various pages - feel free to do what you will with these comments.

from http://ts78xx.digriz.org.uk/fpga/quirks:
"FPGA Pins for PCI"
According to the TS-7800 hardware designer, the "perfect" PCI pins on 
the Lattice FPGA in this case are nothing more than regular LVCMOS 
capable pins with an optional diode clamp. They are a nice feature for 
PCI peripheral cards attached to PCI motherboards with PCI sockets and 
long trace lengths where signal ringing is inevitable, but completely 
unnecessary for a less than 1" trace between CPU to FPGA whose signal 
integrity is characterized and within spec.  Re-aligning the FPGA to be 
able to use these pins with shorter traces is about as useful as 
re-aligning chips so all chip labeling faces the same way.

from http://ts78xx.digriz.org.uk/booting-woes:
 > Techologic Systems borked up the Master Boot Record

bork! bork! bork!

 > for both the NAND and the SD card. They mis-entered the partition 
table information so that for the NAND the maximum kernel size is 3MB 
(0x1800*512) and the initrd is 1.5MB (0x0c00*512) whilst for the SD card 
the limits are 4MB kernel (0x2000*512) and 3MB (0x1800*512) initrd); 
when either of these blobs are too large then the code simply truncates 
the kernel/initrd.

I'm not sure what the problem is here... is it that the partition sizes 
are different (smaller) for the NAND than it is for the SD card?  Or is 
it that the code gets truncated if you try to copy an image that is too 
large?

In any case, here is the source file for the TS-7800 MBR boot code, in 
case you might find it useful.
------------------- mbrboot-7800.c
#include "MBR.h"

struct partition_info_aligned { // little-endian format
   unsigned int bootable:8; // 0x80 = active, 0x00 = don't use for booting
   unsigned int starting_head:8;
   unsigned int starting_csect:8;
   unsigned int starting_xcyl:8;
   // MSB bits 0-5 are sector
   unsigned int system_id:8; // format of partition
   unsigned int ending_head:8;
   unsigned int ending_csect:8;
   unsigned int ending_xcyl:8;
   unsigned int relative_sectors1:16; // sector offset from start of 
disk to star
t of volume
   unsigned int relative_sectors2:16; // sector offset from start of 
disk to star
t of volume
   unsigned int total_sectors1:16;
   unsigned int total_sectors2:16;
} __attribute__((packed));

#define PIA(x) ((struct partition_info_aligned *)x)
#define RS1(x) ((int)(PIA(x)->relative_sectors1))
#define RS2(x) ((int)(PIA(x)->relative_sectors2))
#define RS(x)  (RS1(x) + (RS2(x) << 16))
#define TS1(x) ((int)(PIA(x)->total_sectors1))
#define TS2(x) ((int)(PIA(x)->total_sectors2))
#define TS(x)  (TS1(x) + (TS2(x) << 16))

typedef void (*kptr)(int, short);
typedef void (*fptr1)(char *);
typedef void (*fptr2)(unsigned int, char *,int);
void mbrboot(fptr2, fptr1) __attribute__((naked));
extern struct partition_table partitions;
static unsigned char *atags;
static unsigned char atag_template[20];
static unsigned char atag_script[] = {
   /* ATAG_CORE */
   0x00, 0x05, 0x04, 0x01, 0x06, 0x41, 0x87, 0x54,

   /* ATAG_MEM */
   0x00, 0x04, 0x04, 0x02, 0xcb, 0x08,

   /* ATAG_INITRD2 */
   0x04, 0x05, 0x06, 0x42, 0x0b, 0x01, 0x0e, 0x40, 0xcf, 0x00
};


static inline void modify_atag_template(int x, unsigned char y) {
         atag_template[x & 0x3f] = y;
}

static inline unsigned char * atags_runscript(unsigned char *pc) {
         unsigned int c, i;

         for (;;) {
                 c = *(pc++);
                 modify_atag_template(c, *(pc++));
                 if (c & 0x80) for (i = 0; i < (atag_template[0] * 4); i++)
                   *(atags++) = atag_template[i];
                 if (c & 0x40) break;
         }
         return pc;
}

static inline int load_partitions(fptr2 sdread, fptr1 ser_puts, unsigned 
int *lo
cs) {
         int start, sz, partno;
         char **bufs = (char **)locs;

         for (partno = 0; partno < 4; partno++) {
                 if (partitions.part[partno].system_id == 0xda) {
                         start = RS(&partitions.part[partno]);
                         sz = TS(&partitions.part[partno]);
                         sdread(start, *(bufs++), sz);
                         ser_puts(".\r\n");
                 }
         }
         return bufs - (char **)locs;
}

void mbrboot(fptr2 sdread, fptr1 ser_puts) {
         int j;
         unsigned char *pc, *atags_start;
         kptr kernel = (kptr)0x8000;
         unsigned int locs[2] = { 0x8000, 0x1000000 };

         ser_puts(".\r\n");

         atags_start = atags = (unsigned char *)0x100;
         for (j = 0; j < 20; j++) modify_atag_template(j, 0);
         pc = atags_runscript(atag_script);

         if (load_partitions(sdread, ser_puts, locs) > 1)
                 atags_runscript(pc);
         *(unsigned int *)atags = 0;
         ser_puts(".\r\n");

         kernel(0, 526);
}
------------------- mbrboot-7800.c END


  ______   Best Regards,
|__  __/                  Michael Schmidt
    ||                   Software Engineer
    ||echnologic Systems (EmbeddedARM.com)
    || (480)        16525 East Laser Drive
    |/ 837-5200   Fountain Hills, AZ 85268
        http://oz.embeddedarm.com/~michael


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

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