Help with RTEMS C User’s Guide

2017-01-23 Thread Tanu Hari Dixit
Hello Devs,

I have been trying to setup a makefile so as to execute the various code
snippets given in the C User's guide for RTEMS (https://docs.rtems.org/doc-
current/share/rtems/html/c_user/index.html#SEC_Contents) and have failed
miserably. Can you please help me with this?

I have made a file with the first example of printing object names (
https://docs.rtems.org/doc-current/share/rtems/html/c_
user/Key-Concepts-Object-Names.html#Key-Concepts-Object-Names) and i use
the following command to use sparc-rtems4.12-gcc to compile this program

sparc-rtems4.12-gcc --pipe -B/home/thd/development/rtems/
src/builds/erc32_1/sparc-rtems4.12/erc32/lib -specs bsp_specs -qrtems -Wall
-g -O2 -o rtems_object_try rtems_object_try.c

but when i do ./rtems_object_try I get:

./rtems_object_try: Invalid argument

I narrowed in on the above compiler command by reading the makefile as
given here(https://github.com/alanc98/rki/blob/master/Makefile).

What is it that I am missing?

Also is it necessary to use sparc-rtems4.12-gcc and not the gcc available
to me normally on my machine. When I use gcc,
I get the following error:


thd@thd-Inspiron-5537:~/development/rtems/src/programs/rtems_object$ gcc
--pipe 
-B/home/thd/development/rtems/src/builds/erc32_1/sparc-rtems4.12/erc32/lib
-specs bsp_specs -qrtems -Wall -g -O2 -o rtems_object_try
rtems_object_try.c
In file included from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/score/object.h:26:0,
 from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/score/thread.h:30,
 from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/score/heap.h:22,
 from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/rtems/types.h:26,
 from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems.h:31,
 from rtems_object_try.c:1:
/home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/score/rbtree.h:21:22: fatal error:
sys/tree.h: No such file or directory
 #include 
  ^
compilation terminated.



I am not able to understand what is wrong. It would be great if you could
point that out.
Thank you,
Tanu Hari Dixit.
#include 
#include 

void print_main(rtems_id id)
{
char buffer[10];
char *result;
result = rtems_object_get_name( id, sizeof(buffer), buffer);
printk( "ID=0x%08lx name=%s\n", id, ((result)? result: "no name"));
}

int main()
{
print_main(1);
}
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/2] Adding ARM VFP V2 support

2017-01-23 Thread Sebastian Huber
In this case the FPU is no longer in full-compliance with EEE 754. I 
don't think this should be set by the startup code depending on some BSP 
optimization options. I guess the paranoia test fails if you enable this.


On 23/01/17 15:43, Kirspel, Kevin wrote:

Yes

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

-Original Message-
From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de]
Sent: Monday, January 23, 2017 9:37 AM
To: Kirspel, Kevin ; devel@rtems.org
Subject: Re: [PATCH 1/2] Adding ARM VFP V2 support



On 23/01/17 14:51, Kevin Kirspel wrote:

+#ifdef __FAST_MATH__
+   /* Enable Fast FPU options */
+   mov r0, #(3 << 24)
+   vmsr FPSCR, r0
+#endif

This define is related to the GCC fast-math optimization option.



--
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: Help regarding contributing to RTEMS

2017-01-23 Thread Joel Sherrill
On Sun, Jan 22, 2017 at 10:25 AM, vathsa sri 
wrote:

> Hello !!
>
> My name is Sri Vathsa. I am sophomore at IIT Roorkee, India, pursuing my
> B.Tech in Electronics and Communication. I am new to open source and would
> like to contribute to RTEMS . I have been using python for the last couple
> of years and C for the past few months. Can anyone help me out with where I
> can start for contributing and any other prerequisites you think are
> necessary ?
>
>
Welcome to the project!

Are you planning on participating in Google Summer of Code?

We have a Hello World exercise that is recommended for everyone
getting started and required for GSOC and SOCIS students.
I would start there. Once you are through that, we can begin to
discuss projects.

We use Python on the host side for scripting. There are a number
of projects in this area.

On the target side, we primarily use C. There are projects here
as well but the most desirable ones from a project perspective
are likely to be host side Python ones. That's just my opinion though.


--joel


