[PATCH 2/5] bsp/xen: Create empty template BSP for Xen

Jeff Kubascik jeff.kubascik at dornerworks.com
Mon Dec 2 18:58:14 UTC 2019


Copied from no_cpu/no_bsp template
---
 bsps/arm/xen/README                   |  66 ++++++++
 bsps/arm/xen/config/no_bsp.cfg        |  13 ++
 bsps/arm/xen/console/console.c        | 217 ++++++++++++++++++++++++++
 bsps/arm/xen/headers.am               |  10 ++
 bsps/arm/xen/include/bsp.h            |  57 +++++++
 bsps/arm/xen/include/bsp/irq.h        |   1 +
 bsps/arm/xen/include/tm27.h           |   1 +
 bsps/arm/xen/start/bsp_specs          |   7 +
 bsps/arm/xen/start/bspstart.c         |  27 ++++
 bsps/arm/xen/start/linkcmds.in        |  71 +++++++++
 c/src/lib/libbsp/arm/xen/Makefile.am  |  38 +++++
 c/src/lib/libbsp/arm/xen/configure.ac |  19 +++
 12 files changed, 527 insertions(+)
 create mode 100644 bsps/arm/xen/README
 create mode 100644 bsps/arm/xen/config/no_bsp.cfg
 create mode 100644 bsps/arm/xen/console/console.c
 create mode 100644 bsps/arm/xen/headers.am
 create mode 100644 bsps/arm/xen/include/bsp.h
 create mode 100644 bsps/arm/xen/include/bsp/irq.h
 create mode 100644 bsps/arm/xen/include/tm27.h
 create mode 100644 bsps/arm/xen/start/bsp_specs
 create mode 100644 bsps/arm/xen/start/bspstart.c
 create mode 100644 bsps/arm/xen/start/linkcmds.in
 create mode 100644 c/src/lib/libbsp/arm/xen/Makefile.am
 create mode 100644 c/src/lib/libbsp/arm/xen/configure.ac

