2020年9月22日星期二

HSpice notes

 ** .OPTIONS
.OPTION POST      // will show all nets
.OPTION POST PROBE     // will only show the nets which declared in .PROBE
.OPTION POSTOP=<N>     // will show down to the N hierachy level from top, .OPTION POST will override this option


** Switching between Two Voltage Sources Connected to the Same Node

You can use the HSPICE voltage controlled voltage source (E-element) to
design a behavioral switch by creating a netlist as follows:

.option post
Vin1 in1 0 pwl ...
$ source 1
Vin2 in2 0 pwl ...
$ source 2
Ein in 0 vol='v(in1)*v(ctrl) + v(in2)*(1-v(ctrl))'
$ behavioral switch
vctrl ctrl 0 pwl 0 1 49n 1 50n 0
$ control voltage
.tran 1n 100n
.end
//In this example, the v(ctrl) value is 1 initially so that v(in)=v(in1). At
//50 ns, the control voltage changes to 0 and v(in)=v(in2).


** output waveform for cscope
.option post_version=2001

** post sim
.option posttop=2     // look for first 2 level signals from top
.option sim_la        // use RC reduction in post sim
.option altcc altchk    // when use .ALTER, reduce netlist process check time

** measure simulated output data without re-run simulation
hspice -i xx.tr0 -meas <meas_file> // reuse the simulated data to measure instead of re-run sim

** auto stop
.option autostop    // stop sim as long as last measurement is completed


** don't print mode data
.option nomod

 

** sim with case sensitive (for the case netlist converted from RTL)

hspice -case -d -i input.sp -o output.lis -mt 10

 

 

calibre hcell file format

 ***** calibre hcell file format *****
i.e.
//layout name    || cdl source name
ABC          DEF        //one to many
ABC          GHI        //one to many
UVW          XYZ        //many to one
RST          XYZ        //many to one
LMN          PQK        //one to one
JFQ          KPT        //one to one

output a shape/net to gds format

 ***** output a shape/net to gds format *****
DRC CHECK MAP "rule_check" GDSII "layer number" "datatype" "filename"
i.e.
Grow_Metal1 { @ Grow metal1 by 0.1u
        SIZE metal1 BY 0.1
    }
DRC CHECK MAP Grow_Metal1 GDSII 21 0 "./mask/grown_m1.gds"

i.e.
LAYER metal metal1 metal2 metal3 // define layer set "metal"
Plot_RESET { @ Output all metal shapes beloging to RESET net
        NET metal RESET
    }
DRC CHECK MAP Plot_RESET GDSII 1 0 "./plots/RESET.gds"

2013年7月30日星期二

Android cupcake development environment

OS requirements
host: linux
x86 32bit OS, android does not support 64bit OS.
gcc version 4.2.3 (32 bit gcc)
our testing env : Mandriva 2008.1 x86-32, Linux 2.6.24.7

virtual machine: windows xp

Compiling Android
Set up compiling environment

Install EABI compatable cross compiler
cp arm-none-linux-gnueabi-4.3.2.tar.bz2 ~/tools/
cd ~/tools/
tar -jxvf arm-none-linux-gnueabi-4.3.2.tar.bz2

install JAVA sdk
cp jdk-1_5_0_17-linux-i586.bin ~/tools/
run the file to install

Note: since Android does not support Java 6 (jdk1.6), we have to install this package (jdk1.5) to compile cupcake.

install Android sdk
cp android-sdk-1.5.tar.bz2 ~/tools/
cd ~/tools
tar -jxvf android-sdk-1.5.tar.bz2

install Eclipse
cp eclipse-android.tar.bz2 ~/tools/
cd ~/tools
tar -jxvf eclipse-android.tar.bz2

Setup path, ie, in bash:

ARM_GCC_PATH=~/tools/arm-none-linux-gnueabi-4.3.2
ANDROID_SDK_PATH=~/tools/android-sdk-1.5
ECLIPSE_PATH=~/tools/eclipse
export JAVA_HOME=~/tools/jdk1.5.0_17
export ANDROID_JAVA_HOME=$JAVA_HOME
export PATH=$PATH:$ARM_GCC_PATH/bin:$JAVA_HOME/bin:$ANDROID_SDK_PATH/tools: $ECLIPSE_PATH

