mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
Merge branch 'next' of git://git.denx.de/u-boot-nios
This commit is contained in:
commit
c88d6ab19f
17 changed files with 640 additions and 8 deletions
|
@ -858,6 +858,7 @@ Scott McNutt <smcnutt@psyent.com>
|
|||
EP1C20 Nios-II
|
||||
EP1S10 Nios-II
|
||||
EP1S40 Nios-II
|
||||
nios2-generic Nios-II
|
||||
|
||||
#########################################################################
|
||||
# MicroBlaze Systems: #
|
||||
|
|
1
MAKEALL
1
MAKEALL
|
@ -830,6 +830,7 @@ LIST_nios2=" \
|
|||
EP1S40 \
|
||||
PCI5441 \
|
||||
PK1C20 \
|
||||
nios2-generic \
|
||||
"
|
||||
|
||||
#########################################################################
|
||||
|
|
6
Makefile
6
Makefile
|
@ -3534,6 +3534,12 @@ PK1C20_config : unconfig
|
|||
PCI5441_config : unconfig
|
||||
@$(MKCONFIG) PCI5441 nios2 nios2 pci5441 psyent
|
||||
|
||||
# nios2 generic boards
|
||||
NIOS2_GENERIC = nios2-generic
|
||||
|
||||
$(NIOS2_GENERIC:%=%_config) : unconfig
|
||||
@$(MKCONFIG) $(@:_config=) nios2 nios2 nios2-generic altera
|
||||
|
||||
#========================================================================
|
||||
## Microblaze
|
||||
#========================================================================
|
||||
|
|
|
@ -29,4 +29,4 @@ STANDALONE_LOAD_ADDR = 0x02000000 -L $(gcclibdir)
|
|||
PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
|
||||
PLATFORM_CPPFLAGS += -ffixed-r15 -G0
|
||||
|
||||
LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
|
||||
LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
.global _start
|
||||
|
||||
_start:
|
||||
wrctl status, r0 /* Disable interrupts */
|
||||
/* ICACHE INIT -- only the icache line at the reset address
|
||||
* is invalidated at reset. So the init must stay within
|
||||
* the cache line size (8 words). If GERMS is used, we'll
|
||||
|
@ -43,10 +44,9 @@ _start:
|
|||
ori r4, r0, %lo(CONFIG_SYS_ICACHELINE_SIZE)
|
||||
movhi r5, %hi(CONFIG_SYS_ICACHE_SIZE)
|
||||
ori r5, r5, %lo(CONFIG_SYS_ICACHE_SIZE)
|
||||
mov r6, r0
|
||||
0: initi r6
|
||||
add r6, r6, r4
|
||||
bltu r6, r5, 0b
|
||||
0: initi r5
|
||||
sub r5, r5, r4
|
||||
bgt r5, r0, 0b
|
||||
br _except_end /* Skip the tramp */
|
||||
|
||||
/* EXCEPTION TRAMPOLINE -- the following gets copied
|
||||
|
@ -62,7 +62,6 @@ _except_end:
|
|||
/* INTERRUPTS -- for now, all interrupts masked and globally
|
||||
* disabled.
|
||||
*/
|
||||
wrctl status, r0 /* Disable interrupts */
|
||||
wrctl ienable, r0 /* All disabled */
|
||||
|
||||
/* DCACHE INIT -- if dcache not implemented, initd behaves as
|
||||
|
|
|
@ -25,6 +25,12 @@
|
|||
#define __ASM_NIOS2_BYTEORDER_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
|
||||
# define __BYTEORDER_HAS_U64__
|
||||
# define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
|
||||
#include <linux/byteorder/little_endian.h>
|
||||
|
||||
#endif /* __ASM_NIOS2_BYTEORDER_H_ */
|
||||
|
|
23
arch/nios2/include/asm/dma-mapping.h
Normal file
23
arch/nios2/include/asm/dma-mapping.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef __ASM_NIOS2_DMA_MAPPING_H
|
||||
#define __ASM_NIOS2_DMA_MAPPING_H
|
||||
|
||||
/* dma_alloc_coherent() return cache-line aligned allocation which is mapped
|
||||
* to uncached io region.
|
||||
*
|
||||
* IO_REGION_BASE should be defined in board config header file
|
||||
* 0x80000000 for nommu, 0xe0000000 for mmu
|
||||
*/
|
||||
|
||||
static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
|
||||
{
|
||||
void *addr = malloc(len + CONFIG_SYS_DCACHELINE_SIZE);
|
||||
if (!addr)
|
||||
return 0;
|
||||
flush_dcache((unsigned long)addr, len + CONFIG_SYS_DCACHELINE_SIZE);
|
||||
*handle = ((unsigned long)addr +
|
||||
(CONFIG_SYS_DCACHELINE_SIZE - 1)) &
|
||||
~(CONFIG_SYS_DCACHELINE_SIZE - 1) & ~(IO_REGION_BASE);
|
||||
return (void *)(*handle | IO_REGION_BASE);
|
||||
}
|
||||
|
||||
#endif /* __ASM_NIOS2_DMA_MAPPING_H */
|
|
@ -28,6 +28,7 @@
|
|||
#include <stdio_dev.h>
|
||||
#include <watchdog.h>
|
||||
#include <malloc.h>
|
||||
#include <mmc.h>
|
||||
#include <net.h>
|
||||
#ifdef CONFIG_STATUS_LED
|
||||
#include <status_led.h>
|
||||
|
@ -35,6 +36,9 @@
|
|||
#if defined(CONFIG_SYS_NIOS_EPCSBASE)
|
||||
#include <nios2-epcs.h>
|
||||
#endif
|
||||
#ifdef CONFIG_CMD_NAND
|
||||
#include <nand.h> /* cannot even include nand.h if it isnt configured */
|
||||
#endif
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
|
@ -100,7 +104,9 @@ void board_init (void)
|
|||
bd = gd->bd;
|
||||
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
|
||||
bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
|
||||
#ifndef CONFIG_SYS_NO_FLASH
|
||||
bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
|
||||
#endif
|
||||
#if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE)
|
||||
bd->bi_sramstart= CONFIG_SYS_SRAM_BASE;
|
||||
bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;
|
||||
|
@ -119,8 +125,20 @@ void board_init (void)
|
|||
/* The Malloc area is immediately below the monitor copy in RAM */
|
||||
mem_malloc_init(CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
|
||||
|
||||
#ifndef CONFIG_SYS_NO_FLASH
|
||||
WATCHDOG_RESET ();
|
||||
bd->bi_flashsize = flash_init();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CMD_NAND
|
||||
puts("NAND: ");
|
||||
nand_init();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GENERIC_MMC
|
||||
puts("MMC: ");
|
||||
mmc_initialize(bd);
|
||||
#endif
|
||||
|
||||
WATCHDOG_RESET ();
|
||||
env_relocate();
|
||||
|
|
33
board/altera/common/cfide.c
Normal file
33
board/altera/common/cfide.c
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Altera CF drvier
|
||||
*
|
||||
* (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#include <common.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#if defined(CONFIG_IDE_RESET) && defined(CONFIG_SYS_CF_CTL_BASE)
|
||||
/* ide_set_reset for Altera CF interface */
|
||||
#define ALTERA_CF_CTL_STATUS 0
|
||||
#define ALTERA_CF_IDE_CTL 4
|
||||
#define ALTERA_CF_CTL_STATUS_PRESENT_MSK (0x1)
|
||||
#define ALTERA_CF_CTL_STATUS_POWER_MSK (0x2)
|
||||
#define ALTERA_CF_CTL_STATUS_RESET_MSK (0x4)
|
||||
#define ALTERA_CF_CTL_STATUS_IRQ_EN_MSK (0x8)
|
||||
#define ALTERA_CF_IDE_CTL_IRQ_EN_MSK (0x1)
|
||||
|
||||
void ide_set_reset(int idereset)
|
||||
{
|
||||
int i;
|
||||
writel(idereset ? ALTERA_CF_CTL_STATUS_RESET_MSK :
|
||||
ALTERA_CF_CTL_STATUS_POWER_MSK,
|
||||
CONFIG_SYS_CF_CTL_BASE + ALTERA_CF_CTL_STATUS);
|
||||
/* wait 500 ms for power to stabilize */
|
||||
for (i = 0; i < 500; i++)
|
||||
udelay(1000);
|
||||
}
|
||||
#endif
|
59
board/altera/nios2-generic/Makefile
Normal file
59
board/altera/nios2-generic/Makefile
Normal file
|
@ -0,0 +1,59 @@
|
|||
#
|
||||
# (C) Copyright 2001-2006
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
# (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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 $(TOPDIR)/config.mk
|
||||
ifneq ($(OBJTREE),$(SRCTREE))
|
||||
$(shell mkdir -p $(obj)../common)
|
||||
endif
|
||||
|
||||
LIB = $(obj)lib$(BOARD).a
|
||||
|
||||
COBJS-y := $(BOARD).o
|
||||
COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o
|
||||
COBJS-$(CONFIG_EPLED) += ../common/epled.o
|
||||
COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o
|
||||
|
||||
SOBJS-y := text_base.o
|
||||
|
||||
SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
|
||||
OBJS := $(addprefix $(obj),$(COBJS-y))
|
||||
SOBJS := $(addprefix $(obj),$(SOBJS-y))
|
||||
|
||||
$(LIB): $(obj).depend $(OBJS) $(SOBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
|
||||
|
||||
clean:
|
||||
rm -f $(SOBJS) $(OBJS)
|
||||
|
||||
distclean: clean
|
||||
rm -f $(LIB) core *.bak $(obj).depend
|
||||
|
||||
#########################################################################
|
||||
|
||||
# defines $(obj).depend target
|
||||
include $(SRCTREE)/rules.mk
|
||||
|
||||
sinclude $(obj).depend
|
||||
|
||||
#########################################################################
|
34
board/altera/nios2-generic/config.mk
Normal file
34
board/altera/nios2-generic/config.mk
Normal file
|
@ -0,0 +1,34 @@
|
|||
#
|
||||
# (C) Copyright 2005, Psyent Corporation <www.psyent.com>
|
||||
# Scott McNutt <smcnutt@psyent.com>
|
||||
#
|
||||
# See file CREDITS for list of people who contributed to this
|
||||
# project.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# we get text_base from board config header, so do not use this
|
||||
#TEXT_BASE = do-not-use-me
|
||||
|
||||
PLATFORM_CPPFLAGS += -mno-hw-div -mno-hw-mul
|
||||
PLATFORM_CPPFLAGS += -I$(TOPDIR)/board/$(VENDOR)/include
|
||||
|
||||
ifeq ($(debug),1)
|
||||
PLATFORM_CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
|
||||
LDSCRIPT := $(SRCTREE)/board/$(VENDOR)/$(BOARD)/u-boot.lds
|
66
board/altera/nios2-generic/custom_fpga.h
Normal file
66
board/altera/nios2-generic/custom_fpga.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This file is generated by sopc-create-config-files.
|
||||
*/
|
||||
#ifndef _CUSTOM_FPGA_H_
|
||||
#define _CUSTOM_FPGA_H_
|
||||
|
||||
/* generated from std_1c20.sopc */
|
||||
|
||||
/* cpu.data_master is a altera_nios2 */
|
||||
#define CONFIG_SYS_CLK_FREQ 50000000
|
||||
#define CONFIG_SYS_RESET_ADDR 0x00000000
|
||||
#define CONFIG_SYS_EXCEPTION_ADDR 0x01000020
|
||||
#define CONFIG_SYS_ICACHE_SIZE 4096
|
||||
#define CONFIG_SYS_ICACHELINE_SIZE 32
|
||||
#define CONFIG_SYS_DCACHE_SIZE 2048
|
||||
#define CONFIG_SYS_DCACHELINE_SIZE 4
|
||||
|
||||
/* sdram.s1 is a altera_avalon_new_sdram_controller */
|
||||
#define CONFIG_SYS_SDRAM_BASE 0x01000000
|
||||
#define CONFIG_SYS_SDRAM_SIZE 0x01000000
|
||||
|
||||
/* uart1.s1 is a altera_avalon_uart */
|
||||
#define CONFIG_SYS_UART_BASE 0x82120840
|
||||
#define CONFIG_SYS_UART_FREQ 50000000
|
||||
#define CONFIG_SYS_UART_BAUD 115200
|
||||
|
||||
/* lan91c111.s1 is a altera_avalon_lan91c111 */
|
||||
#define CONFIG_SMC91111_BASE 0x82110300
|
||||
#define CONFIG_SMC91111
|
||||
#define CONFIG_SMC_USE_32_BIT
|
||||
|
||||
/* jtag_uart.avalon_jtag_slave is a altera_avalon_jtag_uart */
|
||||
#define CONFIG_SYS_JTAG_UART_BASE 0x821208b0
|
||||
|
||||
/* led_pio.s1 is a altera_avalon_pio */
|
||||
#define LED_PIO_BASE 0x82120870
|
||||
|
||||
/* high_res_timer.s1 is a altera_avalon_timer */
|
||||
#define CONFIG_SYS_TIMER_BASE 0x82120820
|
||||
#define CONFIG_SYS_TIMER_IRQ 3
|
||||
#define CONFIG_SYS_TIMER_FREQ 50000000
|
||||
|
||||
/* ext_flash.s1 is a altera_avalon_cfi_flash */
|
||||
#define CONFIG_SYS_FLASH_BASE 0x80000000
|
||||
#define CONFIG_FLASH_CFI_DRIVER
|
||||
#define CONFIG_SYS_CFI_FLASH_STATUS_POLL /* fix amd flash issue */
|
||||
#define CONFIG_SYS_FLASH_CFI
|
||||
#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
|
||||
#define CONFIG_SYS_FLASH_PROTECTION
|
||||
#define CONFIG_SYS_MAX_FLASH_BANKS 1
|
||||
#define CONFIG_SYS_MAX_FLASH_SECT 1024
|
||||
|
||||
/* ext_ram.s1 is a altera_nios_dev_kit_stratix_edition_sram2 */
|
||||
#define CONFIG_SYS_SRAM_BASE 0x02000000
|
||||
#define CONFIG_SYS_SRAM_SIZE 0x00100000
|
||||
|
||||
/* sysid.control_slave is a altera_avalon_sysid */
|
||||
#define CONFIG_SYS_SYSID_BASE 0x821208b8
|
||||
|
||||
#endif /* _CUSTOM_FPGA_H_ */
|
68
board/altera/nios2-generic/nios2-generic.c
Normal file
68
board/altera/nios2-generic/nios2-generic.c
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* (C) Copyright 2005, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.com>
|
||||
* (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* 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 <common.h>
|
||||
#include <netdev.h>
|
||||
|
||||
void text_base_hook(void); /* nop hook for text_base.S */
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
text_base_hook();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkboard(void)
|
||||
{
|
||||
printf("BOARD : %s\n", CONFIG_BOARD_NAME);
|
||||
return 0;
|
||||
}
|
||||
|
||||
phys_size_t initdram(int board_type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CMD_NET
|
||||
int board_eth_init(bd_t *bis)
|
||||
{
|
||||
int rc = 0;
|
||||
#ifdef CONFIG_SMC91111
|
||||
rc += smc91111_initialize(0, CONFIG_SMC91111_BASE);
|
||||
#endif
|
||||
#ifdef CONFIG_DRIVER_DM9000
|
||||
rc += dm9000_initialize(bis);
|
||||
#endif
|
||||
#ifdef CONFIG_ALTERA_TSE
|
||||
rc += altera_tse_initialize(0,
|
||||
CONFIG_SYS_ALTERA_TSE_MAC_BASE,
|
||||
CONFIG_SYS_ALTERA_TSE_SGDMA_RX_BASE,
|
||||
CONFIG_SYS_ALTERA_TSE_SGDMA_TX_BASE);
|
||||
#endif
|
||||
#ifdef CONFIG_ETHOC
|
||||
rc += ethoc_initialize(0, CONFIG_SYS_ETHOC_BASE);
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
#endif
|
21
board/altera/nios2-generic/text_base.S
Normal file
21
board/altera/nios2-generic/text_base.S
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* text_base
|
||||
*
|
||||
* (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#ifdef CONFIG_SYS_MONITOR_BASE
|
||||
.text
|
||||
/* text base used in link script u-boot.lds */
|
||||
.global text_base
|
||||
.equ text_base,CONFIG_SYS_MONITOR_BASE
|
||||
/* dummy func to let linker include this file */
|
||||
.global text_base_hook
|
||||
text_base_hook:
|
||||
ret
|
||||
#endif
|
136
board/altera/nios2-generic/u-boot.lds
Normal file
136
board/altera/nios2-generic/u-boot.lds
Normal file
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
* (C) Copyright 2004, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.com>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlenios2")
|
||||
OUTPUT_ARCH(nios2)
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = text_base;
|
||||
.text :
|
||||
{
|
||||
arch/nios2/cpu/start.o (.text)
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
*(.gnu.linkonce.t*)
|
||||
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
|
||||
*(.gnu.linkonce.r*)
|
||||
}
|
||||
. = ALIGN (4);
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
|
||||
/* CMD TABLE - sandwich this in between text and data so
|
||||
* the initialization code relocates the command table as
|
||||
* well -- admittedly, this is just pure laziness ;-)
|
||||
*/
|
||||
__u_boot_cmd_start = .;
|
||||
.u_boot_cmd :
|
||||
{
|
||||
*(.u_boot_cmd)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
__u_boot_cmd_end = .;
|
||||
|
||||
/* INIT DATA sections - "Small" data (see the gcc -G option)
|
||||
* is always gp-relative. Here we make all init data sections
|
||||
* adjacent to simplify the startup code -- and provide
|
||||
* the global pointer for gp-relative access.
|
||||
*/
|
||||
_data = .;
|
||||
.data :
|
||||
{
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d*)
|
||||
}
|
||||
|
||||
. = ALIGN(16);
|
||||
_gp = .; /* Global pointer addr */
|
||||
PROVIDE (gp = .);
|
||||
|
||||
.sdata :
|
||||
{
|
||||
*(.sdata)
|
||||
*(.sdata.*)
|
||||
*(.gnu.linkonce.s.*)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
|
||||
_edata = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
/* UNINIT DATA - Small uninitialized data is first so it's
|
||||
* adjacent to sdata and can be referenced via gp. The normal
|
||||
* bss follows. We keep it adjacent to simplify init code.
|
||||
*/
|
||||
__bss_start = .;
|
||||
.sbss (NOLOAD) :
|
||||
{
|
||||
*(.sbss)
|
||||
*(.sbss.*)
|
||||
*(.gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
.bss (NOLOAD) :
|
||||
{
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(.dynbss)
|
||||
*(COMMON)
|
||||
*(.scommon)
|
||||
}
|
||||
. = ALIGN(4);
|
||||
_end = .;
|
||||
PROVIDE (end = .);
|
||||
|
||||
/* DEBUG -- symbol table, string table, etc. etc.
|
||||
*/
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
}
|
|
@ -38,8 +38,16 @@ int serial_init( void ) { return(0);}
|
|||
|
||||
void serial_putc (char c)
|
||||
{
|
||||
while (NIOS_JTAG_WSPACE ( readl (&jtag->control)) == 0)
|
||||
WATCHDOG_RESET ();
|
||||
while (1) {
|
||||
unsigned st = readl(&jtag->control);
|
||||
if (NIOS_JTAG_WSPACE(st))
|
||||
break;
|
||||
#ifdef CONFIG_ALTERA_JTAG_UART_BYPASS
|
||||
if (!(st & NIOS_JTAG_AC)) /* no connection */
|
||||
return;
|
||||
#endif
|
||||
WATCHDOG_RESET();
|
||||
}
|
||||
writel ((unsigned char)c, &jtag->data);
|
||||
}
|
||||
|
||||
|
|
153
include/configs/nios2-generic.h
Normal file
153
include/configs/nios2-generic.h
Normal file
|
@ -0,0 +1,153 @@
|
|||
/*
|
||||
* (C) Copyright 2005, Psyent Corporation <www.psyent.com>
|
||||
* Scott McNutt <smcnutt@psyent.com>
|
||||
* (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* 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 __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
/*
|
||||
* BOARD/CPU
|
||||
*/
|
||||
#include "../board/altera/nios2-generic/custom_fpga.h" /* fpga parameters */
|
||||
#define CONFIG_BOARD_NAME "nios2-generic" /* custom board name */
|
||||
#define CONFIG_BOARD_EARLY_INIT_F /* enable early board-spec. init */
|
||||
#define CONFIG_SYS_NIOS_SYSID_BASE CONFIG_SYS_SYSID_BASE
|
||||
|
||||
/*
|
||||
* SERIAL
|
||||
*/
|
||||
#define CONFIG_ALTERA_UART
|
||||
#if defined(CONFIG_ALTERA_JTAG_UART)
|
||||
# define CONFIG_SYS_NIOS_CONSOLE CONFIG_SYS_JTAG_UART_BASE
|
||||
#else
|
||||
# define CONFIG_SYS_NIOS_CONSOLE CONFIG_SYS_UART_BASE
|
||||
#endif
|
||||
|
||||
#define CONFIG_ALTERA_JTAG_UART_BYPASS
|
||||
#define CONFIG_SYS_NIOS_FIXEDBAUD
|
||||
#define CONFIG_BAUDRATE CONFIG_SYS_UART_BAUD
|
||||
#define CONFIG_SYS_BAUDRATE_TABLE {CONFIG_BAUDRATE}
|
||||
#define CONFIG_SYS_CONSOLE_INFO_QUIET /* Suppress console info */
|
||||
|
||||
/*
|
||||
* TIMER
|
||||
*/
|
||||
#define CONFIG_SYS_NIOS_TMRBASE CONFIG_SYS_TIMER_BASE
|
||||
#define CONFIG_SYS_NIOS_TMRIRQ CONFIG_SYS_TIMER_IRQ
|
||||
#define CONFIG_SYS_HZ 1000 /* Always 1000 */
|
||||
#define CONFIG_SYS_NIOS_TMRMS 10 /* Desired period (msec)*/
|
||||
#define CONFIG_SYS_NIOS_TMRCNT \
|
||||
(CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_TIMER_FREQ / 1000) - 1)
|
||||
|
||||
/*
|
||||
* STATUS LED
|
||||
*/
|
||||
#define CONFIG_STATUS_LED /* Enable status driver */
|
||||
#define CONFIG_EPLED /* Enable LED PIO driver */
|
||||
#define CONFIG_SYS_LEDPIO_ADDR LED_PIO_BASE
|
||||
|
||||
#define STATUS_LED_BIT 1 /* Bit-0 on PIO */
|
||||
#define STATUS_LED_STATE 1 /* Blinking */
|
||||
#define STATUS_LED_PERIOD (500 / CONFIG_SYS_NIOS_TMRMS) /* 500 msec */
|
||||
|
||||
/*
|
||||
* BOOTP options
|
||||
*/
|
||||
#define CONFIG_BOOTP_BOOTFILESIZE
|
||||
#define CONFIG_BOOTP_BOOTPATH
|
||||
#define CONFIG_BOOTP_GATEWAY
|
||||
#define CONFIG_BOOTP_HOSTNAME
|
||||
|
||||
/*
|
||||
* Command line configuration.
|
||||
*/
|
||||
#include <config_cmd_default.h>
|
||||
#undef CONFIG_CMD_BOOTD
|
||||
#undef CONFIG_CMD_FPGA
|
||||
#undef CONFIG_CMD_IMLS
|
||||
#undef CONFIG_CMD_ITEST
|
||||
#undef CONFIG_CMD_NFS
|
||||
#undef CONFIG_CMD_SETGETDCR
|
||||
#undef CONFIG_CMD_XIMG
|
||||
|
||||
#ifdef CONFIG_CMD_NET
|
||||
# define CONFIG_NET_MULTI
|
||||
# define CONFIG_CMD_DHCP
|
||||
# define CONFIG_CMD_PING
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ENVIRONMENT -- Put environment in sector CONFIG_SYS_MONITOR_LEN above
|
||||
* CONFIG_SYS_RESET_ADDR, since we assume the monitor is stored at the
|
||||
* reset address, no? This will keep the environment in user region
|
||||
* of flash. NOTE: the monitor length must be multiple of sector size
|
||||
* (which is common practice).
|
||||
*/
|
||||
#define CONFIG_ENV_IS_IN_FLASH
|
||||
|
||||
#define CONFIG_ENV_SIZE 0x10000 /* 64k, 1 sector */
|
||||
#define CONFIG_ENV_OVERWRITE /* Serial change Ok */
|
||||
#define CONFIG_ENV_ADDR ((CONFIG_SYS_RESET_ADDR + \
|
||||
CONFIG_SYS_MONITOR_LEN) | \
|
||||
CONFIG_SYS_FLASH_BASE)
|
||||
|
||||
/*
|
||||
* MEMORY ORGANIZATION
|
||||
* -Monitor at top of sdram.
|
||||
* -The heap is placed below the monitor
|
||||
* -Global data is placed below the heap.
|
||||
* -The stack is placed below global data (&grows down).
|
||||
*/
|
||||
#define CONFIG_MONITOR_IS_IN_RAM
|
||||
#define CONFIG_SYS_MONITOR_LEN 0x40000 /* Reserve 256k */
|
||||
#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_SDRAM_BASE + \
|
||||
CONFIG_SYS_SDRAM_SIZE - \
|
||||
CONFIG_SYS_MONITOR_LEN)
|
||||
#define CONFIG_SYS_GBL_DATA_SIZE 256 /* Global data size rsvd */
|
||||
#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x20000)
|
||||
#define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - \
|
||||
CONFIG_SYS_MALLOC_LEN)
|
||||
#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_MALLOC_BASE - \
|
||||
CONFIG_SYS_GBL_DATA_SIZE)
|
||||
#define CONFIG_SYS_INIT_SP CONFIG_SYS_GBL_DATA_OFFSET
|
||||
|
||||
/*
|
||||
* MISC
|
||||
*/
|
||||
#define CONFIG_SYS_LONGHELP /* Provide extended help */
|
||||
#define CONFIG_SYS_PROMPT "==> " /* Command prompt */
|
||||
#define CONFIG_SYS_CBSIZE 256 /* Console I/O buf size */
|
||||
#define CONFIG_SYS_MAXARGS 16 /* Max command args */
|
||||
#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Bootarg buf size */
|
||||
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
|
||||
sizeof(CONFIG_SYS_PROMPT) + \
|
||||
16) /* Print buf size */
|
||||
#define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_SDRAM_BASE
|
||||
#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
|
||||
#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_INIT_SP - 0x20000)
|
||||
#define CONFIG_CMDLINE_EDITING
|
||||
|
||||
#define CONFIG_SYS_HUSH_PARSER
|
||||
#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
|
||||
|
||||
#endif /* __CONFIG_H */
|
Loading…
Add table
Reference in a new issue