diff --git a/bsps/arm/xen/README b/bsps/arm/xen/README
new file mode 100644
index 0000000000..1b24d84c9a
--- /dev/null
+++ b/bsps/arm/xen/README
@@ -0,0 +1,66 @@
+#  This is a sample hardware description file for a BSP.  This comment
+#  block does not have to appear in a real one.  The intention of this
+#  file is to provide a central place to look when searching for
+#  information about a board when starting a new BSP.  For example,
+#  you may want to find an existing timer driver for the chip you are
+#  using on your board.  It is easier to grep for the chip name in
+#  all of the HARDWARE files than to peruse the source tree.  Hopefully,
+#  making the HARDDWARE files accurate will also alleviate the common
+#  problem of not knowing anything about a board based on its BSP
+#  name.
+#
+#  NOTE:  If you have a class of peripheral chip on board which
+#         is not in this list please add it to this file so
+#         others will also use the same name.
+#
+#         Timer resolution is the way it is configured in this BSP.
+#         On a counting timer, this is the length of time which
+#         corresponds to 1 count.
+#
+
+BSP NAME:           fastsbc1
+BOARD:              Fasssst Computers, Fast SBC-1
+BUS:                SchoolBus
+CPU FAMILY:         i386
+CPU:                Intel Hexium
+COPROCESSORS:       Witch Hex87
+MODE:               32 bit mode
+
+DEBUG MONITOR:      HexBug
+
+PERIPHERALS
+===========
+TIMERS:             Intel i8254
+  RESOLUTION:         .0001 microseconds
+SERIAL PORTS:       Zilog Z8530 (with 2 ports)
+REAL-TIME CLOCK:    RTC-4
+DMA:                Intel i8259
+VIDEO:              none
+SCSI:               none
+NETWORKING:         none
+
+DRIVER INFORMATION
+==================
+CLOCK DRIVER:       RTC-4
+IOSUPP DRIVER:      Zilog Z8530 port A
+SHMSUPP:            polled and interrupts
+TIMER DRIVER:       Intel i8254
+TTY DRIVER:         stub only
+
+STDIO
+=====
+PORT:               Console port 0
+ELECTRICAL:         RS-232
+BAUD:               9600
+BITS PER CHARACTER: 8
+PARITY:             None
+STOP BITS:          1
+
+NOTES
+=====
+
+(1) 900 Mhz and 950 Mhz versions.
+
+(2) 1 Gb or 2 Gb RAM.
+
+(3) PC compatible if HexBug not enabled.
diff --git a/bsps/arm/xen/config/no_bsp.cfg b/bsps/arm/xen/config/no_bsp.cfg
new file mode 100644
index 0000000000..15e2f29bff
--- /dev/null
+++ b/bsps/arm/xen/config/no_bsp.cfg
@@ -0,0 +1,13 @@
+#
+#  Configuration file for the "no_bsp" board
+#
+
+include $(RTEMS_ROOT)/make/custom/default.cfg
+
+RTEMS_CPU=no_cpu
+
+# Miscellaneous additions go here. Typical options usually look like
+CFLAGS_OPTIMIZE_V += -O2 -g
+CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
+
+LDFLAGS = -Wl,--gc-sections
diff --git a/bsps/arm/xen/console/console.c b/bsps/arm/xen/console/console.c
new file mode 100644
index 0000000000..41c17c29ef
--- /dev/null
+++ b/bsps/arm/xen/console/console.c
@@ -0,0 +1,217 @@
+/*
+ *  This file contains the template for a console IO package.
+ *
+ *  COPYRIGHT (c) 1989-1999.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  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.
+ */
+
+#define NO_BSP_INIT
+
+#include <bsp.h>
+#include <rtems/libio.h>
+
+/*  console_initialize
+ *
+ *  This routine initializes the console IO driver.
+ *
+ *  Input parameters: NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  Return values:
+ */
+
+rtems_device_driver console_initialize(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+)
+{
+  rtems_status_code status;
+
+  status = rtems_io_register_name(
+    "/dev/console",
+    major,
+    (rtems_device_minor_number) 0
+  );
+
+  if (status != RTEMS_SUCCESSFUL)
+    rtems_fatal_error_occurred(status);
+
+  return RTEMS_SUCCESSFUL;
+}
+
+/*  is_character_ready
+ *
+ *  This routine returns TRUE if a character is available.
+ *
+ *  Input parameters: NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  Return values:
+ */
+
+bool is_character_ready(
+  char *ch
+)
+{
+  *ch = '\0';   /* return NULL for no particular reason */
+  return true;
+}
+
+/*  inbyte
+ *
+ *  This routine reads a character from the SOURCE.
+ *
+ *  Input parameters: NONE
+ *
+ *  Output parameters:  NONE
+ *
+ *  Return values:
+ *    character read from SOURCE
+ */
+
+char inbyte( void )
+{
+  /*
+   *  If polling, wait until a character is available.
+   */
+
+  return '\0';
+}
+
+/*  outbyte
+ *
+ *  This routine transmits a character out the SOURCE.  It may support
+ *  XON/XOFF flow control.
+ *
+ *  Input parameters:
+ *    ch  - character to be transmitted
+ *
+ *  Output parameters:  NONE
+ */
+
+void outbyte(
+  char ch
+)
+{
+  /*
+   *  If polling, wait for the transmitter to be ready.
+   *  Check for flow control requests and process.
+   *  Then output the character.
+   */
+
+  /*
+   *  Carriage Return/New line translation.
+   */
+
+  if ( ch == '\n' )
+    outbyte( '\r' );
+}
+
+/*
+ *  Open entry point
+ */
+
+rtems_device_driver console_open(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ *  Close entry point
+ */
+
+rtems_device_driver console_close(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+
+rtems_device_driver console_read(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+  int maximum;
+  int count = 0;
+
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    buffer[ count ] = inbyte();
+    if (buffer[ count ] == '\n' || buffer[ count ] == '\r') {
+      buffer[ count++ ]  = '\n';
+      break;
+    }
+  }
+
+  rw_args->bytes_moved = count;
+  return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  int count;
+  int maximum;
+  rtems_libio_rw_args_t *rw_args;
+  char *buffer;
+
+  rw_args = (rtems_libio_rw_args_t *) arg;
+
+  buffer = rw_args->buffer;
+  maximum = rw_args->count;
+
+  for (count = 0; count < maximum; count++) {
+    if ( buffer[ count ] == '\n') {
+      outbyte('\r');
+    }
+    outbyte( buffer[ count ] );
+  }
+
+  rw_args->bytes_moved = maximum;
+  return 0;
+}
+
+/*
+ *  IO Control entry point
+ */
+
+rtems_device_driver console_control(
+  rtems_device_major_number major,
+  rtems_device_minor_number minor,
+  void                    * arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
diff --git a/bsps/arm/xen/headers.am b/bsps/arm/xen/headers.am
new file mode 100644
index 0000000000..fe2f157349
--- /dev/null
+++ b/bsps/arm/xen/headers.am
@@ -0,0 +1,10 @@
+## This file was generated by "./boostrap -H".
+
+include_HEADERS =
+include_HEADERS += ../../../../../../bsps/no_cpu/no_bsp/include/bsp.h
+include_HEADERS += include/bspopts.h
+include_HEADERS += ../../../../../../bsps/no_cpu/no_bsp/include/tm27.h
+
+include_bspdir = $(includedir)/bsp
+include_bsp_HEADERS =
+include_bsp_HEADERS += ../../../../../../bsps/no_cpu/no_bsp/include/bsp/irq.h
diff --git a/bsps/arm/xen/include/bsp.h b/bsps/arm/xen/include/bsp.h
new file mode 100644
index 0000000000..46a20fc831
--- /dev/null
+++ b/bsps/arm/xen/include/bsp.h
@@ -0,0 +1,57 @@
+/**
+ * @file
+ *
+ * @ingroup RTEMSBSPsNoCPUNoBsp
+ *
+ * @brief Global BSP definitions.
+ */
+
+/*  bsp.h
+ *
+ *  This include file contains all board IO definitions.
+ *
+ *  XXX : put yours in here
+ */
+
+/*
+ *  COPYRIGHT (c) 1989-1999.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  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_NO_CPU_NO_BSP_BSP_H
+#define LIBBSP_NO_CPU_NO_BSP_BSP_H
+
+/**
+ * @addtogroup RTEMSBSPsNoCPU
+ *
+ * @{
+ */
+
+#include <bspopts.h>
+#include <bsp/default-initial-extension.h>
+
+#include <rtems.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* functions */
+
+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  */
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+
+#endif
diff --git a/bsps/arm/xen/include/bsp/irq.h b/bsps/arm/xen/include/bsp/irq.h
new file mode 100644
index 0000000000..8a97d7a1b0
--- /dev/null
+++ b/bsps/arm/xen/include/bsp/irq.h
@@ -0,0 +1 @@
+#include <bsp/irq-default.h>
diff --git a/bsps/arm/xen/include/tm27.h b/bsps/arm/xen/include/tm27.h
new file mode 100644
index 0000000000..0dfa7bf628
--- /dev/null
+++ b/bsps/arm/xen/include/tm27.h
@@ -0,0 +1 @@
+#include <rtems/tm27-default.h>
diff --git a/bsps/arm/xen/start/bsp_specs b/bsps/arm/xen/start/bsp_specs
new file mode 100644
index 0000000000..140802f2c0
--- /dev/null
+++ b/bsps/arm/xen/start/bsp_specs
@@ -0,0 +1,7 @@
+%rename lib old_lib
+
+*lib:
+%{!qrtems: %(old_lib)} \
+%{!nostdlib: %{qrtems: --start-group -lrtemsbsp -lrtemscpu -lc -lgcc --end-group \
+%{!qnolinkcmds: -T linkcmds%s}}}
+
diff --git a/bsps/arm/xen/start/bspstart.c b/bsps/arm/xen/start/bspstart.c
new file mode 100644
index 0000000000..b77b971ca1
--- /dev/null
+++ b/bsps/arm/xen/start/bspstart.c
@@ -0,0 +1,27 @@
+/*
+ *  This routine starts the application.  It includes application,
+ *  board, and monitor specific initialization and configuration.
+ *  The generic CPU dependent initialization has been performed
+ *  before this routine is invoked.
+ *
+ *  COPYRIGHT (c) 1989-1999.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  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 <string.h>
+
+#include <bsp.h>
+
+/*
+ *  bsp_start
+ *
+ *  This routine does the bulk of the system initialization.
+ */
+
+void bsp_start( void )
+{
+}
diff --git a/bsps/arm/xen/start/linkcmds.in b/bsps/arm/xen/start/linkcmds.in
new file mode 100644
index 0000000000..6f2fda7b41
--- /dev/null
+++ b/bsps/arm/xen/start/linkcmds.in
@@ -0,0 +1,71 @@
+/*
+ *  This file contains directives for the GNU linker which are specific
+ *  to the NO_CPU NO_BSP BOARD.
+ *
+ *  COPYRIGHT (c) 1989-1999.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  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
+	{
+	ram : org = 0x0, l = 1M
+	}
+
+SECTIONS
+{
+        .text 0x0 :
+	{
+	text_start = . ;
+	_text_start = . ;
+        *(.text)
+	. = ALIGN (16);
+
+	/*
+	 * Special FreeBSD sysctl sections.
+	 */
+	. = ALIGN (16);
+	__start_set_sysctl_set = .;
+	*(set_sysctl_*);
+	__stop_set_sysctl_set = ABSOLUTE(.);
+	*(set_domain_*);
+	*(set_pseudo_*);
+
+	*(.eh_fram)
+	. = ALIGN (16);
+
+	/*
+	 * 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 ADDR( .text ) + SIZEOF( .text ):
+	{
+	data_start = . ;
+	_data_start = . ;
+        *(.data)
+	_edata = ALIGN( 0x10 ) ;
+        }
+        .bss ADDR( .data ) + SIZEOF( .data ):
+        {
+	bss_start = . ;
+	_bss_start = . ;
+	*(.bss)
+	*(COMMON)
+	end = . ;
+	__end = . ;
+	}
+}
diff --git a/c/src/lib/libbsp/arm/xen/Makefile.am b/c/src/lib/libbsp/arm/xen/Makefile.am
new file mode 100644
index 0000000000..9f9b6426bd
--- /dev/null
+++ b/c/src/lib/libbsp/arm/xen/Makefile.am
@@ -0,0 +1,38 @@
+ACLOCAL_AMFLAGS = -I ../../../../aclocal
+
+include $(top_srcdir)/../../../../automake/compile.am
+include $(top_srcdir)/../../bsp.am
+
+dist_project_lib_DATA = ../../../../../../bsps/no_cpu/no_bsp/start/bsp_specs
+
+noinst_PROGRAMS =
+
+project_lib_DATA = linkcmds
+
+project_lib_LIBRARIES = librtemsbsp.a
+librtemsbsp_a_SOURCES =
+
+# startup
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/start/bspstart.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/start/setvec.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspreset-empty.c
+# clock
+librtemsbsp_a_SOURCES +=../../../../../../bsps/no_cpu/no_bsp/clock/ckinit.c
+# console
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/console/console.c
+# timer
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/btimer/btimer.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/btimer/timerisr.c
+# shmsupp
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/mpci/addrconv.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/mpci/getcfg.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/mpci/lock.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/no_cpu/no_bsp/mpci/mpisr.c
+
+include $(srcdir)/../../../../../../bsps/shared/irq-default-sources.am
+include $(srcdir)/../../../../../../bsps/shared/shared-sources.am
+include $(srcdir)/../../../../../../bsps/no_cpu/no_bsp/headers.am
diff --git a/c/src/lib/libbsp/arm/xen/configure.ac b/c/src/lib/libbsp/arm/xen/configure.ac
new file mode 100644
index 0000000000..3e54ec9f34
--- /dev/null
+++ b/c/src/lib/libbsp/arm/xen/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-no_cpu-no_bsp],[_RTEMS_VERSION],[https://devel.rtems.org/newticket])
+RTEMS_TOP(../../../../../..)
+RTEMS_SOURCE_TOP
+RTEMS_BUILD_TOP
+RTEMS_BSP_LINKCMDS
+
+RTEMS_CANONICAL_TARGET_CPU
+AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.12.2])
+RTEMS_BSP_CONFIGURE
+
+
+RTEMS_BSP_CLEANUP_OPTIONS
+
+# Explicitly list all Makefiles here
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
-- 
2.17.1



More information about the devel mailing list