Copy the following souce code to the working place and extract them:
linux source : s3c-linux-2.6.28-Real6410.tar.bz2
u-boot source : s3c-u-boot-1.1.6-Real6410.tar.bz2
android source : cupcake-1.5.2.tar.bz2

Compile u-boot
cd s3c-u-boot-1.1.6-Real6410

edit Makefile, and make sure the compiler set as below
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-none-linux-gnueabi-
endif
one more line:
CROSS_COMPILE =arm-none-linux-gnueabi-
export CROSS_COMPILE

boot from nand flash : run ./make_nand_image → output is “u-boot.bin”
boot from SD card : run ./make_mmc_image → output is “u-boot_mmc.bin”

Compile Linux kernel
cd s3c-linux-2.6.28

edit Makefile, and make sure that the compiler set as below
ARCH ?= arm
CROSS_COMPILE ?= arm-none-linux-gnueabi-

make xconfig to configure the kernel (detailed configuration setup in another page)
make to compile

the compiled image locate in:
arch/arm/boot/zImage

change the name “zImage” to “zImage-android”.

Compile Android (make sure the machine has enough memory, min 1.5G RAM)
cd cupcake-1.5.2
make to compile

OS requirements
host: linux
x86 32bit OS, android does not support 64bit OS.
gcc version 4.2.3 (32 bit gcc)
our testing env : Mandriva 2008.1 x86-32, Linux 2.6.24.7

virtual machine: windows xp

Compiling Android
Set up compiling environment

Install EABI compatable cross compiler
cp arm-none-linux-gnueabi-4.3.2.tar.bz2 ~/tools/
cd ~/tools/
tar -jxvf arm-none-linux-gnueabi-4.3.2.tar.bz2

install JAVA sdk
cp jdk-1_5_0_17-linux-i586.bin ~/tools/
run the file to install

Note: since Android does not support Java 6 (jdk1.6), we have to install this package (jdk1.5) to compile cupcake.

install Android sdk
cp android-sdk-1.5.tar.bz2 ~/tools/
cd ~/tools
tar -jxvf android-sdk-1.5.tar.bz2

install Eclipse
cp eclipse-android.tar.bz2 ~/tools/
cd ~/tools
tar -jxvf eclipse-android.tar.bz2

Setup path, ie, in bash:

ARM_GCC_PATH=~/tools/arm-none-linux-gnueabi-4.3.2
ANDROID_SDK_PATH=~/tools/android-sdk-1.5
ECLIPSE_PATH=~/tools/eclipse
export JAVA_HOME=~/tools/jdk1.5.0_17
export ANDROID_JAVA_HOME=$JAVA_HOME
export PATH=$PATH:$ARM_GCC_PATH/bin:$JAVA_HOME/bin:$ANDROID_SDK_PATH/tools: $ECLIPSE_PATH

Copy the following souce code to the working place and extract them:
linux source : s3c-linux-2.6.28-Real6410.tar.bz2
u-boot source : s3c-u-boot-1.1.6-Real6410.tar.bz2
android source : cupcake-1.5.2.tar.bz2

Compile u-boot
cd s3c-u-boot-1.1.6-Real6410

edit Makefile, and make sure the compiler set as below
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-none-linux-gnueabi-
endif
one more line:
CROSS_COMPILE =arm-none-linux-gnueabi-
export CROSS_COMPILE

boot from nand flash : run ./make_nand_image → output is “u-boot.bin”
boot from SD card : run ./make_mmc_image → output is “u-boot_mmc.bin”

Compile Linux kernel
cd s3c-linux-2.6.28

edit Makefile, and make sure that the compiler set as below
ARCH ?= arm
CROSS_COMPILE ?= arm-none-linux-gnueabi-

make xconfig to configure the kernel (detailed configuration setup in another page)
make to compile

the compiled image locate in:
arch/arm/boot/zImage

change the name “zImage” to “zImage-android”.

Compile Android (make sure the machine has enough memory, min 1.5G RAM)
cd cupcake-1.5.2
make to compile



2012年11月14日星期三

function inside a struct

//---- test function inside struct
typedef struct try {
    void (*init)();
    void (*set)();
    void (*print)();
    int x,y;
} foo;

void init(foo *p)
{
    p->x=0;
    p->y=0;
}

void set(foo *p, int x, int y)
{
    p->x = x;
    p->y = y;
}

void print(foo *p)
{
    printf("x=%d, y=%d\n\r", p->x, p->y);
}

