forked from Imagelibrary/rtems
2010-08-20 <yann.sionneau@telecom-sudparis.eu>
Add Milkymist BSP developed as part of GSOC 2010. * ChangeLog, Makefile.am, README, bsp_specs, configure.ac, preinstall.am, Documentation/uart.txt, include/.cvsignore, include/bsp.h, include/system_conf.h, include/tm27.h, make/custom/milkymist.cfg, startup/linkcmds: New files.
This commit is contained in:
9
c/src/lib/libbsp/lm32/milkymist/ChangeLog
Normal file
9
c/src/lib/libbsp/lm32/milkymist/ChangeLog
Normal file
@@ -0,0 +1,9 @@
|
||||
2010-08-20 <yann.sionneau@telecom-sudparis.eu>
|
||||
|
||||
Add Milkymist BSP developed as part of GSOC 2010.
|
||||
* ChangeLog, Makefile.am, README, bsp_specs, configure.ac,
|
||||
preinstall.am, Documentation/uart.txt, include/.cvsignore,
|
||||
include/bsp.h, include/system_conf.h, include/tm27.h,
|
||||
make/custom/milkymist.cfg, startup/linkcmds: New files.
|
||||
|
||||
08 / 12 / 2010 : <Yann Sionneau> Added Milkymist BSP
|
||||
31
c/src/lib/libbsp/lm32/milkymist/Documentation/uart.txt
Normal file
31
c/src/lib/libbsp/lm32/milkymist/Documentation/uart.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
Initialization :
|
||||
|
||||
set the CSR_UART_DIVISOR to the correct VALUE,
|
||||
depending on the internal frequency of the LatticeMico32 softcore.
|
||||
|
||||
for the ML401 board, this value is calculated using this formula : clk_frequency/230400/16
|
||||
clk_frequency = 100000000 Hz
|
||||
=> we must set CSR_UART_DIVISOR to 27
|
||||
|
||||
How to send a byte to uart :
|
||||
|
||||
void writechar(char c)
|
||||
{
|
||||
CSR_UART_RXTX = c;
|
||||
while(!(irq_pending() & IRQ_UARTTX));
|
||||
irq_ack(IRQ_UARTTX);
|
||||
}
|
||||
|
||||
How to receive a byte from uart :
|
||||
|
||||
|
||||
char readchar()
|
||||
{
|
||||
char c;
|
||||
while(!(irq_pending() & IRQ_UARTRX));
|
||||
irq_ack(IRQ_UARTRX);
|
||||
c = CSR_UART_RXTX;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
69
c/src/lib/libbsp/lm32/milkymist/Makefile.am
Normal file
69
c/src/lib/libbsp/lm32/milkymist/Makefile.am
Normal file
@@ -0,0 +1,69 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
ACLOCAL_AMFLAGS = -I ../../../../aclocal
|
||||
|
||||
include $(top_srcdir)/../../../../automake/compile.am
|
||||
|
||||
include_bspdir = $(includedir)/bsp
|
||||
|
||||
dist_project_lib_DATA = bsp_specs
|
||||
|
||||
include_HEADERS = include/bsp.h
|
||||
include_HEADERS += include/tm27.h
|
||||
|
||||
nodist_include_HEADERS = include/bspopts.h
|
||||
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
|
||||
DISTCLEANFILES = include/bspopts.h
|
||||
|
||||
noinst_PROGRAMS =
|
||||
|
||||
include_HEADERS += ../../shared/include/coverhd.h
|
||||
include_HEADERS += include/system_conf.h
|
||||
|
||||
noinst_LIBRARIES = libbspstart.a
|
||||
libbspstart_a_SOURCES = ../../lm32/shared/start/start.S
|
||||
project_lib_DATA = start.$(OBJEXT)
|
||||
|
||||
dist_project_lib_DATA += startup/linkcmds
|
||||
|
||||
noinst_LIBRARIES += libbsp.a
|
||||
libbsp_a_SOURCES =
|
||||
libbsp_a_LIBADD =
|
||||
|
||||
# startup
|
||||
libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
|
||||
../../shared/bsppost.c ../shared/startup/bspstart.c \
|
||||
../../shared/bspreset.c ../../shared/bsppretaskinghook.c \
|
||||
../../shared/bspgetworkarea.c ../../shared/bootcard.c \
|
||||
../../shared/sbrk.c ../../lm32/shared/startup/setvec.c \
|
||||
../../shared/gnatinstallhandler.c
|
||||
|
||||
# clock
|
||||
|
||||
libbsp_a_SOURCES += ../../lm32/shared/milkymist_clock/ckinit.c
|
||||
|
||||
# console
|
||||
libbsp_a_SOURCES += ../../lm32/shared/milkymist_console/console.c \
|
||||
../../lm32/shared/milkymist_console/uart.c
|
||||
# timer
|
||||
libbsp_a_SOURCES += ../../lm32/shared/milkymist_timer/timer.c
|
||||
|
||||
# framebuffer
|
||||
libbsp_a_SOURCES += ../../lm32/shared/milkymist_framebuffer/framebuffer.c
|
||||
|
||||
# gpio
|
||||
libbsp_a_SOURCES += ../../lm32/shared/milkymist_gpio/gpio.c
|
||||
|
||||
if HAS_NETWORKING
|
||||
noinst_PROGRAMS += network.rel
|
||||
network_rel_SOURCES = ../../lm32/shared/milkymist_networking/network.c \
|
||||
../../lm32/shared/milkymist_networking/mm_crc32.c
|
||||
network_rel_CPPFLAGS = $(AM_CPPFLAGS) -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
|
||||
network_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
|
||||
libbsp_a_LIBADD += network.rel
|
||||
endif
|
||||
|
||||
include $(srcdir)/preinstall.am
|
||||
include $(top_srcdir)/../../../../automake/local.am
|
||||
21
c/src/lib/libbsp/lm32/milkymist/README
Normal file
21
c/src/lib/libbsp/lm32/milkymist/README
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
This is a BSP written by Yann Sionneau <yann.sionneau@telecom-sudparis.eu>
|
||||
as part of Google Summer of Code 2010.
|
||||
|
||||
This is a BSP to make RTEMS run on Milkymist One board using Milkymist SoC
|
||||
|
||||
It provides driver for timer, uart, ethernet, framebuffer so far.
|
||||
|
||||
Milkymist SoC is running @ 83 MHz with 128 MB of 32-bit DDR400 SDRAM
|
||||
The SoC is based on a XC6SLX45 Spartan-6 FPGA running
|
||||
the LatticeMico32 softcore.
|
||||
|
||||
More informations available at : http://www.milkymist.org/
|
||||
|
||||
Information about the porting can be found in Yann Sionneau's blog
|
||||
at http://sionneau.net/
|
||||
|
||||
Milkymist is a project leaded by Sebastien Bourdeauducq (aka lekernel)
|
||||
13
c/src/lib/libbsp/lm32/milkymist/bsp_specs
Normal file
13
c/src/lib/libbsp/lm32/milkymist/bsp_specs
Normal file
@@ -0,0 +1,13 @@
|
||||
%rename endfile old_endfile
|
||||
%rename startfile old_startfile
|
||||
%rename link old_link
|
||||
|
||||
*startfile:
|
||||
%{!qrtems: %(old_startfile)} \
|
||||
%{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s -e start}}
|
||||
|
||||
*link:
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
|
||||
*endfile:
|
||||
%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
|
||||
34
c/src/lib/libbsp/lm32/milkymist/configure.ac
Normal file
34
c/src/lib/libbsp/lm32/milkymist/configure.ac
Normal file
@@ -0,0 +1,34 @@
|
||||
## Process this file with autoconf to produce a configure script.
|
||||
##
|
||||
## $Id$
|
||||
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT([rtems-c-src-lib-libbsp-lm32-milkymist],
|
||||
[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
|
||||
AC_CONFIG_SRCDIR([bsp_specs])
|
||||
RTEMS_TOP(../../../../../..)
|
||||
|
||||
RTEMS_CANONICAL_TARGET_CPU
|
||||
AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.10])
|
||||
RTEMS_BSP_CONFIGURE
|
||||
|
||||
RTEMS_PROG_CC_FOR_TARGET
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_PROG_CCAS
|
||||
|
||||
RTEMS_CHECK_NETWORKING
|
||||
AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
|
||||
|
||||
RTEMS_BSPOPTS_SET([ON_SIMULATOR],[*],[])
|
||||
RTEMS_BSPOPTS_HELP([ON_SIMULATOR],
|
||||
[If defined, this indicates the BSP is being built to run on the lm32
|
||||
simulator in GDB. This enables fast idle support which speeds up the
|
||||
clock ticks while the idle task is running so time spent in the idle
|
||||
task is minimized. This significantly reduces the wall time required
|
||||
to execute the RTEMS test suites. It also enables a special exit and
|
||||
alternate printk support.])
|
||||
|
||||
RTEMS_BSP_CLEANUP_OPTIONS(0,0)
|
||||
# Explicitly list all Makefiles here
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
4
c/src/lib/libbsp/lm32/milkymist/include/.cvsignore
Normal file
4
c/src/lib/libbsp/lm32/milkymist/include/.cvsignore
Normal file
@@ -0,0 +1,4 @@
|
||||
stamp-h
|
||||
stamp-h.in
|
||||
bspopts.h
|
||||
bspopts.h.in
|
||||
74
c/src/lib/libbsp/lm32/milkymist/include/bsp.h
Normal file
74
c/src/lib/libbsp/lm32/milkymist/include/bsp.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/* bsp.h
|
||||
*
|
||||
* This include file contains all board IO definitions.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Yann Sionneau <yann.sionneau@telecom-sudparis.eu>, (GSoC 2010)
|
||||
* Telecom SudParis
|
||||
*/
|
||||
|
||||
#ifndef _BSP_H
|
||||
#define _BSP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <bspopts.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/console.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BSP_DIRTY_MEMORY 1
|
||||
|
||||
#define BSP_HAS_FRAME_BUFFER 1
|
||||
|
||||
#define GPIO_DRIVER_TABLE_ENTRY { gpio_initialize, \
|
||||
gpio_open, gpio_close, gpio_read, gpio_write, gpio_control}
|
||||
|
||||
/*
|
||||
* lm32 requires certain aligment of mbuf because unaligned uint32_t
|
||||
* accesses are not handled properly.
|
||||
*/
|
||||
|
||||
#define CPU_U32_FIX
|
||||
|
||||
#if defined(RTEMS_NETWORKING)
|
||||
#include <rtems/rtems_bsdnet.h>
|
||||
struct rtems_bsdnet_ifconfig;
|
||||
extern int rtems_minimac_driver_attach (struct rtems_bsdnet_ifconfig *config,
|
||||
int attaching);
|
||||
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_minimac_driver_attach
|
||||
#define RTEMS_BSP_NETWORK_DRIVER_NAME "minimac0"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simple spin delay in microsecond units for device drivers.
|
||||
* This is very dependent on the clock speed of the target.
|
||||
*/
|
||||
|
||||
#define rtems_bsp_delay( microseconds ) \
|
||||
{ \
|
||||
}
|
||||
|
||||
/* functions */
|
||||
lm32_isr_entry set_vector( /* returns old vector */
|
||||
rtems_isr_entry handler, /* isr routine */
|
||||
rtems_vector_number vector, /* vector number */
|
||||
int type /* RTEMS or RAW intr */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
56
c/src/lib/libbsp/lm32/milkymist/include/system_conf.h
Normal file
56
c/src/lib/libbsp/lm32/milkymist/include/system_conf.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* system_conf.h
|
||||
* Global System conf
|
||||
*
|
||||
* Milkymist port of RTEMS
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SYSTEM_CONFIG_H_
|
||||
#define __SYSTEM_CONFIG_H_
|
||||
|
||||
#define CPU_FREQUENCY (83333333)
|
||||
#define UART_BAUD_RATE (115200)
|
||||
|
||||
#define MM_TIMER1_COMPARE (0xe0001024)
|
||||
#define MM_TIMER1_COUNTER (0xe0001028)
|
||||
#define MM_TIMER1_CONTROL (0xe0001020)
|
||||
|
||||
#define MM_TIMER0_COMPARE (0xe0001014)
|
||||
#define MM_TIMER0_COUNTER (0xe0001018)
|
||||
#define MM_TIMER0_CONTROL (0xe0001010)
|
||||
|
||||
#define TIMER_ENABLE (0x01)
|
||||
#define TIMER_AUTORESTART (0x02)
|
||||
|
||||
#define MM_VGA_RESET_MODE (0x01)
|
||||
#define MM_VGA_RESET (0xe0003000)
|
||||
#define MM_VGA_BASEADDRESS (0xe0003024)
|
||||
#define MM_VGA_BASEADDRESS_ACT (0xe0003028)
|
||||
|
||||
#define MM_MINIMAC_SETUP (0xe0009000)
|
||||
#define MM_MINIMAC_STATE0 (0xe0009008)
|
||||
#define MM_MINIMAC_ADDR0 (0xe000900C)
|
||||
#define MM_MINIMAC_COUNT0 (0xe0009010)
|
||||
|
||||
#define MM_MINIMAC_STATE1 (0xe0009014)
|
||||
#define MM_MINIMAC_ADDR1 (0xe0009018)
|
||||
#define MM_MINIMAC_COUNT1 (0xe000901C)
|
||||
|
||||
#define MM_MINIMAC_STATE2 (0xe0009020)
|
||||
#define MM_MINIMAC_ADDR2 (0xe0009024)
|
||||
#define MM_MINIMAC_COUNT2 (0xe0009028)
|
||||
|
||||
#define MM_MINIMAC_STATE3 (0xe000902C)
|
||||
#define MM_MINIMAC_ADDR3 (0xe0009030)
|
||||
#define MM_MINIMAC_COUNT3 (0xe0009034)
|
||||
|
||||
#define MM_MINIMAC_TXREMAINING (0xe000903C)
|
||||
#define MM_MINIMAC_TXADR (0xe0009038)
|
||||
|
||||
#endif /* __SYSTEM_CONFIG_H_ */
|
||||
32
c/src/lib/libbsp/lm32/milkymist/include/tm27.h
Normal file
32
c/src/lib/libbsp/lm32/milkymist/include/tm27.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* tm27.h
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_TMTEST27
|
||||
#error "This is an RTEMS internal file you must not include directly."
|
||||
#endif
|
||||
|
||||
#ifndef __tm27_h
|
||||
#define __tm27_h
|
||||
|
||||
/*
|
||||
* Stuff for Time Test 27
|
||||
*/
|
||||
|
||||
#define MUST_WAIT_FOR_INTERRUPT 0
|
||||
|
||||
#define Install_tm27_vector( handler ) set_vector( (handler), 0, 1 )
|
||||
|
||||
#define Cause_tm27_intr() /* empty */
|
||||
|
||||
#define Clear_tm27_intr() /* empty */
|
||||
|
||||
#define Lower_tm27_intr() /* empty */
|
||||
|
||||
#endif
|
||||
28
c/src/lib/libbsp/lm32/milkymist/make/custom/milkymist.cfg
Normal file
28
c/src/lib/libbsp/lm32/milkymist/make/custom/milkymist.cfg
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Config file for the milkymist BSP
|
||||
#
|
||||
|
||||
# Choices for CPU_MODEL:
|
||||
# tiny (no cache)
|
||||
# standard (instruction cache)
|
||||
# fast (instruction and data cache)
|
||||
|
||||
RTEMS_CPU = lm32
|
||||
RTEMS_CPU_MODEL = lm32
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/default.cfg
|
||||
|
||||
# This contains the compiler options necessary to select the CPU model
|
||||
# and (hopefully) optimize for it.
|
||||
CPU_CFLAGS = -mbarrel-shift-enabled -mmultiply-enabled \
|
||||
-mdivide-enabled -msign-extend-enabled
|
||||
|
||||
# optimize flag: typically -O2
|
||||
# ATM, doesn't work with optimization levels > 0
|
||||
CFLAGS_OPTIMIZE_V = -O2 -g
|
||||
|
||||
define bsp-post-link
|
||||
$(OBJCOPY) -O binary --strip-all $(basename $@).exe \
|
||||
-R entry -R exceptions $(basename $@)$(DOWNEXT)
|
||||
$(default-bsp-post-link)
|
||||
endef
|
||||
71
c/src/lib/libbsp/lm32/milkymist/preinstall.am
Normal file
71
c/src/lib/libbsp/lm32/milkymist/preinstall.am
Normal file
@@ -0,0 +1,71 @@
|
||||
## Automatically generated by ampolish3 - Do not edit
|
||||
|
||||
if AMPOLISH3
|
||||
$(srcdir)/preinstall.am: Makefile.am
|
||||
$(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
|
||||
endif
|
||||
|
||||
PREINSTALL_DIRS =
|
||||
DISTCLEANFILES += $(PREINSTALL_DIRS)
|
||||
|
||||
all-local: $(TMPINSTALL_FILES)
|
||||
|
||||
TMPINSTALL_FILES =
|
||||
CLEANFILES = $(TMPINSTALL_FILES)
|
||||
|
||||
all-am: $(PREINSTALL_FILES)
|
||||
|
||||
PREINSTALL_FILES =
|
||||
CLEANFILES += $(PREINSTALL_FILES)
|
||||
|
||||
$(PROJECT_LIB)/$(dirstamp):
|
||||
@$(MKDIR_P) $(PROJECT_LIB)
|
||||
@: > $(PROJECT_LIB)/$(dirstamp)
|
||||
PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
|
||||
|
||||
$(PROJECT_INCLUDE)/$(dirstamp):
|
||||
@$(MKDIR_P) $(PROJECT_INCLUDE)
|
||||
@: > $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/$(dirstamp):
|
||||
@$(MKDIR_P) $(PROJECT_INCLUDE)/bsp
|
||||
@: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
|
||||
$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
|
||||
PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
|
||||
|
||||
$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/bootcard.h: ../../shared/include/bootcard.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/bootcard.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h
|
||||
|
||||
$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
|
||||
|
||||
$(PROJECT_INCLUDE)/system_conf.h: include/system_conf.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/system_conf.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/system_conf.h
|
||||
|
||||
$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
|
||||
TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
|
||||
|
||||
$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
|
||||
PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
|
||||
|
||||
290
c/src/lib/libbsp/lm32/milkymist/startup/linkcmds
Normal file
290
c/src/lib/libbsp/lm32/milkymist/startup/linkcmds
Normal file
@@ -0,0 +1,290 @@
|
||||
OUTPUT_FORMAT("elf32-lm32", "elf32-lm32",
|
||||
"elf32-lm32")
|
||||
OUTPUT_ARCH(lm32)
|
||||
ENTRY(_start)
|
||||
/* Do we need any of these for elf?
|
||||
__DYNAMIC = 0; */
|
||||
|
||||
/*
|
||||
* Declare some sizes. Heap is sized at whatever ram space is left.
|
||||
*/
|
||||
RamBase = DEFINED(RamBase) ? RamBase : 0x40000000;
|
||||
RamSize = DEFINED(RamSize) ? RamSize : 64M;
|
||||
HeapSize = DEFINED(HeapSize) ? HeapSize : 2M;
|
||||
_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
|
||||
|
||||
PROVIDE (__stack = 0);
|
||||
MEMORY {
|
||||
sdram : ORIGIN = 0x40000000 , LENGTH = 64M
|
||||
}
|
||||
SECTIONS
|
||||
{
|
||||
.boot :
|
||||
{
|
||||
KEEP (*(.boot))
|
||||
} > sdram
|
||||
|
||||
/* Read-only sections, merged into text segment: */
|
||||
.interp : { *(.interp) } > sdram
|
||||
.hash : { *(.hash) } > sdram
|
||||
.dynsym : { *(.dynsym) } > sdram
|
||||
.dynstr : { *(.dynstr) } > sdram
|
||||
.gnu.version : { *(.gnu.version) } > sdram
|
||||
.gnu.version_d : { *(.gnu.version_d) } > sdram
|
||||
.gnu.version_r : { *(.gnu.version_r) } > sdram
|
||||
.rela.text :
|
||||
{ *(.rela.text) *(.rela.gnu.linkonce.t*) } > sdram
|
||||
.rela.data :
|
||||
{ *(.rela.data) *(.rela.gnu.linkonce.d*) } > sdram
|
||||
.rela.rodata :
|
||||
{ *(.rela.rodata*) *(.rela.gnu.linkonce.r*) } > sdram
|
||||
.rela.got : { *(.rela.got) } > sdram
|
||||
.rela.got1 : { *(.rela.got1) } > sdram
|
||||
.rela.got2 : { *(.rela.got2) } > sdram
|
||||
.rela.ctors : { *(.rela.ctors) } > sdram
|
||||
.rela.dtors : { *(.rela.dtors) } > sdram
|
||||
.rela.init : { *(.rela.init) } > sdram
|
||||
.rela.fini : { *(.rela.fini) } > sdram
|
||||
.rela.bss : { *(.rela.bss) } > sdram
|
||||
.rela.plt : { *(.rela.plt) } > sdram
|
||||
.rela.sdata : { *(.rela.sdata) } > sdram
|
||||
.rela.sbss : { *(.rela.sbss) } > sdram
|
||||
.rela.sdata2 : { *(.rela.sdata2) } > sdram
|
||||
.rela.sbss2 : { *(.rela.sbss2) } > sdram
|
||||
.rela.dyn : { *(.rela.dyn) } > sdram
|
||||
|
||||
.init : { KEEP(*(.init)) } > sdram
|
||||
|
||||
.text :
|
||||
{
|
||||
*(.text*)
|
||||
|
||||
/*
|
||||
* Special FreeBSD sysctl sections.
|
||||
*/
|
||||
. = ALIGN (16);
|
||||
__start_set_sysctl_set = .;
|
||||
*(set_sysctl_*);
|
||||
__stop_set_sysctl_set = ABSOLUTE(.);
|
||||
*(set_domain_*);
|
||||
*(set_pseudo_*);
|
||||
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
*(.gnu.linkonce.t*)
|
||||
} > sdram
|
||||
|
||||
.fini : { _fini = .; KEEP(*(.fini)) } > sdram
|
||||
|
||||
.rodata : { *(.rodata*) *(.gnu.linkonce.r*) } > sdram
|
||||
.rodata1 : { *(.rodata1) } > sdram
|
||||
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. */
|
||||
. = ALIGN(0x10000) + (. & (0x10000 - 1));
|
||||
/* Ensure the __preinit_array_start label is properly aligned. We
|
||||
could instead move the label definition inside the section, but
|
||||
the linker would then create the section even if it turns out to
|
||||
be empty, which isn't pretty. */
|
||||
. = ALIGN(32 / 8);
|
||||
PROVIDE (__preinit_array_start = .);
|
||||
.preinit_array : { *(.preinit_array) } >sdram
|
||||
PROVIDE (__preinit_array_end = .);
|
||||
PROVIDE (__init_array_start = .);
|
||||
.init_array : { *(.init_array) } >sdram
|
||||
PROVIDE (__init_array_end = .);
|
||||
PROVIDE (__fini_array_start = .);
|
||||
.fini_array : { *(.fini_array) } >sdram
|
||||
PROVIDE (__fini_array_end = .);
|
||||
|
||||
/* _SDA2_BASE_ = __SDATA2_START__ + 0xe000; */
|
||||
.sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } >sdram
|
||||
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
|
||||
/* avoid empty sdata2/sbss2 area -- __eabi would not set up r2
|
||||
* which may be important if run-time loading is used
|
||||
*/
|
||||
. += 1;
|
||||
} >sdram
|
||||
.eh_frame : { *.(eh_frame) } >sdram
|
||||
|
||||
/* NOTE: if the BSP uses page tables, the correctness of
|
||||
* '_etext' (and __DATA_START__) is CRUCIAL - otherwise,
|
||||
* an invalid mapping may result!!!
|
||||
*/
|
||||
_etext = .;
|
||||
PROVIDE (etext = .);
|
||||
|
||||
/* Adjust the address for the data segment. We want to adjust up to
|
||||
the same address within the page on the next page up. It would
|
||||
be more correct to do this:
|
||||
. = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
|
||||
The current expression does not correctly handle the case of a
|
||||
text segment ending precisely at the end of a page; it causes the
|
||||
data segment to skip a page. The above expression does not have
|
||||
this problem, but it will currently (2/95) cause BFD to allocate
|
||||
a single segment, combining both text and data, for this case.
|
||||
This will prevent the text segment from being shared among
|
||||
multiple executions of the program; I think that is more
|
||||
important than losing a page of the virtual address space (note
|
||||
that no actual memory is lost; the page which is skipped can not
|
||||
be referenced). */
|
||||
. = ALIGN(0x1000);
|
||||
.data ALIGN(0x1000) :
|
||||
{
|
||||
/* NOTE: if the BSP uses page tables, the correctness of
|
||||
* '__DATA_START__' (and _etext) is CRUCIAL - otherwise,
|
||||
* an invalid mapping may result!!!
|
||||
*/
|
||||
PROVIDE(__DATA_START__ = ABSOLUTE(.) );
|
||||
*(.data .data.* .gnu.linkonce.d*)
|
||||
SORT(CONSTRUCTORS)
|
||||
} > sdram
|
||||
.data1 : { *(.data1) } > sdram
|
||||
PROVIDE (__EXCEPT_START__ = .);
|
||||
.gcc_except_table : {
|
||||
*(.gcc_except_table)
|
||||
*(.gcc_except_table.*)
|
||||
} > sdram
|
||||
PROVIDE (__EXCEPT_END__ = .);
|
||||
.got1 : { *(.got1) } > sdram
|
||||
/* Put .ctors and .dtors next to the .got2 section, so that the pointers
|
||||
get relocated with -mrelocatable. Also put in the .fixup pointers.
|
||||
The current compiler no longer needs this, but keep it around for 2.7.2 */
|
||||
PROVIDE (_GOT2_START_ = .);
|
||||
.got2 : { *(.got2) } > sdram
|
||||
.dynamic : { *(.dynamic) } > sdram
|
||||
|
||||
.ctors :
|
||||
{
|
||||
/* gcc uses crtbegin.o to find the start of
|
||||
the constructors, so we make sure it is
|
||||
first. Because this is a wildcard, it
|
||||
doesn't matter if the user does not
|
||||
actually link against crtbegin.o; the
|
||||
linker won't look for a file to match a
|
||||
wildcard. The wildcard also means that it
|
||||
doesn't matter which directory crtbegin.o
|
||||
is in. */
|
||||
KEEP (*crtbegin.o(.ctors))
|
||||
/* We don't want to include the .ctor section from
|
||||
from the crtend.o file until after the sorted ctors.
|
||||
The .ctor section from the crtend file contains the
|
||||
end of ctors marker and it must be last */
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
|
||||
KEEP (*(SORT(.ctors.*)))
|
||||
KEEP (*(.ctors))
|
||||
} > sdram
|
||||
.dtors :
|
||||
{
|
||||
KEEP (*crtbegin.o(.dtors))
|
||||
KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
|
||||
KEEP (*(SORT(.dtors.*)))
|
||||
KEEP (*(.dtors))
|
||||
} > sdram
|
||||
|
||||
|
||||
PROVIDE (_FIXUP_START_ = .);
|
||||
.fixup : { *(.fixup) } > sdram
|
||||
PROVIDE (_FIXUP_END_ = .);
|
||||
PROVIDE (_GOT2_END_ = .);
|
||||
PROVIDE (_GOT_START_ = .);
|
||||
|
||||
.got : { *(.got) } > sdram
|
||||
.got.plt : { *(.got.plt) } > sdram
|
||||
|
||||
PROVIDE (_GOT_END_ = .);
|
||||
|
||||
.jcr : { KEEP (*(.jcr)) } > sdram
|
||||
|
||||
/* We want the small data sections together, so single-instruction offsets
|
||||
can access them all, and initialized data all before uninitialized, so
|
||||
we can shorten the on-disk segment size. */
|
||||
/* _SDA_BASE_ = __SDATA_START__ + 0xe000; */
|
||||
.sdata : { *(.sdata*) *(.gnu.linkonce.s.*) } >sdram
|
||||
_edata = .;
|
||||
_gp = .;
|
||||
PROVIDE (edata = .);
|
||||
.sbss :
|
||||
{
|
||||
_clear_start = .;
|
||||
PROVIDE (__sbss_start = .);
|
||||
*(.dynsbss)
|
||||
*(.sbss* .gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
/* avoid empty sdata/sbss area -- __eabi would not set up r13
|
||||
* which may be important if run-time loading is used
|
||||
*/
|
||||
. += 1;
|
||||
. = ALIGN(16);
|
||||
PROVIDE (__sbss_end = .);
|
||||
} > sdram
|
||||
.plt : { *(.plt) } > sdram
|
||||
.bss :
|
||||
{
|
||||
PROVIDE (__bss_start = .);
|
||||
*(.dynbss)
|
||||
*(.bss .bss* .gnu.linkonce.b*)
|
||||
*(COMMON)
|
||||
. = ALIGN(16);
|
||||
_end = . ;
|
||||
__rtems_end = . ;
|
||||
PROVIDE (end = .);
|
||||
|
||||
. += _StackSize;
|
||||
_fstack = .;
|
||||
|
||||
WorkAreaBase = .;
|
||||
|
||||
. = ALIGN (16);
|
||||
_stack_init = .;
|
||||
_clear_end = .;
|
||||
|
||||
} > sdram
|
||||
|
||||
|
||||
/DISCARD/ :
|
||||
{
|
||||
*(.comment)
|
||||
}
|
||||
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.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) }
|
||||
|
||||
/* DWARF debug sections.
|
||||
Symbols in the DWARF debugging sections are relative to the beginning
|
||||
of the section so we begin them at 0. */
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
|
||||
/* DWARF 2 */
|
||||
.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) }
|
||||
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* These must appear regardless of . */
|
||||
}
|
||||
Reference in New Issue
Block a user