forked from Imagelibrary/rtems
* Makefile.am, irq/irq_config.h, irq/irq_init.c, irq/irq.h:
add basic IRQ support (for decrementer)
* start/start.S, startup/cmain.c, startup/linkcmds: add support
for sdata* sections
* startup/bsppanic.c: some cleanup
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
2009-10-02 Thomas Doerfler <Thomas.Doerfler@embedded-brains.de>
|
||||
* Makefile.am, irq/irq_config.h, irq/irq_init.c, irq/irq.h:
|
||||
add basic IRQ support (for decrementer)
|
||||
|
||||
* start/start.S, startup/cmain.c, startup/linkcmds: add support
|
||||
for sdata* sections
|
||||
|
||||
* startup/bsppanic.c: some cleanup
|
||||
|
||||
2009-09-30 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* include/bsp.h: BSP does not have much memory. Limited to BIOS space.
|
||||
|
||||
@@ -13,7 +13,6 @@ dist_project_lib_DATA = bsp_specs
|
||||
|
||||
include_HEADERS = include/bsp.h
|
||||
include_HEADERS += ../../shared/include/tm27.h
|
||||
include_bsp_HEADERS = irq/irq.h
|
||||
|
||||
nodist_include_HEADERS = include/bspopts.h
|
||||
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
|
||||
@@ -31,21 +30,38 @@ project_lib_DATA += rtems_crti.$(OBJEXT)
|
||||
|
||||
dist_project_lib_DATA += startup/linkcmds
|
||||
|
||||
# startup
|
||||
startup_SOURCES = ../../shared/bspclean.c ../../shared/bsplibc.c \
|
||||
../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
|
||||
../../shared/bspgetworkarea.c ../../shared/bsppost.c \
|
||||
../../shared/bspstart.c ../../shared/bootcard.c ../../shared/sbrk.c \
|
||||
../../shared/bootcard.c ../../shared/sbrk.c \
|
||||
../../shared/gnatinstallhandler.c \
|
||||
startup/cmain.c startup/bsppanic.c
|
||||
startup/cmain.c startup/bspstart.c startup/bsppanic.c
|
||||
# pclock
|
||||
clock_SOURCES = ../../shared/clock_driver_simidle.c
|
||||
# console
|
||||
console_SOURCES = ../../shared/console-polled.c console/console-io.c
|
||||
#timer
|
||||
timer_SOURCES = ../../shared/timerstub.c
|
||||
|
||||
# irq
|
||||
include_bsp_HEADERS = irq/irq.h \
|
||||
../../shared/include/irq-generic.h \
|
||||
irq/irq-config.h
|
||||
|
||||
irq_SOURCES = irq/irq_init.c \
|
||||
../../shared/src/irq-generic.c \
|
||||
../../shared/src/irq-legacy.c
|
||||
|
||||
noinst_LIBRARIES += libbsp.a
|
||||
libbsp_a_SOURCES = $(startup_SOURCES) $(clock_SOURCES) $(console_SOURCES) \
|
||||
$(timer_SOURCES)
|
||||
$(timer_SOURCES) $(irq_SOURCES)
|
||||
|
||||
# ../../../libcpu/@RTEMS_CPU@/mpc6xx/clock.rel
|
||||
include_bsp_HEADERS += ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/vectors.h \
|
||||
../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/irq_supp.h \
|
||||
../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/ppc_exc_bspsupp.h
|
||||
|
||||
|
||||
libbsp_a_LIBADD = ../../../libcpu/@RTEMS_CPU@/shared/cpuIdent.rel \
|
||||
../../../libcpu/@RTEMS_CPU@/shared/stack.rel \
|
||||
|
||||
78
c/src/lib/libbsp/powerpc/qemuppc/irq/irq-config.h
Normal file
78
c/src/lib/libbsp/powerpc/qemuppc/irq/irq-config.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup bsp_interrupt
|
||||
*
|
||||
* @brief BSP interrupt support configuration.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008
|
||||
* Embedded Brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* rtems@embedded-brains.de
|
||||
*
|
||||
* 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 LIBBSP_POWERPC_QEMUPPC_IRQ_CONFIG_H
|
||||
#define LIBBSP_POWERPC_QEMUPPC_IRQ_CONFIG_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <bsp/irq.h>
|
||||
|
||||
/**
|
||||
* @addtogroup bsp_interrupt
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Minimum vector number.
|
||||
*/
|
||||
#define BSP_INTERRUPT_VECTOR_MIN BSP_LOWEST_OFFSET
|
||||
|
||||
/**
|
||||
* @brief Maximum vector number.
|
||||
*/
|
||||
#define BSP_INTERRUPT_VECTOR_MAX BSP_MAX_OFFSET
|
||||
|
||||
/**
|
||||
* @brief Enables the index table.
|
||||
*
|
||||
* If you enable the index table, you have to define a size for the handler
|
||||
* table (@ref BSP_INTERRUPT_HANDLER_TABLE_SIZE) and must provide an integer
|
||||
* type capable to index the complete handler table (@ref
|
||||
* bsp_interrupt_handler_index_type).
|
||||
*/
|
||||
#undef BSP_INTERRUPT_USE_INDEX_TABLE
|
||||
|
||||
/**
|
||||
* @brief Disables usage of the heap.
|
||||
*
|
||||
* If you define this, you have to define @ref BSP_INTERRUPT_USE_INDEX_TABLE as
|
||||
* well.
|
||||
*/
|
||||
#undef BSP_INTERRUPT_NO_HEAP_USAGE
|
||||
|
||||
#ifdef BSP_INTERRUPT_USE_INDEX_TABLE
|
||||
|
||||
/**
|
||||
* @brief Size of the handler table.
|
||||
*/
|
||||
#define BSP_INTERRUPT_HANDLER_TABLE_SIZE 63
|
||||
|
||||
/**
|
||||
* @brief Integer type capable to index the complete handler table.
|
||||
*/
|
||||
typedef uint8_t bsp_interrupt_handler_index_type;
|
||||
|
||||
#endif /* BSP_INTERRUPT_USE_INDEX_TABLE */
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* LIBBSP_POWERPC_QEMUPPC_IRQ_CONFIG_H */
|
||||
@@ -36,6 +36,7 @@
|
||||
* PCI IRQ handlers related definitions
|
||||
* CAUTION : BSP_PCI_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE
|
||||
*/
|
||||
/* FIXME: do we need PCI interrrupts here ? */
|
||||
#define BSP_PCI_IRQ_NUMBER (16)
|
||||
#define BSP_PCI_IRQ_LOWEST_OFFSET (0)
|
||||
#define BSP_PCI_IRQ_MAX_OFFSET (BSP_PCI_IRQ_LOWEST_OFFSET + BSP_PCI_IRQ_NUMBER - 1)
|
||||
|
||||
63
c/src/lib/libbsp/powerpc/qemuppc/irq/irq_init.c
Normal file
63
c/src/lib/libbsp/powerpc/qemuppc/irq/irq_init.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*===============================================================*\
|
||||
| Project: RTEMS generic MPC83xx BSP |
|
||||
+-----------------------------------------------------------------+
|
||||
| Copyright (c) 2007 |
|
||||
| Embedded Brains GmbH |
|
||||
| Obere Lagerstr. 30 |
|
||||
| D-82178 Puchheim |
|
||||
| Germany |
|
||||
| rtems@embedded-brains.de |
|
||||
+-----------------------------------------------------------------+
|
||||
| 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. |
|
||||
| |
|
||||
+-----------------------------------------------------------------+
|
||||
| this file integrates the IPIC irq controller |
|
||||
\*===============================================================*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#include <libcpu/powerpc-utility.h>
|
||||
#include <libcpu/raw_exception.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/irq.h>
|
||||
#include <bsp/vectors.h>
|
||||
#include <bsp/ppc_exc_bspsupp.h>
|
||||
|
||||
int qemuppc_exception_handler( BSP_Exception_frame *frame, unsigned exception_number)
|
||||
{
|
||||
BSP_panic("Unexpected interrupt occured");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* functions to enable/disable a source at the ipic
|
||||
*/
|
||||
rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
|
||||
{
|
||||
/* FIXME: do something */
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
|
||||
{
|
||||
/* FIXME: do something */
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_facility_initialize(void)
|
||||
{
|
||||
/* Install exception handler */
|
||||
if (ppc_exc_set_handler( ASM_EXT_VECTOR, qemuppc_exception_handler)) {
|
||||
return RTEMS_IO_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void bsp_interrupt_handler_default( rtems_vector_number vector)
|
||||
{
|
||||
printk( "Spurious interrupt: 0x%08x\n", vector);
|
||||
}
|
||||
@@ -45,10 +45,6 @@ $(PROJECT_INCLUDE)/tm27.h: ../../shared/include/tm27.h $(PROJECT_INCLUDE)/$(dirs
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
|
||||
@@ -73,3 +69,27 @@ $(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
|
||||
PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.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-config.h: irq/irq-config.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq-config.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq-config.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/vectors.h: ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/vectors.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/vectors.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/vectors.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/irq_supp.h: ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/irq_supp.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq_supp.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq_supp.h
|
||||
|
||||
$(PROJECT_INCLUDE)/bsp/ppc_exc_bspsupp.h: ../../../libcpu/@RTEMS_CPU@/@exceptions@/bspsupport/ppc_exc_bspsupp.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/ppc_exc_bspsupp.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/ppc_exc_bspsupp.h
|
||||
|
||||
|
||||
@@ -7,6 +7,15 @@ _start:
|
||||
ori %r1,%r1,_stack@l
|
||||
li %r3,8192
|
||||
mtmsr %r3
|
||||
|
||||
/* Read-only small data */
|
||||
lis %r2, _SDA2_BASE_@h
|
||||
ori %r2, %r2,_SDA2_BASE_@l
|
||||
|
||||
/* Read-write small data */
|
||||
lis %r13, _SDA_BASE_@h
|
||||
ori %r13, %r13,_SDA_BASE_@l
|
||||
|
||||
bl cmain
|
||||
.size _start, . - _start
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
void BSP_panic(char *s)
|
||||
{
|
||||
/*
|
||||
printk("%s PANIC %s\n",_RTEMS_version, s);
|
||||
rebootQuestion();
|
||||
*/
|
||||
while(1){};
|
||||
}
|
||||
|
||||
void _BSP_Fatal_error(unsigned int v)
|
||||
{
|
||||
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
|
||||
while(1){};
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ __bzero (unsigned char *d, int len)
|
||||
|
||||
extern unsigned char __sdata2_load[], __sdata2_start[], __sdata2_end[];
|
||||
extern unsigned char __data_load[], __data_start[], __data_end[];
|
||||
extern unsigned char __sdata_load[], __sdata_start[], __sdata_end[];
|
||||
extern unsigned char __sbss2_start[], __sbss2_end[];
|
||||
extern unsigned char __sbss_start[], __sbss_end[];
|
||||
extern unsigned char __bss_start[], __bss_end[];
|
||||
@@ -38,13 +39,16 @@ extern void boot_card(void *);
|
||||
|
||||
void cmain (void)
|
||||
{
|
||||
printk( "hello #1\n");
|
||||
/*
|
||||
* init variable sections
|
||||
*/
|
||||
__memcpy (__sdata2_start, __sdata2_load, __sdata2_end - __sdata2_start);
|
||||
__memcpy (__sdata_start, __sdata_load, __sdata_end - __sdata_start);
|
||||
__memcpy (__data_start, __data_load, __data_end - __data_start);
|
||||
__bzero (__sbss2_start, __sbss2_end - __sbss2_start);
|
||||
__bzero (__sbss_start, __sbss_end - __sbss_start);
|
||||
__bzero (__bss_start, __bss_end - __bss_start);
|
||||
printk( "hello #2\n");
|
||||
printk( "hello #\n");
|
||||
boot_card(0);
|
||||
printk( "end of BSP\n");
|
||||
__outb (0x92, 0x01);
|
||||
|
||||
@@ -14,6 +14,8 @@ RamBase = DEFINED(RamBase) ? RamBase : 0x0;
|
||||
RamSize = DEFINED(RamSize) ? RamSize : 4M;
|
||||
HeapSize = DEFINED(HeapSize) ? HeapSize : 0;
|
||||
|
||||
bsp_section_align = 32;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Read-only sections, merged into text segment: */
|
||||
@@ -43,6 +45,7 @@ SECTIONS
|
||||
|
||||
/* .gnu.warning sections are handled specially by elf32.em. */
|
||||
*(.gnu.warning)
|
||||
. = ALIGN (bsp_section_align);
|
||||
__text_end = .;
|
||||
} >ROM =0
|
||||
.init :
|
||||
@@ -77,7 +80,7 @@ SECTIONS
|
||||
{
|
||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||
*(.rodata1)
|
||||
. = ALIGN(4);
|
||||
. = ALIGN (bsp_section_align);
|
||||
__rodata_end = .;
|
||||
} >ROM =0
|
||||
|
||||
@@ -88,14 +91,14 @@ SECTIONS
|
||||
__sdata2_start = .;
|
||||
PROVIDE (_SDA2_BASE_ = 32768);
|
||||
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
|
||||
. = ALIGN(4);
|
||||
. = ALIGN (bsp_section_align);
|
||||
__sdata2_end = .;
|
||||
} >RAM
|
||||
.sbss2 :
|
||||
{
|
||||
__sbss2_start = .;
|
||||
*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
|
||||
. = ALIGN(4);
|
||||
. = ALIGN (bsp_section_align);
|
||||
__sbss2_end = .;
|
||||
} >RAM
|
||||
__data_load = __sdata2_load + SIZEOF (.sdata2);
|
||||
@@ -106,20 +109,38 @@ SECTIONS
|
||||
KEEP (*(.gnu.linkonce.d.*personality*))
|
||||
SORT(CONSTRUCTORS)
|
||||
*(.data1)
|
||||
PROVIDE (_SDA_BASE_ = 32768);
|
||||
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
||||
. = ALIGN(4);
|
||||
. = ALIGN (bsp_section_align);
|
||||
__data_end = .;
|
||||
} >RAM
|
||||
__sdata_load = __data_load + SIZEOF (.data);
|
||||
.sdata : AT(__sdata_load) {
|
||||
__sdata_start = .;
|
||||
PROVIDE (_SDA_BASE_ = 32768);
|
||||
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
||||
|
||||
. = ALIGN (bsp_section_align);
|
||||
|
||||
_edata = .;
|
||||
__sdata_end = .;
|
||||
PROVIDE (edata = .);
|
||||
|
||||
/*
|
||||
* BSP: End of data section
|
||||
*/
|
||||
bsp_section_data_end = .;
|
||||
} > RAM
|
||||
|
||||
PROVIDE (__EXCEPT_START__ = .);
|
||||
.gcc_except_table : { *(.gcc_except_table*) } >RAM
|
||||
PROVIDE (__EXCEPT_END__ = .);
|
||||
|
||||
.sbss :
|
||||
{
|
||||
__sbss_start = .;
|
||||
*(.dynsbss)
|
||||
*(.sbss .sbss.* .gnu.linkonce.sb.*)
|
||||
*(.scommon)
|
||||
. = ALIGN (bsp_section_align);
|
||||
__sbss_end = .;
|
||||
} >RAM
|
||||
.bss :
|
||||
@@ -128,7 +149,7 @@ SECTIONS
|
||||
*(.dynbss)
|
||||
*(.bss .bss.* .gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
. = ALIGN (bsp_section_align);
|
||||
__bss_end = .;
|
||||
|
||||
/* Allocate the main stack area. Make sure it starts 16bytes aligned
|
||||
@@ -137,6 +158,13 @@ SECTIONS
|
||||
_end = _stack;
|
||||
} >RAM
|
||||
|
||||
/*
|
||||
* BSP: Interrupt stack
|
||||
*/
|
||||
bsp_interrupt_stack_start = _end;
|
||||
bsp_interrupt_stack_end = bsp_interrupt_stack_start + 32k;
|
||||
bsp_interrupt_stack_size = bsp_interrupt_stack_end - bsp_interrupt_stack_start;
|
||||
|
||||
WorkAreaBase = .;
|
||||
. = RamBase + RamSize;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user