mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-29 09:58:26 +02:00
add serial output function, Thanks Dennis <dennis.yxun@gmail.com>, his patch make me clear. Thank for Andy Green help.
This commit is contained in:
parent
12ba156cfb
commit
b92d8222aa
@ -14,10 +14,46 @@
|
|||||||
# MA 02111-1307 USA
|
# MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
all :
|
include config.mk
|
||||||
cd src ; make all
|
|
||||||
|
LDS = src/kboot-stage1.lds
|
||||||
|
INCLUDE = include
|
||||||
|
IMAGE_DIR = image
|
||||||
|
#CFLAGS = -Wall -I $(INCLUDE) -msoft-float -g -c
|
||||||
|
CFLAGS = -Wall -I $(INCLUDE) -g -c
|
||||||
|
LDFLAGS =
|
||||||
|
#START = start.o lowlevel_init.o
|
||||||
|
S_SRCS = src/start.S src/lowlevel_init.S
|
||||||
|
S_OBJS = $(patsubst %.S,%.o, $(S_SRCS))
|
||||||
|
C_SRCS = $(wildcard src/*.c)
|
||||||
|
C_OBJS = $(patsubst %.c,%.o, $(C_SRCS))
|
||||||
|
|
||||||
|
#SRCS := $(START: .o=.S) $(COBJS: .o=.c)
|
||||||
|
SRCS = ${S_SRCS} ${C_SRCS}
|
||||||
|
OBJS = ${S_OBJS} ${C_OBJS}
|
||||||
|
|
||||||
|
TARGET = src/start_kboot_all
|
||||||
|
IMAGE = $(IMAGE_DIR)/start
|
||||||
|
|
||||||
|
%.o: %.S
|
||||||
|
@$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@$(CC) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
all:${TARGET}
|
||||||
|
|
||||||
|
${OBJS}:${SRCS}
|
||||||
|
|
||||||
|
${TARGET}:${OBJS}
|
||||||
|
$(LD) ${LDFLAGS} -T$(LDS) -g $(OBJS) -o ${TARGET}
|
||||||
|
$(OBJCOPY) -O binary -S ${TARGET} ${IMAGE}
|
||||||
|
$(OBJDUMP) -D ${TARGET} >${IMAGE}.dis
|
||||||
|
|
||||||
|
blink_led:src/led_on.S
|
||||||
|
$(CC) $(CFLAGS) led_on.o led_on.S
|
||||||
|
$(LD) -g led_on.o -o led_on_temp.o
|
||||||
|
$(OBJCOPY) -O binary -S led_on_temp.o $(IMAGE)/led_on
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cd src ; make clean
|
rm -f src/*.o src/*~ ${IMAGE}* ${TARGET}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Include the make variables (CC, etc...)
|
# Include the make variables (CC, etc...)
|
||||||
#
|
#
|
||||||
|
#CROSS_COMPILE=arm-softfloat-linux-gnu-
|
||||||
CROSS_COMPILE=arm-angstrom-linux-gnueabi-
|
CROSS_COMPILE=arm-angstrom-linux-gnueabi-
|
||||||
|
|
||||||
AS = $(CROSS_COMPILE)as
|
AS = $(CROSS_COMPILE)as
|
||||||
|
41
qiboot/include/blink_led.h
Normal file
41
qiboot/include/blink_led.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* (C) Copyright 2007 OpenMoko, Inc.
|
||||||
|
* Author: xiangfu liu <xiangfu@openmoko.org>
|
||||||
|
*
|
||||||
|
* Configuation settings for the FIC Neo GTA02 Linux GSM phone
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __BLINK_LED_H
|
||||||
|
#define __BLINK_LED_H
|
||||||
|
|
||||||
|
#define GPBCON (*(volatile unsigned *)0x56000010)
|
||||||
|
#define GPBDAT (*(volatile unsigned *)0x56000014)
|
||||||
|
#define GPBDW (*(volatile unsigned *)0x56000018)
|
||||||
|
#define ORANGE_OFF() (GPBDAT &= ~(0x1))
|
||||||
|
#define BLUE_OFF() (GPBDAT &= ~(0x2))
|
||||||
|
#define ORANGE_ON() (GPBDAT |= (0x1))
|
||||||
|
#define BLUE_ON() (GPBDAT |= (0x2))
|
||||||
|
|
||||||
|
#define ORANGE 1;
|
||||||
|
#define BLUE 0;
|
||||||
|
|
||||||
|
int orange_on(int times);
|
||||||
|
int blue_on(int times);
|
||||||
|
int blink_led(void);
|
||||||
|
|
||||||
|
#endif /* __BLINK_LED_H */
|
22
qiboot/include/nand_read.h
Normal file
22
qiboot/include/nand_read.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* nand_read.c: Simple NAND read functions for booting from NAND
|
||||||
|
*
|
||||||
|
* This is used by cpu/arm920/start.S assembler code,
|
||||||
|
* and the board-specific linker script must make sure this
|
||||||
|
* file is linked within the first 4kB of NAND flash.
|
||||||
|
*
|
||||||
|
* Taken from GPLv2 licensed vivi bootloader,
|
||||||
|
* Copyright (C) 2002 MIZI Research, Inc.
|
||||||
|
*
|
||||||
|
* Author: Hwang, Chideok <hwang@mizi.com>
|
||||||
|
* Date : $Date: 2004/02/04 10:37:37 $
|
||||||
|
*
|
||||||
|
* u-boot integration and bad-block skipping (C) 2006 by OpenMoko, Inc.
|
||||||
|
* Author: Harald Welte <laforge@openmoko.org>
|
||||||
|
*/
|
||||||
|
#ifndef __NAND_READ_H
|
||||||
|
#define __NAND_READ_H
|
||||||
|
|
||||||
|
int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size);
|
||||||
|
|
||||||
|
#endif /* __NAND_READ_H */
|
32
qiboot/include/serial.h
Normal file
32
qiboot/include/serial.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* (C) Copyright 2007 OpenMoko, Inc.
|
||||||
|
* Author: xiangfu liu <xiangfu@openmoko.org>
|
||||||
|
*
|
||||||
|
* Configuation settings for the FIC Neo GTA02 Linux GSM phone
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define rUTXH0 (*(volatile unsigned char *)0x50000023)
|
||||||
|
#define UTRSTAT (*(volatile unsigned char *)0x50000010)
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define PUT_CHAR() (rUTXH0
|
||||||
|
#define ORANGE_OFF() (GPBDAT &= ~(0x1))
|
||||||
|
*/
|
||||||
|
|
||||||
|
void serial_puti (const int i);
|
||||||
|
|
@ -66,7 +66,7 @@ int blue_on(int times)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int blink_led()
|
int blink_led(void)
|
||||||
{
|
{
|
||||||
set_GPB();
|
set_GPB();
|
||||||
|
|
||||||
|
@ -32,23 +32,35 @@ SECTIONS
|
|||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
start.o (.text)
|
src/start.o (.text)
|
||||||
lowlevel_init.o(.text)
|
src/lowlevel_init.o(.text)
|
||||||
start_kboot.o (.text)
|
src/start_kboot.o (.text)
|
||||||
*(.text)
|
*(.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.rodata : { *(.rodata) }
|
.rodata :
|
||||||
|
{
|
||||||
|
*(.rodata)
|
||||||
|
}
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.data : { *(.data) }
|
.data :
|
||||||
|
{
|
||||||
|
*(.data)
|
||||||
|
}
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
.got : { *(.got) }
|
.got :
|
||||||
|
{
|
||||||
|
*(.got)
|
||||||
|
}
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
__bss_start = .;
|
__bss_start = .;
|
||||||
.bss : { *(.bss) }
|
.bss :
|
||||||
|
{
|
||||||
|
*(.bss)
|
||||||
|
}
|
||||||
_end = .;
|
_end = .;
|
||||||
}
|
}
|
||||||
|
33
qiboot/src/serial.c
Normal file
33
qiboot/src/serial.c
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* (C) Copyright 2007 OpenMoko, Inc.
|
||||||
|
* Author: xiangfu liu <xiangfu@openmoko.org>
|
||||||
|
*
|
||||||
|
* Configuation settings for the FIC Neo GTA02 Linux GSM phone
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||||
|
* MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
# include <serial.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Output a single byte to the serial port.
|
||||||
|
*/
|
||||||
|
void serial_puti (const int i)
|
||||||
|
{
|
||||||
|
while (!(UTRSTAT & 0x2));
|
||||||
|
|
||||||
|
rUTXH0 |= i;
|
||||||
|
}
|
@ -21,6 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "blink_led.h"
|
#include "blink_led.h"
|
||||||
#include "nand_read.h"
|
#include "nand_read.h"
|
||||||
|
#include "serial.h"
|
||||||
/*
|
/*
|
||||||
unsigned char buf[]={
|
unsigned char buf[]={
|
||||||
0x0d,0xc0,0xa0,0xe1,0x00,0xd8,0x2d,0xe9,0x04,0xb0,0x4c,0xe2,0x4c,0x20,0x9f,0xe5,
|
0x0d,0xc0,0xa0,0xe1,0x00,0xd8,0x2d,0xe9,0x04,0xb0,0x4c,0xe2,0x4c,0x20,0x9f,0xe5,
|
||||||
@ -36,14 +37,19 @@ unsigned char buf[2048];
|
|||||||
|
|
||||||
#define ADDR ((volatile unsigned *)&buf)
|
#define ADDR ((volatile unsigned *)&buf)
|
||||||
|
|
||||||
int start_kboot()
|
int start_kboot(void)
|
||||||
{
|
{
|
||||||
if(nand_read_ll(buf, 0x32000000, sizeof(buf))==-1)
|
/*1 say hello to uart */
|
||||||
{
|
serial_puti (123);
|
||||||
while(1){blink_led(1);}
|
blue_on(1);
|
||||||
|
/*2. test nand flash */
|
||||||
|
if(nand_read_ll(buf, 0x40000, sizeof(buf))==-1) {
|
||||||
|
while(1) {
|
||||||
|
blink_led();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
asm volatile("mov pc, %0\n"
|
asm volatile("mov pc, %0\n"
|
||||||
: /* output */
|
: /* output */
|
||||||
:"r"(ADDR) /* input */
|
:"r"(ADDR) /* input */
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user