[PATCH] Add new (first) OpenRISC BSP called or1ksim.
Hesham Moustafa
heshamelmatary at gmail.com
Wed Aug 20 20:40:34 UTC 2014
On Wed, Aug 20, 2014 at 10:29 PM, Gedare Bloom <gedare at rtems.org> wrote:
> On Wed, Aug 20, 2014 at 4:06 PM, Hesham Moustafa
> <heshamelmatary at gmail.com> wrote:
>> Hi,
>>
>> On Wed, Aug 20, 2014 at 9:54 PM, Joel Sherrill
>> <joel.sherrill at oarcorp.com> wrote:
>>> Hi
>>>
>>> Thanks.
>>>
>>> I just pushed this. I did not compile it. Make sure it builds all tests
>> What about the nop instruction? Should I add a conditional macros in
>> the init.c file, or create a new macro to mirror l.nop to nop for or1k
>> targets?
> It might be nice to suggest this for gcc/gas. You can use a
> conditional like Joel suggested, otherwise.
>
>>> for
>>> you just like it did before.
>>>
>> Thanks for pushing the code.
>>> How is the test pass/fail rate?
>>>
>> How can I get this? Is there a script for running all tests or
>> something similar?
> You may be interested to investigate adding support for or1ksim to
> rtems-tester: http://git.rtems.org/rtems-tools/tree/tester
>
> We left it off the original plan due to time constraints, but it would
> be nice for maintenance of the port.
>
I will see what I can do.
>>> Did you get ticker running?
>>>
>> Ticker is running but there are still two issues. The first is with
>> the very long delay of context switches. The second is about the
> What is the fidelity of the clock in ork1sim? How accurate wrt wall
> time is it? Do you need to use any prescalar to get an accurate time?
> Using the FAST_IDLE mode can alleviate the timing problems.
>
The time is getting very quickly when I replace
"status = rtems_task_wake_after(task_index * 5 *
rtems_clock_get_ticks_per_second());"
with
"status = rtems_task_wake_after(task_index * 5);"
Though it goes very quickly. That was how I make sure ticker is
working and do not wait too much as for the case now.
When I used FAST_IDLE mode, I did not get output from ticker.exe. I
have configured or1ksim to run at 100MHz (10 ns) from sim.cfg and
added a definition for that at or1ksim.h which is used from uart.h
driver.
>> printf and the possibility of broken context switch (which I debug
>> currently). To get around the printf problem, I was adding an entry in
>> buffer_test_io.h for or1k target to force tests to use printk. Gedare
>> suggested not to push such a solution.
> Yes, you should not hide your bug in this way. Figure out why printf
> is failing. It almost certainly is corruption of the registers during
> either isr or context switch handling.
>
Yes, I am trying to debug with Sebastian's solution you provided.
Hopefully I'd find the bug soon.
Thanks,
Hesham
> -Gedare
>
>>> On 8/20/2014 12:23 PM, Hesham ALMatary wrote:
>>>> This BSP is intended to run on or1ksim (the main OpenRISC emulator).
>>>> Fixed version according to Joel comments from the mailing list.
>>>> ---
>>>> c/src/aclocal/rtems-cpu-subdirs.m4 | 1 +
>>>> c/src/lib/libbsp/or1k/Makefile.am | 10 +
>>>> c/src/lib/libbsp/or1k/acinclude.m4 | 10 +
>>>> c/src/lib/libbsp/or1k/configure.ac | 19 ++
>>>> c/src/lib/libbsp/or1k/or1ksim/Makefile.am | 109 ++++++++
>>>> c/src/lib/libbsp/or1k/or1ksim/README | 17 ++
>>>> c/src/lib/libbsp/or1k/or1ksim/bsp_specs | 12 +
>>>> c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c | 104 +++++++
>>>> c/src/lib/libbsp/or1k/or1ksim/configure.ac | 30 ++
>>>> .../libbsp/or1k/or1ksim/console/console-config.c | 58 ++++
>>>> c/src/lib/libbsp/or1k/or1ksim/console/uart.c | 144 ++++++++++
>>>> c/src/lib/libbsp/or1k/or1ksim/include/bsp.h | 47 ++++
>>>> c/src/lib/libbsp/or1k/or1ksim/include/irq.h | 45 +++
>>>> c/src/lib/libbsp/or1k/or1ksim/include/or1ksim.h | 118 ++++++++
>>>> c/src/lib/libbsp/or1k/or1ksim/include/uart.h | 42 +++
>>>> c/src/lib/libbsp/or1k/or1ksim/irq/irq.c | 42 +++
>>>> .../or1k/or1ksim/make/custom/or1k_or1ksim.cfg | 7 +
>>>> c/src/lib/libbsp/or1k/or1ksim/preinstall.am | 115 ++++++++
>>>> c/src/lib/libbsp/or1k/or1ksim/start/start.S | 182 ++++++++++++
>>>> c/src/lib/libbsp/or1k/or1ksim/startup/linkcmds | 41 +++
>>>> c/src/lib/libbsp/or1k/or1ksim/timer/timer.c | 64 +++++
>>>> c/src/lib/libbsp/or1k/preinstall.am | 7 +
>>>> .../libbsp/or1k/shared/include/linker-symbols.h | 79 ++++++
>>>> c/src/lib/libbsp/or1k/shared/startup/linkcmds.base | 310 +++++++++++++++++++++
>>>> 24 files changed, 1613 insertions(+)
>>>> create mode 100644 c/src/lib/libbsp/or1k/Makefile.am
>>>> create mode 100644 c/src/lib/libbsp/or1k/acinclude.m4
>>>> create mode 100644 c/src/lib/libbsp/or1k/configure.ac
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/Makefile.am
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/README
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/bsp_specs
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/configure.ac
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/console/console-config.c
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/console/uart.c
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/bsp.h
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/irq.h
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/or1ksim.h
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/uart.h
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/irq/irq.c
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/make/custom/or1k_or1ksim.cfg
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/preinstall.am
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/start/start.S
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/startup/linkcmds
>>>> create mode 100644 c/src/lib/libbsp/or1k/or1ksim/timer/timer.c
>>>> create mode 100644 c/src/lib/libbsp/or1k/preinstall.am
>>>> create mode 100644 c/src/lib/libbsp/or1k/shared/include/linker-symbols.h
>>>> create mode 100644 c/src/lib/libbsp/or1k/shared/startup/linkcmds.base
>>>>
>>>> diff --git a/c/src/aclocal/rtems-cpu-subdirs.m4 b/c/src/aclocal/rtems-cpu-subdirs.m4
>>>> index c5a4a19..9593d34 100644
>>>> --- a/c/src/aclocal/rtems-cpu-subdirs.m4
>>>> +++ b/c/src/aclocal/rtems-cpu-subdirs.m4
>>>> @@ -23,6 +23,7 @@ _RTEMS_CPU_SUBDIR([mips],[$1]);;
>>>> _RTEMS_CPU_SUBDIR([moxie],[$1]);;
>>>> _RTEMS_CPU_SUBDIR([nios2],[$1]);;
>>>> _RTEMS_CPU_SUBDIR([no_cpu],[$1]);;
>>>> +_RTEMS_CPU_SUBDIR([or1k],[$1]);;
>>>> _RTEMS_CPU_SUBDIR([powerpc],[$1]);;
>>>> _RTEMS_CPU_SUBDIR([sh],[$1]);;
>>>> _RTEMS_CPU_SUBDIR([sparc],[$1]);;
>>>> diff --git a/c/src/lib/libbsp/or1k/Makefile.am b/c/src/lib/libbsp/or1k/Makefile.am
>>>> new file mode 100644
>>>> index 0000000..0ce20e6
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/Makefile.am
>>>> @@ -0,0 +1,10 @@
>>>> +ACLOCAL_AMFLAGS = -I ../../../aclocal
>>>> +
>>>> +## Descend into the @RTEMS_BSP_FAMILY@ directory
>>>> +## Currently, the shared directory is not explicitly
>>>> +## added but it is present in the source tree.
>>>> +SUBDIRS = @RTEMS_BSP_FAMILY@
>>>> +
>>>> +include $(srcdir)/preinstall.am
>>>> +include $(top_srcdir)/../../../automake/subdirs.am
>>>> +include $(top_srcdir)/../../../automake/local.am
>>>> diff --git a/c/src/lib/libbsp/or1k/acinclude.m4 b/c/src/lib/libbsp/or1k/acinclude.m4
>>>> new file mode 100644
>>>> index 0000000..c593670
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/acinclude.m4
>>>> @@ -0,0 +1,10 @@
>>>> +# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY)
>>>> +AC_DEFUN([RTEMS_CHECK_BSPDIR],
>>>> +[
>>>> + case "$1" in
>>>> + or1ksim )
>>>> + AC_CONFIG_SUBDIRS([or1ksim]);;
>>>> + *)
>>>> + AC_MSG_ERROR([Invalid BSP]);;
>>>> + esac
>>>> +])
>>>> diff --git a/c/src/lib/libbsp/or1k/configure.ac b/c/src/lib/libbsp/or1k/configure.ac
>>>> new file mode 100644
>>>> index 0000000..96bba16
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/configure.ac
>>>> @@ -0,0 +1,19 @@
>>>> +# Process this file with autoconf to produce a configure script.
>>>> +
>>>> +AC_PREREQ([2.69])
>>>> +AC_INIT([rtems-c-src-lib-libbsp-or1k],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
>>>> +AC_CONFIG_SRCDIR([or1ksim])
>>>> +RTEMS_TOP(../../../../..)
>>>> +
>>>> +RTEMS_CANONICAL_TARGET_CPU
>>>> +AM_INIT_AUTOMAKE([no-define foreign 1.12.2])
>>>> +AM_MAINTAINER_MODE
>>>> +
>>>> +RTEMS_ENV_RTEMSBSP
>>>> +RTEMS_PROJECT_ROOT
>>>> +
>>>> +RTEMS_CHECK_BSPDIR([$RTEMS_BSP_FAMILY])
>>>> +
>>>> +# Explicitly list all Makefiles here
>>>> +AC_CONFIG_FILES([Makefile])
>>>> +AC_OUTPUT
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/Makefile.am b/c/src/lib/libbsp/or1k/or1ksim/Makefile.am
>>>> new file mode 100644
>>>> index 0000000..d5eb10c
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/Makefile.am
>>>> @@ -0,0 +1,109 @@
>>>> +#
>>>> +# @file
>>>> +#
>>>> +# @brief Makefile of LibBSP for the or1ksim BSP.
>>>> +#
>>>> +
>>>> +ACLOCAL_AMFLAGS = -I ../../../../aclocal
>>>> +
>>>> +include $(top_srcdir)/../../../../automake/compile.am
>>>> +
>>>> +include_bspdir = $(includedir)/bsp
>>>> +#include_libcpudir = $(includedir)/libcpu
>>>> +
>>>> +dist_project_lib_DATA = bsp_specs
>>>> +
>>>> +###############################################################################
>>>> +# Header #
>>>> +###############################################################################
>>>> +
>>>> +include_bsp_HEADERS =
>>>> +include_HEADERS = include/bsp.h
>>>> +
>>>> +nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
>>>> +
>>>> +include_bsp_HEADERS += ../shared/include/linker-symbols.h
>>>> +include_bsp_HEADERS += ../../../libbsp/shared/include/mm.h
>>>> +include_bsp_HEADERS += ../../shared/include/utility.h
>>>> +include_bsp_HEADERS += ../../shared/include/irq-generic.h
>>>> +include_bsp_HEADERS += ../../shared/include/irq-info.h
>>>> +include_bsp_HEADERS += ../../shared/include/stackalloc.h
>>>> +include_bsp_HEADERS += ../../shared/include/uart-output-char.h
>>>> +include_bsp_HEADERS += ../../shared/tod.h
>>>> +include_bsp_HEADERS += ../../shared/include/tm27.h
>>>> +include_bsp_HEADERS += include/irq.h
>>>> +include_bsp_HEADERS += include/uart.h
>>>> +include_bsp_HEADERS += include/or1ksim.h
>>>> +
>>>> +nodist_include_HEADERS = ../../shared/include/coverhd.h \
>>>> + include/bspopts.h
>>>> +
>>>> +###############################################################################
>>>> +# Data #
>>>> +###############################################################################
>>>> +
>>>> +noinst_LIBRARIES = libbspstart.a
>>>> +
>>>> +libbspstart_a_SOURCES = start/start.S
>>>> +
>>>> +project_lib_DATA = start.$(OBJEXT)
>>>> +
>>>> +project_lib_DATA += startup/linkcmds
>>>> +project_lib_DATA += ../shared/startup/linkcmds.base
>>>> +
>>>> +###############################################################################
>>>> +# LibBSP #
>>>> +###############################################################################
>>>> +
>>>> +noinst_LIBRARIES += libbsp.a
>>>> +
>>>> +libbsp_a_SOURCES =
>>>> +libbsp_a_CPPFLAGS =
>>>> +libbsp_a_LIBADD =
>>>> +
>>>> +# Startup
>>>> +libbsp_a_SOURCES += ../../shared/bspstart.c
>>>> +libbsp_a_SOURCES += ../../shared/bspreset.c
>>>> +
>>>> +# Shared
>>>> +libbsp_a_SOURCES += ../../shared/bootcard.c
>>>> +libbsp_a_SOURCES += ../../shared/bspclean.c
>>>> +libbsp_a_SOURCES += ../../shared/bspgetworkarea.c
>>>> +libbsp_a_SOURCES += ../../shared/bsplibc.c
>>>> +libbsp_a_SOURCES += ../../shared/bsppost.c
>>>> +libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
>>>> +libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
>>>> +libbsp_a_SOURCES += ../../shared/cpucounterread.c
>>>> +libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
>>>> +libbsp_a_SOURCES += ../../shared/gnatinstallhandler.c
>>>> +libbsp_a_SOURCES += ../../shared/sbrk.c
>>>> +libbsp_a_SOURCES += ../../shared/src/stackalloc.c
>>>> +
>>>> +# Console
>>>> +libbsp_a_SOURCES += ../../shared/console.c
>>>> +libbsp_a_SOURCES += ../../shared/console_control.c
>>>> +libbsp_a_SOURCES += ../../shared/console_read.c
>>>> +libbsp_a_SOURCES += ../../shared/console_select.c
>>>> +libbsp_a_SOURCES += ../../shared/console_write.c
>>>> +libbsp_a_SOURCES += console/console-config.c
>>>> +libbsp_a_SOURCES += console/uart.c
>>>> +
>>>> +# Timer
>>>> +libbsp_a_SOURCES += timer/timer.c
>>>> +
>>>> +# clock
>>>> +libbsp_a_SOURCES += clock/clockdrv.c ../../../shared/clockdrv_shell.h
>>>> +
>>>> +# IRQ
>>>> +libbsp_a_SOURCES += ../../shared/src/irq-default-handler.c
>>>> +libbsp_a_SOURCES += ../../shared/src/irq-generic.c
>>>> +libbsp_a_SOURCES += ../../shared/src/irq-info.c
>>>> +libbsp_a_SOURCES += irq/irq.c
>>>> +###############################################################################
>>>> +# Special Rules #
>>>> +###############################################################################
>>>> +
>>>> +DISTCLEANFILES = include/bspopts.h
>>>> +
>>>> +include $(srcdir)/preinstall.am
>>>> +include $(top_srcdir)/../../../../automake/local.am
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/README b/c/src/lib/libbsp/or1k/or1ksim/README
>>>> new file mode 100644
>>>> index 0000000..99d1edf
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/README
>>>> @@ -0,0 +1,17 @@
>>>> +This BSP should run only on or1ksim: the main simulator for or1k architecture.
>>>> +or1ksim should be used for testing purposes.
>>>> +
>>>> +svn co http://opencores.org/ocsvn/openrisc/openrisc/trunk/or1ksim
>>>> +cd or1ksim
>>>> +mkdir builddir_or1ksim
>>>> +cd builddir_or1ksim
>>>> +../configure --target=or32-elf --prefix=/opt/or1ksim
>>>> +make all
>>>> +make install
>>>> +export PATH=/opt/or1ksim/bin:$PATH
>>>> +
>>>> +Configuration file "sim.cfg" should be provided for complex board
>>>> +configurations at the current directory (which you run or1ksim from) or at
>>>> +~/.or1k/
>>>> +
>>>> +sim -f sim.cfg hello.exe
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/bsp_specs b/c/src/lib/libbsp/or1k/or1ksim/bsp_specs
>>>> new file mode 100644
>>>> index 0000000..446dafa
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/bsp_specs
>>>> @@ -0,0 +1,12 @@
>>>> +%rename endfile old_endfile
>>>> +%rename startfile old_startfile
>>>> +%rename link old_link
>>>> +
>>>> +*startfile:
>>>> +%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: \
>>>> +%{!qrtems_debug: start.o%s} \
>>>> +%{qrtems_debug: start_g.o%s}}}
>>>> +
>>>> +*link:
>>>> +%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e _start}
>>>> +
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c b/c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c
>>>> new file mode 100644
>>>> index 0000000..926e2b0
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c
>>>> @@ -0,0 +1,104 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup bsp_clock
>>>> + *
>>>> + * @brief or1ksim clock support.
>>>> + */
>>>> +
>>>> +/*
>>>> + * or1ksim Clock driver
>>>> + *
>>>> + * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +#include <rtems.h>
>>>> +#include <bsp.h>
>>>> +#include <bsp/irq.h>
>>>> +#include <bsp/or1ksim.h>
>>>> +#include <rtems/score/cpu.h>
>>>> +#include <rtems/score/or1k-utility.h>
>>>> +
>>>> +/* The number of clock cycles before generating a tick timer interrupt. */
>>>> +#define TTMR_NUM_OF_CLOCK_TICKS_INTERRUPT 0xFFED9
>>>> +#define OR1KSIM_CLOCK_CYCLE_TIME_NANOSECONDS 10
>>>> +
>>>> +/* This prototype is added here to Avoid warnings */
>>>> +void Clock_isr(void *arg);
>>>> +
>>>> +static void or1ksim_clock_at_tick(void)
>>>> +{
>>>> + uint32_t TTMR;
>>>> +
>>>> + /* For TTMR register,
>>>> + * The least significant 28 bits are the number of clock cycles
>>>> + * before generating a tick timer interrupt. While the most
>>>> + * significant 4 bits are used for mode configuration, tick timer
>>>> + * interrupt enable and pending interrupts status.
>>>> + */
>>>> + TTMR = (CPU_OR1K_SPR_TTMR_MODE_RESTART | CPU_OR1K_SPR_TTMR_IE |
>>>> + (TTMR_NUM_OF_CLOCK_TICKS_INTERRUPT & CPU_OR1K_SPR_TTMR_TP_MASK)
>>>> + ) & ~(CPU_OR1K_SPR_TTMR_IP);
>>>> +
>>>> + _OR1K_mtspr(CPU_OR1K_SPR_TTMR, TTMR);
>>>> + _OR1K_mtspr(CPU_OR1K_SPR_TTCR, 0);
>>>> +}
>>>> +
>>>> +static void or1ksim_clock_handler_install(proc_ptr new_isr, proc_ptr old_isr)
>>>> +{
>>>> + rtems_status_code sc = RTEMS_SUCCESSFUL;
>>>> + old_isr = NULL;
>>>> + _CPU_ISR_install_vector(OR1K_EXCEPTION_TICK_TIMER,
>>>> + new_isr,
>>>> + old_isr);
>>>> +
>>>> + if (sc != RTEMS_SUCCESSFUL) {
>>>> + rtems_fatal_error_occurred(0xdeadbeef);
>>>> + }
>>>> +}
>>>> +
>>>> +static void or1ksim_clock_initialize(void)
>>>> +{
>>>> + uint32_t sr;
>>>> +
>>>> + or1ksim_clock_at_tick();
>>>> +
>>>> + /* Enable tick timer */
>>>> + sr = _OR1K_mfspr(CPU_OR1K_SPR_SR);
>>>> + sr |= CPU_OR1K_SPR_SR_TEE;
>>>> + _OR1K_mtspr(CPU_OR1K_SPR_SR, sr);
>>>> +}
>>>> +
>>>> + static void or1ksim_clock_cleanup(void)
>>>> +{
>>>> +}
>>>> +
>>>> +/*
>>>> + * Return the nanoseconds since last tick
>>>> + */
>>>> +static uint32_t or1ksim_clock_nanoseconds_since_last_tick(void)
>>>> +{
>>>> + return
>>>> + TTMR_NUM_OF_CLOCK_TICKS_INTERRUPT * OR1KSIM_CLOCK_CYCLE_TIME_NANOSECONDS;
>>>> +}
>>>> +
>>>> +#define Clock_driver_support_at_tick() or1ksim_clock_at_tick()
>>>> +
>>>> +#define Clock_driver_support_initialize_hardware() or1ksim_clock_initialize()
>>>> +
>>>> +#define Clock_driver_support_install_isr(isr, old_isr) \
>>>> + do { \
>>>> + or1ksim_clock_handler_install(isr, old_isr); \
>>>> + old_isr = NULL; \
>>>> + } while (0)
>>>> +
>>>> +#define Clock_driver_support_shutdown_hardware() or1ksim_clock_cleanup()
>>>> +
>>>> +#define Clock_driver_nanoseconds_since_last_tick \
>>>> + or1ksim_clock_nanoseconds_since_last_tick
>>>> +
>>>> +#include "../../../shared/clockdrv_shell.h"
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/configure.ac b/c/src/lib/libbsp/or1k/or1ksim/configure.ac
>>>> new file mode 100644
>>>> index 0000000..8aff7e3
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/configure.ac
>>>> @@ -0,0 +1,30 @@
>>>> +#
>>>> +# @file
>>>> +#
>>>> +# @brief Configure script of LibBSP for or1ksim BSP.
>>>> +#
>>>> +
>>>> +AC_PREREQ(2.69)
>>>> +AC_INIT([rtems-c-src-lib-libbsp-or1k-or1ksim],[_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.12.2])
>>>> +RTEMS_BSP_CONFIGURE
>>>> +
>>>> +RTEMS_BSPOPTS_SET([BSP_START_RESET_VECTOR],[*],[])
>>>> +RTEMS_BSPOPTS_HELP([BSP_START_RESET_VECTOR],[reset vector address for BSP start])
>>>> +
>>>> +RTEMS_BSPOPTS_SET([BSP_OR1K_OR1KSIM_PERIPHCLK],[*],[100000000U])
>>>> +RTEMS_BSPOPTS_HELP([BSP_OR1K_OR1KSIM_PERIPHCLK],[or1ksim PERIPHCLK clock frequency in Hz])
>>>> +
>>>> +RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
>>>> +RTEMS_CANONICALIZE_TOOLS
>>>> +RTEMS_PROG_CCAS
>>>> +
>>>> +RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
>>>> +RTEMS_BSP_LINKCMDS
>>>> +
>>>> +AC_CONFIG_FILES([Makefile])
>>>> +AC_OUTPUT
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/console/console-config.c b/c/src/lib/libbsp/or1k/or1ksim/console/console-config.c
>>>> new file mode 100644
>>>> index 0000000..9853f20
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/console/console-config.c
>>>> @@ -0,0 +1,58 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup or1ksim_uart
>>>> + *
>>>> + * @brief Console Configuration.
>>>> + */
>>>> +
>>>> +/*
>>>> + * Copyright (c) 2014 Hesham ALMatary
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +#include <rtems/bspIo.h>
>>>> +
>>>> +#include <libchip/serial.h>
>>>> +
>>>> +#include <bspopts.h>
>>>> +#include <bsp/uart.h>
>>>> +#include <bsp/or1ksim.h>
>>>> +
>>>> +console_tbl Console_Configuration_Ports [] = {
>>>> + {
>>>> + .sDeviceName = "/dev/ttyS0",
>>>> + .deviceType = SERIAL_CUSTOM,
>>>> + .pDeviceFns = &or1ksim_uart_fns,
>>>> + .deviceProbe = NULL,
>>>> + .pDeviceFlow = NULL,
>>>> + .ulCtrlPort1 = OR1KSIM_BSP_UART_BASE,
>>>> + .ulCtrlPort2 = 0,
>>>> + .ulClock = OR1KSIM_UART_DEFAULT_BAUD,
>>>> + .ulIntVector = OR1KSIM_BSP_UART_IRQ
>>>> + }
>>>> +};
>>>> +
>>>> +#define PORT_COUNT \
>>>> + (sizeof(Console_Configuration_Ports) \
>>>> + / sizeof(Console_Configuration_Ports [0]))
>>>> +
>>>> +unsigned long Console_Configuration_Count = PORT_COUNT;
>>>> +
>>>> +static void output_char(char c)
>>>> +{
>>>> + const console_fns *con =
>>>> + Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
>>>> +
>>>> + if (c == '\n') {
>>>> + con->deviceWritePolled((int) Console_Port_Minor, '\r');
>>>> + }
>>>> + con->deviceWritePolled((int) Console_Port_Minor, c);
>>>> +}
>>>> +
>>>> +BSP_output_char_function_type BSP_output_char = output_char;
>>>> +
>>>> +BSP_polling_getchar_function_type BSP_poll_char = NULL;
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/console/uart.c b/c/src/lib/libbsp/or1k/or1ksim/console/uart.c
>>>> new file mode 100644
>>>> index 0000000..f1cfa09
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/console/uart.c
>>>> @@ -0,0 +1,144 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup or1ksim_uart
>>>> + *
>>>> + * @brief UART support.
>>>> + */
>>>> +
>>>> +/*
>>>> + * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +#include <libchip/sersupp.h>
>>>> +#include <bsp/or1ksim.h>
>>>> +#include <bsp.h>
>>>> +#include <bsp/irq.h>
>>>> +#include <bsp/uart.h>
>>>> +#include <rtems/score/isr.h>
>>>> +
>>>> +static rtems_vector_number uart_get_irq_number(const console_tbl *ct)
>>>> +{
>>>> + return ct->ulIntVector;
>>>> +}
>>>> +
>>>> +static uint32_t uart_get_baud(const console_tbl *ct)
>>>> +{
>>>> + return ct->ulClock;
>>>> +}
>>>> +
>>>> +static void uart_set_baud(int baud)
>>>> +{
>>>> + int divisor = (OR1KSIM_BSP_CLOCK_FREQ) / (16 * baud);
>>>> + OR1KSIM_REG(OR1KSIM_BSP_UART_REG_LINE_CTRL) |=
>>>> + OR1KSIM_BSP_UART_REG_LINE_CTRL_DLAB;
>>>> +
>>>> + OR1KSIM_REG(OR1KSIM_BSP_UART_REG_DEV_LATCH_LOW) = divisor & 0xff;
>>>> +
>>>> + OR1KSIM_REG(OR1KSIM_BSP_UART_REG_DEV_LATCH_HIGH) =
>>>> + (divisor >> 8) & 0xff;
>>>> +
>>>> + OR1KSIM_REG(OR1KSIM_BSP_UART_REG_LINE_CTRL) &=
>>>> + ~(OR1KSIM_BSP_UART_REG_LINE_CTRL_DLAB);
>>>> +}
>>>> +
>>>> +static void uart_initialize(int minor)
>>>> +{
>>>> + /* Disable all interrupts */
>>>> + OR1KSIM_REG(OR1KSIM_BSP_UART_REG_INT_ENABLE) = 0x00;
>>>> +
>>>> + /* Reset receiver and transmitter */
>>>> + OR1KSIM_REG(OR1KSIM_BSP_UART_REG_FIFO_CTRL) =
>>>> + OR1KSIM_BSP_UART_REG_FIFO_CTRL_ENABLE_FIFO |
>>>> + OR1KSIM_BSP_UART_REG_FIFO_CTRL_CLEAR_RCVR |
>>>> + OR1KSIM_BSP_UART_REG_FIFO_CTRL_CLEAR_XMIT |
>>>> + OR1KSIM_BSP_UART_REG_FIFO_CTRL_TRIGGER_14;
>>>> +
>>>> + /* Set data pattern configuration */
>>>> + OR1KSIM_REG(OR1KSIM_BSP_UART_REG_LINE_CTRL) =
>>>> + OR1KSIM_BSP_UART_REG_LINE_CTRL_WLEN8 &
>>>> + (OR1KSIM_BSP_UART_REG_LINE_CTRL_STOP |
>>>> + OR1KSIM_BSP_UART_REG_LINE_CTRL_PARITY);
>>>> +
>>>> + /* Set baud rate */
>>>> + uart_set_baud(OR1KSIM_UART_DEFAULT_BAUD);
>>>> +}
>>>> +
>>>> +static int uart_first_open(int major, int minor, void *arg)
>>>> +{
>>>> + rtems_libio_open_close_args_t *oc = (rtems_libio_open_close_args_t *) arg;
>>>> + struct rtems_termios_tty *tty = (struct rtems_termios_tty *) oc->iop->data1;
>>>> + const console_tbl *ct = Console_Port_Tbl [minor];
>>>> + console_data *cd = &Console_Port_Data [minor];
>>>> +
>>>> + cd->termios_data = tty;
>>>> + rtems_termios_set_initial_baud(tty, ct->ulClock);
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static int uart_last_close(int major, int minor, void *arg)
>>>> +{
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static int uart_read_polled(int minor)
>>>> +{
>>>> + return -1;
>>>> +}
>>>> +
>>>> +static void uart_write_polled(int minor, char c)
>>>> +{
>>>> + unsigned char lsr;
>>>> + const uint32_t transmit_finished =
>>>> + (OR1KSIM_BSP_UART_REG_LINE_STATUS_TEMT |
>>>> + OR1KSIM_BSP_UART_REG_LINE_STATUS_THRE);
>>>> +
>>>> + /* Wait until there is no pending data in the transmitter FIFO (empty) */
>>>> + do {
>>>> + lsr = OR1KSIM_REG(OR1KSIM_BSP_UART_REG_LINE_STATUS);
>>>> + } while (!(lsr & OR1KSIM_BSP_UART_REG_LINE_STATUS_THRE));
>>>> +
>>>> + OR1KSIM_REG(OR1KSIM_BSP_UART_REG_TX) = c;
>>>> +
>>>> + /* Wait until trasmit data is finished */
>>>> + do {
>>>> + lsr = OR1KSIM_REG(OR1KSIM_BSP_UART_REG_LINE_STATUS);
>>>> + } while ( (lsr & transmit_finished) != transmit_finished );
>>>> +}
>>>> +
>>>> +static ssize_t uart_write_support_polled(
>>>> + int minor,
>>>> + const char *s,
>>>> + size_t n
>>>> +)
>>>> +{
>>>> + ssize_t i = 0;
>>>> +
>>>> + for (i = 0; i < n; ++i){
>>>> + uart_write_polled(minor, s [i]);
>>>> + }
>>>> +
>>>> + return n;
>>>> +}
>>>> +
>>>> +static int uart_set_attributes(int minor, const struct termios *term)
>>>> +{
>>>> + return -1;
>>>> +}
>>>> +
>>>> +const console_fns or1ksim_uart_fns = {
>>>> + .deviceProbe = libchip_serial_default_probe,
>>>> + .deviceFirstOpen = uart_first_open,
>>>> + .deviceLastClose = uart_last_close,
>>>> + .deviceRead = uart_read_polled,
>>>> + .deviceWrite = uart_write_support_polled,
>>>> + .deviceInitialize = uart_initialize,
>>>> + .deviceWritePolled = uart_write_polled,
>>>> + .deviceSetAttributes = uart_set_attributes,
>>>> + .deviceOutputUsesInterrupts = false
>>>> +};
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/include/bsp.h b/c/src/lib/libbsp/or1k/or1ksim/include/bsp.h
>>>> new file mode 100644
>>>> index 0000000..502e4d9
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/include/bsp.h
>>>> @@ -0,0 +1,47 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup or1k_or1ksim
>>>> + *
>>>> + * @brief Global BSP definitions.
>>>> + */
>>>> +
>>>> +/*
>>>> + * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +#ifndef LIBBSP_OR1K_OR1KSIM_H
>>>> +#define LIBBSP_OR1K_OR1KSIM_H
>>>> +
>>>> +#include <bspopts.h>
>>>> +#include <rtems.h>
>>>> +#include <rtems/console.h>
>>>> +#include <rtems/clockdrv.h>
>>>> +#include <bsp/or1ksim.h>
>>>> +
>>>> +#include <bsp/default-initial-extension.h>
>>>> +
>>>> +#ifdef __cplusplus
>>>> +extern "C" {
>>>> +#endif /* __cplusplus */
>>>> +
>>>> +#define BSP_FEATURE_IRQ_EXTENSION
>>>> +
>>>> +#ifdef __cplusplus
>>>> +}
>>>> +#endif /* __cplusplus */
>>>> +
>>>> +#endif /* LIBBSP_OR1K_OR1KSIM_H */
>>>> +
>>>> +/**
>>>> + * @defgroup or1k_or1ksim support
>>>> + *
>>>> + * @ingroup bsp_or1k
>>>> + *
>>>> + * @brief or1ksim support package
>>>> + *
>>>> + */
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/include/irq.h b/c/src/lib/libbsp/or1k/or1ksim/include/irq.h
>>>> new file mode 100644
>>>> index 0000000..be669d8
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/include/irq.h
>>>> @@ -0,0 +1,45 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup or1ksim_interrupt
>>>> + *
>>>> + * @brief Interrupt definitions.
>>>> + */
>>>> +
>>>> +/**
>>>> + * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +#ifndef LIBBSP_OR1K_OR1KSIM_IRQ_H
>>>> +#define LIBBSP_OR1K_OR1KSIM_IRQ_H
>>>> +
>>>> +#ifndef ASM
>>>> +
>>>> +#include <rtems.h>
>>>> +#include <rtems/irq.h>
>>>> +#include <rtems/irq-extension.h>
>>>> +
>>>> +#define BSP_INTERRUPT_VECTOR_MIN 0x100
>>>> +#define BSP_INTERRUPT_VECTOR_MAX 0x1F00
>>>> +
>>>> +/* Interrupt Identification Register */
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ID_MSI (0x00)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ID_NO_INT (0x01)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ID_THRI (0x02)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ID_RDI (0x04)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ID_ID (0x06)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ID_RLSI (0x06)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ID_TOI (0x0c)
>>>> +
>>>> +/* Interrupt Enable Register */
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ENABLE_RDI (0x01)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ENABLE_THRI (0x02)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ENABLE_RLSI (0x04)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ENABLE_MSI (0x08)
>>>> +
>>>> +#endif /* ASM */
>>>> +#endif /* LIBBSP_OR1K_OR1KSIM_IRQ_H */
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/include/or1ksim.h b/c/src/lib/libbsp/or1k/or1ksim/include/or1ksim.h
>>>> new file mode 100644
>>>> index 0000000..8279566
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/include/or1ksim.h
>>>> @@ -0,0 +1,118 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup or1ksim_reg
>>>> + *
>>>> + * @brief Register definitions.
>>>> + */
>>>> +
>>>> +/*
>>>> + * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +#ifndef LIBBSP_OR1K_OR1KSIM_H
>>>> +#define LIBBSP_OR1K_OR1KSIM_H
>>>> +
>>>> +#include <stdint.h>
>>>> +
>>>> +/**
>>>> + * @defgroup or1ksim_reg Register Definitions
>>>> + *
>>>> + * @ingroup or1k_or1ksim
>>>> + *
>>>> + * @brief Register Definitions
>>>> + *
>>>> + * @{
>>>> + */
>>>> +
>>>> +/**
>>>> + * @name Register Macros
>>>> + *
>>>> + * @{
>>>> + */
>>>> +
>>>> + #define OR1KSIM_REG(x) (*((volatile char *) (x)))
>>>> + #define OR1KSIM_BIT(n) (1 << (n))
>>>> +
>>>> +/** @} */
>>>> +
>>>> +/**
>>>> + * @name Internal OR1K UART Registers
>>>> + *
>>>> + * @{
>>>> + */
>>>> +#define OR1KSIM_BSP_CLOCK_FREQ 100000000UL
>>>> +#define OR1KSIM_BSP_UART_BASE 0x90000000
>>>> +
>>>> +#define OR1KSIM_BSP_UART_REG_TX (OR1KSIM_BSP_UART_BASE+0)
>>>> +#define OR1KSIM_BSP_UART_REG_RX (OR1KSIM_BSP_UART_BASE+0)
>>>> +#define OR1KSIM_BSP_UART_REG_DEV_LATCH_LOW (OR1KSIM_BSP_UART_BASE+1)
>>>> +#define OR1KSIM_BSP_UART_REG_DEV_LATCH_HIGH (OR1KSIM_BSP_UART_BASE+1)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ENABLE (OR1KSIM_BSP_UART_BASE+2)
>>>> +#define OR1KSIM_BSP_UART_REG_INT_ID (OR1KSIM_BSP_UART_BASE+2)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL (OR1KSIM_BSP_UART_BASE+2)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL (OR1KSIM_BSP_UART_BASE+3)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_CTRL (OR1KSIM_BSP_UART_BASE+4)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_STATUS (OR1KSIM_BSP_UART_BASE+5)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS (OR1KSIM_BSP_UART_BASE+6)
>>>> +#define OR1KSIM_BSP_UART_REG_SCRATCH (OR1KSIM_BSP_UART_BASE+7)
>>>> +
>>>> +/* FIFO Control Register */
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_TRIGGER_1 (0x00)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_ENABLE_FIFO (0x01)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_CLEAR_RCVR (0x02)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_CLEAR_XMIT (0x03)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_DMA_SELECT (0x08)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_TRIGGER_4 (0x40)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_TRIGGER_8 (0x80)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_TRIGGER_14 (0xC0)
>>>> +#define OR1KSIM_BSP_UART_REG_FIFO_CTRL_TRIGGER_MASK (0xC0)
>>>> +
>>>> +/* Line Control Register */
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_WLEN5 (0x00)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_WLEN6 (0x01)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_WLEN7 (0x02)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_WLEN8 (0x03)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_STOP (0x04)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_PARITY (0x08)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_EPAR (0x10)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_SPAR (0x20)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_SBC (0x40)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_CTRL_DLAB (0x80)
>>>> +
>>>> +/* Line Status Register */
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_STATUS_DR (0x01)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_STATUS_OE (0x02)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_STATUS_PE (0x04)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_STATUS_FE (0x08)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_STATUS_BI (0x10)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_STATUS_THRE (0x20)
>>>> +#define OR1KSIM_BSP_UART_REG_LINE_STATUS_TEMT (0x40)
>>>> +
>>>> +/* Modem Control Register */
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_CTRL_DTR (0x01)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_CTRL_RTS (0x02)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_CTRL_OUT1 (0x04)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_CTRL_OUT2 (0x08)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_CTRL_LOOP (0x10)
>>>> +
>>>> +/* Modem Status Register */
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_DCTS (0x01)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_DDSR (0x02)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_TERI (0x04)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_DDCD (0x08)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_CTS (0x10)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_DSR (0x20)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_RI (0x40)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_DCD (0x80)
>>>> +#define OR1KSIM_BSP_UART_REG_MODEM_STATUS_ANY_DELTA (0x0F)
>>>> +
>>>> +/** @} */
>>>> +
>>>> +/** @} */
>>>> +
>>>> +#endif /* LIBBSP_OR1K_OR1KSIM_H */
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/include/uart.h b/c/src/lib/libbsp/or1k/or1ksim/include/uart.h
>>>> new file mode 100644
>>>> index 0000000..92ed203
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/include/uart.h
>>>> @@ -0,0 +1,42 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup or1ksim_uart
>>>> + *
>>>> + * @brief UART support.
>>>> + */
>>>> +
>>>> +/*
>>>> + * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +/**
>>>> + * @defgroup or1ksim_uart UART Support
>>>> + *
>>>> + * @ingroup or1k_or1ksim
>>>> + *
>>>> + * @brief Universal Asynchronous Receiver/Transmitter (UART) Support
>>>> + */
>>>> +
>>>> +#ifndef LIBBSP_OR1K_OR1KSIM_UART_H
>>>> +#define LIBBSP_OR1K_OR1KSIM_UART_H
>>>> +
>>>> +#include <libchip/serial.h>
>>>> +
>>>> +#ifdef __cplusplus
>>>> +extern "C" {
>>>> +#endif /* __cplusplus */
>>>> +
>>>> +#define OR1KSIM_UART_DEFAULT_BAUD 115200
>>>> +#define OR1KSIM_BSP_UART_IRQ 13
>>>> +extern const console_fns or1ksim_uart_fns;
>>>> +
>>>> +#ifdef __cplusplus
>>>> +}
>>>> +#endif /* __cplusplus */
>>>> +
>>>> +#endif /* LIBBSP_OR1K_OR1KSIM_UART_H */
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/irq/irq.c b/c/src/lib/libbsp/or1k/or1ksim/irq/irq.c
>>>> new file mode 100644
>>>> index 0000000..c3c4d6d
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/irq/irq.c
>>>> @@ -0,0 +1,42 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup or1k_interrupt
>>>> + *
>>>> + * @brief Interrupt support.
>>>> + */
>>>> +
>>>> +/*
>>>> + * Copyright (c) 2014 Hesham ALMatary
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE.
>>>> + */
>>>> +
>>>> +#include <bsp/irq.h>
>>>> +#include <bsp/irq-generic.h>
>>>> +
>>>> +/* Almost all of the jobs that the following functions should
>>>> + * do are implemented in cpukit
>>>> + */
>>>> +
>>>> +void bsp_interrupt_handler_default(rtems_vector_number vector)
>>>> +{
>>>> + printk("spurious interrupt: %u\n", vector);
>>>> +}
>>>> +
>>>> +rtems_status_code bsp_interrupt_facility_initialize()
>>>> +{
>>>> + return 0;
>>>> +}
>>>> +
>>>> +rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
>>>> +{
>>>> + return 0;
>>>> +}
>>>> +
>>>> +rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
>>>> +{
>>>> + return 0;
>>>> +}
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/make/custom/or1k_or1ksim.cfg b/c/src/lib/libbsp/or1k/or1ksim/make/custom/or1k_or1ksim.cfg
>>>> new file mode 100644
>>>> index 0000000..fff00ae
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/make/custom/or1k_or1ksim.cfg
>>>> @@ -0,0 +1,7 @@
>>>> +include $(RTEMS_ROOT)/make/custom/default.cfg
>>>> +
>>>> +RTEMS_CPU = or1k
>>>> +
>>>> +CPU_CFLAGS = -O2
>>>> +
>>>> +CFLAGS_OPTIMIZE_V ?= -O0 -g
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/preinstall.am b/c/src/lib/libbsp/or1k/or1ksim/preinstall.am
>>>> new file mode 100644
>>>> index 0000000..29b37a6
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/preinstall.am
>>>> @@ -0,0 +1,115 @@
>>>> +## 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)/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)/bsp/linker-symbols.h: ../shared/include/linker-symbols.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/linker-symbols.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/linker-symbols.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/mm.h: ../../../libbsp/shared/include/mm.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/mm.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/mm.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/utility.h: ../../shared/include/utility.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/utility.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/utility.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/irq-generic.h: ../../shared/include/irq-generic.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-generic.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-generic.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/irq-info.h: ../../shared/include/irq-info.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-info.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-info.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/stackalloc.h: ../../shared/include/stackalloc.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/stackalloc.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/stackalloc.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/uart-output-char.h: ../../shared/include/uart-output-char.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/uart-output-char.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/uart-output-char.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/tod.h: ../../shared/tod.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tod.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tod.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/tm27.h: ../../shared/include/tm27.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/tm27.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/tm27.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/irq.h: include/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/uart.h: include/uart.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/uart.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/uart.h
>>>> +
>>>> +$(PROJECT_INCLUDE)/bsp/or1ksim.h: include/or1ksim.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/or1ksim.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/or1ksim.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)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
>>>> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.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
>>>> +TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds
>>>> +
>>>> +$(PROJECT_LIB)/linkcmds.base: ../shared/startup/linkcmds.base $(PROJECT_LIB)/$(dirstamp)
>>>> + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.base
>>>> +TMPINSTALL_FILES += $(PROJECT_LIB)/linkcmds.base
>>>> +
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/start/start.S b/c/src/lib/libbsp/or1k/or1ksim/start/start.S
>>>> new file mode 100644
>>>> index 0000000..6942b52
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/start/start.S
>>>> @@ -0,0 +1,182 @@
>>>> +/*
>>>> + * Copyright (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +#include <bsp/linker-symbols.h>
>>>> +
>>>> +/* The following macro defines the first instructions every exception
>>>> + * should execute before jumping to its handler function from the
>>>> + * exception vector table. r3 is saved into the stack and loaded with
>>>> + * vector number before jumping to _ISR_Handler. r3 value is restored
>>>> + * back from _ISR_Handler after handling the exception and before
>>>> + * returning from interrupt.
>>>> + */
>>>> +#define EXCEPTION_SETUP(vector) \
>>>> + l.nop ;\
>>>> + l.addi r1, r1, -4 ;\
>>>> + l.sw 0(r1), r3; \
>>>> + l.addi r3, r0, vector; \
>>>> + l.j _ISR_Handler; \
>>>> + l.nop
>>>> +
>>>> + .extern bsp_start
>>>> + .extern boot_card
>>>> + .extern bsp_section_bss_begin
>>>> + .extern bsp_section_bss_end
>>>> +
>>>> + .extern bsp_start_vector_table_end
>>>> + .extern bsp_start_vector_table_size
>>>> + .extern bsp_vector_table_size
>>>> + .extern bsp_section_stack_begin
>>>> +
>>>> + .extern exception_frame_save
>>>> + .extern _OR1K_Exception_Process
>>>> + .extern _OR1K_Exception_default
>>>> + .extern rtems_clock_tick
>>>> + .extern _exit
>>>> + .extern printk
>>>> + .extern bsp_interrupt_handler_default
>>>> +
>>>> + /* Global symbols */
>>>> + .global _start
>>>> + .global bsp_start_vector_table_begin
>>>> +
>>>> +/* Popualte HW vector table */
>>>> +
>>>> +.section .vector, "ax"
>>>> +
>>>> +.org 0x100
>>>> +_reset:
>>>> + l.j _start
>>>> + l.nop
>>>> +
>>>> +.org 0x200
>>>> +_buserr:
>>>> + EXCEPTION_SETUP(2)
>>>> +
>>>> +.org 0x300
>>>> +_dPageFault:
>>>> + EXCEPTION_SETUP(3)
>>>> +
>>>> +.org 0x400
>>>> +_iPageFaule:
>>>> + EXCEPTION_SETUP(4)
>>>> +
>>>> +.org 0x500
>>>> +_timer:
>>>> + EXCEPTION_SETUP(5)
>>>> +
>>>> +.org 0x600
>>>> +_unalign:
>>>> + EXCEPTION_SETUP(6)
>>>> +
>>>> +.org 0x700
>>>> +_undefIns:
>>>> + EXCEPTION_SETUP(7)
>>>> +
>>>> +.org 0x800
>>>> +_exInt:
>>>> + EXCEPTION_SETUP(8)
>>>> +
>>>> +.org 0x900
>>>> +_dTLB:
>>>> + EXCEPTION_SETUP(9)
>>>> +
>>>> +.org 0xA00
>>>> +_iTLB:
>>>> + EXCEPTION_SETUP(10)
>>>> +
>>>> +.org 0xB00
>>>> +_range:
>>>> + EXCEPTION_SETUP(11)
>>>> +
>>>> +.org 0xC00
>>>> +_syscall:
>>>> + EXCEPTION_SETUP(12)
>>>> +
>>>> +.org 0xD00
>>>> +_fp:
>>>> + EXCEPTION_SETUP(13)
>>>> +
>>>> +.org 0xE00
>>>> +_trap:
>>>> + EXCEPTION_SETUP(14)
>>>> +
>>>> +.org 0xF00
>>>> +_undef1:
>>>> + EXCEPTION_SETUP(15)
>>>> +
>>>> +.org 0x1500
>>>> +_undef2:
>>>> + EXCEPTION_SETUP(16)
>>>> +
>>>> +.org 0x1900
>>>> +_undef3:
>>>> + EXCEPTION_SETUP(17)
>>>> +
>>>> +.org 0x1F00
>>>> +
>>>> +bsp_start_vector_table_begin:
>>>> +
>>>> + .word 0
>>>> + .word _start /* Reset */
>>>> + .word _OR1K_Exception_default /* Bus Error */
>>>> + .word _OR1K_Exception_default /* Data Page Fault */
>>>> + .word _OR1K_Exception_default /* Instruction Page Fault */
>>>> + .word _OR1K_Exception_default /* Tick timer */
>>>> + .word _OR1K_Exception_default /* Alignment */
>>>> + .word _OR1K_Exception_default /* Undefiend Instruction */
>>>> + .word _OR1K_Exception_default /* External Interrupt */
>>>> + .word _OR1K_Exception_default /* Data TLB Miss */
>>>> + .word _OR1K_Exception_default /* Instruction TLB Miss */
>>>> + .word _OR1K_Exception_default /* Range Exception */
>>>> + .word _OR1K_Exception_default /* System Call */
>>>> + .word _OR1K_Exception_default /* Floating Point Exception */
>>>> + .word _OR1K_Exception_default /* Trap */
>>>> + .word _OR1K_Exception_default /* Reserver for future use */
>>>> + .word _OR1K_Exception_default /* Reserved for implementation-specific */
>>>> + .word _OR1K_Exception_default /* Reserved for custom exceptions. */
>>>> +
>>>> +bsp_start_vector_table_end:
>>>> +
>>>> + .section ".bsp_start_text", "ax"
>>>> + .type _start, at function
>>>> +
>>>> +_start:
>>>> + /* Set SR register to Supervision mode */
>>>> + l.ori r1, r0, 0x1
>>>> + l.mtspr r0, r1, 17
>>>> +
>>>> + /* load stack and frame pointers */
>>>> + l.movhi r1, hi(bsp_section_stack_begin)
>>>> + l.ori r1, r1, lo(bsp_section_stack_begin)
>>>> + l.add r2, r0, r1
>>>> +
>>>> +/* Clearing .bss */
>>>> + l.movhi r13, hi(bsp_section_bss_begin)
>>>> + l.ori r13, r13, lo(bsp_section_bss_begin)
>>>> + l.movhi r15, hi(bsp_section_bss_end)
>>>> + l.ori r15, r15, lo(bsp_section_bss_end)
>>>> +
>>>> +_loop_clear_bss:
>>>> + l.sfgeu r13, r15
>>>> + l.bf _end_clear_bss
>>>> + l.addi r13, r13, 4
>>>> + l.sw 0(r13), r0
>>>> + l.j _loop_clear_bss
>>>> + l.nop
>>>> +_end_clear_bss:
>>>> +
>>>> + l.j boot_card
>>>> + l.nop
>>>> +
>>>> +/* Temporary code for unhandled exceptions */
>>>> +.section .text
>>>> +.align
>>>> +.global _unhandled_exception
>>>> +
>>>> +unhandled_exception:
>>>> + l.nop
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/startup/linkcmds b/c/src/lib/libbsp/or1k/or1ksim/startup/linkcmds
>>>> new file mode 100644
>>>> index 0000000..a88db1f
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/startup/linkcmds
>>>> @@ -0,0 +1,41 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup bsp_linker
>>>> + *
>>>> + * @brief Memory map
>>>> + */
>>>> +
>>>> +/*
>>>> + * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +MEMORY
>>>> + {
>>>> + VECTOR_RAM (AIW) : ORIGIN = 0x0 , LENGTH = 8260
>>>> + RAM : org = 0x00002048, l = 0x1FFDFB8
>>>> + UNEXPECTED_SECTIONS : ORIGIN = 0xffffffff, LENGTH = 0
>>>> + }
>>>> +
>>>> +REGION_ALIAS ("REGION_START", RAM);
>>>> +REGION_ALIAS ("REGION_VECTOR", VECTOR_RAM);
>>>> +REGION_ALIAS ("REGION_TEXT", RAM);
>>>> +REGION_ALIAS ("REGION_TEXT_LOAD", RAM);
>>>> +REGION_ALIAS ("REGION_RODATA", RAM);
>>>> +REGION_ALIAS ("REGION_RODATA_LOAD", RAM);
>>>> +REGION_ALIAS ("REGION_DATA", RAM);
>>>> +REGION_ALIAS ("REGION_DATA_LOAD", RAM);
>>>> +REGION_ALIAS ("REGION_FAST_DATA", RAM);
>>>> +REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM);
>>>> +REGION_ALIAS ("REGION_BSS", RAM);
>>>> +REGION_ALIAS ("REGION_WORK", RAM);
>>>> +REGION_ALIAS ("REGION_STACK", RAM);
>>>> +
>>>> +bsp_section_vector_begin = 0;
>>>> +bsp_section_stack_begin = 0x1FFDFB8;
>>>> +
>>>> +INCLUDE linkcmds.base
>>>> diff --git a/c/src/lib/libbsp/or1k/or1ksim/timer/timer.c b/c/src/lib/libbsp/or1k/or1ksim/timer/timer.c
>>>> new file mode 100644
>>>> index 0000000..5d557bf
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/or1ksim/timer/timer.c
>>>> @@ -0,0 +1,64 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup or1ksim
>>>> + *
>>>> + * @brief Benchmark timer support.
>>>> + */
>>>> +
>>>> +/*
>>>> + * Copyright (c) 2014 by Hesham ALMatary
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +#include <rtems.h>
>>>> +#include <rtems/btimer.h>
>>>> +#include <bsp/or1ksim.h>
>>>> +#include <rtems/score/or1k-utility.h>
>>>> +
>>>> +#define OR1KSIM_NANOSECONDS_PER_CLK_CYCLE 10
>>>> +
>>>> +static bool benchmark_timer_find_average_overhead = false;
>>>> +static uint64_t benchmark_timer_base;
>>>> +
>>>> +void benchmark_timer_initialize(void)
>>>> +{
>>>> + benchmark_timer_base = _OR1K_mfspr(CPU_OR1K_SPR_TTCR);
>>>> +}
>>>> +
>>>> +#define AVG_OVERHEAD 0
>>>> +#define LEAST_VALID 1
>>>> +
>>>> +uint32_t benchmark_timer_read( void )
>>>> +{
>>>> + uint64_t clicks;
>>>> + uint64_t total;
>>>> + uint64_t delta;
>>>> + /*
>>>> + * Read the timer and see how many clicks (clock cycles)
>>>> + * has passed since timer initialization.
>>>> + */
>>>> + clicks = _OR1K_mfspr(CPU_OR1K_SPR_TTCR);
>>>> +
>>>> + delta = clicks - benchmark_timer_base;
>>>> +
>>>> + /* total in nanoseconds */
>>>> + total = OR1KSIM_NANOSECONDS_PER_CLK_CYCLE * (delta);
>>>> +
>>>> + if ( benchmark_timer_find_average_overhead == true )
>>>> + return total; /* in nanoseconds microsecond units */
>>>> + else {
>>>> + if ( total < LEAST_VALID )
>>>> + return 0; /* below timer resolution */
>>>> +
>>>> + return (total - AVG_OVERHEAD);
>>>> + }
>>>> +}
>>>> +
>>>> +void benchmark_timer_disable_subtracting_average_overhead(bool find_flag)
>>>> +{
>>>> + benchmark_timer_find_average_overhead = find_flag;
>>>> +}
>>>> diff --git a/c/src/lib/libbsp/or1k/preinstall.am b/c/src/lib/libbsp/or1k/preinstall.am
>>>> new file mode 100644
>>>> index 0000000..dba6cc4
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/preinstall.am
>>>> @@ -0,0 +1,7 @@
>>>> +## Automatically generated by ampolish3 - Do not edit
>>>> +
>>>> +if AMPOLISH3
>>>> +$(srcdir)/preinstall.am: Makefile.am
>>>> + $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
>>>> +endif
>>>> +
>>>> diff --git a/c/src/lib/libbsp/or1k/shared/include/linker-symbols.h b/c/src/lib/libbsp/or1k/shared/include/linker-symbols.h
>>>> new file mode 100644
>>>> index 0000000..f0f8377
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/shared/include/linker-symbols.h
>>>> @@ -0,0 +1,79 @@
>>>> +#ifndef LIBBSP_OR1k_SHARED_LINKER_SYMBOLS_H
>>>> +#define LIBBSP_OR1k_SHARED_LINKER_SYMBOLS_H
>>>> +
>>>> +#ifdef __cplusplus
>>>> +extern "C" {
>>>> +#endif /* __cplusplus */
>>>> +
>>>> +/**
>>>> + * @defgroup or1k_linker Linker Support
>>>> + *
>>>> + * @ingroup or1k_shared
>>>> + *
>>>> + * @brief Linker support.
>>>> + *
>>>> + * @{
>>>> + */
>>>> +
>>>> +#ifndef ASM
>>>> + #define LINKER_SYMBOL(sym) extern char sym [];
>>>> +#else
>>>> + #define LINKER_SYMBOL(sym) .extern sym
>>>> +#endif
>>>> +
>>>> +LINKER_SYMBOL(bsp_section_start_begin)
>>>> +LINKER_SYMBOL(bsp_section_start_end)
>>>> +LINKER_SYMBOL(bsp_section_start_size)
>>>> +
>>>> +LINKER_SYMBOL(bsp_section_vector_begin)
>>>> +LINKER_SYMBOL(bsp_section_vector_end)
>>>> +LINKER_SYMBOL(bsp_section_vector_size)
>>>> +
>>>> +LINKER_SYMBOL(bsp_section_text_begin)
>>>> +LINKER_SYMBOL(bsp_section_text_end)
>>>> +LINKER_SYMBOL(bsp_section_text_size)
>>>> +LINKER_SYMBOL(bsp_section_text_load_begin)
>>>> +LINKER_SYMBOL(bsp_section_text_load_end)
>>>> +
>>>> +LINKER_SYMBOL(bsp_section_rodata_begin)
>>>> +LINKER_SYMBOL(bsp_section_rodata_end)
>>>> +LINKER_SYMBOL(bsp_section_rodata_size)
>>>> +LINKER_SYMBOL(bsp_section_rodata_load_begin)
>>>> +LINKER_SYMBOL(bsp_section_rodata_load_end)
>>>> +
>>>> +LINKER_SYMBOL(bsp_section_data_begin)
>>>> +LINKER_SYMBOL(bsp_section_data_end)
>>>> +LINKER_SYMBOL(bsp_section_data_size)
>>>> +LINKER_SYMBOL(bsp_section_data_load_begin)
>>>> +LINKER_SYMBOL(bsp_section_data_load_end)
>>>> +
>>>> +LINKER_SYMBOL(bsp_section_bss_begin)
>>>> +LINKER_SYMBOL(bsp_section_bss_end)
>>>> +LINKER_SYMBOL(bsp_section_bss_size)
>>>> +
>>>> +LINKER_SYMBOL(bsp_section_work_begin)
>>>> +LINKER_SYMBOL(bsp_section_work_end)
>>>> +LINKER_SYMBOL(bsp_section_work_size)
>>>> +
>>>> +LINKER_SYMBOL(bsp_section_stack_begin)
>>>> +LINKER_SYMBOL(bsp_section_stack_end)
>>>> +LINKER_SYMBOL(bsp_section_stack_size)
>>>> +
>>>> +LINKER_SYMBOL(bsp_vector_table_begin)
>>>> +LINKER_SYMBOL(bsp_vector_table_end)
>>>> +LINKER_SYMBOL(bsp_vector_table_size)
>>>> +
>>>> +LINKER_SYMBOL(bsp_start_vector_table_begin)
>>>> +LINKER_SYMBOL(bsp_start_vector_table_end)
>>>> +LINKER_SYMBOL(bsp_start_vector_table_size)
>>>> +
>>>> +LINKER_SYMBOL(bsp_translation_table_base)
>>>> +LINKER_SYMBOL(bsp_translation_table_end)
>>>> +
>>>> +/** @} */
>>>> +
>>>> +#ifdef __cplusplus
>>>> +}
>>>> +#endif /* __cplusplus */
>>>> +
>>>> +#endif /* LIBBSP_OR1K_SHARED_LINKER_SYMBOLS_H */
>>>> diff --git a/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base b/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base
>>>> new file mode 100644
>>>> index 0000000..e773d79
>>>> --- /dev/null
>>>> +++ b/c/src/lib/libbsp/or1k/shared/startup/linkcmds.base
>>>> @@ -0,0 +1,310 @@
>>>> +/**
>>>> + * @file
>>>> + *
>>>> + * @ingroup bsp_linker
>>>> + *
>>>> + * @brief Linker command base file.
>>>> + */
>>>> +
>>>> +/*
>>>> + * COPYRIGHT (c) 2014 Hesham ALMatary <heshamelmatary at gmail.com>
>>>> + *
>>>> + * The license and distribution terms for this file may be
>>>> + * found in the file LICENSE in this distribution or at
>>>> + * http://www.rtems.org/license/LICENSE
>>>> + */
>>>> +
>>>> +OUTPUT_ARCH (or1k)
>>>> +
>>>> +ENTRY (_start)
>>>> +
>>>> +/*
>>>> + * Global symbols that may be defined externally
>>>> + */
>>>> +
>>>> +bsp_start_vector_table_begin = 0x1F00;
>>>> +bsp_vector_table_size = DEFINED (bsp_vector_table_size) ? bsp_vector_table_size
>>>> +: 8260;
>>>> +/* 8192 for raw vector table, and 17 * 4 for handlers vector. */
>>>> +
>>>> +bsp_section_xbarrier_align = DEFINED (bsp_section_xbarrier_align) ? bsp_section_xbarrier_align : 1;
>>>> +bsp_section_robarrier_align = DEFINED (bsp_section_robarrier_align) ? bsp_section_robarrier_align : 1;
>>>> +bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1;
>>>> +
>>>> +bsp_stack_align = DEFINED (bsp_stack_align) ? bsp_stack_align : 8;
>>>> +
>>>> +bsp_stack_main_size = DEFINED (bsp_stack_main_size) ? bsp_stack_main_size : 0;
>>>> +bsp_stack_main_size = ALIGN (bsp_stack_main_size, bsp_stack_align);
>>>> +
>>>> +bsp_processor_count = DEFINED (bsp_processor_count) ? bsp_processor_count : 1;
>>>> +
>>>> +SECTIONS {
>>>> +
>>>> + .vector : ALIGN_WITH_INPUT {
>>>> + *(.vector)
>>>> + . = ALIGN(bsp_vector_table_size);
>>>> + bsp_section_vector_end = .;
>>>> + } > REGION_VECTOR AT > REGION_VECTOR
>>>> + bsp_section_vector_size = bsp_section_vector_end - bsp_section_vector_begin;
>>>> + bsp_vector_table_begin = bsp_section_vector_begin;
>>>> + bsp_vector_table_end = bsp_vector_table_begin + bsp_vector_table_size;
>>>> +
>>>> + .start : ALIGN_WITH_INPUT {
>>>> + bsp_section_start_begin = .;
>>>> + KEEP (*(.bsp_start_text))
>>>> + KEEP (*(.bsp_start_data))
>>>> + bsp_section_start_end = .;
>>>> + } > REGION_START AT > REGION_START
>>>> + bsp_section_start_size = bsp_section_start_end - bsp_section_start_begin;
>>>> +
>>>> +.xbarrier : ALIGN_WITH_INPUT {
>>>> + . = ALIGN (bsp_section_xbarrier_align);
>>>> + } > REGION_VECTOR AT > REGION_VECTOR
>>>> +
>>>> +.text : ALIGN_WITH_INPUT {
>>>> + bsp_section_text_begin = .;
>>>> + *(.text.unlikely .text.*_unlikely)
>>>> + *(.text .stub .text.* .gnu.linkonce.t.*)
>>>> + /* .gnu.warning sections are handled specially by elf32.em. */
>>>> + *(.gnu.warning)
>>>> + *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
>>>> + } > REGION_TEXT AT > REGION_TEXT_LOAD
>>>> + .init : ALIGN_WITH_INPUT {
>>>> + KEEP (*(.init))
>>>> + } > REGION_TEXT AT > REGION_TEXT_LOAD
>>>> + .fini : ALIGN_WITH_INPUT {
>>>> + KEEP (*(.fini))
>>>> + bsp_section_text_end = .;
>>>> + } > REGION_TEXT AT > REGION_TEXT_LOAD
>>>> + bsp_section_text_size = bsp_section_text_end - bsp_section_text_begin;
>>>> + bsp_section_text_load_begin = LOADADDR (.text);
>>>> + bsp_section_text_load_end = bsp_section_text_load_begin + bsp_section_text_size;
>>>> +
>>>> +.robarrier : ALIGN_WITH_INPUT {
>>>> + . = ALIGN (bsp_section_robarrier_align);
>>>> + } > REGION_RODATA AT > REGION_RODATA
>>>> +
>>>> +.rodata : ALIGN_WITH_INPUT {
>>>> + bsp_section_rodata_begin = .;
>>>> + *(.rodata .rodata.* .gnu.linkonce.r.*)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> +.eh_frame : ALIGN_WITH_INPUT {
>>>> + KEEP (*(.eh_frame))
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .gcc_except_table : ALIGN_WITH_INPUT {
>>>> + *(.gcc_except_table .gcc_except_table.*)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .tdata : ALIGN_WITH_INPUT {
>>>> + _TLS_Data_begin = .;
>>>> + *(.tdata .tdata.* .gnu.linkonce.td.*)
>>>> + _TLS_Data_end = .;
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .tbss : ALIGN_WITH_INPUT {
>>>> + _TLS_BSS_begin = .;
>>>> + *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon)
>>>> + _TLS_BSS_end = .;
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + _TLS_Data_size = _TLS_Data_end - _TLS_Data_begin;
>>>> + _TLS_Data_begin = _TLS_Data_size != 0 ? _TLS_Data_begin : _TLS_BSS_begin;
>>>> + _TLS_Data_end = _TLS_Data_size != 0 ? _TLS_Data_end : _TLS_BSS_begin;
>>>> + _TLS_BSS_size = _TLS_BSS_end - _TLS_BSS_begin;
>>>> + _TLS_Size = _TLS_BSS_end - _TLS_Data_begin;
>>>> + _TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss));
>>>> + .preinit_array : ALIGN_WITH_INPUT {
>>>> + PROVIDE_HIDDEN (__preinit_array_start = .);
>>>> + KEEP (*(.preinit_array))
>>>> + PROVIDE_HIDDEN (__preinit_array_end = .);
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .init_array : ALIGN_WITH_INPUT {
>>>> + PROVIDE_HIDDEN (__init_array_start = .);
>>>> + KEEP (*(SORT(.init_array.*)))
>>>> + KEEP (*(.init_array))
>>>> + PROVIDE_HIDDEN (__init_array_end = .);
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .fini_array : ALIGN_WITH_INPUT {
>>>> + PROVIDE_HIDDEN (__fini_array_start = .);
>>>> + KEEP (*(.fini_array))
>>>> + KEEP (*(SORT(.fini_array.*)))
>>>> + PROVIDE_HIDDEN (__fini_array_end = .);
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .ctors : ALIGN_WITH_INPUT {
>>>> + /* 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))
>>>> + KEEP (*crtbegin?.o(.ctors))
>>>> + /* We don't want to include the .ctor section 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 *crtend?.o ) .ctors))
>>>> + KEEP (*(SORT(.ctors.*)))
>>>> + KEEP (*(.ctors))
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .dtors : ALIGN_WITH_INPUT {
>>>> + KEEP (*crtbegin.o(.dtors))
>>>> + KEEP (*crtbegin?.o(.dtors))
>>>> + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
>>>> + KEEP (*(SORT(.dtors.*)))
>>>> + KEEP (*(.dtors))
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .data.rel.ro : ALIGN_WITH_INPUT {
>>>> + *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
>>>> + *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .jcr : ALIGN_WITH_INPUT {
>>>> + KEEP (*(.jcr))
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .interp : ALIGN_WITH_INPUT {
>>>> + *(.interp)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .note.gnu.build-id : ALIGN_WITH_INPUT {
>>>> + *(.note.gnu.build-id)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .hash : ALIGN_WITH_INPUT {
>>>> + *(.hash)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .gnu.hash : ALIGN_WITH_INPUT {
>>>> + *(.gnu.hash)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .dynsym : ALIGN_WITH_INPUT {
>>>> + *(.dynsym)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .dynstr : ALIGN_WITH_INPUT {
>>>> + *(.dynstr)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .gnu.version : ALIGN_WITH_INPUT {
>>>> + *(.gnu.version)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .gnu.version_d : ALIGN_WITH_INPUT {
>>>> + *(.gnu.version_d)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .gnu.version_r : ALIGN_WITH_INPUT {
>>>> + *(.gnu.version_r)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .rel.dyn : ALIGN_WITH_INPUT {
>>>> + *(.rel.init)
>>>> + *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
>>>> + *(.rel.fini)
>>>> + *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
>>>> + *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)
>>>> + *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
>>>> + *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
>>>> + *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
>>>> + *(.rel.ctors)
>>>> + *(.rel.dtors)
>>>> + *(.rel.got)
>>>> + *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
>>>> + PROVIDE_HIDDEN (__rel_iplt_start = .);
>>>> + *(.rel.iplt)
>>>> + PROVIDE_HIDDEN (__rel_iplt_end = .);
>>>> + PROVIDE_HIDDEN (__rela_iplt_start = .);
>>>> + PROVIDE_HIDDEN (__rela_iplt_end = .);
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .rela.dyn : ALIGN_WITH_INPUT {
>>>> + *(.rela.init)
>>>> + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
>>>> + *(.rela.fini)
>>>> + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
>>>> + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
>>>> + *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
>>>> + *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
>>>> + *(.rela.ctors)
>>>> + *(.rela.dtors)
>>>> + *(.rela.got)
>>>> + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
>>>> + PROVIDE_HIDDEN (__rel_iplt_start = .);
>>>> + PROVIDE_HIDDEN (__rel_iplt_end = .);
>>>> + PROVIDE_HIDDEN (__rela_iplt_start = .);
>>>> + *(.rela.iplt)
>>>> + PROVIDE_HIDDEN (__rela_iplt_end = .);
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .rel.plt : ALIGN_WITH_INPUT {
>>>> + *(.rel.plt)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .rela.plt : ALIGN_WITH_INPUT {
>>>> + *(.rela.plt)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .plt : ALIGN_WITH_INPUT {
>>>> + *(.plt)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .iplt : ALIGN_WITH_INPUT {
>>>> + *(.iplt)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .dynamic : ALIGN_WITH_INPUT {
>>>> + *(.dynamic)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .got : ALIGN_WITH_INPUT {
>>>> + *(.got.plt) *(.igot.plt) *(.got) *(.igot)
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + .rtemsroset : ALIGN_WITH_INPUT {
>>>> + /* Special FreeBSD linker set sections */
>>>> + __start_set_sysctl_set = .;
>>>> + *(set_sysctl_*);
>>>> + __stop_set_sysctl_set = .;
>>>> + *(set_domain_*);
>>>> + *(set_pseudo_*);
>>>> +
>>>> + KEEP (*(SORT(.rtemsroset.*)))
>>>> + bsp_section_rodata_end = .;
>>>> + } > REGION_RODATA AT > REGION_RODATA_LOAD
>>>> + bsp_section_rodata_size = bsp_section_rodata_end - bsp_section_rodata_begin;
>>>> + bsp_section_rodata_load_begin = LOADADDR (.rodata);
>>>> + bsp_section_rodata_load_end = bsp_section_rodata_load_begin + bsp_section_rodata_size;
>>>> +
>>>> +.rwbarrier : ALIGN_WITH_INPUT {
>>>> + . = ALIGN (bsp_section_rwbarrier_align);
>>>> + } > REGION_DATA AT > REGION_DATA
>>>> +
>>>> +.data : ALIGN_WITH_INPUT {
>>>> + bsp_section_data_begin = .;
>>>> + *(.data .data.* .gnu.linkonce.d.*)
>>>> + SORT(CONSTRUCTORS)
>>>> + } > REGION_DATA AT > REGION_DATA_LOAD
>>>> + .data1 : ALIGN_WITH_INPUT {
>>>> + *(.data1)
>>>> + } > REGION_DATA AT > REGION_DATA_LOAD
>>>> + .rtemsrwset : ALIGN_WITH_INPUT {
>>>> + KEEP (*(SORT(.rtemsrwset.*)))
>>>> + bsp_section_data_end = .;
>>>> + } > REGION_DATA AT > REGION_DATA_LOAD
>>>> + bsp_section_data_size = bsp_section_data_end - bsp_section_data_begin;
>>>> + bsp_section_data_load_begin = LOADADDR (.data);
>>>> + bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
>>>> +
>>>> + .bss : ALIGN_WITH_INPUT {
>>>> + bsp_section_bss_begin = .;
>>>> + *(.dynbss)
>>>> + *(.bss .bss.* .gnu.linkonce.b.*)
>>>> + *(COMMON)
>>>> + bsp_section_bss_end = .;
>>>> + } > REGION_BSS AT > REGION_BSS
>>>> + bsp_section_bss_size = bsp_section_bss_end - bsp_section_bss_begin;
>>>> +
>>>> +.work : ALIGN_WITH_INPUT {
>>>> + /*
>>>> + * The work section will occupy the remaining REGION_WORK region and
>>>> + * contains the RTEMS work space and heap.
>>>> + */
>>>> + bsp_section_work_begin = .;
>>>> + . += ORIGIN (REGION_WORK) + LENGTH (REGION_WORK) - ABSOLUTE (.);
>>>> + bsp_section_work_end = .;
>>>> + } > REGION_WORK AT > REGION_WORK
>>>> + bsp_section_work_size = bsp_section_work_end - bsp_section_work_begin;
>>>> +
>>>> + .stack : ALIGN_WITH_INPUT {
>>>> + bsp_section_stack_end = .;
>>>> + } > REGION_STACK AT > REGION_STACK
>>>> + bsp_section_stack_size = bsp_section_stack_begin - bsp_section_stack_end;
>>>> +
>>>> + RamBase = ORIGIN (REGION_WORK);
>>>> + RamSize = LENGTH (REGION_WORK);
>>>> + WorkAreaBase = bsp_section_work_begin;
>>>> + HeapSize = 0;
>>>> +}
>>>> --
>>>> 1.9.3
>>>>
>>>> _______________________________________________
>>>> devel mailing list
>>>> devel at rtems.org
>>>> http://lists.rtems.org/mailman/listinfo/devel
>>>
>>> --
>>> Joel Sherrill, Ph.D. Director of Research & Development
>>> joel.sherrill at OARcorp.com On-Line Applications Research
>>> Ask me about RTEMS: a free RTOS Huntsville AL 35805
>>> Support Available (256) 722-9985
>>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list