[PATCH 5/5] psxtests: new test psxshm02 using heap for shm objects

2016-08-18 Thread Gedare Bloom
---
 testsuites/psxtests/psxshm02/Makefile.am  | 22 
 testsuites/psxtests/psxshm02/init.c   | 91 +++
 testsuites/psxtests/psxshm02/psxshm02.scn |  0
 testsuites/psxtests/psxshm02/system.h | 38 +
 4 files changed, 151 insertions(+)
 create mode 100644 testsuites/psxtests/psxshm02/Makefile.am
 create mode 100644 testsuites/psxtests/psxshm02/init.c
 create mode 100644 testsuites/psxtests/psxshm02/psxshm02.scn
 create mode 100644 testsuites/psxtests/psxshm02/system.h

diff --git a/testsuites/psxtests/psxshm02/Makefile.am 
b/testsuites/psxtests/psxshm02/Makefile.am
new file mode 100644
index 000..c174b0c
--- /dev/null
+++ b/testsuites/psxtests/psxshm02/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxshm02
+psxshm02_SOURCES = init.c system.h
+
+dist_rtems_tests_DATA = psxshm02.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxshm02_OBJECTS)
+LINK_LIBS = $(psxshm02_LDLIBS)
+
+psxshm02$(EXEEXT): $(psxshm02_OBJECTS) $(psxshm02_DEPENDENCIES)
+   @rm -f psxshm02$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxshm02/init.c 
b/testsuites/psxtests/psxshm02/init.c
new file mode 100644
index 000..29dea97
--- /dev/null
+++ b/testsuites/psxtests/psxshm02/init.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * 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.
+ */
+
+/*
+ * From http://pubs.opengroup.org/onlinepubs/9699919799/functions/shm_open.html
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+#include "pritime.h"
+
+#include 
+
+#include 
+#include 
+#include 
+
+const char rtems_test_name[] = "PSX SHM02";
+
+#define MAX_LEN 1
+struct region {/* Defines "structure" of shared memory */
+  int len;
+  char buf[MAX_LEN];
+};
+
+void *POSIX_Init(
+  void *argument
+)
+{
+  struct region *p;
+  int fd;
+  int err;
+  char *name = "/shm";
+
+  TEST_BEGIN();
+
+  puts( "Init: shm_open" );
+  fd = shm_open( name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR );
+  if ( fd == -1 ) {
+printf ( "Error: %s\n", strerror(errno) );
+rtems_test_assert( fd != -1 );
+  }
+
+  puts( "Init: ftruncate" );
+  err = ftruncate( fd, sizeof( struct region ) );
+  if ( err == -1 ) {
+printf ( "Error: %s\n", strerror(errno) );
+rtems_test_assert( err != -1 );
+  }
+
+  puts( "Init: mmap" );
+  p = mmap(
+NULL,
+sizeof( struct region ),
+PROT_READ | PROT_WRITE, MAP_SHARED,
+fd,
+0
+  );
+  rtems_test_assert( p != MAP_FAILED );
+
+  puts( "Init: write to mapped region" );
+  p->len = MAX_LEN;
+
+  puts( "Init: munmap" );
+  err = munmap( p, sizeof( struct region ) );
+  if ( err == -1 ) {
+printf ( "Error: %s\n", strerror(errno) );
+rtems_test_assert( err != -1 );
+  }
+
+  puts( "Init: close" );
+  err = close( fd );
+  if ( err == -1 ) {
+printf ( "Error: %s\n", strerror(errno) );
+rtems_test_assert( err != -1 );
+  }
+
+  TEST_END();
+
+  rtems_test_exit(0);
+  return 0;
+}
diff --git a/testsuites/psxtests/psxshm02/psxshm02.scn 
b/testsuites/psxtests/psxshm02/psxshm02.scn
new file mode 100644
index 000..e69de29
diff --git a/testsuites/psxtests/psxshm02/system.h 
b/testsuites/psxtests/psxshm02/system.h
new file mode 100644
index 000..8d11792
--- /dev/null
+++ b/testsuites/psxtests/psxshm02/system.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * 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 
+#include 
+#include 
+
+void *POSIX_Init(
+  void *argument
+);
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 10
+#define CONFIGURE_MAXIMUM_POSIX_SHMS 1
+#define CONFIGURE_MEMORY_OVERHEAD 10
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#include 
+const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations = {
+  _POSIX_Shm_Object_create_from_heap,
+  _POSIX_Shm_Object_resize_from_heap,
+  _POSIX_Shm_Object_delete_from_heap,
+  _POSIX_Shm_Object_mmap_from_heap
+};
+#define CONFIGURE_HAS_OWN_POSIX_SHM_OBJECT_OPERATIONS
+
+#include 
-- 
1.9.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 4/5] posix: add user-facing hooks for shm object management