foo *initialize(void)
{
    foo *p   = (foo*)malloc(sizeof(foo));
    p->init  = init;
    p->set   = set;
    p->print = print;
   
    return p;
}

//-------------------------------------
//----- test

foo *p = initialize();
p->init(p);
p->set(p, 10, 2);
p->print(p);
p->set(p, 15, 12);
p->print(p);

2012年10月24日星期三

JLink for Keil ARM

Use STM32F103T8 as an example:

Flash
  --> Configure Flash Tool
    --> Utilities --> Use Target Driver for Flash Programming
           --> select "Cortex-M/R J-LINK/J-Trace
           --> Settings --> Programming Algorithm
           --> Add --> select "STM32F10X Med-density Flash" On-Chip Flash 128K

     -->  Debug
          --> in Use, select "Cortex-M/R J-LINK/J-Trace"

2012年1月30日星期一

Layer mapping

Include the layer map file while stream-in a gds file from other libraries, the format are as below:

#Cadence layer name(by techfile)     Cadence layer purpose     Stream-in layer number(source)     Stream-in data type
  =========================      =================     =========================    =============== 
                Nwell                                              drawing                                         200                                                       0
               Poly                                                 drawing                                         204                                                       0
               Pisland                                            drawing                                         202                                                       0
               Nisland                                           drawing                                         201                                                       0
               Nselect                                            drawing                                         205                                                       0
               Pselect                                             drawing                                        206                                                        0
               Thickox                                          drawing                                        203                                                        0
               Silblk                                              drawing                                         207                                                       0
               Contact                                           drawing                                        208                                                       0
                Met1                                               drawing                                        209                                                       0
                Via1                                               drawing                                        210                                                        0
                Met2                                               drawing                                        211                                                      0
                Via2                                               drawing                                        212                                                       0
                Met3                                              drawing                                         213                                                      0
                HR                                                  drawing                                        214                                                      0
                M1text                                           text                                                226                                                      0
               M2text                                            text                                               227                                                       0
                text                                                 drawing                                        21                                                        0

the layers which did not specified in the layer map file will be ignored when stream-in.

To probe signal from layout for reviewing

This can be done by running DRC check
Keep the layer and connection definition, delete the rule checks in the rule deck (NOT the header file),
then add the following commands at end of the rule deck:

*** remember to set "DRC MAXIMUM RESULTS ALL", since the result output

*** may be exceed the max. limits

// probe nets
Plot_VDDA { @output all metal shapes belonging to VDDA net
NET Metaltop VDDA
NET Met3 VDDA
NET Met2 VDDA
NET PolyxRes VDDA
NET Nsd VDDA
NET Psd VDDA
}
DRC CHECK MAP Plot_VDDA GDSII 6 0 "./plots/VDDA.gds"

Convert verilog netlist to spice netlist

"v2lvs" (come along with Calibre) can convert verilog netlist to Calibre format netlist for LVS purpose

       v2lvs -v verilog_in.v -o spice_out.sp -w 3


for more complex syntax put into a script, say "v2sp.sh"

      v2lvs -n -s0 GND -s1 VDD -s inc_1.cdl -s inc_2.sp -lsp sp_ref_lib.sp -v $1 -o $2

e.g. run in console:
./v2sp.sh input.v output.sp


##
-n :  make the unconnected pins to get numbered connections starting at 1000
-s0 : default global ground is changed to
-s1 : default global power is changed to
-s : causes the string .INCLUDE "filename" to be put at the beginning of the generated spice file
-lsp : Spice library file name, pin mode. The spice file is parsed for interface configurations. Pins with pin select ([]) annotation are kept as individual pins using escaped identifiers. Normally standard cells reference library for cell mapping.
-v : input verilog file name
-o : output spice netlist file name
$1 : system var, which is filename1
$2 : system var, which is filename2


Commands to run LVS/DRC in console mode

calibre -lvs -hier lvs.runset

calibre -drc -hier drc.runset

To ignore a cell or region when running DRC/LVS

if a cell is not ready or a region where the design rule is violated, they can be ignored in the rule deck

     LAYOUT WINDEL 315 2638 384 2680 // ignore the rectangle region at (315, 2638) (384, 2680)

     EXCLUDE CELL "cell_name" // exclude the "cell_name"

     LVS BOX cell1 cell2 // treat cell1, cell2 as a black box, only check pin connection, not the inside netlist/layout of the cells. (useful for phantom cells or unfinished cells for doing LVS)

