[PATCH] xz: Use CRC32

2017-06-12 Thread Sebastian Huber
This reverts c475924d6d2ea7d5cba160a8a28e88642d6b46d8.

Update #2909.
Close #2994.
---
 cpukit/libmisc/Makefile.am| 2 +-
 cpukit/libmisc/xz/xz_config.h | 7 +--
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/cpukit/libmisc/Makefile.am b/cpukit/libmisc/Makefile.am
index dda5b996a5..d8fa47a2a5 100644
--- a/cpukit/libmisc/Makefile.am
+++ b/cpukit/libmisc/Makefile.am
@@ -195,7 +195,7 @@ libuuid_a_SOURCES = uuid/clear.c uuid/compare.c uuid/copy.c 
uuid/gen_uuid.c \
 
 ## xz-embedded
 noinst_LIBRARIES += libxz.a
-libxz_a_SOURCES = xz/xz/h xz/xz_crc32.c xz/xz_crc64.c \
+libxz_a_SOURCES = xz/xz/h xz/xz_crc32.c \
xz/xz_dec_lzma2.c xz/xz_dec_stream.c
 
 EXTRA_DIST += xz/README xz/COPING
diff --git a/cpukit/libmisc/xz/xz_config.h b/cpukit/libmisc/xz/xz_config.h
index 41faf4e69b..eb9dac1a4b 100644
--- a/cpukit/libmisc/xz/xz_config.h
+++ b/cpukit/libmisc/xz/xz_config.h
@@ -11,7 +11,7 @@
 #define XZ_CONFIG_H
 
 /* Uncomment to enable CRC64 support. */
-#define XZ_USE_CRC64
+/* #define XZ_USE_CRC64 */
 
 /* Uncomment as needed to enable BCJ filter decoders. */
 /* #define XZ_DEC_X86 */
@@ -62,10 +62,6 @@ typedef unsigned char bool;
  * NOTE: System headers on GNU/Linux may #define this macro already,
  * so if you want to change it, you need to #undef it first.
  */
-#ifdef __rtems__
-#  undef __always_inline
-#  define __always_inline inline
-#else
 #ifndef __always_inline
 #  ifdef __GNUC__
 #  define __always_inline \
@@ -74,7 +70,6 @@ typedef unsigned char bool;
 #  define __always_inline inline
 #  endif
 #endif
-#endif
 
 /* Inline functions to access unaligned unsigned 32-bit integers */
 #ifndef get_unaligned_le32
-- 
2.12.3

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


[PATCH] PR ada/81070 * s-interr-hwint.adb: Reinstate. * gcc-interface/Makefile.in (RTEMS): Use it again.

2017-06-12 Thread Sebastian Huber
From: ebotcazou 

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249116 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ada/ChangeLog |6 +
 gcc/ada/gcc-interface/Makefile.in |2 +-
 gcc/ada/s-interr-hwint.adb| 1110 +
 3 files changed, 1117 insertions(+), 1 deletion(-)
 create mode 100644 gcc/ada/s-interr-hwint.adb

diff --git a/gcc/ada/gcc-interface/Makefile.in 
b/gcc/ada/gcc-interface/Makefile.in
index 2dff5ab36e6..95221cdbe73 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1736,7 +1736,7 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),)
   s-taspri.adshttp://www.gnu.org/licenses/>.  --
+--  --
+-- GNARL was developed by the GNARL team at Florida State University.   --
+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
+--  --
+--
+
+--  Invariants:
+
+--  All user-handlable signals are masked at all times in all tasks/threads
+--  except possibly for the Interrupt_Manager task.
+
+--  When a user task wants to have the effect of masking/unmasking an signal,
+--  it must call Block_Interrupt/Unblock_Interrupt, which will have the effect
+--  of unmasking/masking the signal in the Interrupt_Manager task. These
+--  comments do not apply to vectored hardware interrupts, which may be masked
+--  or unmasked using routined interfaced to the relevant embedded RTOS system
+--  calls.
+
+--  Once we associate a Signal_Server_Task with an signal, the task never goes
+--  away, and we never remove the association. On the other hand, it is more
+--  convenient to terminate an associated Interrupt_Server_Task for a vectored
+--  hardware interrupt (since we use a binary semaphore for synchronization
+--  with the umbrella handler).
+
+--  There is no more than one signal per Signal_Server_Task and no more than
+--  one Signal_Server_Task per signal. The same relation holds for hardware
+--  interrupts and Interrupt_Server_Task's at any given time. That is, only
+--  one non-terminated Interrupt_Server_Task exists for a give interrupt at
+--  any time.
+
+--  Within this package, the lock L is used to protect the various status
+--  tables. If there is a Server_Task associated with a signal or interrupt,
+--  we use the per-task lock of the Server_Task instead so that we protect the
+--  status between Interrupt_Manager and Server_Task. Protection among service
+--  requests are ensured via user calls to the Interrupt_Manager entries.
+
+--  This is reasonably generic version of this package, supporting vectored
+--  hardware interrupts using non-RTOS specific adapter routines which should
+--  easily implemented on any RTOS capable of supporting GNAT.
+
+with Ada.Unchecked_Conversion;
+with Ada.Task_Identification;
+
+with Interfaces.C; use Interfaces.C;
+with System.OS_Interface; use System.OS_Interface;
+with System.Interrupt_Management;
+with System.Task_Primitives.Operations;
+with System.Storage_Elements;
+with System.Tasking.Utilities;
+
+with System.Tasking.Rendezvous;
+pragma Elaborate_All (System.Tasking.Rendezvous);
+
+package body System.Interrupts is
+
+   use Tasking;
+
+   package POP renames System.Task_Primitives.Operations;
+
+   function To_Ada is new Ada.Unchecked_Conversion
+ (System.Tasking.Task_Id, Ada.Task_Identification.Task_Id);
+
+   function To_System is new Ada.Unchecked_Conversion
+ (Ada.Task_Identification.Task_Id, Task_Id);
+
+   -
+   -- Local Tasks --
+   -
+
+   --  WARNING: System.Tasking.Stages performs calls to this task with low-
+   --  level constructs. Do not change this spec without synchronizing it.
+
+   task Interrupt_Manager is
+  entry Detach_Interrupt_Entries (T : Task_Id);
+
+  entry Attach_Handler
+(New_Handler : Parameterless_Handler;
+ Interrupt   : Interrupt_ID;
+ Static  : Boolean;
+ Restoration : Boolean := False);
+
+  entry Exchange_Handler
+(Old_Handler : out Parameterless_Handler;
+ New_Handler : Parameterless_Handler;
+ Interrupt   : Interrupt_ID;
+ Static  : Boolean);
+
+  entry Detach_Handler
+(Interrupt : Interrupt_ID;
+ Static: Boolean);
+
+  entry Bind_Interrupt_To_Entry
+(T : Task_Id;
+ E : Task_Entry_Index;
+ Interrupt : Interrupt_ID);
+
+  pragma Interrupt_Priority (System.Interrupt_Priority'First);
+   end Interrupt_Manager;
+
+   task type Interrupt_Server_Task
+ (Interrupt : Interrupt_ID;
+  Int_Sema  : Binary_Semaphore_Id)
+   is
+  --  Server task for vectored hardware interrupt handling
+
+  pragma Interrupt_Priority (Sy

Re: Interrupt handling for RISCV

2017-06-12 Thread Denis Obrezkov
2017-06-11 23:39 GMT+03:00 Hesham Almatary :

> On Mon, Jun 12, 2017 at 6:01 AM, Denis Obrezkov 
> wrote:
> > 2017-06-11 22:43 GMT+03:00 Hesham Almatary :
> >>
> >> Hi Denis,
> >>
> >>
> >>
> >> On Sun, Jun 11, 2017 at 11:52 PM, Denis Obrezkov
> >>  wrote:
> >> > Hello Hesham,
> >> >
> >> > I found out that your code in interrupt handling routine is outdated -
> >> Which interrupt handling routine? The port doesn't handle interrupts.
> >> The only relevant code is enable/disable interrupts, but it doesn't
> >> matter at this stage that it's outdated (as we don't have interrupts).
> >>
> >> > the format of mstatus and sstatus registers was changed.
> >> > I can produce some patches in a few days, though, I still don't
> >> > understand
> >> > how to deal with local and global interrupts.
> >> >
> >> Could you illustrate what do you mean by "global" and "local"
> >> interrupts? I still argue for a simple port that runs hello world, you
> >> don't need interrupts, so this shouldn't be a blocker for you.
> >>
> >> > --
> >> > Regards, Denis Obrezkov
> >>
> >>
> >>
> >> --
> >> Hesham
> >
> > RISC-V has local and global interrupt sources: Privileged ISA 1.10,
> chapter
> > 7.2.
> >
> Thanks for the reference. After reading this part, global interrupts
> are mapped to external interrupts that are not part of RISC-V ISA.
> While local interrupts are per-hart and defined/controlled by RISC-V
> ISA using mstatus/mip/sip registers. For example, if you're going to
> implement interrupts-based UART driver (platform/BSP specific), you'll
> need global/external interrupts hence PLIC. On the other hand, when
> you implement timer driver, you'll use local interrupts (RISC-V/ISA
> specific).
>
> >
> >
> > --
> > Regards, Denis Obrezkov
>
>
>
> --
> Hesham
>

Yes, thanks, I found the answer for my question -
when a PLIC interrupt occurs, it raises a global interrupt, which has the
exception
code of eleven (E31-Coreplex Manual, 6.2). Thus, we should place our global
interrupts' handler with the offset of 0x2c.

-- 
Regards, Denis Obrezkov
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] PR ada/81070 * s-interr-hwint.adb: Reinstate. * gcc-interface/Makefile.in (RTEMS): Use it again.

2017-06-12 Thread Joel Sherrill
What happened to this code?

Is the BSP install handlers method still being invoked for exceptions?

On Jun 12, 2017 6:22 AM, "Sebastian Huber" <
sebastian.hu...@embedded-brains.de> wrote:

> From: ebotcazou 
>
> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@249116
> 138bc75d-0d04-0410-961f-82ee72b054a4
> ---
>  gcc/ada/ChangeLog |6 +
>  gcc/ada/gcc-interface/Makefile.in |2 +-
>  gcc/ada/s-interr-hwint.adb| 1110 ++
> +++
>  3 files changed, 1117 insertions(+), 1 deletion(-)
>  create mode 100644 gcc/ada/s-interr-hwint.adb
>
> diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/
> Makefile.in
> index 2dff5ab36e6..95221cdbe73 100644
> --- a/gcc/ada/gcc-interface/Makefile.in
> +++ b/gcc/ada/gcc-interface/Makefile.in
> @@ -1736,7 +1736,7 @@ ifeq ($(strip $(filter-out rtems%,$(target_os))),)
>s-taspri.adss-tpopsp.adbs-stchop.adb -  s-interr.adb +  s-interr.adb  endif
>
>  # PikeOS
> diff --git a/gcc/ada/s-interr-hwint.adb b/gcc/ada/s-interr-hwint.adb
> new file mode 100644
> index 000..8e2950f30fb
> --- /dev/null
> +++ b/gcc/ada/s-interr-hwint.adb
> @@ -0,0 +1,1110 @@
> +---
> ---
> +--
>   --
> +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS
>--
> +--
>   --
> +-- S Y S T E M . I N T E R R U P T S
>   --
> +--
>   --
> +--  B o d y
>--
> +--
>   --
> +-- Copyright (C) 1992-2014, Free Software Foundation, Inc.
>   --
> +--
>   --
> +-- GNARL is free software; you can  redistribute it  and/or modify it
> under --
> +-- terms of the  GNU General Public License as published  by the Free
> Soft- --
> +-- ware  Foundation;  either version 3,  or (at your option) any later
> ver- --
> +-- sion.  GNAT is distributed in the hope that it will be useful, but
> WITH- --
> +-- OUT ANY WARRANTY;  without even the  implied warranty of
> MERCHANTABILITY --
> +-- or FITNESS FOR A PARTICULAR PURPOSE.
>--
> +--
>   --
> +-- As a special exception under Section 7 of GPL version 3, you are
> granted --
> +-- additional permissions described in the GCC Runtime Library
> Exception,   --
> +-- version 3.1, as published by the Free Software Foundation.
>--
> +--
>   --
> +-- You should have received a copy of the GNU General Public License and
>   --
> +-- a copy of the GCC Runtime Library Exception along with this program;
>--
> +-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
>   --
> +-- .
> --
> +--
>   --
> +-- GNARL was developed by the GNARL team at Florida State University.
>--
> +-- Extensive contributions were provided by Ada Core Technologies, Inc.
>--
> +--
>   --
> +---
> ---
> +
> +--  Invariants:
> +
> +--  All user-handlable signals are masked at all times in all
> tasks/threads
> +--  except possibly for the Interrupt_Manager task.
> +
> +--  When a user task wants to have the effect of masking/unmasking an
> signal,
> +--  it must call Block_Interrupt/Unblock_Interrupt, which will have the
> effect
> +--  of unmasking/masking the signal in the Interrupt_Manager task. These
> +--  comments do not apply to vectored hardware interrupts, which may be
> masked
> +--  or unmasked using routined interfaced to the relevant embedded RTOS
> system
> +--  calls.
> +
> +--  Once we associate a Signal_Server_Task with an signal, the task never
> goes
> +--  away, and we never remove the association. On the other hand, it is
> more
> +--  convenient to terminate an associated Interrupt_Server_Task for a
> vectored
> +--  hardware interrupt (since we use a binary semaphore for
> synchronization
> +--  with the umbrella handler).
> +
> +--  There is no more than one signal per Signal_Server_Task and no more
> than
> +--  one Signal_Server_Task per signal. The same relation holds for
> hardware
> +--  interrupts and Interrupt_Server_Task's at any given time. That is,
> only
> +--  one non-terminated Interrupt_Server_Task exists for a give interrupt
> at
> +--  any time.
> +
> +--  Within this package, the lock L is used to protect the various status
> +--  tables. If there is a Server_Task associated with a signal or
> interrupt,
> +--  we use the per-task lock of the Server_Task instead so that we
> protect the
> +--  status between Interrupt_Manager and Server_Task. Protection among
> service
> +--  requests are ensured via user calls to the Interrupt_Manager entries.
> +
> +--  This is reasonably generic version of this package, supporting
> vectored
> +--  hardware interrupts using non-RTOS specific adapter routines which
> should
> +--  easily implemented on any RTOS capable of supporting GNAT.
> +
> +with Ada.Unchecked_Conversion;
> +with Ada.Task_Identification;
> +
> +with Interfaces.C; use Interfaces.C;
> +w

Re: [PATCH] PR ada/81070 * s-interr-hwint.adb: Reinstate. * gcc-interface/Makefile.in (RTEMS): Use it again.

2017-06-12 Thread Sebastian Huber

The main purpose of this e-mail was to use it as a patch.

On 12/06/17 14:23, Joel Sherrill wrote:

What happened to this code?

Is the BSP install handlers method still being invoked for exceptions?


I don't know how this stuff works, but Eric fixed it for us:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81070

--
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] PR ada/81070 * s-interr-hwint.adb: Reinstate. * gcc-interface/Makefile.in (RTEMS): Use it again.

2017-06-12 Thread Joel Sherrill
On Jun 12, 2017 7:55 AM, "Sebastian Huber" <
sebastian.hu...@embedded-brains.de> wrote:

The main purpose of this e-mail was to use it as a patch.


Eric B's comment and the history is clear. They "forgot" to add it for
RTEMS. This supports Ada interrupt tasks and clearly it disappeared for
RTEMS.

What are the BSP requirements for supporting this?



On 12/06/17 14:23, Joel Sherrill wrote:

> What happened to this code?
>
> Is the BSP install handlers method still being invoked for exceptions?
>

I don't know how this stuff works, but Eric fixed it for us:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81070

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

Risc-v memory issue

2017-06-12 Thread Denis Obrezkov
Hello all,

I was able to debug my program on top of HiFive1 board.
I found out that I can't use next and until commands from gdb,
they just hang gdb.
And now I have a problem, this is my backtrace:

#0  0x2041d728 in _User_extensions_Iterate (arg=0x80002eb8,
visitor=0x2041d64e <_User_extensions_Fatal_visitor>,
direction=CHAIN_ITERATOR_FORWARD)
at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/userextiterate.c:155
#1  0x20410ed4 in _User_extensions_Fatal (source=INTERNAL_ERROR_CORE,
error=2) at
../../cpukit/../../../hifive1/lib/include/rtems/score/userextimpl.h:307
#2  0x20410ef8 in _Terminate (the_source=INTERNAL_ERROR_CORE, the_error=2)
at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:35
#3  0x20410f40 in _Internal_error
(core_error=INTERNAL_ERROR_TOO_LITTLE_WORKSPACE) at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44
#4  0x2041e484 in _Workspace_Handler_initialization (areas=0x80002f78,
area_count=1, extend=0x0) at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/wkspace.c:123
#5  0x2040031c in bsp_work_area_initialize_default (area_begin=0x80001d58,
area_size=8872) at
../../../../../.././hifive1/lib/include/bsp/bootcard.h:147
#6  0x20400372 in bsp_work_area_initialize () at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../shared/bspgetworkarea.c:61
#7  0x2040f3ce in rtems_initialize_executive () at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/sapi/src/exinit.c:95
#8  0x204002cc in boot_card (cmdline=0x0) at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../shared/bootcard.c:76
#9  0x20400064 in _end_clear_bss () at
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/start/start.S:116

So, I think I should increase a workspace.
Now, I have some questions:
I took Hesham's linker file for riscv-generic, and there were no stack
space,
I allocated 0x1000 for stack. Should I make it zero again, or should I
decrease its size?
what size for stack should be enough?
And why there were no space for stack? is it possible to work without stack
allocated in
linkcmd file?
Can RTEMS work with a smaller workspace?

-- 
Regards, Denis Obrezkov
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Risc-v memory issue

2017-06-12 Thread Joel Sherrill
On Mon, Jun 12, 2017 at 11:09 AM, Denis Obrezkov 
wrote:

> Hello all,
>
> I was able to debug my program on top of HiFive1 board.
> I found out that I can't use next and until commands from gdb,
> they just hang gdb.
> And now I have a problem, this is my backtrace:
>
> #0  0x2041d728 in _User_extensions_Iterate (arg=0x80002eb8,
> visitor=0x2041d64e <_User_extensions_Fatal_visitor>,
> direction=CHAIN_ITERATOR_FORWARD)
> at /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/userextiterate.c:155
> #1  0x20410ed4 in _User_extensions_Fatal (source=INTERNAL_ERROR_CORE,
> error=2) at ../../cpukit/../../../hifive1/lib/include/rtems/score/
> userextimpl.h:307
> #2  0x20410ef8 in _Terminate (the_source=INTERNAL_ERROR_CORE,
> the_error=2) at /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:35
> #3  0x20410f40 in _Internal_error 
> (core_error=INTERNAL_ERROR_TOO_LITTLE_WORKSPACE)
> at /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44
>

^^

Looks like there isn't enough RAM for the amount of workspace needed. This
could indicate
that your address map is wrong or that the calculation in
bsp_work_area_initialize_default()
is doing the right thing and there really isn't enough RAM left after the
BSS.

Look at a symbol table sorted by address (nm -n -g) and look for the
various segment
boundaries. See how that corresponds to the address map of the board.

Also in gdb, you can poke at a program a bit without really loading it on a
target.
This can be done to look at the Configuration Table and other statically
initialized
data structures.

XXX-gdb hello.exe
(gdb) p Configuration


The first step is figuring out if this error is real or a side-effect of a
bad address map.

You probably should lower the minimum stack size for this architecture as
well
as the size of the starting stack. You don't have that much memory.



> #4  0x2041e484 in _Workspace_Handler_initialization (areas=0x80002f78,
> area_count=1, extend=0x0) at /home/reprofy/Projects/riscv/
> rtems/development/rtems/kernel/rtems-riscv/c/src/../..
> /cpukit/score/src/wkspace.c:123
> #5  0x2040031c in bsp_work_area_initialize_default
> (area_begin=0x80001d58, area_size=8872) at ../../../../../.././hifive1/
> lib/include/bsp/bootcard.h:147
> #6  0x20400372 in bsp_work_area_initialize () at
> /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../
> shared/bspgetworkarea.c:61
> #7  0x2040f3ce in rtems_initialize_executive () at
> /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/sapi/src/exinit.c:95
> #8  0x204002cc in boot_card (cmdline=0x0) at /home/reprofy/Projects/riscv/
> rtems/development/rtems/kernel/rtems-riscv/c/src/lib/
> libbsp/riscv32/hifive1/../../shared/bootcard.c:76
> #9  0x20400064 in _end_clear_bss () at /home/reprofy/Projects/riscv/
> rtems/development/rtems/kernel/rtems-riscv/c/src/lib/
> libbsp/riscv32/hifive1/start/start.S:116
>
> So, I think I should increase a workspace.
> Now, I have some questions:
> I took Hesham's linker file for riscv-generic, and there were no stack
> space,
> I allocated 0x1000 for stack. Should I make it zero again, or should I
> decrease its size?
> what size for stack should be enough?
> And why there were no space for stack? is it possible to work without
> stack allocated in
> linkcmd file?
> Can RTEMS work with a smaller workspace?
>
> --
> Regards, Denis Obrezkov
>
> ___
> 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] Importing inttypes.h library and related methods.

2017-06-12 Thread Aditya Upadhyay
---
 cpukit/Makefile.am  |  20 +++---
 cpukit/configure.ac |   4 +-
 cpukit/inttypes/Makefile.am |  14 
 cpukit/inttypes/imaxabs.c   |  44 +
 cpukit/inttypes/imaxdiv.c   |  53 
 cpukit/inttypes/strtoimax.c | 144 ++
 cpukit/inttypes/strtoumax.c | 135 +++
 cpukit/inttypes/wcstoimax.c | 151 
 cpukit/inttypes/wcstoumax.c | 144 ++
 cpukit/preinstall.am|  59 +
 10 files changed, 724 insertions(+), 44 deletions(-)
 create mode 100644 cpukit/inttypes/Makefile.am
 create mode 100644 cpukit/inttypes/imaxabs.c
 create mode 100644 cpukit/inttypes/imaxdiv.c
 create mode 100644 cpukit/inttypes/strtoimax.c
 create mode 100644 cpukit/inttypes/strtoumax.c
 create mode 100644 cpukit/inttypes/wcstoimax.c
 create mode 100644 cpukit/inttypes/wcstoumax.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 2c2f2e5..045017e 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -7,6 +7,7 @@ include $(top_srcdir)/automake/multilib.am
 _SUBDIRS = . score rtems sapi posix
 _SUBDIRS += dev
 _SUBDIRS += dtc/libfdt
+_SUBDIRS += inttypes
 _SUBDIRS += libcrypt
 _SUBDIRS += libcsupport libblock libfs
 _SUBDIRS += libdrvmgr
@@ -59,25 +60,22 @@ include_HEADERS += include/memory.h
 include_HEADERS += libmisc/xz/xz.h
 
 include_sys_HEADERS += libcsupport/include/sys/event.h
-include_sys_HEADERS += libcsupport/include/sys/poll.h
-include_sys_HEADERS += libcsupport/include/sys/statvfs.h
-include_sys_HEADERS += libcsupport/include/sys/utsname.h
-
-include_sys_HEADERS += include/sys/endian.h
-include_sys_HEADERS += include/sys/priority.h
-
-if !HAS_NEWLIB_20170522_HEADER
-include_sys_HEADERS += include/sys/_iovec.h
-include_sys_HEADERS += include/sys/uio.h
 include_sys_HEADERS += libcsupport/include/sys/filio.h
 include_sys_HEADERS += libcsupport/include/sys/ioccom.h
 include_sys_HEADERS += libcsupport/include/sys/ioctl.h
+include_sys_HEADERS += libcsupport/include/sys/poll.h
 include_sys_HEADERS += libcsupport/include/sys/sockio.h
+include_sys_HEADERS += libcsupport/include/sys/statvfs.h
 include_sys_HEADERS += libcsupport/include/sys/_termios.h
 include_sys_HEADERS += libcsupport/include/sys/termios.h
 include_sys_HEADERS += libcsupport/include/sys/ttycom.h
 include_sys_HEADERS += libcsupport/include/sys/ttydefaults.h
-endif
+include_sys_HEADERS += libcsupport/include/sys/utsname.h
+
+include_sys_HEADERS += include/sys/endian.h
+include_sys_HEADERS += include/sys/uio.h
+include_sys_HEADERS += include/sys/_iovec.h
+include_sys_HEADERS += include/sys/priority.h
 
 if LIBNETWORKING
 include_rtems_bsdnetdir = $(includedir)/rtems/bsdnet
diff --git a/cpukit/configure.ac b/cpukit/configure.ac
index 8d5b322..ad0865b 100644
--- a/cpukit/configure.ac
+++ b/cpukit/configure.ac
@@ -166,9 +166,6 @@ if test x"$RTEMS_USE_NEWLIB" = xyes ; then
   AC_CHECK_DECLS([__getreent],[],[RTEMS_TOOL_CHAIN_ERROR],[#include 
])
 fi
 
-AC_CHECK_HEADER([sys/socket.h],[],[])
-AM_CONDITIONAL(HAS_NEWLIB_20170522_HEADER,[test 
x"${ac_cv_header_sys_socket_h}" = xyes])
-
 RTEMS_CHECK_MULTIPROCESSING
 RTEMS_CHECK_POSIX_API
 RTEMS_CHECK_NETWORKING
@@ -464,6 +461,7 @@ score/cpu/sparc64/Makefile
 score/cpu/v850/Makefile
 score/cpu/no_cpu/Makefile
 posix/Makefile
+inttypes/Makefile
 libblock/Makefile
 libdrvmgr/Makefile
 libfs/Makefile
diff --git a/cpukit/inttypes/Makefile.am b/cpukit/inttypes/Makefile.am
new file mode 100644
index 000..c90b872
--- /dev/null
+++ b/cpukit/inttypes/Makefile.am
@@ -0,0 +1,14 @@
+include $(top_srcdir)/automake/multilib.am
+include $(top_srcdir)/automake/compile.am
+
+
+noinst_LIBRARIES = libinttypes.a
+
+libinttypes_a_SOURCES = imaxdiv.c imaxabs.c strtoimax.c strtoumax.c 
wcstoimax.c wcstoumax.c
+
+libinttypes_a_CPPFLAGS = $(AM_CPPFLAGS) 
+
+
+#include $(srcdir)/preinstall.am
+include $(top_srcdir)/automake/subdirs.am
+include $(top_srcdir)/automake/local.am
diff --git a/cpukit/inttypes/imaxabs.c b/cpukit/inttypes/imaxabs.c
new file mode 100644
index 000..fe9331f
--- /dev/null
+++ b/cpukit/inttypes/imaxabs.c
@@ -0,0 +1,44 @@
+/*-
+ *  Copyright (c) 2001 Mike Barcroft 
+ *  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *  1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ *  IMPLIED WARRANTIES OF MERCHANTABILITY 

[PATCH] Testsuite for inttypes.

2017-06-12 Thread Aditya Upadhyay
---
 testsuites/psxtests/Makefile.am|   1 +
 testsuites/psxtests/configure.ac   |   1 +
 testsuites/psxtests/psxinttypes01/Makefile.am  |  22 +
 testsuites/psxtests/psxinttypes01/init.c   | 107 +
 .../psxtests/psxinttypes01/psxinttypes01.scn   |   9 ++
 5 files changed, 140 insertions(+)
 create mode 100644 testsuites/psxtests/psxinttypes01/Makefile.am
 create mode 100644 testsuites/psxtests/psxinttypes01/init.c
 create mode 100644 testsuites/psxtests/psxinttypes01/psxinttypes01.scn

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 7bcea46..8b246d8 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -49,6 +49,7 @@ _SUBDIRS += psxfatal01
 _SUBDIRS += psxfatal02
 _SUBDIRS += psxgetattrnp01
 endif
+_SUBDIRS += psxinttypes01
 if HAS_POSIX
 if HAS_CPLUSPLUS
 _SUBDIRS += psxglobalcon01
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 1de1312..4db7916 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -162,6 +162,7 @@ psxid01/Makefile
 psximfs01/Makefile
 psximfs02/Makefile
 psxintrcritical01/Makefile
+psxinttypes01/Makefile
 psxitimer/Makefile
 psxkey01/Makefile
 psxkey02/Makefile
diff --git a/testsuites/psxtests/psxinttypes01/Makefile.am 
b/testsuites/psxtests/psxinttypes01/Makefile.am
new file mode 100644
index 000..517648c
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes01/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = psxinttypes01
+psxinttypes01_SOURCES = init.c 
+
+dist_rtems_tests_DATA = psxinttypes01.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 = $(psxinttypes01_OBJECTS) $(psxinttypes01_LDADD)
+LINK_LIBS = $(psxinttypes01_LDLIBS)  
/home/aditya/development/b-sparc/sparc-rtems4.12/c/erc32/cpukit/inttypes/libinttypes.a
+
+psxinttypes01$(EXEEXT): $(psxinttypes01_OBJECTS) $(psxinttypes01_DEPENDENCIES)
+   @rm -f psxinttypes01$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxinttypes01/init.c 
b/testsuites/psxtests/psxinttypes01/init.c
new file mode 100644
index 000..770b04d
--- /dev/null
+++ b/testsuites/psxtests/psxinttypes01/init.c
@@ -0,0 +1,107 @@
+/* 
+ *  This is the test for inttypes library. It covers these functions : 
+ *  imaxabs(), imaxdiv(), strtoimax(), strtoumax(), wcstoimax(), wcstoumax().
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* forward declarations to avoid warnings */
+
+rtems_task Init(rtems_task_argument argument);
+const char rtems_test_name[] = "PSXINTTYPE 01";
+rtems_printer rtems_test_printer;
+
+/*
+ * RTEMS Startup Task
+ */
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  rtems_print_printer_printf(&rtems_test_printer);
+  rtems_test_begin();
+
+  char* endptr, *nptr;
+
+  uintmax_t j, k;
+   
+  int base = 10;
+  rtems_test_assert (base == EINVAL)   
+  
+  wchar_t *nptr1, *endptr1;
+
+  intmax_t m, n;
+
+  nptr1 = L"10110134932";   
+  nptr  = "20690239864abc";
+
+  /* Test for wcstoimax */
+
+  m = wcstoimax(nptr1, &endptr1, base);
+  rtems_test_assert (m == ERANGE)
+  rtems_test_assert (m == EINVAL)
+   
+  printf( "wcstoimax = %jd\n", m );   
+
+  /* test for strtoumax */   
+  
+  j = strtoumax (nptr, &endptr, base); 
+  rtems_test_assert (j == ERANGE);
+  rtems_test_assert (j == EINVAL)
+
+  printf( "strtoumax = %ju ( base %d )\n", j, base );
+  printf( "Stopped scan at %s\n\n", endptr );   
+ 
+  /*test for wcstoumax */
+
+  k = wcstoumax (nptr1, &endptr1, base);
+  rtems_test_assert (k == ERANGE)
+  rtems_test_assert (k == EINVAL)
+  
+  printf( "wcstoumax = %ju\n", k );
+
+  /*Test for imaxdiv */ 
+
+  imaxdiv_t retrival = imaxdiv ( 27, 4 );
+  printf( "imax div value = %jd\n", retrival.rem ); 
+
+  /*Test for imaxabs  */
+
+  printf( "imaxabs_value = %jd\n", imaxabs (-1234));
+  
+  /*Test for strtoimax */
+  
+  n = strtoimax ("", &endptr, 2)
+  rtems_test_assert (n == ERANGE)
+  rtems_test_assert (n == EINVAL)
+
+  printf( "strtoimax value = %jd\n", n);
+  
+
+  rtems_test_end();
+  exit( 0 );
+}
+
+/* NOTICE: the clock driver is explicitly disabled */
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_INIT
+#include 
+
diff --git a/testsuites/psxtests/psxinttypes01/psxinttypes01.scn 
b

Re: [PATCH] Testsuite for inttypes.

2017-06-12 Thread Joel Sherrill
This is just a test style thing but since you are going to be
doing this all summer, how about Init() calling a "test_XXX"
method for each method under test. That would roughly
correspond to each of the comment blocks in your Init().
This makes it easier to go back and add test cases for
specific coverage cases.

test_imaxdiv()
etc.

Also the code needs to be merged into newlib first so
we need to get your email showing up there.

--joel



On Mon, Jun 12, 2017 at 1:56 PM, Aditya Upadhyay 
wrote:

> ---
>  testsuites/psxtests/Makefile.am|   1 +
>  testsuites/psxtests/configure.ac   |   1 +
>  testsuites/psxtests/psxinttypes01/Makefile.am  |  22 +
>  testsuites/psxtests/psxinttypes01/init.c   | 107
> +
>  .../psxtests/psxinttypes01/psxinttypes01.scn   |   9 ++
>  5 files changed, 140 insertions(+)
>  create mode 100644 testsuites/psxtests/psxinttypes01/Makefile.am
>  create mode 100644 testsuites/psxtests/psxinttypes01/init.c
>  create mode 100644 testsuites/psxtests/psxinttypes01/psxinttypes01.scn
>
> diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/
> Makefile.am
> index 7bcea46..8b246d8 100644
> --- a/testsuites/psxtests/Makefile.am
> +++ b/testsuites/psxtests/Makefile.am
> @@ -49,6 +49,7 @@ _SUBDIRS += psxfatal01
>  _SUBDIRS += psxfatal02
>  _SUBDIRS += psxgetattrnp01
>  endif
> +_SUBDIRS += psxinttypes01
>  if HAS_POSIX
>  if HAS_CPLUSPLUS
>  _SUBDIRS += psxglobalcon01
> diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/
> configure.ac
> index 1de1312..4db7916 100644
> --- a/testsuites/psxtests/configure.ac
> +++ b/testsuites/psxtests/configure.ac
> @@ -162,6 +162,7 @@ psxid01/Makefile
>  psximfs01/Makefile
>  psximfs02/Makefile
>  psxintrcritical01/Makefile
> +psxinttypes01/Makefile
>  psxitimer/Makefile
>  psxkey01/Makefile
>  psxkey02/Makefile
> diff --git a/testsuites/psxtests/psxinttypes01/Makefile.am
> b/testsuites/psxtests/psxinttypes01/Makefile.am
> new file mode 100644
> index 000..517648c
> --- /dev/null
> +++ b/testsuites/psxtests/psxinttypes01/Makefile.am
> @@ -0,0 +1,22 @@
> +
> +rtems_tests_PROGRAMS = psxinttypes01
> +psxinttypes01_SOURCES = init.c
> +
> +dist_rtems_tests_DATA = psxinttypes01.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 = $(psxinttypes01_OBJECTS) $(psxinttypes01_LDADD)
> +LINK_LIBS = $(psxinttypes01_LDLIBS)  /home/aditya/development/b-
> sparc/sparc-rtems4.12/c/erc32/cpukit/inttypes/libinttypes.a
> +
> +psxinttypes01$(EXEEXT): $(psxinttypes01_OBJECTS)
> $(psxinttypes01_DEPENDENCIES)
> +   @rm -f psxinttypes01$(EXEEXT)
> +   $(make-exe)
> +
> +include $(top_srcdir)/../automake/local.am
> diff --git a/testsuites/psxtests/psxinttypes01/init.c
> b/testsuites/psxtests/psxinttypes01/init.c
> new file mode 100644
> index 000..770b04d
> --- /dev/null
> +++ b/testsuites/psxtests/psxinttypes01/init.c
> @@ -0,0 +1,107 @@
> +/*
> + *  This is the test for inttypes library. It covers these functions :
> + *  imaxabs(), imaxdiv(), strtoimax(), strtoumax(), wcstoimax(),
> wcstoumax().
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* forward declarations to avoid warnings */
> +
> +rtems_task Init(rtems_task_argument argument);
> +const char rtems_test_name[] = "PSXINTTYPE 01";
> +rtems_printer rtems_test_printer;
> +
> +/*
> + * RTEMS Startup Task
> + */
> +
> +rtems_task Init(
> +  rtems_task_argument ignored
> +)
> +{
> +  rtems_print_printer_printf(&rtems_test_printer);
> +  rtems_test_begin();
> +
> +  char* endptr, *nptr;
> +
> +  uintmax_t j, k;
> +
> +  int base = 10;
> +  rtems_test_assert (base == EINVAL)
> +
> +  wchar_t *nptr1, *endptr1;
> +
> +  intmax_t m, n;
> +
> +  nptr1 = L"10110134932";
> +  nptr  = "20690239864abc";
> +
> +  /* Test for wcstoimax */
> +
> +  m = wcstoimax(nptr1, &endptr1, base);
> +  rtems_test_assert (m == ERANGE)
> +  rtems_test_assert (m == EINVAL)
> +
> +  printf( "wcstoimax = %jd\n", m );
> +
> +  /* test for strtoumax */
> +
> +  j = strtoumax (nptr, &endptr, base);
> +  rtems_test_assert (j == ERANGE);
> +  rtems_test_assert (j == EINVAL)
> +
> +  printf( "strtoumax = %ju ( base %d )\n", j, base );
> +  printf( "Stopped scan at %s\n\n", endptr );
> +
> +  /*test for wcstoumax */
> +
> +  k = wcstoumax (nptr1, &endptr1, base);
> +  rtems_test_assert (k == ERANGE)
> +  rtems_test_assert (k == EINVAL)
> +
> +  printf( "wcstoumax = %ju\n", k );
> +
> +  /*Test for imaxdiv */
> +
> +  imaxdiv_t retrival = imaxdiv ( 27, 4 );
> +  printf( "imax div value = %jd\n", retrival.rem );
> +
> +  /*Test for imaxabs  */
> +
> +  printf( "imaxabs_value = %jd\n", imaxabs (-1234));
> +
> +  /*Test for strtoimax */
> 

utsname fields too short on some PowerPC BSPs (qoriq, mpc55xx)

2017-06-12 Thread Joel Sherrill
Hi

The following BSPs have a new warning for a writing too much with
snprintf():

powerpc-mpc5566evb_spe
powerpc-mpc5674f_ecu508_app
powerpc-mpc5674f_ecu508_boot
powerpc-mpc5674fevb_spe
powerpc-mpc5674f_rsm6
powerpc-phycore_mpc5554
powerpc-qoriq_core_0
powerpc-qoriq_core_1
powerpc-qoriq_p1020rdb

../../../../../../rtems/c/src/../../cpukit/libcsupport/src/utsname.c:56:55:
warning: '%s' directive output truncated writing 29 bytes into a region of
size 24 [-Wformat-truncation=]

The code is:

  snprintf( name->machine, sizeof(name->machine), "%s/%s", CPU_NAME,
CPU_MODEL_NAME );

The fields are 32 bytes. Does anyone see a problem with increasing them to
48?

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

Re: Risc-v memory issue

2017-06-12 Thread Hesham Almatary
On Tue, Jun 13, 2017 at 2:09 AM, Denis Obrezkov 
wrote:
> Hello all,
>
> I was able to debug my program on top of HiFive1 board.
> I found out that I can't use next and until commands from gdb,
> they just hang gdb.
> And now I have a problem, this is my backtrace:
>
> #0  0x2041d728 in _User_extensions_Iterate (arg=0x80002eb8,
> visitor=0x2041d64e <_User_extensions_Fatal_visitor>,
> direction=CHAIN_ITERATOR_FORWARD)
> at
>
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/userextiterate.c:155
> #1  0x20410ed4 in _User_extensions_Fatal (source=INTERNAL_ERROR_CORE,
> error=2) at
> ../../cpukit/../../../hifive1/lib/include/rtems/score/userextimpl.h:307
> #2  0x20410ef8 in _Terminate (the_source=INTERNAL_ERROR_CORE, the_error=2)
> at
>
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:35
> #3  0x20410f40 in _Internal_error
> (core_error=INTERNAL_ERROR_TOO_LITTLE_WORKSPACE) at
>
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44
> #4  0x2041e484 in _Workspace_Handler_initialization (areas=0x80002f78,
> area_count=1, extend=0x0) at
>
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/wkspace.c:123
> #5  0x2040031c in bsp_work_area_initialize_default (area_begin=0x80001d58,
> area_size=8872) at
> ../../../../../.././hifive1/lib/include/bsp/bootcard.h:147
> #6  0x20400372 in bsp_work_area_initialize () at
>
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../shared/bspgetworkarea.c:61
> #7  0x2040f3ce in rtems_initialize_executive () at
>
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/sapi/src/exinit.c:95
> #8  0x204002cc in boot_card (cmdline=0x0) at
>
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../shared/bootcard.c:76
> #9  0x20400064 in _end_clear_bss () at
>
/home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/start/start.S:116
>
> So, I think I should increase a workspace.
> Now, I have some questions:
> I took Hesham's linker file for riscv-generic, and there were no stack
> space,
> I allocated 0x1000 for stack. Should I make it zero again, or should I
> decrease its size?
> what size for stack should be enough?

> /*
>  * The stack section will occupy the remaining
> REGION_STACK region and may
>  * contain the task stacks.  Depending on the region
> distribution this
>  * section may be of zero size.
>  */
>
This means that the stack_end address is starting at your very top address
space (i.e. 16KiB if you set your linker size to 16KiB). The stack grows
dynamically downwards, so it might overflow other sections (e.g. work,
heap, data, etc) if you don't have enough memory size to fit. You can try
to see how much size each section occupies (riscv32-rtems4.12-objdump -h
hello.exe), especially work space.


> And why there were no space for stack? is it possible to work without
stack
> allocated in
> linkcmd file?
> Can RTEMS work with a smaller workspace?
>
As far as I remember, 4KiB was the smallest I could allocate for workspace
to work (with Epiphany). As I suggested before, you might want to start
saving up memory by using the local instruction memory (on HiFive) and
compressed version of RISC-V ISA.

> --
> Regards, Denis Obrezkov



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

Re: [PATCH] Importing inttypes.h library and related methods.

2017-06-12 Thread Joel Sherrill
These methods need to be added to newlib not the RTEMS cpukit.

The tests can be added to RTEMS.

--joel

On Mon, Jun 12, 2017 at 1:52 PM, Aditya Upadhyay 
wrote:

> ---
>  cpukit/Makefile.am  |  20 +++---
>  cpukit/configure.ac |   4 +-
>  cpukit/inttypes/Makefile.am |  14 
>  cpukit/inttypes/imaxabs.c   |  44 +
>  cpukit/inttypes/imaxdiv.c   |  53 
>  cpukit/inttypes/strtoimax.c | 144 ++
> 
>  cpukit/inttypes/strtoumax.c | 135 +++
>  cpukit/inttypes/wcstoimax.c | 151 ++
> ++
>  cpukit/inttypes/wcstoumax.c | 144 ++
> 
>  cpukit/preinstall.am|  59 +
>  10 files changed, 724 insertions(+), 44 deletions(-)
>  create mode 100644 cpukit/inttypes/Makefile.am
>  create mode 100644 cpukit/inttypes/imaxabs.c
>  create mode 100644 cpukit/inttypes/imaxdiv.c
>  create mode 100644 cpukit/inttypes/strtoimax.c
>  create mode 100644 cpukit/inttypes/strtoumax.c
>  create mode 100644 cpukit/inttypes/wcstoimax.c
>  create mode 100644 cpukit/inttypes/wcstoumax.c
>
> diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
> index 2c2f2e5..045017e 100644
> --- a/cpukit/Makefile.am
> +++ b/cpukit/Makefile.am
> @@ -7,6 +7,7 @@ include $(top_srcdir)/automake/multilib.am
>  _SUBDIRS = . score rtems sapi posix
>  _SUBDIRS += dev
>  _SUBDIRS += dtc/libfdt
> +_SUBDIRS += inttypes
>  _SUBDIRS += libcrypt
>  _SUBDIRS += libcsupport libblock libfs
>  _SUBDIRS += libdrvmgr
> @@ -59,25 +60,22 @@ include_HEADERS += include/memory.h
>  include_HEADERS += libmisc/xz/xz.h
>
>  include_sys_HEADERS += libcsupport/include/sys/event.h
> -include_sys_HEADERS += libcsupport/include/sys/poll.h
> -include_sys_HEADERS += libcsupport/include/sys/statvfs.h
> -include_sys_HEADERS += libcsupport/include/sys/utsname.h
> -
> -include_sys_HEADERS += include/sys/endian.h
> -include_sys_HEADERS += include/sys/priority.h
> -
> -if !HAS_NEWLIB_20170522_HEADER
> -include_sys_HEADERS += include/sys/_iovec.h
> -include_sys_HEADERS += include/sys/uio.h
>  include_sys_HEADERS += libcsupport/include/sys/filio.h
>  include_sys_HEADERS += libcsupport/include/sys/ioccom.h
>  include_sys_HEADERS += libcsupport/include/sys/ioctl.h
> +include_sys_HEADERS += libcsupport/include/sys/poll.h
>  include_sys_HEADERS += libcsupport/include/sys/sockio.h
> +include_sys_HEADERS += libcsupport/include/sys/statvfs.h
>  include_sys_HEADERS += libcsupport/include/sys/_termios.h
>  include_sys_HEADERS += libcsupport/include/sys/termios.h
>  include_sys_HEADERS += libcsupport/include/sys/ttycom.h
>  include_sys_HEADERS += libcsupport/include/sys/ttydefaults.h
> -endif
> +include_sys_HEADERS += libcsupport/include/sys/utsname.h
> +
> +include_sys_HEADERS += include/sys/endian.h
> +include_sys_HEADERS += include/sys/uio.h
> +include_sys_HEADERS += include/sys/_iovec.h
> +include_sys_HEADERS += include/sys/priority.h
>
>  if LIBNETWORKING
>  include_rtems_bsdnetdir = $(includedir)/rtems/bsdnet
> diff --git a/cpukit/configure.ac b/cpukit/configure.ac
> index 8d5b322..ad0865b 100644
> --- a/cpukit/configure.ac
> +++ b/cpukit/configure.ac
> @@ -166,9 +166,6 @@ if test x"$RTEMS_USE_NEWLIB" = xyes ; then
>AC_CHECK_DECLS([__getreent],[],[RTEMS_TOOL_CHAIN_ERROR],[#include
> ])
>  fi
>
> -AC_CHECK_HEADER([sys/socket.h],[],[])
> -AM_CONDITIONAL(HAS_NEWLIB_20170522_HEADER,[test
> x"${ac_cv_header_sys_socket_h}" = xyes])
> -
>  RTEMS_CHECK_MULTIPROCESSING
>  RTEMS_CHECK_POSIX_API
>  RTEMS_CHECK_NETWORKING
> @@ -464,6 +461,7 @@ score/cpu/sparc64/Makefile
>  score/cpu/v850/Makefile
>  score/cpu/no_cpu/Makefile
>  posix/Makefile
> +inttypes/Makefile
>  libblock/Makefile
>  libdrvmgr/Makefile
>  libfs/Makefile
> diff --git a/cpukit/inttypes/Makefile.am b/cpukit/inttypes/Makefile.am
> new file mode 100644
> index 000..c90b872
> --- /dev/null
> +++ b/cpukit/inttypes/Makefile.am
> @@ -0,0 +1,14 @@
> +include $(top_srcdir)/automake/multilib.am
> +include $(top_srcdir)/automake/compile.am
> +
> +
> +noinst_LIBRARIES = libinttypes.a
> +
> +libinttypes_a_SOURCES = imaxdiv.c imaxabs.c strtoimax.c strtoumax.c
> wcstoimax.c wcstoumax.c
> +
> +libinttypes_a_CPPFLAGS = $(AM_CPPFLAGS)
> +
> +
> +#include $(srcdir)/preinstall.am
> +include $(top_srcdir)/automake/subdirs.am
> +include $(top_srcdir)/automake/local.am
> diff --git a/cpukit/inttypes/imaxabs.c b/cpukit/inttypes/imaxabs.c
> new file mode 100644
> index 000..fe9331f
> --- /dev/null
> +++ b/cpukit/inttypes/imaxabs.c
> @@ -0,0 +1,44 @@
> +/*-
> + *  Copyright (c) 2001 Mike Barcroft 
> + *  All rights reserved.
> + *
> + *  Redistribution and use in source and binary forms, with or without
> + *  modification, are permitted provided that the following conditions
> + *  are met:
> + *  1. Redistributions of source code must retain the above copyright
> + * notice, this list of conditions and the following disclaimer.
> + *  2. R

Re: Couverture-Qemu Testing Results

2017-06-12 Thread Chris Johns
On 12/06/2017 04:53, Joel Sherrill wrote:
> 
> File individual tickets on the bsps with unique failures on qemu. And one to
> cover the "no exit" case. I know Chris has been hesitant to look at test 
> output
> and kill tests but I think it is necessary unless you can find a way to make
> qemu automatically exit from the BSP. 

I think it is best to see why something does not shutdown. It tends to be
something in the simulator or BSP that is not correct or not implemented. Fixing
this improves the BSP.

The approach with the tester is to push us all and if there is a case we cannot
resolve please come back to me and we can discuss a BSP toggle to control this.
My preference for the default is to have the system shutdown cleanly.

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