> Thanks !
>
> Regards,
> Sri Vathsa
>
> ___
> 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] bsps/sparc: Remove tlib clock driver

2017-01-23 Thread Sebastian Huber
This driver lacked several features and cannot support SMP
configurations.  Use the standard clock driver instead.
---
 c/src/lib/libbsp/sparc/leon3/Makefile.am  |   5 +-
 c/src/lib/libbsp/sparc/leon3/clock/ckinit.c   |  10 -
 c/src/lib/libbsp/sparc/shared/include/tlib.h  |   8 -
 c/src/lib/libbsp/sparc/shared/timer/tlib_ckinit.c | 290 --
 4 files changed, 2 insertions(+), 311 deletions(-)
 delete mode 100644 c/src/lib/libbsp/sparc/shared/timer/tlib_ckinit.c

diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am 
b/c/src/lib/libbsp/sparc/leon3/Makefile.am
index f2f690e..42084c2 100644
--- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
@@ -68,13 +68,12 @@ libbsp_a_SOURCES += ../../sparc/shared/amba/ambapp_names.c
 libbsp_a_SOURCES += ../../sparc/shared/amba/ambapp_show.c
 libbsp_a_SOURCES += ../../sparc/shared/amba/ahbstat.c
 
-# Clock Driver and Timer Library
+# Timer Library
 include_bsp_HEADERS += ../../sparc/shared/include/gptimer.h
 include_bsp_HEADERS += ../../sparc/shared/include/tlib.h
 libbsp_a_SOURCES += ../../sparc/shared/timer/gptimer.c
 libbsp_a_SOURCES += ../../sparc/shared/timer/tlib.c
-libbsp_a_SOURCES += ../../sparc/shared/timer/tlib_ckinit.c
-# non-Driver Manager Clock Implementation
+# Clock Driver
 libbsp_a_SOURCES += clock/ckinit.c
 libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
 
diff --git a/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c 
b/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
index f2372ec..ca0d0c7 100644
--- a/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
+++ b/c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
@@ -28,14 +28,6 @@
 #include 
 #include 
 
-/* The LEON3 BSP Timer driver can rely on the Driver Manager if the
- * DrvMgr is initialized during startup. Otherwise the classic driver
- * must be used.
- *
- * The DrvMgr Clock driver is located in the shared/timer directory
- */
-#ifndef RTEMS_DRVMGR_STARTUP
-
 /* LEON3 Timer system interrupt number */
 static int clkirq;
 
@@ -281,5 +273,3 @@ static void leon3_clock_initialize(void)
 #define Clock_driver_timecounter_tick() leon3_tc_do_tick()
 
 #include "../../../shared/clockdrv_shell.h"
-
-#endif
diff --git a/c/src/lib/libbsp/sparc/shared/include/tlib.h 
b/c/src/lib/libbsp/sparc/shared/include/tlib.h
index 7e6c49a..118722b 100644
--- a/c/src/lib/libbsp/sparc/shared/include/tlib.h
+++ b/c/src/lib/libbsp/sparc/shared/include/tlib.h
@@ -54,14 +54,6 @@ struct tlib_dev {
struct tlib_drv *drv;
 };
 