Layout pin text placement

The pin text on the layout can be specified by a text file rather than placing the text label on layout. This approach can be used for running LVS of a gds file which doesn't include any text information.         

LAYER M2_TXT 50 // define the layer        

TEXT LAYER M2_TXT // define layer as a text layer        

LAYOUT TEXT CLOCK 10.5 16.8 M2_TXT // place the text "CLOCK" at (10.5, 16.8) 

 the layout text can be included in a separated file to simplify the rule deck file

Call an subcircuit when generating netlist in Analog Design Envirnment (ADE)

1) create a sch & symbol view for the subcircuit

2) copy the "symbo" view to "spectre" or "hspiceD", or others view as desired

3) open the base CDF for the cell, add a component partmer called "model" in the "Edit CDF Parameter" from, specify as belows:
       paramType : String
       parseAsNumber: no
       parseAsCell : yes
       storeDefault : no
       name : model
       prompt : Model Name
then press OK

4) in the "Simulation Information", edit the following parameters:
       choose simulator : hspiceD, or others
       otherParamters : model
       instParameters : myParameters
       componentName  : (leave blank)
       namePrefix : x
       termOrder : the subcircuit terminals order

Finally, include the path of the subcircuit by hand edit in the generated netlist, or by
ADE --> Setup --> Model --> Model Libraries


Update:
Follow below steps yet works (without passing parameter) :-
repeat above point 1) & 2).
CDF : Simulatior Information
           |-- by simulator -> hspiceD
           |-- name prefix = x
           |-- termOrder = "a" "b" "c" etc. pin order same as subckt terminals
        
           Alt.
           |-- by simulator ->  spectre
           |-- termOrde = "a" "b" "c" etc. pin order same as subck terminals

2010年3月3日星期三

Change bash shell style

3 special shell paramenters to set the shell looks:

* PS1 - The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is \s-\v\$ .
* PS2 - The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The default is >
* PS3 - The value of this parameter is used as the prompt for the select command
* PS4 - The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution trace. The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is +

PS1 options:
* \a : an ASCII bell character (07)
* \d : the date in "Weekday Month Date" format (e.g., "Tue May 26")
* \D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
* \e : an ASCII escape character (033)
* \h : the hostname up to the first '.'
* \H : the hostname
* \j : the number of jobs currently managed by the shell
* \l : the basename of the shell’s terminal device name
* \n : newline
* \r : carriage return
* \s : the name of the shell, the basename of $0 (the portion following the final slash)
* \t : the current time in 24-hour HH:MM:SS format
* \T : the current time in 12-hour HH:MM:SS format
* \@ : the current time in 12-hour am/pm format
* \A : the current time in 24-hour HH:MM format
* \u : the username of the current user
* \v : the version of bash (e.g., 2.00)
* \V : the release of bash, version + patch level (e.g., 2.00.0)
* \w : the current working directory, with $HOME abbreviated with a tilde
* \W : the basename of the current working directory, with $HOME abbreviated with a tilde
* \! : the history number of this command
* \# : the command number of this command
* \$ : if the effective UID is 0, a #, otherwise a $
* \nnn : the character corresponding to the octal number nnn
* \\ : a backslash
* \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
* \] : end a sequence of non-printing characters

e.g.
PS1="\s-\u:\W\$ "
output : bash-myDesktop:Pictures$

how to change color

2010年2月3日星期三

ARM Note

****************************
*** CRC
****************************
下面以最常用的CRC-16为例来说明其生成过程。

CRC-16码由两个字节构成,在开始时CRC寄存器的每一位都预置为1,然后把CRC寄存器与8-bit的数据进行异或,之后对CRC寄存器从高到低进行移位,在最高位(MSB)的位置补零,而最低位(LSB,移位后已经被移出CRC寄存器)如果为1,则把寄存器与预定义的多项式码进行异或,否则如果LSB为零,则无需进行异或。重复上述的由高至低的移位8次,第一个8-bit数据处理完毕,用此时CRC寄存器的值与下一个8-bit数据异或并进行如前一个数据似的8次移位。所有的字符处理完成后CRC寄存器内的值即为最终的CRC值。