2016-08-18 Thread Gedare Bloom
---
 cpukit/posix/Makefile.am   |  2 +
 cpukit/posix/include/rtems/posix/shm.h | 65 -
 cpukit/posix/include/rtems/posix/shmimpl.h | 11 +
 cpukit/posix/src/shmheap.c | 60 ++
 cpukit/posix/src/shmopen.c | 56 +
 cpukit/posix/src/shmwkspace.c  | 67 ++
 cpukit/sapi/include/confdefs.h | 13 +-
 testsuites/psxtests/Makefile.am|  2 +-
 testsuites/psxtests/configure.ac   |  1 +
 9 files changed, 219 insertions(+), 58 deletions(-)
 create mode 100644 cpukit/posix/src/shmheap.c
 create mode 100644 cpukit/posix/src/shmwkspace.c

diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
index 5490401..1851535 100644
--- a/cpukit/posix/Makefile.am
+++ b/cpukit/posix/Makefile.am
@@ -103,8 +103,10 @@ libposix_a_SOURCES += src/munlock.c
 libposix_a_SOURCES += src/munmap.c
 libposix_a_SOURCES += src/posix_madvise.c
 libposix_a_SOURCES += src/shm.c
+libposix_a_SOURCES += src/shmheap.c
 libposix_a_SOURCES += src/shmopen.c
 libposix_a_SOURCES += src/shmunlink.c
+libposix_a_SOURCES += src/shmwkspace.c
 
 ## MESSAGE_QUEUE_C_FILES
 libposix_a_SOURCES += src/mqueue.c src/mqueueclose.c \