-#ifdef RTEMS_DRVMGR_STARTUP
-/* Clock Driver Timer register function. Only used when the TLIB-Clock
- * driver is used. A specific Timer is registered as the System Clock
- * timer.
- */
-extern void Clock_timer_register(int timer_number);
-#endif
-
 /* Register Timer. Called by Timer Drivers in order to register
  * a Timer to the Timer Library. The registration order determines
  * the Timer Number used in tlib_open() to identify a specific
diff --git a/c/src/lib/libbsp/sparc/shared/timer/tlib_ckinit.c 
b/c/src/lib/libbsp/sparc/shared/timer/tlib_ckinit.c
deleted file mode 100644
index 2848f4c..000
--- a/c/src/lib/libbsp/sparc/shared/timer/tlib_ckinit.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- *  Clock Tick Device Driver using Timer Library implemented
- *  by the GRLIB GPTIMER / LEON2 Timer drivers.
- *
- *  COPYRIGHT (c) 2010.
- *  Cobham Gaisler AB.
- *
- *  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 
-#include 
-#include 
-#include 
-
-#ifdef RTEMS_DRVMGR_STARTUP
-
-/* Undefine this to save space in standard LEON configurations,
- * it will assume that Prescaler is running at 1MHz.
- */
-#undef CLOCK_DRIVER_DONT_ASSUME_PRESCALER_1MHZ
-
-/* Set the below defines from bsp.h if function needed.
-#undef CLOCK_DRIVER_ISRS_PER_TICK
-#undef CLOCK_DRIVER_USE_FAST_IDLE
-*/
-
-/*
- *  Number of Clock ticks since initialization
- */
-volatile uint32_t Clock_driver_ticks;
-
-/*
- *  Timer Number in Timer Library. Defaults to the first Timer in
- *  the System.
- */
-int Clock_timer = 0;
-
-/*
- * Timer Handle in Timer Library
- */
-void *Clock_handle = NULL;
-
-#ifdef CLOCK_DRIVER_DONT_ASSUME_PRESCALER_1MHZ
-unsigned int Clock_basefreq;
-#endif
-
-void Clock_exit(void);
-void Clock_isr(void *arg_unused);
-
-static rtems_timecounter_simple tlib_tc;
-
-static uint32_t tlib_tc_get(rtems_timecounter_simple *tc)
-{
-  unsigned int clicks = 0;
-
-  if (Clock_handle != NULL) {
-tlib_get_counter(Clock_handle, );
-  }
-
-  return clicks;
-}
-
-static bool tlib_tc_is_pending(rtems_timecounter_simple *tc)
-{
-  bool pending = false;
-
-  if (Clock_handle != NULL) {
-pending = tlib_interrupt_pending(Clock_handle, 0) != 0;
-  }
-
-  return pending;
-}
-
-static uint32_t tlib_tc_get_timecount(struct timecounter *tc)
-{
-  return rtems_timecounter_simple_downcounter_get(
-tc,
-tlib_tc_get,
-

RE: [PATCH 1/2] Adding ARM VFP V2 support

2017-01-23 Thread Kirspel, Kevin
Yes

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

-Original Message-
From: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de] 
Sent: Monday, January 23, 2017 9:37 AM
To: Kirspel, Kevin ; devel@rtems.org
Subject: Re: [PATCH 1/2] Adding ARM VFP V2 support



On 23/01/17 14:51, Kevin Kirspel wrote:
> +#ifdef __FAST_MATH__
> + /* Enable Fast FPU options */
> + mov r0, #(3 << 24)
> + vmsr FPSCR, r0
> +#endif

This define is related to the GCC fast-math optimization option.

-- 
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 1/2] Adding ARM VFP V2 support

2017-01-23 Thread Sebastian Huber



On 23/01/17 14:51, Kevin Kirspel wrote:

+#ifdef __FAST_MATH__
+   /* Enable Fast FPU options */
+   mov r0, #(3 << 24)
+   vmsr FPSCR, r0
+#endif


This define is related to the GCC fast-math optimization option.

--
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


[PATCH] sparc: Relax CPU_STACK_ALIGNMENT

2017-01-23 Thread Sebastian Huber
Close #2352.
---
 cpukit/score/cpu/sparc/rtems/score/cpu.h | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h 
b/cpukit/score/cpu/sparc/rtems/score/cpu.h
index 6d8e1f9..a59fc36 100644
--- a/cpukit/score/cpu/sparc/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h
@@ -826,19 +826,10 @@ extern const CPU_Trap_table_entry _CPU_Trap_slot_template;
 #define CPU_PARTITION_ALIGNMENTCPU_ALIGNMENT
 
 /**
- * This number corresponds to the byte alignment requirement for the
- * stack.  This alignment requirement may be stricter than that for the
- * data types alignment specified by CPU_ALIGNMENT.  If the CPU_ALIGNMENT
- * is strict enough for the stack, then this should be set to 0.
- *
- * NOTE:  This must be a power of 2 either 0 or greater than CPU_ALIGNMENT.
- *
- * The alignment restrictions for the SPARC are not that strict but this
- * should unsure that the stack is always sufficiently alignment that the
- * window overflow, underflow, and flush routines can use double word loads
- * and stores.
+ * Stack frames must be doubleword aligned according to the System V ABI for
+ * SPARC.
  */
-#define CPU_STACK_ALIGNMENT16
+#define CPU_STACK_ALIGNMENT CPU_ALIGNMENT
 
 #ifndef ASM
 
-- 
1.8.4.5

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


[PATCH 1/2] Adding ARM VFP V2 support

2017-01-23 Thread Kevin Kirspel
---
 c/src/lib/libbsp/arm/shared/start/start.S | 14 --
 cpukit/score/cpu/arm/rtems/score/arm.h|  6 ++
 2 files changed, 18 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 c/src/lib/libbsp/arm/shared/start/start.S
 mode change 100644 => 100755 cpukit/score/cpu/arm/rtems/score/arm.h

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 7adcb44..33d4e64
--- 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 
@@ -274,6 +274,7 @@ bsp_start_skip_hyp_svc_switch:
/* Stay in SVC mode */
 
 #ifdef ARM_MULTILIB_VFP
+#ifdef ARM_MULTILIB_HAS_CPACR
/* Read CPACR */
mrc p15, 0, r0, c1, c0, 2
 
@@ -289,11 +290,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 __FAST_MATH__
+   /* Enable Fast FPU options */
+   mov r0, #(3 << 24)
+   vmsr FPSCR, r0
+#endif
+
 #ifdef BSP_START_NEEDS_REGISTER_INITIALIZATION
bl bsp_start_init_registers_vfp
 #endif
@@ -408,6 +416,7 @@ _start:
 #endif
 
 #ifdef ARM_MULTILIB_VFP
+#ifdef ARM_MULTILIB_HAS_CPACR
/*
 * Enable CP10 and CP11 coprocessors for privileged and user mode in
 * CPACR (bits 20-23).  Ensure that write to register completes.
@@ -418,6 +427,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/rtems/score/arm.h 
b/cpukit/score/cpu/arm/rtems/score/arm.h
old mode 100644
new mode 100755
index 666ee54..f08da1d
--- a/cpukit/score/cpu/arm/rtems/score/arm.h
+++ b/cpukit/score/cpu/arm/rtems/score/arm.h
@@ -58,6 +58,12 @@ extern "C" {
   #define ARM_MULTILIB_CACHE_LINE_MAX_64
 #endif
 
+#if defined(__ARM_ARCH_7A__) \
+  || defined(__ARM_ARCH_7M__) \
+  || defined(__ARM_ARCH_7EM__)
+  #define ARM_MULTILIB_HAS_CPACR
+#endif
+
 #if !defined(__SOFTFP__)
   #if defined(__ARM_NEON__)
 #define ARM_MULTILIB_VFP_D32
-- 
1.9.1

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


[PATCH 2/2] Enable/Disable vector routines now check for a valid vector. Without these guards, the Enable/Disable vector routines will not work with the interrupt server

2017-01-23 Thread Kevin Kirspel
---
 c/src/lib/libbsp/arm/lpc32xx/irq/irq.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)
 mode change 100644 => 100755 c/src/lib/libbsp/arm/lpc32xx/irq/irq.c

diff --git a/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c 
b/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
old mode 100644
new mode 100755
index 77a0c19..8657140
--- a/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
+++ b/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
@@ -269,10 +269,12 @@ rtems_status_code 
bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
   rtems_interrupt_level level;

-  rtems_interrupt_disable(level);
-  lpc32xx_irq_set_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
-  lpc32xx_irq_set_bit_in_field(vector, _irq_enable);
-  rtems_interrupt_enable(level);
+  if (lpc32xx_irq_is_valid(vector)) {
+rtems_interrupt_disable(level);
+lpc32xx_irq_set_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
+lpc32xx_irq_set_bit_in_field(vector, _irq_enable);
+rtems_interrupt_enable(level);
+  }

   return RTEMS_SUCCESSFUL;
 }
@@ -281,10 +283,12 @@ rtems_status_code 
bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
   rtems_interrupt_level level;

-  rtems_interrupt_disable(level);
-  lpc32xx_irq_clear_bit_in_field(vector, _irq_enable);
-  lpc32xx_irq_clear_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
-  rtems_interrupt_enable(level);
+  if (lpc32xx_irq_is_valid(vector)) {
+rtems_interrupt_disable(level);
+lpc32xx_irq_clear_bit_in_field(vector, _irq_enable);
+lpc32xx_irq_clear_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
+rtems_interrupt_enable(level);
+  }

   return RTEMS_SUCCESSFUL;
 }
--
1.9.1

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