CRC的计算过程:
1.设置CRC寄存器,并给其赋值FFFF(hex)。
2.将数据的第一个8-bit字符与16位CRC寄存器的低8位进行异或,并把结果存入CRC寄存器。
3.CRC寄存器向右移一位,MSB补零,移出并检查LSB。
4.如果LSB为0,重复第三步;若LSB为1,CRC寄存器与多项式码相异或。
5.重复第3与第4步直到8次移位全部完成。此时一个8-bit数据处理完毕。
6.重复第2至第5步直到所有数据全部处理完成。
7.最终CRC寄存器的内容即为CRC值。

The sample code searched from web:

//-- reverse order of 0x8005 (X16+X15+X2+1, CRC-16, ignored MSB X16)
//-- since we are XORing bit0 of the data
volatile unsigned short CRCPOLY16 = 0xA001;

//-- bit-at-a-time CRC-16 algorithm
unsigned short crc16( unsigned char *data, unsigned char len)
{
unsigned char i;
unsigned char j;
unsigned short byte;
unsigned short crc;
unsigned short mask;

i = 0;
crc = 0xFFFF;

while( i < len )
{
if( data[i] != 0 )
{
byte = data[i]; //-- get next byte
crc = crc ^ byte;
for( j=8; j>0; j-- )
{
mask = -(crc & 1);
crc = (crc >> 1) ^ (CRCPOLY16 & mask);
}
}
i++;
}
return ~crc;
}

********************** END CRC *****************

**************************************************
** I2C Slave mode
**************************************************
Sample code for ARM7 :

"i2c_slave.h" :
#ifndef __I2C_SLAVE_H__
#define __I2C_SLAVE_H__

void IRQ_I2C0_SLV (void) __attribute__ ((interrupt("IRQ")));
volatile unsigned char I2C_SlaveRcv;
volatile unsigned char *I2C_SlaveSndBuf;
volatile unsigned char I2C_Snd_num;
volatile unsigned char I2C_SlvSnd_end;
volatile unsigned char I2C_NoOfByte;
void Initialize_I2C0_SLV( unsigned int irq_slot, unsigned char id, unsigned char noofbyte);
void IRQ_I2C0_SLV(void);
void I2C_Slv_SendData( unsigned char *s);

#endif // __I2C_SLAVE_H__

"i2c_slave.c" :
void Initialize_I2C0_SLV( unsigned int irq_slot, unsigned char id, unsigned char noofbyte)
{
volatile unsigned long *addr;
PINSEL0 |= 0x00000050; //-- p0.2=SDA0, p0.3=SCL0
I2C0ADR = ( id << 1); //-- set I2C slave address, shitf 1-bit left to filter r/w bit
I2C0CONSET = 0x44; //-- enable I2C hardware and set AA (ack) to enable slave mode
addr = &VICVectCntl0;
*(addr + irq_slot) = 0x00000020 | VIC_I2C0;
addr = &VICVectAddr0;
*(addr + irq_slot) = ( unsigned int ) &IRQ_I2C0_SLV;

VICIntSelect &= ~( 1 << VIC_I2C0);
VICIntEnable |= ( 1 << VIC_I2C0);

I2C_NoOfByte = noofbyte;
I2C_SlaveSndBuf = NULL;
I2C_Snd_num = I2C_NoOfByte;
I2C_SlvSnd_end = 1;
}

void IRQ_I2C0_SLV(void)
{
unsigned char sta;

sta = I2C0STAT;
//I2C0CONCLR = 0x2C; //-- clear STA, AA and SI
I2C0CONCLR = 0x24; //-- clear STA and AA

switch( sta)
{
//-- slave receiver mode
case 0x60: //-- own SLA+W has been received, ack has been returned, no I2CDAT action
I2C0CONSET = 0x04; //-- set AA, will receive data and return ACK
break;
case 0x68: //-- address as slave
I2C0CONSET = 0x04; //-- set AA, return ACK on first byte
break;
case 0x70:
break;
case 0x78:
break;
case 0x80: //-- Data received, ACK returned
I2C_SlaveRcv = I2C0DAT; //-- read and store data, NACK on next byte
I2C0CONSET = 0x04;
break;
case 0x88: //-- data received, NACK returned, will exit slave mode
I2C0CONSET = 0x04; //-- set to not addressed slave
break;
case 0xA0: //-- STOP or repeat START received with addressed as slave, will leave slave mode
I2C0CONSET = 0x04; //-- set AA to re-enter slave mode
break;

//-- slave transmitter mode
case 0xA8: //-- own SLA+R received, ACK returned (slave transmitted)
I2C_SlvSnd_end = 0; //-- start send bytes
I2C_Snd_num = I2C_NoOfByte; //-- initiate pointer
I2C0DAT = *I2C_SlaveSndBuf; //-- first byte will be sent;
I2C0CONSET = 0x04; //-- current data byte will be transmitted, ACK will be received, AA=1
break;
case 0xB0: //-- Arbitration lost, enter slave transmitter mode
break;
case 0xB8: //-- Data transmitted, ACK received
I2C_Snd_num--; //-- decrease data byte counter
I2C0DAT = *(I2C_SlaveSndBuf + (I2C_NoOfByte - I2C_Snd_num));
if( I2C_Snd_num > 0 ) //-- if not the last byte
{
I2C0CONSET = 0x04; //-- Data byte will be transmitted, ACK will be received, AA=1
}
else //-- the last byte
{
I2C0CONCLR = 0x04; //-- Last data byte will be sent and ACK will be received, AA=0
}
break;
case 0xC0: //-- Data byte transmitted, NACK received(end of master receive mode), not addressed slave entered
I2C0CONSET = 0x04; //-- set AA, switch to not addressed mode
I2C_Snd_num = I2C_NoOfByte; //-- reset counter
I2C_SlvSnd_end = 1; //-- reset end of send byte flag
break;
case 0xC8: //-- Last data transmitted, ACK received
I2C_Snd_num = I2C_NoOfByte; //-- reset counter
I2C_SlvSnd_end = 1; //-- reset end of byte flag
I2C0CONSET = 0x04; //-- Set AA, switch to not addressed slave mode
break;
default:
I2C_Snd_num = I2C_NoOfByte; //-- reset counter
I2C_SlvSnd_end = 0; //-- reset end of byte flag
break;
}
I2C0CONCLR = 0x08; //-- clear SI
VICVectAddr = 0x00; //-- reset VIC
}

void I2C_Slv_SendData( unsigned char *s)
{
if( I2C_SlvSnd_end == 1)
I2C_SlaveSndBuf = s;
}

******************** END I2C Slave mode ************************

2009年7月23日星期四

AVR - building avr toolchain under Linux

avr-gcc build notes:

host gcc version: 4.2.3

set default install path
- export prefix=~/tools/avr


1) build binutils
version: binutils-2.19.1

-- cd binutils-2.19.1
-- ./configure --target=avr --prefix=$prefix --disable-nls
-- make
-- make install


2) build avr-gcc
version: gcc-core-4.2.4

add path:
-- export PATH=$prefix/bin:$PATH

-- cd gcc-4.2.4
-- ./configure --target=avr --prefix=$prefix --disable-libssp --enable-language=c
-- make
-- make install

if build version gcc-core-4.4.0
we need lib "mpfr" and "gmp", the arithmetic libs

version: mpfr-2.4.1.tar.gz
source: http://www.mpfr.org/mpfr-current/#download

version: gmp-4.3.1.tar.gz
source: http://gmplib.org/#DOWNLOAD

-- tar -zxvf gcc-core-4.4.0.tar.gz
-- tar -zxvf mpfr-2.4.1.tar.gz
-- cp -R mpfr-2.4.1 gcc-4.4.0
-- cd gcc-4.4.0
-- mv mpfr-2.4.1 mpfr

-- tar -zxvf gmp-4.3.1.tar.gz
-- cp -R gmp-4.3.1 gcc-4.4.0
-- mv gmp-4.3.1 gmp

we must not configure directly under gcc-4.4.0 or any existing subfolders,
otherwise may get errors like:

"Makefile:144: ../.././gcc/libgcc.mvars: No such file or directory
make[2]: *** No rule to make target `../.././gcc/libgcc.mvars'. Stop. "

-- cd gcc-4.4.0
-- mkdir build
-- cd build
-- ../configure --target=avr --prefix=$prefix --disable-libssp --enable-language=c
-- make
-- make install


3) build avr-libc
version: avr-libc-1.6.7.tar.bz2
source: http://ftp.twaren.net/Unix/NonGNU/avr-libc/

-- tar -jxvf avr-libc-1.6.7.tar.bz2
-- cd avr-libc-1.6.7
-- ./configure --host=avr --prefix=$prefix
-- make
-- make install

if I follow the INSTALL guild:
-- ./configure --build='./config.guess' --host=avr --prefix=$prefix

I got the following error:
"Invalid configuration `./config.guess': machine `./config.guess' not recognized "


