mirror of
https://github.com/t-crest/rtems.git
synced 2025-11-16 12:34:47 +00:00
Add BSP for the Patmos hardware
This commit is contained in:
@@ -14,6 +14,7 @@ rtems_src_dir=$rtems_dir/rtems-src
|
||||
rtems_build_dir=$rtems_dir/rtems-build
|
||||
rtems_install_dir=$rtems_dir/rtems-install
|
||||
rtems_examples_dir=$rtems_dir/rtems-examples
|
||||
rtems_bsp=tcrest
|
||||
|
||||
old_target=patmos-unknown-unknown-elf
|
||||
new_target=patmos-unknown-rtems
|
||||
@@ -24,6 +25,7 @@ build_emulator=false
|
||||
build_rtems_examples=false
|
||||
build_llvm_release=true
|
||||
get_rtems=true
|
||||
run_bootstrap=false
|
||||
|
||||
function add2bashrc(){
|
||||
echo $1 >> ~/.bashrc
|
||||
@@ -57,6 +59,7 @@ for i in ${@:1}
|
||||
;;
|
||||
"-r" | "-R")
|
||||
build_rtems=true
|
||||
run_bootstrap=true
|
||||
;;
|
||||
"-rs" | "-RS")
|
||||
build_rtems=true
|
||||
@@ -135,7 +138,10 @@ if [[ $build_rtems == "true" ]]; then
|
||||
echo "error: "$(basename $rtems_src_dir)" not empty directory"
|
||||
exit 1
|
||||
fi
|
||||
git clone https://github.com/t-crest/rtems.git $rtems_src_dir
|
||||
git clone https://github.com/t-crest/rtems.git $rtems_src_dir
|
||||
fi
|
||||
|
||||
if [[ $run_bootstrap == "true" ]]; then
|
||||
cd $rtems_src_dir
|
||||
./bootstrap -p
|
||||
./bootstrap
|
||||
@@ -150,12 +156,12 @@ if [[ $build_rtems == "true" ]]; then
|
||||
rtems_install_dir=$(pwd)
|
||||
|
||||
cd $rtems_build_dir
|
||||
$rtems_src_dir/configure --target=patmos-unknown-rtems --enable-posix --disable-networking --disable-cxx --enable-tests --enable-rtemsbsp=pasim --prefix=$rtems_install_dir
|
||||
$rtems_src_dir/configure --target=patmos-unknown-rtems --enable-posix --disable-networking --disable-cxx --enable-tests --enable-rtemsbsp=$rtems_bsp --prefix=$rtems_install_dir
|
||||
make install
|
||||
grep -Fxq "export RTEMS_MAKEFILE_PATH="$rtems_install_dir"/patmos-unknown-rtems/pasim" ~/.bashrc
|
||||
grep -Fxq "export RTEMS_MAKEFILE_PATH="$rtems_install_dir"/patmos-unknown-rtems/"$rtems_bsp ~/.bashrc
|
||||
if [[ $? == 1 ]]; then
|
||||
add2bashrc "export RTEMS_MAKEFILE_PATH="$rtems_install_dir"/patmos-unknown-rtems/pasim"
|
||||
export RTEMS_MAKEFILE_PATH"="$rtems_install_dir"/patmos-unknown-rtems/pasim"
|
||||
add2bashrc "export RTEMS_MAKEFILE_PATH="$rtems_install_dir"/patmos-unknown-rtems/"$rtems_bsp
|
||||
export RTEMS_MAKEFILE_PATH"="$rtems_install_dir"/patmos-unknown-rtems/"$rtems_bsp
|
||||
fi
|
||||
#rm -rf $pwd
|
||||
fi
|
||||
|
||||
@@ -9,9 +9,8 @@ SUBDIRS = @RTEMS_BSP_FAMILY@
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
EXTRA_DIST += shared/bspclean.c
|
||||
EXTRA_DIST += shared/bspstart.c
|
||||
EXTRA_DIST += shared/start.S
|
||||
EXTRA_DIST += shared/startup/bspstart.c
|
||||
EXTRA_DIST += shared/startup/start.S
|
||||
|
||||
include $(top_srcdir)/../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../automake/local.am
|
||||
|
||||
2
c/src/lib/libbsp/patmos/acinclude.m4
Normal file → Executable file
2
c/src/lib/libbsp/patmos/acinclude.m4
Normal file → Executable file
@@ -4,6 +4,8 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
|
||||
case "$1" in
|
||||
pasim )
|
||||
AC_CONFIG_SUBDIRS([pasim]);;
|
||||
tcrest )
|
||||
AC_CONFIG_SUBDIRS([tcrest]);;
|
||||
*)
|
||||
AC_MSG_ERROR([Invalid BSP]);;
|
||||
esac
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##
|
||||
## $Id: Makefile.am,v 1.00 2013/06/14 15:17:12 André Rocha $
|
||||
## $Id: Makefile.am,v 1.00 2013/06/14 15:17:12 Andre Rocha $
|
||||
##
|
||||
|
||||
ACLOCAL_AMFLAGS = -I ../../../../aclocal
|
||||
@@ -23,7 +23,7 @@ include_HEADERS += include/pasim.h
|
||||
include_HEADERS += ../../shared/include/coverhd.h
|
||||
|
||||
noinst_LIBRARIES = libbspstart.a
|
||||
libbspstart_a_SOURCES = ../../patmos/shared/start.S
|
||||
libbspstart_a_SOURCES = ../../patmos/shared/startup/start.S
|
||||
project_lib_DATA = start.$(OBJEXT)
|
||||
|
||||
dist_project_lib_DATA += startup/linkcmds
|
||||
@@ -34,17 +34,17 @@ libbsp_a_SOURCES =
|
||||
|
||||
# startup
|
||||
libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
|
||||
../../shared/bsppost.c ../../shared/bootcard.c startup/bspstart.c \
|
||||
../../shared/bsppost.c ../../shared/bootcard.c ../shared/startup/bspstart.c \
|
||||
../../shared/bsppretaskinghook.c ../../shared/bsppredriverhook.c \
|
||||
../shared/bspgetworkarea.c ../../shared/sbrk.c
|
||||
# console
|
||||
libbsp_a_SOURCES += console/console.c
|
||||
libbsp_a_SOURCES += ../shared/console/console.c
|
||||
# debugio
|
||||
libbsp_a_SOURCES += console/debugputs.c
|
||||
libbsp_a_SOURCES += ../shared/console/debugputs.c
|
||||
# clock
|
||||
libbsp_a_SOURCES += clock/ckinit.c ../../../shared/clockdrv_shell.h
|
||||
libbsp_a_SOURCES += ../shared/clock/ckinit.c ../../../shared/clockdrv_shell.h
|
||||
# timer
|
||||
libbsp_a_SOURCES += timer/timer.c
|
||||
libbsp_a_SOURCES += ../shared/timer/timer.c
|
||||
|
||||
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/cache.rel \
|
||||
../../../libcpu/@RTEMS_CPU@/exceptions.rel
|
||||
|
||||
@@ -20,14 +20,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <bspopts.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <pasim.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
#include <rtems/console.h>
|
||||
|
||||
/* PATMOS CPU variant: PASIM */
|
||||
/* Patmos CPU variant: PASIM */
|
||||
#define PASIM 1
|
||||
|
||||
/* Constants */
|
||||
@@ -44,6 +37,13 @@ extern "C" {
|
||||
#define PROM_SIZE 256M
|
||||
#define PROM_END PROM_START + PROM_SIZE
|
||||
|
||||
#ifndef ASM
|
||||
|
||||
#include <bspopts.h>
|
||||
#include <rtems.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
#include <rtems/console.h>
|
||||
|
||||
extern int CLOCK_SPEED;
|
||||
|
||||
extern int end; /* last address in the program */
|
||||
@@ -60,10 +60,14 @@ void BSP_fatal_return( void );
|
||||
|
||||
void bsp_spurious_initialize( void );
|
||||
|
||||
#endif /* !ASM */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <pasim.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Clock Tick Device Driver
|
||||
*
|
||||
* This routine initializes PASIM timer 1 which used for the clock tick.
|
||||
* This routine initializes Patmos timer 1 which used for the clock tick.
|
||||
*
|
||||
* The tick frequency is directly programmed to the configured number of
|
||||
* microseconds per tick.
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* This file contains the TTY driver for the serial ports on the PASIM.
|
||||
* This file contains the TTY driver for the serial ports on Patmos.
|
||||
*
|
||||
* This driver uses the termios pseudo driver.
|
||||
*
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* This file contains the TTY driver for the serial ports on the PASIM.
|
||||
* This file contains the TTY driver for the serial ports on Patmos.
|
||||
*
|
||||
* This driver uses the termios pseudo driver.
|
||||
*
|
||||
@@ -6,7 +6,7 @@
|
||||
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
|
||||
*
|
||||
* Copyright (C) GMVIS Skysoft S.A., 2013
|
||||
* @author André Rocha
|
||||
* @author Andre Rocha
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
|
||||
#include <rtems/asm.h>
|
||||
#include <pasim.h>
|
||||
#include <bsp.h>
|
||||
|
||||
.comm _loader_baseaddr,4,4
|
||||
.comm _loader_off,4,4
|
||||
|
||||
.type hard_reset, @function
|
||||
.size hard_reset, .Ltmp0-hard_reset
|
||||
@@ -27,8 +30,16 @@
|
||||
PUBLIC(hard_reset)
|
||||
SYM(hard_reset):
|
||||
|
||||
and $r0 = $r0, 0x0 /* Reset r0 to 0 */
|
||||
|
||||
/*
|
||||
* save loader return information
|
||||
*/
|
||||
li $r1 = _loader_baseaddr
|
||||
mfs $r29 = $srb
|
||||
swm [$r1] = $r29
|
||||
li $r1 = _loader_off
|
||||
mfs $r29 = $sro
|
||||
swm [$r1] = $r29
|
||||
|
||||
/*
|
||||
* setup stack cache and stack frame
|
||||
*/
|
||||
@@ -36,59 +47,11 @@ SYM(hard_reset):
|
||||
li $r9 = _stack_cache_base
|
||||
mts $s5 = $r9 /* Initialize the stack cache's top pointer */
|
||||
mts $s6 = $r9 /* Initialize the stack cache's spill top pointer */
|
||||
|
||||
/*
|
||||
* Copy the initialized data from ROM to RAM
|
||||
*
|
||||
* FROM: _etext
|
||||
* TO: _data_start
|
||||
* LENGTH: (__bss_start - _data_start) bytes
|
||||
*/
|
||||
|
||||
// li $r9 = _etext /* r9 = start of initialized data in ROM */
|
||||
// li $r10 = _data_start /* r10 = start of initialized data in RAM */
|
||||
// li $r11 = _bss_start /* r11 = end of initialized data in RAM */
|
||||
|
||||
// cmplt $p2 = $r10, $r11 /* Is the pointer past the end of dest? */
|
||||
// (!$p2) br clear_bss
|
||||
// nop
|
||||
// nop
|
||||
// nop
|
||||
|
||||
//copy_data:
|
||||
// lwc $r12 = [ $r9 + 0 ]
|
||||
// swc [ $r10 + 0 ] = $r12 /* copy this word */
|
||||
// add $r9 = $r9, 4 /* bump the source pointer */
|
||||
// add $r10 = $r10, 4 /* bump the destination pointer */
|
||||
// cmplt $p2 = $r10, $r11 /* Is the pointer past the end of dest? */
|
||||
// ($p2) br copy_data
|
||||
// nop
|
||||
// nop
|
||||
// nop
|
||||
|
||||
//clear_bss: /* clear the bss */
|
||||
// li $r9 = _edata /* r9 = start of bss */
|
||||
// li $r10 = _end /* r10 = end of bss */
|
||||
|
||||
// cmple $p2 = $r9, $r10
|
||||
// (!$p2) br call_boot
|
||||
// nop
|
||||
// nop
|
||||
// nop
|
||||
|
||||
//zero_bss:
|
||||
// swc [ $r9 + 0 ] = $r0 /* zero the bss */
|
||||
// add $r9 = $r9, 4 /* bump the bss pointer */
|
||||
// cmple $p2 = $r9, $r10
|
||||
// ($p2) br zero_bss
|
||||
// nop
|
||||
// nop
|
||||
|
||||
/*
|
||||
* invoke main function
|
||||
*/
|
||||
|
||||
//call_boot:
|
||||
|
||||
call SYM(boot_card) /* invoke boot_card function */
|
||||
li $r3 = 0 /* pass argument argc */
|
||||
li $r4 = 0 /* pass argument argv */
|
||||
@@ -108,8 +71,16 @@ SYM(hard_reset):
|
||||
|
||||
PUBLIC(__exit)
|
||||
SYM(__exit):
|
||||
mov $r1 = $r3 /* store exit code */
|
||||
brcf $r0 /* halt */
|
||||
li $r1 = _loader_baseaddr
|
||||
lwm $r29 = [$r1]
|
||||
nop
|
||||
mts $srb = $r29
|
||||
li $r1 = _loader_off
|
||||
lwm $r29 = [$r1]
|
||||
nop
|
||||
mts $sro = $r29
|
||||
mov $r1 = $r3 /* store exit code */
|
||||
ret /* return to loader and/or halt */
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
53
c/src/lib/libbsp/patmos/tcrest/Makefile.am
Executable file
53
c/src/lib/libbsp/patmos/tcrest/Makefile.am
Executable file
@@ -0,0 +1,53 @@
|
||||
##
|
||||
## $Id: Makefile.am,v 1.00 2014/03/27 15:17:12 Andre Rocha $
|
||||
##
|
||||
|
||||
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 += ../../shared/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 += include/tcrest.h
|
||||
include_HEADERS += ../../shared/include/coverhd.h
|
||||
|
||||
noinst_LIBRARIES = libbspstart.a
|
||||
libbspstart_a_SOURCES = ../../patmos/shared/startup/start.S
|
||||
project_lib_DATA = start.$(OBJEXT)
|
||||
|
||||
dist_project_lib_DATA += startup/linkcmds
|
||||
dist_project_lib_DATA += ../shared/libsyms.ll
|
||||
|
||||
noinst_LIBRARIES += libbsp.a
|
||||
libbsp_a_SOURCES =
|
||||
|
||||
# startup
|
||||
libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
|
||||
../../shared/bsppost.c ../../shared/bootcard.c ../shared/startup/bspstart.c \
|
||||
../../shared/bsppretaskinghook.c ../../shared/bsppredriverhook.c \
|
||||
../shared/bspgetworkarea.c ../../shared/sbrk.c
|
||||
# console
|
||||
libbsp_a_SOURCES += ../shared/console/console.c
|
||||
# debugio
|
||||
libbsp_a_SOURCES += ../shared/console/debugputs.c
|
||||
# clock
|
||||
libbsp_a_SOURCES += ../shared/clock/ckinit.c ../../../shared/clockdrv_shell.h
|
||||
# timer
|
||||
libbsp_a_SOURCES += ../shared/timer/timer.c
|
||||
|
||||
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/cache.rel \
|
||||
../../../libcpu/@RTEMS_CPU@/exceptions.rel
|
||||
|
||||
include $(srcdir)/preinstall.am
|
||||
include $(top_srcdir)/../../../../automake/local.am
|
||||
13
c/src/lib/libbsp/patmos/tcrest/bsp_specs
Normal file
13
c/src/lib/libbsp/patmos/tcrest/bsp_specs
Normal file
@@ -0,0 +1,13 @@
|
||||
%rename endfile old_endfile
|
||||
%rename startfile old_startfile
|
||||
%rename link old_link
|
||||
|
||||
*endfile:
|
||||
crtend.o%s crtn.o%s
|
||||
|
||||
*startfile:
|
||||
%{!qrtems: %(old_startfile)} \
|
||||
%{!nostdlib: %{qrtems: start.o%s crti.o%s crtbegin.o%s}}
|
||||
|
||||
*link:
|
||||
%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N}
|
||||
22
c/src/lib/libbsp/patmos/tcrest/configure.ac
Executable file
22
c/src/lib/libbsp/patmos/tcrest/configure.ac
Executable file
@@ -0,0 +1,22 @@
|
||||
## Process this file with autoconf to produce a configure script.
|
||||
##
|
||||
## $Id: configure.ac,v 1.00 2013/06/14 15:17:12 Andre Rocha $
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
AC_INIT([rtems-c-src-lib-libbsp-patmos-tcrest],[_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.11.1])
|
||||
RTEMS_BSP_CONFIGURE
|
||||
|
||||
RTEMS_PROG_CC_FOR_TARGET
|
||||
RTEMS_CANONICALIZE_TOOLS
|
||||
RTEMS_PROG_CCAS
|
||||
|
||||
RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
|
||||
|
||||
# Explicitly list all Makefiles here
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
73
c/src/lib/libbsp/patmos/tcrest/include/bsp.h
Executable file
73
c/src/lib/libbsp/patmos/tcrest/include/bsp.h
Executable file
@@ -0,0 +1,73 @@
|
||||
/* bsp.h
|
||||
*
|
||||
* This include file contains all PATMOS simulator definitions.
|
||||
*
|
||||
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
|
||||
*
|
||||
* Copyright (C) GMVIS Skysoft S.A., 2014
|
||||
* @author Andre Rocha
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BSP_H
|
||||
#define _BSP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Patmos CPU variant: TCREST */
|
||||
#define TCREST 2
|
||||
|
||||
/* Constants */
|
||||
|
||||
/*
|
||||
* Information placed in the linkcmds file.
|
||||
*/
|
||||
|
||||
#define RAM_START 0x00020000
|
||||
#define RAM_SIZE 1536K
|
||||
#define RAM_END RAM_START + RAM_SIZE
|
||||
|
||||
#define PROM_START 0x00000000
|
||||
#define PROM_SIZE 0K
|
||||
#define PROM_END PROM_START + PROM_SIZE
|
||||
|
||||
#ifndef ASM
|
||||
|
||||
#include <bspopts.h>
|
||||
#include <rtems.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
#include <rtems/console.h>
|
||||
|
||||
extern int CLOCK_SPEED;
|
||||
|
||||
extern int end; /* last address in the program */
|
||||
|
||||
/* miscellaneous stuff assumed to exist */
|
||||
|
||||
rtems_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 */
|
||||
);
|
||||
|
||||
void BSP_fatal_return( void );
|
||||
|
||||
void bsp_spurious_initialize( void );
|
||||
|
||||
#endif /* !ASM */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <tcrest.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
194
c/src/lib/libbsp/patmos/tcrest/include/tcrest.h
Executable file
194
c/src/lib/libbsp/patmos/tcrest/include/tcrest.h
Executable file
@@ -0,0 +1,194 @@
|
||||
/* tcrest.h
|
||||
*
|
||||
* TCREST BSP data types and macros.
|
||||
*
|
||||
* Project: T-CREST - Time-Predictable Multi-Core Architecture for Embedded Systems
|
||||
*
|
||||
* Copyright (C) GMVIS Skysoft S.A., 2014
|
||||
* @author Andre Rocha
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _INCLUDE_TCREST_h
|
||||
#define _INCLUDE_TCREST_h
|
||||
|
||||
#include <rtems/score/patmos.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TODO: replace these by linker symbols
|
||||
*/
|
||||
|
||||
#define _shadow_stack_base 0x00200000
|
||||
#define _stack_cache_base 0x001f0000
|
||||
|
||||
#ifndef ASM
|
||||
|
||||
#define _IODEV __attribute__((address_space(1)))
|
||||
|
||||
typedef _IODEV unsigned int volatile * const _iodev_ptr_t;
|
||||
|
||||
|
||||
/*
|
||||
* CPU Info Management
|
||||
*/
|
||||
|
||||
extern char _cpuinfo_base; /* linker symbol giving the address of the CPU info */
|
||||
|
||||
extern uint32_t get_cpu_freq_mhz(void);
|
||||
|
||||
/* Address to access the CPU id */
|
||||
#define __PATMOS_CPU_ID_ADDR (&_cpuinfo_base + 0x00)
|
||||
|
||||
/* Address to access the CPU frequency */
|
||||
#define __PATMOS_CPU_FREQ_ADDR (&_cpuinfo_base + 0x04)
|
||||
|
||||
/* Macro to read the CPU id */
|
||||
#define __PATMOS_CPU_RD_ID(res) res = *((_iodev_ptr_t)__PATMOS_CPU_ID_ADDR);
|
||||
|
||||
/* Macro to read the CPU frequency */
|
||||
#define __PATMOS_CPU_RD_FREQ(res) res = *((_iodev_ptr_t)__PATMOS_CPU_FREQ_ADDR);
|
||||
|
||||
/*
|
||||
* End of CPU Info Management
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* UART Management
|
||||
*/
|
||||
|
||||
extern char _iomap_base; /* linker symbol giving the base address of the IO map address range */
|
||||
|
||||
extern char _uart_base; /* linker symbol giving the address of the UART */
|
||||
|
||||
/*
|
||||
* The following defines the bits in the TCREST UART Status Registers.
|
||||
*/
|
||||
|
||||
#define __PATMOS_UART_TRE 1 /* Bit mask for the transmit-ready bit (TRE) */
|
||||
#define __PATMOS_UART_DAV 2 /* Bit mask for the data-available bit (DAV) */
|
||||
#define __PATMOS_UART_PAE 4 /* Bit mask for the parity-error bit (PAE) */
|
||||
#define __PATMOS_UART_TFL 8 /* Bit mask for the transmit-flush bit (TFL) */
|
||||
|
||||
/*
|
||||
* Address to access the status register of the UART coming with Patmos
|
||||
*/
|
||||
#define __PATMOS_UART_STATUS_ADDR (&_uart_base + 0x00)
|
||||
|
||||
/*
|
||||
* Address to access the data register of the UART coming with Patmos
|
||||
*/
|
||||
#define __PATMOS_UART_DATA_ADDR (&_uart_base + 0x04)
|
||||
|
||||
|
||||
/*
|
||||
* Macros to handle read and write to the UART's status, control and data registers
|
||||
*/
|
||||
|
||||
/* Macro to read the UART's status register */
|
||||
#define __PATMOS_UART_STATUS(res) res = *((_iodev_ptr_t)__PATMOS_UART_STATUS_ADDR);
|
||||
|
||||
/* Macro to read the UART's data register */
|
||||
#define __PATMOS_UART_RD_DATA(res) res = *((_iodev_ptr_t)__PATMOS_UART_DATA_ADDR);
|
||||
|
||||
/* Macro to write the UART's control register */
|
||||
#define __PATMOS_UART_WR_CTRL(data) *((_iodev_ptr_t)__PATMOS_UART_STATUS_ADDR) = data;
|
||||
|
||||
/* Macro to write the UART's data register */
|
||||
#define __PATMOS_UART_WR_DATA(data) *((_iodev_ptr_t)__PATMOS_UART_DATA_ADDR) = data;
|
||||
|
||||
/*
|
||||
* End of UART Management
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* RTC Management
|
||||
*/
|
||||
|
||||
extern char _timer_base; /* linker symbol giving the address of the RTC */
|
||||
|
||||
extern uint64_t get_cpu_usecs (void);
|
||||
|
||||
extern void set_usec_timer (uint64_t time_warp);
|
||||
|
||||
/* Address to access the cycle counter low register of the RTC */
|
||||
#define __PATMOS_RTC_CYCLE_LOW_ADDR (&_timer_base + 0x04)
|
||||
|
||||
/* Address to access the cycle counter up register of the RTC */
|
||||
#define __PATMOS_RTC_CYCLE_UP_ADDR (&_timer_base + 0x00)
|
||||
|
||||
/* Address to access the time in microseconds low register of the RTC */
|
||||
#define __PATMOS_RTC_TIME_LOW_ADDR (&_timer_base + 0x0C)
|
||||
|
||||
/* Address to access the time in microseconds up register of the RTC */
|
||||
#define __PATMOS_RTC_TIME_UP_ADDR (&_timer_base + 0x08)
|
||||
|
||||
/* Address to access the ISR address register of the RTC cycle timer */
|
||||
#define __PATMOS_RTC_ISR_ADDR (&_excunit_base + 0xc0)
|
||||
|
||||
/* Macro to read the RTC's cycle counter low register of the RTC */
|
||||
#define __PATMOS_RTC_RD_CYCLE_LOW(res) res = *((_iodev_ptr_t)__PATMOS_RTC_CYCLE_LOW_ADDR);
|
||||
|
||||
/* Macro to read the RTC's cycle counter up register of the RTC */
|
||||
#define __PATMOS_RTC_RD_CYCLE_UP(res) res = *((_iodev_ptr_t)__PATMOS_RTC_CYCLE_UP_ADDR);
|
||||
|
||||
/* Macro to read the RTC's time in microseconds low register of the RTC */
|
||||
#define __PATMOS_RTC_RD_TIME_LOW(res) res = *((_iodev_ptr_t)__PATMOS_RTC_TIME_LOW_ADDR);
|
||||
|
||||
/* Macro to read the RTC's time in microseconds up register of the RTC */
|
||||
#define __PATMOS_RTC_RD_TIME_UP(res) res = *((_iodev_ptr_t)__PATMOS_RTC_TIME_UP_ADDR);
|
||||
|
||||
/* Macro to write the RTC's cycle counter low register */
|
||||
#define __PATMOS_RTC_WR_CYCLE_LOW(val) *((_iodev_ptr_t)__PATMOS_RTC_CYCLE_LOW_ADDR) = val;
|
||||
|
||||
/* Macro to write the RTC's cycle counter up register */
|
||||
#define __PATMOS_RTC_WR_CYCLE_UP(val) *((_iodev_ptr_t)__PATMOS_RTC_CYCLE_UP_ADDR) = val;
|
||||
|
||||
/* Macro to write the RTC's ISR address register */
|
||||
#define __PATMOS_RTC_WR_ISR(address) *((_iodev_ptr_t)__PATMOS_RTC_ISR_ADDR) = address;
|
||||
|
||||
/*
|
||||
* End of RTC Management
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Exception Management
|
||||
*/
|
||||
|
||||
extern char _excunit_base; /* linker symbol giving the base address of the exception handling unit */
|
||||
|
||||
/* The status register of the exception unit */
|
||||
#define EXC_STATUS (*((_iodev_ptr_t)(&_excunit_base+0x00)))
|
||||
|
||||
/* The interrupt mask register */
|
||||
#define EXC_MASK (*((_iodev_ptr_t)(&_excunit_base+0x04)))
|
||||
|
||||
/* The pending interrupts register */
|
||||
#define EXC_PEND (*((_iodev_ptr_t)(&_excunit_base+0x08)))
|
||||
|
||||
/* The exception source register */
|
||||
#define EXC_SOURCE (*((_iodev_ptr_t)(&_excunit_base+0x0c)))
|
||||
|
||||
/*
|
||||
* End of Exception Management
|
||||
*/
|
||||
|
||||
#endif /* !ASM */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_INCLUDE_TCREST_h */
|
||||
/* end of include file */
|
||||
|
||||
23
c/src/lib/libbsp/patmos/tcrest/make/custom/tcrest.cfg
Executable file
23
c/src/lib/libbsp/patmos/tcrest/make/custom/tcrest.cfg
Executable file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# Config file for the TCREST PATMOS processor.
|
||||
#
|
||||
# $Id: tcrest.cfg,v 1.00 2014/03/27 15:17:12 Andre Rocha $
|
||||
#
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/default.cfg
|
||||
|
||||
RTEMS_CPU=patmos
|
||||
RTEMS_CPU_MODEL=tcrest
|
||||
|
||||
# This contains the compiler options necessary to select the CPU model
|
||||
# and (hopefully) optimize for it.
|
||||
CPU_CFLAGS = -msoft-float
|
||||
|
||||
# optimize flag: typically -O2
|
||||
CFLAGS_OPTIMIZE_V = -O2 -g -Xllc -trap-func=abort_trap
|
||||
|
||||
# debug flags: disable optimizations
|
||||
# We need the optimized register allocator here, the fast register allocator at -O0 wants to introduce spill code in naked functions.
|
||||
CFLAGS_DEBUG_V = -O0 -Xllc -optimize-regalloc
|
||||
|
||||
LINK_LIBS += $(PROJECT_RELEASE)/lib/start.o $(PROJECT_RELEASE)/lib/libsyms.ll -l=c -l=rtemscpu -l=rtemsbsp -nostartfiles -Xgold -Map -Xgold map.map -Xgold --script=$(PROJECT_RELEASE)/lib/linkcmds
|
||||
75
c/src/lib/libbsp/patmos/tcrest/preinstall.am
Executable file
75
c/src/lib/libbsp/patmos/tcrest/preinstall.am
Executable file
@@ -0,0 +1,75 @@
|
||||
## 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: ../../shared/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)/tcrest.h: include/tcrest.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tcrest.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/tcrest.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_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
|
||||
|
||||
$(PROJECT_LIB)/libsyms.ll: ../shared/libsyms.ll $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/libsyms.ll
|
||||
PREINSTALL_FILES += $(PROJECT_LIB)/libsyms.ll
|
||||
|
||||
128
c/src/lib/libbsp/patmos/tcrest/startup/linkcmds
Executable file
128
c/src/lib/libbsp/patmos/tcrest/startup/linkcmds
Executable file
@@ -0,0 +1,128 @@
|
||||
/* linkcmds
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/* Default values, can be overridden */
|
||||
|
||||
_PROM_SIZE = 0K;
|
||||
_PROM_START = 0x00000000;
|
||||
|
||||
_RAM_SIZE = 1536K;
|
||||
_RAM_START = 0x00020000;
|
||||
|
||||
/* these are the maximum values */
|
||||
|
||||
RamBase = 0x00020000;
|
||||
RamSize = 1536K;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
rom : ORIGIN = 0x00000000, LENGTH = 0K
|
||||
ram : ORIGIN = 0x00020000, LENGTH = 1536K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(patmos)
|
||||
ENTRY(hard_reset)
|
||||
__DYNAMIC = 0;
|
||||
|
||||
/*
|
||||
* The memory map looks like this:
|
||||
* +--------------------+ <- low memory
|
||||
* | .text ROM |
|
||||
* | _text_start |
|
||||
* | ctor list | the ctor and dtor lists are for
|
||||
* | dtor list | C++ support
|
||||
* | _etext |
|
||||
* +--------------------+
|
||||
* | .data RAM | initialized data goes here
|
||||
* | _sdata |
|
||||
* | _edata |
|
||||
* +--------------------+
|
||||
* | .bss RAM |
|
||||
* | __bss_start | start of bss, cleared by crt0
|
||||
* | _end | start of heap, used by sbrk()
|
||||
* +--------------------+
|
||||
* | heap space |
|
||||
* | _ENDHEAP |
|
||||
* | stack space |
|
||||
* | __stack | top of stack
|
||||
* +--------------------+ <- high memory
|
||||
*/
|
||||
|
||||
_RAM_END = _RAM_START + _RAM_SIZE;
|
||||
|
||||
_PROM_END = _PROM_START + _PROM_SIZE;
|
||||
|
||||
/*
|
||||
* Alternate names without leading _.
|
||||
*/
|
||||
|
||||
PROM_START = _PROM_START;
|
||||
PROM_SIZE = _PROM_SIZE;
|
||||
PROM_END = _PROM_END;
|
||||
|
||||
RAM_START = _RAM_START;
|
||||
RAM_SIZE = _RAM_SIZE;
|
||||
RAM_END = _RAM_END;
|
||||
|
||||
/*
|
||||
* stick everything in ram (of course)
|
||||
*/
|
||||
SECTIONS
|
||||
{
|
||||
.text 0x00020000 :
|
||||
{
|
||||
text_start = . ;
|
||||
_text_start = . ;
|
||||
*(.text)
|
||||
. = ALIGN (0x10);
|
||||
|
||||
/*
|
||||
* Special FreeBSD sysctl sections.
|
||||
*/
|
||||
. = ALIGN (16);
|
||||
__start_set_sysctl_set = .;
|
||||
*(set_sysctl_*);
|
||||
__stop_set_sysctl_set = ABSOLUTE(.);
|
||||
*(set_domain_*);
|
||||
*(set_pseudo_*);
|
||||
|
||||
*(.eh_fram)
|
||||
. = ALIGN (0x10);
|
||||
|
||||
/*
|
||||
* C++ constructors
|
||||
*/
|
||||
__CTOR_LIST__ = .;
|
||||
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
|
||||
*(.ctors)
|
||||
LONG(0)
|
||||
__CTOR_END__ = .;
|
||||
__DTOR_LIST__ = .;
|
||||
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
|
||||
*(.dtors)
|
||||
LONG(0)
|
||||
__DTOR_END__ = .;
|
||||
_etext = ALIGN( 0x10 ) ;
|
||||
}
|
||||
.data :
|
||||
{
|
||||
data_start = . ;
|
||||
_data_start = . ;
|
||||
*(.data)
|
||||
_edata = ALIGN( 0x10 ) ;
|
||||
}
|
||||
.bss :
|
||||
{
|
||||
bss_start = . ;
|
||||
_bss_start = . ;
|
||||
*(.bss)
|
||||
*(COMMON)
|
||||
WorkAreaBase = . ;
|
||||
end = . ;
|
||||
_end = . ;
|
||||
__end = . ;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user