From 76c03152e110dcb770253b54277811228e8f78df Mon Sep 17 00:00:00 2001 From: Amaan Cheval Date: Mon, 9 Jul 2018 16:42:56 +0530 Subject: bsp/x86_64: Minimal bootable BSP Current state: - Basic context initialization and switching code. - Stubbed console (empty functions). - Mostly functional linker script (may need tweaks if we ever want to move away from the large code model (see: CPU_CFLAGS). - Fully functional boot, by using FreeBSD's bootloader to load RTEMS's ELF for UEFI-awareness. In short, the current state with this commit lets us boot, go through the system initialization functions, and then call user application's Init task too. Updates #2898. --- c/src/lib/libbsp/x86_64/Makefile.am | 7 ++++++ c/src/lib/libbsp/x86_64/acinclude.m4 | 10 ++++++++ c/src/lib/libbsp/x86_64/amd64/Makefile.am | 40 ++++++++++++++++++++++++++++++ c/src/lib/libbsp/x86_64/amd64/configure.ac | 19 ++++++++++++++ c/src/lib/libbsp/x86_64/configure.ac | 20 +++++++++++++++ 5 files changed, 96 insertions(+) create mode 100644 c/src/lib/libbsp/x86_64/Makefile.am create mode 100644 c/src/lib/libbsp/x86_64/acinclude.m4 create mode 100644 c/src/lib/libbsp/x86_64/amd64/Makefile.am create mode 100644 c/src/lib/libbsp/x86_64/amd64/configure.ac create mode 100644 c/src/lib/libbsp/x86_64/configure.ac (limited to 'c/src/lib') diff --git a/c/src/lib/libbsp/x86_64/Makefile.am b/c/src/lib/libbsp/x86_64/Makefile.am new file mode 100644 index 0000000000..c25b2d3f99 --- /dev/null +++ b/c/src/lib/libbsp/x86_64/Makefile.am @@ -0,0 +1,7 @@ +ACLOCAL_AMFLAGS = -I ../../../aclocal + +# Descend into the @RTEMS_BSP_FAMILY@ directory +_SUBDIRS = @RTEMS_BSP_FAMILY@ + +include $(top_srcdir)/../../../automake/subdirs.am +include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/lib/libbsp/x86_64/acinclude.m4 b/c/src/lib/libbsp/x86_64/acinclude.m4 new file mode 100644 index 0000000000..92ae6f719e --- /dev/null +++ b/c/src/lib/libbsp/x86_64/acinclude.m4 @@ -0,0 +1,10 @@ +# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY) +AC_DEFUN([RTEMS_CHECK_BSPDIR], +[ + case "$1" in + amd64 ) + AC_CONFIG_SUBDIRS([amd64]);; + *) + AC_MSG_ERROR([Invalid BSP]);; + esac +]) diff --git a/c/src/lib/libbsp/x86_64/amd64/Makefile.am b/c/src/lib/libbsp/x86_64/amd64/Makefile.am new file mode 100644 index 0000000000..f05b40f3f9 --- /dev/null +++ b/c/src/lib/libbsp/x86_64/amd64/Makefile.am @@ -0,0 +1,40 @@ +ACLOCAL_AMFLAGS = -I ../../../../aclocal + +include $(top_srcdir)/../../../../automake/compile.am +include $(top_srcdir)/../../bsp.am + +dist_project_lib_DATA = ../../../../../../bsps/x86_64/amd64/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 +# XXX: We may want a custom bsp_work_area_initialize to detect memory size like +# the i386 +# +# FreeBSD's bootloader may leave a bootinfo structure for the kernel to find later: +# http://fxr.watson.org/fxr/source/i386/include/bootinfo.h?v=FREEBSD11#L48 +# +librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspgetworkarea-default.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/x86_64/amd64/start/bspstart.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/x86_64/amd64/start/start.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/sbrk.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/getentropy/getentropy-cpucounter.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspreset-empty.c +# clock +librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/clock/clock-simidle.c +# console +librtemsbsp_a_SOURCES += ../../../../../../bsps/x86_64/amd64/console/console.c +# timer +librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/btimer/btimer-stub.c +# cache +librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/cache/nocache.c + +include $(top_srcdir)/../../../../automake/local.am +include $(srcdir)/../../../../../../bsps/shared/shared-sources.am +include $(srcdir)/../../../../../../bsps/x86_64/amd64/headers.am diff --git a/c/src/lib/libbsp/x86_64/amd64/configure.ac b/c/src/lib/libbsp/x86_64/amd64/configure.ac new file mode 100644 index 0000000000..2f565fc4d9 --- /dev/null +++ b/c/src/lib/libbsp/x86_64/amd64/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-x86_64-amd64],[_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 diff --git a/c/src/lib/libbsp/x86_64/configure.ac b/c/src/lib/libbsp/x86_64/configure.ac new file mode 100644 index 0000000000..a398a4e202 --- /dev/null +++ b/c/src/lib/libbsp/x86_64/configure.ac @@ -0,0 +1,20 @@ +## Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([rtems-c-src-lib-libbsp-x86_64],[_RTEMS_VERSION],[https://devel.rtems.org/newticket]) +RTEMS_TOP(../../../../..) +RTEMS_SOURCE_TOP +RTEMS_BUILD_TOP + +RTEMS_CANONICAL_TARGET_CPU +AM_INIT_AUTOMAKE([no-define foreign subdir-objects 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 -- cgit v1.2.3