4) build avr-gdb
version: gdb-6.8.tar.gz
source: http://ftp.gnu.org/gnu/gdb/

-- tar -zxvf gdb-6.8.tar.gz
-- cd gdb-6.8
-- ./configure --target=avr --prefix=$prefix
-- make
-- make install


5) build avrdude
version: avrdude-5.8.tar.gz
source: http://ftp.twaren.net/Unix/NonGNU/avrdude/

It needs the following packages:
bison and flex

version: bison-2.4.1.tar.gz
source: http://ftp.gnu.org/gnu/bison/

version: flex-2.5.35.tar.gz
source: http://flex.sourceforge.net/

#install bison
-- tar -zxvf bison-2.4.1.tar.gz
-- cd bison-2.4.1
-- ./configure
-- make
-- sudo make install

#install flex
-- tar -zxvf flex-2.5.35.tar.gz
-- cd flex-2.5.35
-- ./configure
-- make
-- sudo make install

#install avrdude
-- tar -zxvf avrdude-5.8.tar.gz
-- cd avrdude-5.8
-- ./configure --prefix=$prefix
-- make
-- make install


6) build avarice
version: avarice-2.10.tar.bz2
source: http://sourceforge.net/projects/avarice/

-- tar -jxvf avarice-2.10.tar.bz2
-- cd avarice-2.10
-- ./configure --prefix=$prefix
-- make
-- make install

If it warns: "configure: error: You need to install libbfd.a from binutils."
the package "libbinutils2-devel" may be missing (me, Mandriva 2008)
install this package from Software Management


7) build simulavr
version: simulavr-0.1.2.6.tar.gz
source: http://savannah.nongnu.org/projects/simulavr/

-- tar -zxvf simulavr-0.1.2.6.tar.gz
-- cd simulavr-0.1.2.6
-- ./configure --prefix=$prefix
-- make
-- make install

2009年6月8日星期一

Linux - Compiling Qt Embedded under Ubuntu 8.1

installing qt-embedded
linux version : ubuntu 8.01-x86-64
qt-embedded version : qt-embedded-linux-opensource-src-4.5.1.tar.gz
qt-x11 version : qt-x11-opensource-src-4.5.1.tar.gz (we need this package to get qvfb)

copy the source file to 2 identical directories with different names:
- qt-embedded-x86 (for x86 arch, qvfb could only run on embedded x86 arch)
- qt-embbeded-arm (for arm arch, gnu arm toolchain to be install in advance)

-- export TOOLPATH=/tools/qt-embedded
1) qt-embedded-x86 :
in order to make qvfb usable, the plugin options added as below
-- ./configure -prefix $TOOLPATH/x86 -plugin-gfx-qvfb -qt-kbd-qvfb -qt-mouse-qvfb
-- ./make
-- ./make install

alterntive way to make qvfb usable:
-- cd ./src/plugins/gfxdrivers/qvfb/
-- create qmake path: export PATH=$PATH:$TOOLPATH/x86/bin
-- sudo make install


2) qt-embedded-arm :
Need to install gnu ARM toolchain prior to install this package.
-- ./configure -prefix $TOOLPATH/arm -xplatform qws/linux-arm-g++ -embeded arm -little-endian


3) qt-x11 :
Compile qt-x11 to get qvfb
Before compile, we need libXtst.so package
-- sudo apt-get install libxtst-dev
-- check : ls /usr/lib64/ | grep Xtst

--------
-- ./configure -qvfb
-- ./make
if want to install qt-x11
-- ./make install

-- cd ./tools/qvfb
-- ./make
-- cd ../../bin
-- cp ./qvfb $TOOLPATH/x86/bin

4) test
-- cd /tools/qt-embedded-x86/demos/books
-- qvfb &
-- ./books -qws

5) Build your own qt project
-- 1st build the qt project under X11, compile and qmake under X11 (using the X11 version of qmake)
-- run under xterm to test the program
-- recompile the the project under X11 by using /tools/qt-embedded/x86/bin/qmake
-- ./qvfb&
-- ./apps -qws

6) Build arm binary (NOT try yet, will come back after trying the flow)