diff --git a/cpukit/posix/include/rtems/posix/shm.h 
b/cpukit/posix/include/rtems/posix/shm.h
index f3d7a91..eae0dcf 100644
--- a/cpukit/posix/include/rtems/posix/shm.h
+++ b/cpukit/posix/include/rtems/posix/shm.h
@@ -30,6 +30,13 @@ extern "C" {
  * Internal implementation support for POSIX shared memory.
  * @{
  */
+typedef struct POSIX_Shm_Object_operations POSIX_Shm_Object_operations;
+extern const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations;
+typedef struct {
+  void   *handle;
+  size_t  size;
+  const POSIX_Shm_Object_operations  *ops;
+} POSIX_Shm_Object;
 
 typedef struct {
Objects_Control  Object;
@@ -37,15 +44,7 @@ typedef struct {
 
int  reference_count;
 
-   void*shm_object;
-   size_t   shm_object_size;
-   void*( *shm_object_allocate )( size_t size );
-   void*( *shm_object_reallocate )(
-  void *ptr,
-  size_t curr_size,
-  size_t new_size
-);
-   void ( *shm_object_free ) ( void *ptr );
+   POSIX_Shm_Object shm_object;
 
uid_tuid;
gid_tgid;
@@ -54,9 +53,55 @@ typedef struct {
time_t   atime;
time_t   mtime;
time_t   ctime;
-
 } POSIX_Shm_Control;
 
+struct POSIX_Shm_Object_operations {
+  int   ( *object_create ) ( POSIX_Shm_Control *shm, size_t size );
+  int   ( *object_resize ) ( POSIX_Shm_Control *shm, size_t size );
+  int   ( *object_delete ) ( POSIX_Shm_Control *shm );
+  void *( *object_mmap   ) ( POSIX_Shm_Control *shm, size_t len, int prot, int 
flags, off_t off );
+};
+
+extern int _POSIX_Shm_Object_create_from_workspace(
+  POSIX_Shm_Control *shm,
+  size_t size
+);
+
+extern int _POSIX_Shm_Object_delete_from_workspace( POSIX_Shm_Control *shm );
+
+extern int _POSIX_Shm_Object_resize_from_workspace(
+  POSIX_Shm_Control *shm,
+  size_t size
+);
+
+extern void *_POSIX_Shm_Object_mmap_from_workspace(
+  POSIX_Shm_Control *shm,
+  size_t len,
+  int prot,
+  int flags,
+  off_t off
+);
+
+extern int _POSIX_Shm_Object_create_from_heap(
+  POSIX_Shm_Control *shm,
+  size_t size
+);
+
+extern int _POSIX_Shm_Object_delete_from_heap( POSIX_Shm_Control *shm );
+
+extern int _POSIX_Shm_Object_resize_from_heap(
+  POSIX_Shm_Control *shm,
+  size_t size
+);
+
+extern void *_POSIX_Shm_Object_mmap_from_heap(
+  POSIX_Shm_Control *shm,
+  size_t len,
+  int prot,
+  int flags,
+  off_t off
+);
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/posix/include/rtems/posix/shmimpl.h 
b/cpukit/posix/include/rtems/posix/shmimpl.h
index 2df4bd3..c012771 100644
--- a/cpukit/posix/include/rtems/posix/shmimpl.h
+++ b/cpukit/posix/include/rtems/posix/shmimpl.h
@@ -81,6 +81,17 @@ RTEMS_INLINE_ROUTINE POSIX_Shm_Control 
*_POSIX_Shm_Get_by_name(
 error
   );
 }
+
+RTEMS_INLINE_ROUTINE void _POSIX_Shm_Update_mtime_ctime(
+  POSIX_Shm_Control *shm
+)
+{
+  struct timeval now;
+  gettimeofday( &now, 0 );
+  shm->mtime = now.tv_sec;
+  shm->ctime = now.tv_sec;
+}
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/posix/src/shmheap.c b/cpukit/posix/src/shmheap.c
new file mode 100644
index 000..4f6f105
--- /dev/null
+++ b/cpukit/posix/src/shmheap.c
@@ -0,0 +1,60 @@
+/**
+ * @file
+ */
+
+/*
+ * Copyright (c) 2016 Gedare Bloom.
+ *
+ * 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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include

RE: VFP support for lpc32xx

2016-08-18 Thread Kirspel, Kevin
After some finagling, I was successful using the RTEMS tester, GDB, and an ARM 
Jlink JTAG cable to run the sptests under the testsuite.  I passed all but 8.  
3 of the tests actually passed but have some issues with the test cases or 
output parser.  The 5 remaining failures should have nothing to do with the VFP 
additions so I’m pretty confident it is fine.  I’ll post the patches for 
review.  They are pretty minor.

Kevin Kirspel
Electrical Engineer - Sr. Staff
Opti Medical
235 Hembree Park Drive
Roswell GA 30076
Tel: (770)-510- ext. 81642
Direct: (770)-688-1642
Fax: (770)-510-4445

From: Joel Sherrill [mailto:joel.sherr...@gmail.com]
Sent: Wednesday, August 17, 2016 3:06 PM
To: Kirspel, Kevin ; Chris Johns 
Cc: devel@rtems.org
Subject: Re: VFP support for lpc32xx



On Wed, Aug 17, 2016 at 2:04 PM, Kirspel, Kevin 
mailto:kevin-kirs...@idexx.com>> wrote:
I have a patch for the RTEMS source builder as well as RTEMS itself to support 
the VFP on the lpc32xx.  I don’t have hardware the matches the lpc32xx BSP but 
I do have some custom hardware that I can run the test suite on.  Can you point 
me to some documentation that tells you how to automate the running of the test 
suite?


If you have JTAG on your HW, the rtems-tester in rtems-tools has setup to run
tests on Zynq automated using gdb and JTAG.

Chris Johns should speak up.

Kevin Kirspel
Electrical Engineer - Sr. Staff
Opti Medical
235 Hembree Park Drive
Roswell GA 30076
Tel: (770)-510- ext. 81642
Direct: (770)-688-1642
Fax: (770)-510-4445


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 1/2] RTEMS Source Builder changes for lpc32xx VFP support

2016-08-18 Thread Kirspel, Kevin
diff --git 
a/rtems/config/tools/rtems-gcc-6-20160609-newlib-2.4.0.20160527-1.cfg 
b/rtems/config/tools/rtems-gcc-6-20160609-newlib-2.4.0.20160527-1.cfg
old mode 100644
new mode 100755
index 66c83b9..6c553e6
--- a/rtems/config/tools/rtems-gcc-6-20160609-newlib-2.4.0.20160527-1.cfg
+++ b/rtems/config/tools/rtems-gcc-6-20160609-newlib-2.4.0.20160527-1.cfg
@@ -7,12 +7,14 @@
%define mpc_version0.8.1
%define gmp_version4.3.2
+%patch add gcc file://gcc-6.1.1-arm-eabi-multilib-20160816.diff
 %hash sha512 gcc-6-20160609.tar.bz2 
f9ea9034c0456d350e418a7263cdd02596fdd553f40e9741907436f0df7dbbc5b025ea421c2aece2769ade8e356985c104a37fe6c1bdc51eb61d52257206e0f1
%hash sha512 newlib-2.4.0.20160527.tar.gz 
09d0c8ac2a657e910eebfeeb7e5fcc6956591223fe499ed4717b5e719287148fc35e80835821fb5b6b586e371100737a7765a03c43f0c194cf67892484132d3f
%hash sha512 mpfr-2.4.2.tar.bz2 
c004b3dbf86c04960e4a1f8db37a409a7cc4cb76135e76e98dcc5ad93aaa8deb62334ee13ff84447a7c12a5e8cb57f25c62ac908c24920f1fb1a38d79d4a4c5e
%hash sha512 mpc-0.8.1.tar.gz 
14cb9ae3d33caed24d5ae648eed28b2e00ad047a8baeff25981129af88245b4def2948573d7a00d65c5bd34e53524aa6a7351b76703c9f888b41830c1a1daae2
%hash sha512 gmp-4.3.2.tar.bz2 
2e0b0fd23e6f10742a5517981e5171c6e88b0a93c83da701b296f5c0861d72c19782daab589a7eac3f9032152a0fc7eff7f5362db8fccc4859564a9aa82329cf
+%hash sha512 gcc-6.1.1-arm-eabi-multilib-20160816.diff 
cd47a1e44351d63dd848b2170f1fdd1106a1fb1ed4d0680fd86ef599f81aa421635030c5235d6b044143286207fc34094245fdb4a85d78db83e3a5f965f735a3
 %define with_threads 1
%define with_plugin  0
diff --git a/source-builder/patches/gcc-6.1.1-arm-eabi-multilib-20160816.diff 
b/source-builder/patches/gcc-6.1.1-arm-eabi-multilib-20160816.diff
index e69de29..d2f0bfd 100755
--- a/source-builder/patches/gcc-6.1.1-arm-eabi-multilib-20160816.diff
+++ b/source-builder/patches/gcc-6.1.1-arm-eabi-multilib-20160816.diff
@@ -0,0 +1,18 @@
+diff -ruN gcc-6-20160609.orig/gcc/config/arm/t-rtems 
gcc-6-20160609/gcc/config/arm/t-rtems
+--- gcc-6-20160609.orig/gcc/config/arm/t-rtems  2016-01-15 
03:29:12.0 -0800
 gcc-6-20160609/gcc/config/arm/t-rtems2016-08-16 11:42:02.727219302 
-0700
+@@ -1,7 +1,7 @@
+ # Custom RTEMS multilibs for ARM
+
+-MULTILIB_OPTIONS  = mbig-endian mthumb 
march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m/mcpu=cortex-m7 
mfpu=neon/mfpu=vfpv3-d16/mfpu=fpv4-sp-d16/mfpu=fpv5-d16 mfloat-abi=hard
+-MULTILIB_DIRNAMES = eb thumb armv6-m armv7-a armv7-r armv7-m cortex-m7 neon 
vfpv3-d16 fpv4-sp-d16 fpv5-d16 hard
++MULTILIB_OPTIONS  = mbig-endian mthumb 
march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m/mcpu=cortex-m7 
mfpu=neon/mfpu=vfp/mfpu=vfpv3-d16/mfpu=fpv4-sp-d16/mfpu=fpv5-d16 
mfloat-abi=hard/mfloat-abi=softfp
++MULTILIB_DIRNAMES = eb thumb armv6-m armv7-a armv7-r armv7-m cortex-m7 neon 
vfp vfpv3-d16 fpv4-sp-d16 fpv5-d16 hard softfp
+
+ # Enumeration of multilibs
+
+@@ -19,3 +19,4 @@
+ MULTILIB_REQUIRED += mthumb/mcpu=cortex-m7/mfpu=fpv5-d16/mfloat-abi=hard
+ MULTILIB_REQUIRED += mthumb/march=armv7-m
+ MULTILIB_REQUIRED += mthumb
++MULTILIB_REQUIRED += mfpu=vfp/mfloat-abi=softfp
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 2/2] RTEMS changes for lpc32xx VFP support

2016-08-18 Thread Kirspel, Kevin
diff --git a/c/src/lib/libbsp/arm/lpc32xx/make/custom/lpc32xx.inc 
b/c/src/lib/libbsp/arm/lpc32xx/make/custom/lpc32xx.inc
old mode 100644
new mode 100755
index f184741..1d478ce
--- a/c/src/lib/libbsp/arm/lpc32xx/make/custom/lpc32xx.inc
+++ b/c/src/lib/libbsp/arm/lpc32xx/make/custom/lpc32xx.inc
@@ -6,7 +6,8 @@ include $(RTEMS_ROOT)/make/custom/default.cfg
 RTEMS_CPU = arm
-CPU_CFLAGS = -mcpu=arm926ej-s -mthumb
+#CPU_CFLAGS = -mcpu=arm926ej-s -mthumb
+CPU_CFLAGS = -mcpu=arm926ej-s -mfpu=vfp -mfloat-abi=softfp
 CFLAGS_OPTIMIZE_V ?= -O2 -g
CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections
diff --git a/c/src/lib/libbsp/arm/shared/start/start.S 
b/c/src/lib/libbsp/arm/shared/start/start.S
old mode 100644
new mode 100755
index 30501be..cb3bff7
--- a/c/src/lib/libbsp/arm/shared/start/start.S
+++ b/c/src/lib/libbsp/arm/shared/start/start.S
@@ -19,9 +19,9 @@
  */
 #include 
-#include 
+#include 
#include 
-
+
#include 
#include 
#include 
@@ -265,6 +265,7 @@ bsp_start_skip_hyp_svc_switch:
   /* Stay in SVC mode */
 #ifdef ARM_MULTILIB_VFP
+#ifndef ARM_MULTILIB_ARCH_V5TEJ
   /* Read CPACR */
   mrc p15, 0, r0, c1, c0, 2
@@ -280,11 +281,18 @@ bsp_start_skip_hyp_svc_switch:
   /* Write CPACR */
   mcr p15, 0, r0, c1, c0, 2
   isb
+#endif
/* Enable FPU */
   mov r0, #(1 << 30)
   vmsr FPEXC, r0
+#ifdef ARM_MULTILIB_ARCH_V5TEJ
+ /* Enable FPU Run Fast*/
+ mov r0, #(3 << 24)
+ vmsr FPSCR, r0
+#endif
+
#ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
   bl bsp_start_init_registers_vfp
#endif
@@ -399,6 +407,7 @@ _start:
#endif
 #ifdef ARM_MULTILIB_VFP
+#ifndef ARM_MULTILIB_ARCH_V5TEJ
   /*
* Enable CP10 and CP11 coprocessors for privileged and user 
mode in
* CPACR (bits 20-23).  Ensure that write to register completes.
@@ -409,6 +418,7 @@ _start:
   str   r1, [r0]
   dsb
   isb
+#endif
 #ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
   bl bsp_start_init_registers_vfp
diff --git a/cpukit/score/cpu/arm/arm-context-validate.S 
b/cpukit/score/cpu/arm/arm-context-validate.S
old mode 100644
new mode 100755
index fdfb6c1..6485993
--- a/cpukit/score/cpu/arm/arm-context-validate.S
+++ b/cpukit/score/cpu/arm/arm-context-validate.S
@@ -46,7 +46,11 @@
.section .text
+#ifdef __thumb__
FUNCTION_THUMB_ENTRY(_CPU_Context_validate)
+#else
+FUNCTION_ENTRY(_CPU_Context_validate)
+#endif
/* Save */
@@ -99,12 +103,16 @@ FUNCTION_THUMB_ENTRY(_CPU_Context_validate)
#ifdef ARM_MULTILIB_VFP
   /* R3 contains the FPSCR */
   vmrs  r3, FPSCR
+#ifdef ARM_MULTILIB_ARCH_V5TEJ
+ ldr  r4, =0xf01f
+#else
   movs r4, #0x001f
#ifdef ARM_MULTILIB_ARCH_V7M
   movt r4, #0xf000
#else
   movt r4, #0xf800
#endif
+#endif
   bic  r3, r3, r4
   andr4, r4, r0
   orr  r3, r3, r4
diff --git a/cpukit/score/cpu/arm/arm-context-volatile-clobber.S 
b/cpukit/score/cpu/arm/arm-context-volatile-clobber.S
old mode 100644
new mode 100755
index 7970b8e..cf3f428
--- a/cpukit/score/cpu/arm/arm-context-volatile-clobber.S
+++ b/cpukit/score/cpu/arm/arm-context-volatile-clobber.S
@@ -20,7 +20,11 @@
.section .text
+#ifdef __thumb__
FUNCTION_THUMB_ENTRY(_CPU_Context_volatile_clobber)
+#else
+FUNCTION_ENTRY(_CPU_Context_volatile_clobber)
+#endif
 .macro clobber_register reg
   sub r0, r0, #1
@@ -29,8 +33,12 @@ FUNCTION_THUMB_ENTRY(_CPU_Context_volatile_clobber)
 #ifdef ARM_MULTILIB_VFP
   vmrs  r1, FPSCR
+#ifdef ARM_MULTILIB_ARCH_V5TEJ
+ ldr  r2, =0xf81f
+#else
   movs r2, #0x001f
   movt r2, #0xf800
+#endif
   bic  r1, r1, r2
   andr2, r2, r0
   orr  r1, r1, r2
diff --git a/cpukit/score/cpu/arm/rtems/score/arm.h 
b/cpukit/score/cpu/arm/rtems/score/arm.h
old mode 100644
new mode 100755
index 666ee54..929585e
--- a/cpukit/score/cpu/arm/rtems/score/arm.h
+++ b/cpukit/score/cpu/arm/rtems/score/arm.h
@@ -35,6 +35,10 @@ extern "C" {
#elif defined(__ARM_ARCH_6M__)
   #define CPU_MODEL_NAME "ARMv6M"
   #define ARM_MULTILIB_ARCH_V6M
+#elif defined(__ARM_ARCH_5TEJ__)
+  #define CPU_MODEL_NAME "ARMv5TEJ"
+  #define ARM_MULTILIB_ARCH_V5TEJ
+  #define ARM_MULTILIB_ARCH_V4
#else
   #define CPU_MODEL_NAME "ARMv4"
   #define ARM_MULTILIB_ARCH_V4
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

lpc32xx and rtems-libbsd

2016-08-18 Thread Kirspel, Kevin
I have created a libbsd port for a modified version of the lpc32xx BSP.  The 
lpc code from FREEBSD 10 was backported to FREEBSD 9.3 because FREEBSD 9.3 did 
not support ARM LPC processors.  I ran into some issues that I would like to 
run by the group.

Issue 1 - the order of declared modules in nexus-devices.h does not guarantee 
that they will come up in that order on boot up.

a.   The lpc code consists of multiple modules that need to be instantiated 
in a particular order.  When running the libbsd testsuite (mainly dhcp01 and 
usb01), the boot up order of the modules was different for each test.  In one 
case it was OK but the other was not.

b.   To have some control over the ordering, I added order support to 
RTEMS_BSD_DEFINE_NEXUS_DEVICE (RTEMS_BSD_DEFINE_NEXUS_DEVICE_ORDERED). This is 
modeled off of what FREEBSD does for DRIVER_MODULE (DRIVER_MODULE_ORDERED).   A 
small change to rtems-kernel-nexus.c was needed to support this.

Issue 2 - rtems_bsd_get_mac_address() , rtems_bsd_get_task_priority(), and 
rtems_bsd_get_task_stack_size() are application dependent.  Are we against 
creating a configuration structure to initialize these things before 
rtems_bsd_initialize() is called?  At a bare minimum, the RTEMS BSP could set 
some variables used by libbsd.

Kevin Kirspel
Electrical Engineer - Sr. Staff
Opti Medical
235 Hembree Park Drive
Roswell GA 30076
Tel: (770)-510- ext. 81642
Direct: (770)-688-1642
Fax: (770)-510-4445
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/2] RTEMS Source Builder changes for lpc32xx VFP support

2016-08-18 Thread Sebastian Huber



On 19/08/16 02:11, Kirspel, Kevin wrote:


diff --git 
a/source-builder/patches/gcc-6.1.1-arm-eabi-multilib-20160816.diff 
b/source-builder/patches/gcc-6.1.1-arm-eabi-multilib-20160816.diff


index e69de29..d2f0bfd 100755

--- a/source-builder/patches/gcc-6.1.1-arm-eabi-multilib-20160816.diff

+++ b/source-builder/patches/gcc-6.1.1-arm-eabi-multilib-20160816.diff

@@ -0,0 +1,18 @@

+diff -ruN gcc-6-20160609.orig/gcc/config/arm/t-rtems 
gcc-6-20160609/gcc/config/arm/t-rtems


+--- gcc-6-20160609.orig/gcc/config/arm/t-rtems 2016-01-15 
03:29:12.0 -0800


 gcc-6-20160609/gcc/config/arm/t-rtems2016-08-16 
11:42:02.727219302 -0700


+@@ -1,7 +1,7 @@

+ # Custom RTEMS multilibs for ARM

+

+-MULTILIB_OPTIONS  = mbig-endian mthumb 
march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m/mcpu=cortex-m7 
mfpu=neon/mfpu=vfpv3-d16/mfpu=fpv4-sp-d16/mfpu=fpv5-d16 mfloat-abi=hard


+-MULTILIB_DIRNAMES = eb thumb armv6-m armv7-a armv7-r armv7-m 
cortex-m7 neon vfpv3-d16 fpv4-sp-d16 fpv5-d16 hard


++MULTILIB_OPTIONS  = mbig-endian mthumb 
march=armv6-m/march=armv7-a/march=armv7-r/march=armv7-m/mcpu=cortex-m7 
mfpu=neon/mfpu=vfp/mfpu=vfpv3-d16/mfpu=fpv4-sp-d16/mfpu=fpv5-d16 
mfloat-abi=hard/mfloat-abi=softfp


++MULTILIB_DIRNAMES = eb thumb armv6-m armv7-a armv7-r armv7-m 
cortex-m7 neon vfp vfpv3-d16 fpv4-sp-d16 fpv5-d16 hard softfp


+

+ # Enumeration of multilibs

+

+@@ -19,3 +19,4 @@

+ MULTILIB_REQUIRED += mthumb/mcpu=cortex-m7/mfpu=fpv5-d16/mfloat-abi=hard

+ MULTILIB_REQUIRED += mthumb/march=armv7-m

+ MULTILIB_REQUIRED += mthumb

++MULTILIB_REQUIRED += mfpu=vfp/mfloat-abi=softfp



Why do you want to use the softfp ABI?

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 2/2] RTEMS changes for lpc32xx VFP support

2016-08-18 Thread Sebastian Huber



On 19/08/16 02:16, Kirspel, Kevin wrote:


diff --git a/c/src/lib/libbsp/arm/lpc32xx/make/custom/lpc32xx.inc 
b/c/src/lib/libbsp/arm/lpc32xx/make/custom/lpc32xx.inc


old mode 100644

new mode 100755

index f184741..1d478ce

--- a/c/src/lib/libbsp/arm/lpc32xx/make/custom/lpc32xx.inc

+++ b/c/src/lib/libbsp/arm/lpc32xx/make/custom/lpc32xx.inc

@@ -6,7 +6,8 @@ include $(RTEMS_ROOT)/make/custom/default.cfg

 RTEMS_CPU = arm

-CPU_CFLAGS = -mcpu=arm926ej-s -mthumb

+#CPU_CFLAGS = -mcpu=arm926ej-s -mthumb

+CPU_CFLAGS = -mcpu=arm926ej-s -mfpu=vfp -mfloat-abi=softfp

 CFLAGS_OPTIMIZE_V ?= -O2 -g

CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections

diff --git a/c/src/lib/libbsp/arm/shared/start/start.S 
b/c/src/lib/libbsp/arm/shared/start/start.S


old mode 100644

new mode 100755

index 30501be..cb3bff7

--- a/c/src/lib/libbsp/arm/shared/start/start.S

+++ b/c/src/lib/libbsp/arm/shared/start/start.S

@@ -19,9 +19,9 @@

  */

 #include 

-#include 

+#include 

#include 

-

+

#include 

#include 

#include 

@@ -265,6 +265,7 @@ bsp_start_skip_hyp_svc_switch:

   /* Stay in SVC mode */

 #ifdef ARM_MULTILIB_VFP

+#ifndef ARM_MULTILIB_ARCH_V5TEJ



I think a multilib define reflecting the VFP feature set would be better 
instead of this ARM_MULTILIB_ARCH_V5TEJ.



   /* Read CPACR */

   mrc p15, 0, r0, c1, c0, 2

@@ -280,11 +281,18 @@ bsp_start_skip_hyp_svc_switch:

   /* Write CPACR */

   mcr p15, 0, r0, c1, c0, 2

   isb

+#endif

/* Enable FPU */

   mov r0, #(1 << 30)

   vmsr FPEXC, r0

+#ifdef ARM_MULTILIB_ARCH_V5TEJ

+ /* Enable FPU Run Fast*/

+ mov r0, #(3 << 24)

+ vmsr FPSCR, r0

+#endif

+

#ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION

   bl bsp_start_init_registers_vfp

#endif

@@ -399,6 +407,7 @@ _start:

#endif

 #ifdef ARM_MULTILIB_VFP

+#ifndef ARM_MULTILIB_ARCH_V5TEJ

   /*

* Enable CP10 and CP11 coprocessors for privileged and 
user mode in


* CPACR (bits 20-23). Ensure that write to register 
completes.


@@ -409,6 +418,7 @@ _start:

   str   r1, [r0]

   dsb

   isb

+#endif

 #ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION

   bl bsp_start_init_registers_vfp

diff --git a/cpukit/score/cpu/arm/arm-context-validate.S 
b/cpukit/score/cpu/arm/arm-context-validate.S


old mode 100644

new mode 100755

index fdfb6c1..6485993

--- a/cpukit/score/cpu/arm/arm-context-validate.S

+++ b/cpukit/score/cpu/arm/arm-context-validate.S

@@ -46,7 +46,11 @@

.section .text

+#ifdef __thumb__

FUNCTION_THUMB_ENTRY(_CPU_Context_validate)

+#else

+FUNCTION_ENTRY(_CPU_Context_validate)

+#endif



I checked in a slightly modified version for the VFP context validation.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel