[uClinux-dev] (no subject)

wuwyw wuwyw at 163.com
Sun Mar 16 22:30:23 EST 2003


Hi,
I want to port uClinux 2.4.x(ROM Core) to my MC68ez328 board, which has 4M
SDRAM and 2M FLASH.
 I only modified rom.ld (to suit my memory map) and crt0_rom.S( to set some register .
My rom.ld ;MEMORY
	{
	romvec : ORIGIN = 0x01000000, LENGTH = 0x00400
	flash  : ORIGIN = 0x01000400, LENGTH = 0x011fffff - 0x00400
	eflash : ORIGIN = 0x011fffff, LENGTH = 1
	ramvec : ORIGIN = 0x00000000, LENGTH = 1024
	ram    : ORIGIN = 0x00000400, LENGTH = 0x003fffff - 0x400
	eram   : ORIGIN = 0x003fffff, LENGTH = 1
	}

SECTIONS
{
  .romvec :
	{
	_flashstart = . ;
	_romvec = . ;
	__rom_start = . ;
	} > romvec

  .text :
	{
	_stext = . ;
        	*(.text)
	. = ALIGN(0x10) ;
		*(.text.*)
	. = ALIGN(0x10) ;
		*(.exitcall.exit)
	. = ALIGN(0x10) ;
		*(.kstrtab)
	. = ALIGN(16);          /* Exception table              */
	__start___ex_table = .;
		*(__ex_table)
	__stop___ex_table = .;

        __start___ksymtab = .;  /* Kernel symbol table          */
		 *(__ksymtab)
	__stop___ksymtab = .;

	. = ALIGN(0x10) ;
	_etext = . ;
	__data_rom_start = ALIGN(4) ;
        } > flash

  .eflash :
	{
	_flashend = . ;
	} > eflash

  .ramvec :
	{
	__ram_start = . ;
	__ramvec = . ;
	} > ramvec

  .data :
	{
	. = ALIGN(0x4) ;
	_sdata = . ;
	__data_start = . ;

	. = ALIGN(0x4) ;
		*(.rodata)
	. = ALIGN(0x4) ;
		*(.data)
	. = ALIGN(0x4) ;
		*(.data.*)

	. = ALIGN(0x4) ;
	__setup_start = .;
		*(.setup.init)
	. = ALIGN(0x4) ;
	__setup_end = .;

	. = ALIGN(0x4) ;
	__initcall_start = .;
		*(.initcall.init)
	. = ALIGN(0x4) ;
	__initcall_end = .;

	/*. = ALIGN(0x2000) ;*/
		*(.data.init_task)
	. = ALIGN(0x10) ;

	_edata = . ;

        } > ram

  .bss :
        {
	. = ALIGN(0x10) ;
	_sbss = . ;
		*(.bss)
	. = ALIGN(0x10) ;
		*(COMMON)
	. = ALIGN(0x10) ;
	_ebss = . ;
	_end = . ;
	} > ram

  .eram :
	{
	__ramend = . ;
	} > eram
}
my crt0_rom.S;
#include <linux/config.h>

	.global _start
	.global _stext

	.global _rambase
	.global _ramvec
	.global _ramstart
	.global _ramend

#ifdef CONFIG_INIT_LCD
	.global splash_bits
#endif

	.data

/*
 *      Set up the usable of RAM stuff. Size of RAM is determined then
 *      an initial stack set up at the end.
 */
.align 4
_ramvec:
.long   0
_rambase:
.long   0
_ramstart:
.long   0
_ramend:
.long   0

/*ifdef CONFIG_INIT_LCD*/
splash_bits:
#include "bootlogo.rh"
/*#endif*/

	.text
_start:
_stext:	/*movew	#0x2700,%sr*/

	nop
	/* Init like the MOT ADS board.  Check this first */
	moveb	#0x00,   0xfffffb0b	/* Watchdog off */
	moveb	#0x10,   0xfffff000	/* SCR */

	movew   #0x2400, 0xfffff200	/* PLLCR */
	movew   #0x0123, 0xfffff202	/*	 PLLFSR */

	moveb	#0x00,   0xfffff40b	/* enable chip select */
	moveb	#0x00,   0xfffff423	 /*enable /DWE */
	moveb	#0x08,   0xfffffd0d	/* disable hardmap */
	moveb	#0x07,   0xfffffd0e	/* level 7 interrupt clear */

        movew   #0x0800, 0xfffff100     /* FLASH at 0x10C00000 */
        movew   #0x8000, 0xfffff102     /*  */
        movew   #0x0187, 0xfffff110     /* 4Meg, 16bit, enable, 3ws */
	movew   #0x0187, 0xfffff112     /*  */

        movew   #0x8f00, 0xfffffc00     /* DRAM configuration */
        movew   #0x9667, 0xfffffc02     /* DRAM control - *DWE Enable*/
        movew   #0x0000, 0xfffff106     /* DRAM at 0x00000000 */
        movew   #0x028D, 0xfffff116     /* 8Meg, 16bit, enable, 0ws */
        movew   #0x0000, 0xfffff104     /*  */
        movew   #0x028D, 0xfffff114     /*  */


	movew   #0x0808, 0xfffff420
	movew   #0x8007, 0xfffff422
	movew   #0x0061, 0xfffff42a
	movew   #0x619e, 0xfffff428

	moveb	#0x40,   0xfffff300	/* IVR */
	movel	#0x007FFFFF, %d0	/* IMR */
	movel	%d0,     0xfffff304

	moveb   0xfffff42b, %d0
	andb    #0xe0,   %d0
	moveb   %d0,     0xfffff42b

	moveb	#0x08,   0xfffff907	/* Ignore CTS */
	movew	#0x010b, 0xfffff902	/* BAUD to 9600 */
	movew	#0xe100, 0xfffff900	/* enable */

	moveb   #0,      0xfffffA27	/* LCKCON - LCD is off */

#ifdef CONFIG_INIT_LCD
	moveb	#0x61,0xfffff428	/*Select For OUTPUT*/
	movew 	#0x0060,0xfffff42a	/*Select For Internal Operation*/
	movew   #0x0340,0xfffffa36	/*Set The Contrast*/
	movel	#splash_bits, 0xfffffA00 /* LSSA */
	moveb	#0x0a,    0xfffffA05	/* LVPW */
	movew	#0x00a0,  0xFFFFFa08	/* LXMAX */
	movew	#0x00a0,  0xFFFFFa0a	/* LYMAX */
	moveb	#00,      0xfffffa29	/* LBAR */
	moveb	#00,      0xfffffa25	/* LPXCD */
	moveb	#0x08,   0xFFFFFa20	/* LPICF */
	moveb	#0x00,   0xFFFFFA21	/* -ve pol */
	moveb	#0x8f,   0xfffffA27	/* LCKCON */
	movew	#0xff00, 0xfffff412	/* LCD pins */
	movel   #0x023d3c0a,0xfffff430

#endif
	moveal  #_ramend-0x10 ,%sp
	/*moveal  #__ramend-CONFIG_MEMORY_RESERVE*0x100000 - 0x10, %sp*/
	movew   #0x2700 ,%sr

	moveq   #13, %d7                /* '\r' */
        jsr putc

        moveq   #10, %d7                /* '\n' */
        jsr putc

        moveq   #65, %d7                /* 'A' */
        jsr putc

	movew	#32767,%d0 /*#32767, %d0   PLL settle wait loop */
L0:	subq	#1, %d0
	bne	L0
	moveq	#66, %d7
	jsr	putc


	/* Copy data segment from ROM to RAM */
	moveal	/*#__data_rom_start*/ #0x01078800, %a0
	moveal	#_sdata, %a1
	moveal	#_edata, %a2
	moveq	#67, %d7
	jsr	putc


	/* Copy %a0 to %a1 until %a1 == %a2 */
LD1:	movel	%a0@+, %d0   /*a1@+*/
        movel   %d0,%a1@+
	cmpal	%a1, %a2
	bhi	LD1
	moveq	#68, %d7
	jsr	putc

	moveal	#_sbss, %a0
	moveal	#_ebss, %a1
	/* Copy 0 to %a0 until %a0 == %a1 */

L1:
	clrl	%a0@+
	cmpal	%a0, %a1
	bhi	L1

	moveq	#69, %d7
	jsr	putc

        movel   #_sdata, %d0
        movel   %d0,    _rambase
        movel   #_ebss,  %d0
        movel   %d0,    _ramstart

	movel	#__ramend-CONFIG_MEMORY_RESERVE*0x100000 ,%d0
	movel	%d0,	_ramend
	movel	#__ramvec,	%d0
	movel	%d0,	_ramvec

      /*  pea 0
	pea env
	pea %sp@(4)
	pea 0 
	moveq	#70, %d7
	jsr	putc*/
/*
 * load the current task pointer and stack
 */
    
        lea     init_task_union,%a0
        movel   %a0, _current_task
        lea     0x2000(%a0),%sp
	
	moveq   #13, %d7                /* '\r' */
        jsr putc

        moveq   #10, %d7                /* '\n' */
        jsr putc

/* print HHTECH: while flashing the light */
#if 1 
prn:	


	movew   #0x0061,   0xfffff42a
        movew   #0x61ff,   0xfffff428
        nop
        nop
	nop

        moveq   #72, %d7   /* HHTECH */
        jsr     putc

        movew   #0x0061,   0xfffff42a
        movew   #0x61fe,   0xfffff428
        nop
        nop
	nop  

        moveq   #72, %d7
        jsr     putc

        movew   #0x0061,   0xfffff42a
        movew   #0x61df,   0xfffff428
	nop
        nop
	nop

        moveq   #84, %d7
        jsr     putc

       /* Light act */

	movew   #0x0061,   0xfffff42a
        movew   #0x61bf,   0xfffff428
        nop
	nop

        moveq   #69, %d7
        jsr     putc

        movew   #0x0061,   0xfffff42a
        movew   #0x61be,   0xfffff428
        nop
	nop

        moveq   #67, %d7
        jsr     putc
        moveq   #72, %d7
        jsr     putc
        moveq   #58, %d7   /* ':' */
        jsr     putc
   
#endif



lp:	jsr	start_kernel
        jmp lp
 /*bra ,1b*/
_exit:

	jmp	_exit


putc:
	moveb	%d7,0xfffff907
pclp:
	movew	0xfffff906, %d7
	andw	#0x2000, %d7
	beq	pclp   /*1b*/
	rts

	.data
env:
	.long	0
	.text
but print "ABCDE" 
ABCDE :
XXXX
:(
Then stop.
Should I modify the instruction in crt0_rom.S and rom.ld anyway?



thanks,
                                         wu
                                      wuwyw at 163.net


=============================================================
ÍøÒ×VIPÊÕ·ÑÓÊÏä ³É¹¦ÈËÊ¿µÄ×î¼ÑÑ¡Ôñ£¡          http://vip.163.com/
õ¹å¡¢ÇÉ¿ËÁ¦¡¢ºÍÇ鲬½ð×ê½ä£¡                  http://vip.163.com/lover/new_love.jsp
´ºÌìµ½Á˹¶ÀµÄÄ㻹²»Ô¼»á Ô¼»áÆäʵºÜ¼òµ¥            http://dating.163.com/




More information about the uClinux-dev mailing list