[PATCH rtems-tools 1/3] tester/exe: Adjust timeouts by the step size

2021-09-21 Thread chrisj
From: Chris Johns 

---
 tester/rt/exe.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tester/rt/exe.py b/tester/rt/exe.py
index 13b9686..626899e 100644
--- a/tester/rt/exe.py
+++ b/tester/rt/exe.py
@@ -116,12 +116,12 @@ class exe(object):
 def _monitor(self, timeout):
 output_length = self.output_length
 step = 0.25
-period = timeout[0]
-seconds = timeout[1]
+period = timeout[0] * step
+seconds = timeout[1] * step
 while self.process and period > 0 and seconds > 0:
 current_length = self.output_length
 if output_length != current_length:
-period = timeout[0]
+period = timeout[0] * step
 output_length = current_length
 if seconds < step:
 seconds = 0
-- 
2.24.1

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


[PATCH rtems-tools 2/3] tester/wait: Add a wait directive to the tester

2021-09-21 Thread chrisj
From: Chris Johns 

- Lets you test with stand alone TFTP or other services
---
 tester/rt/config.py   |  27 +-
 tester/rt/wait.py | 154 ++
 tester/rtems/testing/wait.cfg |  54 
 3 files changed, 233 insertions(+), 2 deletions(-)
 create mode 100644 tester/rt/wait.py
 create mode 100644 tester/rtems/testing/wait.cfg

diff --git a/tester/rt/config.py b/tester/rt/config.py
index 61e8f0d..a7b9ee3 100644
--- a/tester/rt/config.py
+++ b/tester/rt/config.py
@@ -52,6 +52,7 @@ import tester.rt.console
 import tester.rt.exe
 import tester.rt.gdb
 import tester.rt.tftp
+import tester.rt.wait
 
 timeout = 15
 
@@ -61,6 +62,7 @@ class file(config.file):
 _directives = ['%execute',
'%gdb',
'%tftp',
+   '%wait',
'%console']
 
 def __init__(self, index, total, report, name, opts,
@@ -217,8 +219,8 @@ class file(config.file):
 if data[0] == 'stdio':
 self.console = tester.rt.console.stdio(trace = console_trace)
 elif data[0] == 'tty':
-if len(data) < 2 or len(data) >3:
-raise error.general(self._name_line_msg('no tty 
configuration provided'))
+if len(data) < 2 or len(data) > 3:
+raise error.general(self._name_line_msg('invalid tty 
configuration provided'))
 if len(data) == 3:
 settings = data[2]
 else:
@@ -296,6 +298,25 @@ class file(config.file):
 if self.console:
 self.console.close()
 
+def _dir_wait(self, data, total, index, exe, bsp_arch, bsp):
+if len(data) != 0:
+raise error.general('%wait has no arguments')
+self.kill_on_end = True
+if not self.opts.dry_run():
+self.process = tester.rt.wait.wait(bsp_arch, bsp,
+   trace = self.exe_trace('wait'))
+if not self.in_error:
+if self.console:
+self.console.open()
+self.process.open(output_length = self._output_length,
+  console = self.capture_console,
+  timeout = (int(self.expand('%{timeout}')),
+ 
int(self.expand('%{max_test_period}')),
+ self._timeout,
+ self._test_too_long))
+if self.console:
+self.console.close()
+
 def _directive_filter(self, results, directive, info, data):
 if results[0] == 'directive':
 _directive = results[1]
@@ -332,6 +353,8 @@ class file(config.file):
 self._dir_gdb(ds, total, index, fexe, bsp_arch, bsp)
 elif _directive == '%tftp':
 self._dir_tftp(ds, total, index, fexe, bsp_arch, bsp)
+elif _directive == '%wait':
+self._dir_wait(ds, total, index, fexe, bsp_arch, bsp)
 else:
 raise error.general(self._name_line_msg('invalid 
directive'))
 self._lock()
diff --git a/tester/rt/wait.py b/tester/rt/wait.py
new file mode 100644
index 000..a42e5e5
--- /dev/null
+++ b/tester/rt/wait.py
@@ -0,0 +1,154 @@
+# SPDX-License-Identifier: BSD-2-Clause
+'''Wait test target.'''
+
+# Copyright (C) 2013-2021 Chris Johns (chr...@rtems.org)
+#
+# 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+from __future__ import print_function
+
+import datetime
+import os
+import threading
+import time
+
+
+class wait(object):
+'''RTEMS Testi

[PATCH rtems-tools 3/3] tester/mvme2307: Add support for the MVME2307 (MVME2700) BSP

2021-09-21 Thread chrisj
From: Chris Johns 

- Assumes a stand alone TFTP server
---
 tester/rtems/testing/bsps/mvme2307.ini | 59 ++
 1 file changed, 59 insertions(+)
 create mode 100644 tester/rtems/testing/bsps/mvme2307.ini

diff --git a/tester/rtems/testing/bsps/mvme2307.ini 
b/tester/rtems/testing/bsps/mvme2307.ini
new file mode 100644
index 000..b142aa9
--- /dev/null
+++ b/tester/rtems/testing/bsps/mvme2307.ini
@@ -0,0 +1,59 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2021 Chris Johns (chr...@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# The MVME2307 BSP
+#
+# This BSP uses the bootloader's network autoboot to boot the board. It
+# does nothing but sleep for the test's timeout period.
+#
+# You need to:
+#
+#  1. Set up a TFTP server and provide a suitable path to copy the
+# bootable image to.
+#
+#  2. Use the `env` command to enable network autoboot:
+#   Network Auto Boot Enable [Y/N]   = N? y
+#
+#  3. Provide a script to power cycle the board
+#
+#  4. Provide a telnet connection to the serial port
+#
+#  5. Create a script that converts the executable to the
+# bootable image and copy the image to the TFTP server.
+#
+[mvme2307]
+bsp= mvme2307
+arch   = powerpc
+jobs   = 1
+test_restarts  = 3
+tester = %{_rtscripts}/wait.cfg
+target_start_regex = ^Copyright Motorola Inc.*, All Rights Reserved
+requires   = target_on_command, target_off_command, 
target_reset_command, bsp_tty_dev
-- 
2.24.1

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


Re: Remove old build system

2021-09-21 Thread Sebastian Huber

On 16/09/2021 15:31, Sebastian Huber wrote:

Hello,

I updated the commit which removes the old build system:

https://git.rtems.org/sebh/rtems.git/commit/?h=remove-old-build-system&id=a6dbaeeeb34bbb10922f6a75590d05333599075c 


I updated to the latest RSB (Autoconf/Automake is no longer installed by 
the RSB) and built all BSPs with all tests enabled using the new build 
system and the patch above. I observed no errors and integrated the patch:


https://git.rtems.org/rtems/commit/?id=db8f598d56951cf43f22a5e325e0d23c8f7559f9

So after about two years of development, there is now only the new build 
system in place.


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Remove old build system

2021-09-21 Thread Chris Johns
On 21/9/21 6:32 pm, Sebastian Huber wrote:
> So after about two years of development, there is now only the new build 
> system
> in place.

Congratulations and thank you for all the hard work it took to make this happen.

It is a pleasure to use, I know I have been testing RTEMS 5 patches this week.

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


[PATCH] score: Simplify _Thread_Try_initialize()

2021-09-21 Thread Sebastian Huber
Move a code block to its own new function
_Thread_Initialize_scheduler_and_wait_nodes().  Add comments.
---
 cpukit/score/src/threadinitialize.c | 180 +---
 1 file changed, 108 insertions(+), 72 deletions(-)

diff --git a/cpukit/score/src/threadinitialize.c 
b/cpukit/score/src/threadinitialize.c
index 9c1b809c3a..e10eb1af88 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -96,6 +96,113 @@ void _Thread_Free(
   _Objects_Free( &information->Objects, &the_thread->Object );
 }
 
+static void _Thread_Initialize_scheduler_and_wait_nodes(
+  Thread_Control *the_thread,
+  const Thread_Configuration *config
+)
+{
+  Scheduler_Node  *scheduler_node;
+#if defined(RTEMS_SMP)
+  Scheduler_Node  *scheduler_node_for_index;
+  const Scheduler_Control *scheduler_for_index;
+  size_t   scheduler_index;
+#endif
+
+#if defined(RTEMS_SMP)
+  scheduler_node = NULL;
+  scheduler_node_for_index = the_thread->Scheduler.nodes;
+  scheduler_for_index = &_Scheduler_Table[ 0 ];
+  scheduler_index = 0;
+
+  /*
+   * In SMP configurations, the thread has exactly one scheduler node for each
+   * configured scheduler.  Initialize the scheduler nodes of each scheduler.
+   * The application configuration ensures that we have at least one scheduler
+   * configured.
+   */
+  while ( scheduler_index < _Scheduler_Count ) {
+Priority_Control priority_for_index;
+
+if ( scheduler_for_index == config->scheduler ) {
+  priority_for_index = config->priority;
+  scheduler_node = scheduler_node_for_index;
+} else {
+  /*
+   * Use the idle thread priority for the non-home scheduler instances by
+   * default.
+   */
+  priority_for_index = _Scheduler_Map_priority(
+scheduler_for_index,
+scheduler_for_index->maximum_priority
+  );
+}
+
+_Scheduler_Node_initialize(
+  scheduler_for_index,
+  scheduler_node_for_index,
+  the_thread,
+  priority_for_index
+);
+
+/*
+ * Since the size of a scheduler node depends on the application
+ * configuration, the _Scheduler_Node_size constant is used to get the next
+ * scheduler node.  Using sizeof( Scheduler_Node ) would be wrong.
+ */
+scheduler_node_for_index = (Scheduler_Node *)
+  ( (uintptr_t) scheduler_node_for_index + _Scheduler_Node_size );
+++scheduler_for_index;
+++scheduler_index;
+  }
+
+  /*
+   * The thread is initialized to use exactly one scheduler node which is
+   * provided by its home scheduler.
+   */
+  _Assert( scheduler_node != NULL );
+  _Chain_Initialize_one(
+&the_thread->Scheduler.Wait_nodes,
+&scheduler_node->Thread.Wait_node
+  );
+  _Chain_Initialize_one(
+&the_thread->Scheduler.Scheduler_nodes,
+&scheduler_node->Thread.Scheduler_node.Chain
+  );
+#else
+  /*
+   * In uniprocessor configurations, the thread has exactly one scheduler node.
+   */
+  scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
+  _Scheduler_Node_initialize(
+config->scheduler,
+scheduler_node,
+the_thread,
+config->priority
+  );
+#endif
+
+  /*
+   * The current priority of the thread is initialized to exactly the real
+   * priority of the thread.  During the lifetime of the thread, it may gain
+   * more priority nodes, for example through locking protocols such as
+   * priority inheritance or priority ceiling.
+   */
+  _Priority_Node_initialize( &the_thread->Real_priority, config->priority );
+  _Priority_Initialize_one(
+&scheduler_node->Wait.Priority,
+&the_thread->Real_priority
+  );
+
+#if defined(RTEMS_SMP)
+  RTEMS_STATIC_ASSERT( THREAD_SCHEDULER_BLOCKED == 0, Scheduler_state );
+  the_thread->Scheduler.home_scheduler = config->scheduler;
+  _ISR_lock_Initialize( &the_thread->Scheduler.Lock, "Thread Scheduler" );
+  _ISR_lock_Initialize( &the_thread->Wait.Lock.Default, "Thread Wait Default" 
);
+  _Thread_queue_Gate_open( &the_thread->Wait.Lock.Tranquilizer );
+  _RBTree_Initialize_node( &the_thread->Wait.Link.Registry_node );
+#endif
+}
+
 static bool _Thread_Try_initialize(
   Thread_Information *information,
   Thread_Control *the_thread,
@@ -107,12 +214,6 @@ static bool _Thread_Try_initialize(
   char*stack_begin;
   char*stack_end;
   uintptr_tstack_align;
-  Scheduler_Node  *scheduler_node;
-#if defined(RTEMS_SMP)
-  Scheduler_Node  *scheduler_node_for_index;
-  const Scheduler_Control *scheduler_for_index;
-  size_t   scheduler_index;
-#endif
   Per_CPU_Control *cpu = _Per_CPU_Get_by_index( 0 );
 
   memset(
@@ -182,78 +283,13 @@ static bool _Thread_Try_initialize(
   the_thread->Start.stack_free   = config->stack_free;
 
   _Thread_Timer_initialize( &the_thread->Timer, cpu );
+  _Thread_Initialize_scheduler_and_wait_nodes( the_thread, config );
 
 #if defined(RTEMS_SMP)
-  scheduler_no

[PATCH] score: Improve variable names in thread init

2021-09-21 Thread Sebastian Huber
---
 cpukit/score/src/threadinitialize.c | 50 ++---
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/cpukit/score/src/threadinitialize.c 
b/cpukit/score/src/threadinitialize.c
index e10eb1af88..81199a7044 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -101,17 +101,17 @@ static void _Thread_Initialize_scheduler_and_wait_nodes(
   const Thread_Configuration *config
 )
 {
-  Scheduler_Node  *scheduler_node;
+  Scheduler_Node  *home_scheduler_node;
 #if defined(RTEMS_SMP)
-  Scheduler_Node  *scheduler_node_for_index;
-  const Scheduler_Control *scheduler_for_index;
+  Scheduler_Node  *scheduler_node;
+  const Scheduler_Control *scheduler;
   size_t   scheduler_index;
 #endif
 
 #if defined(RTEMS_SMP)
-  scheduler_node = NULL;
-  scheduler_node_for_index = the_thread->Scheduler.nodes;
-  scheduler_for_index = &_Scheduler_Table[ 0 ];
+  home_scheduler_node = NULL;
+  scheduler_node = the_thread->Scheduler.nodes;
+  scheduler = &_Scheduler_Table[ 0 ];
   scheduler_index = 0;
 
   /*
@@ -121,27 +121,27 @@ static void _Thread_Initialize_scheduler_and_wait_nodes(
* configured.
*/
   while ( scheduler_index < _Scheduler_Count ) {
-Priority_Control priority_for_index;
+Priority_Control priority;
 
-if ( scheduler_for_index == config->scheduler ) {
-  priority_for_index = config->priority;
-  scheduler_node = scheduler_node_for_index;
+if ( scheduler == config->scheduler ) {
+  priority = config->priority;
+  home_scheduler_node = scheduler_node;
 } else {
   /*
* Use the idle thread priority for the non-home scheduler instances by
* default.
*/
-  priority_for_index = _Scheduler_Map_priority(
-scheduler_for_index,
-scheduler_for_index->maximum_priority
+  priority = _Scheduler_Map_priority(
+scheduler,
+scheduler->maximum_priority
   );
 }
 
 _Scheduler_Node_initialize(
-  scheduler_for_index,
-  scheduler_node_for_index,
+  scheduler,
+  scheduler_node,
   the_thread,
-  priority_for_index
+  priority
 );
 
 /*
@@ -149,9 +149,9 @@ static void _Thread_Initialize_scheduler_and_wait_nodes(
  * configuration, the _Scheduler_Node_size constant is used to get the next
  * scheduler node.  Using sizeof( Scheduler_Node ) would be wrong.
  */
-scheduler_node_for_index = (Scheduler_Node *)
-  ( (uintptr_t) scheduler_node_for_index + _Scheduler_Node_size );
-++scheduler_for_index;
+scheduler_node = (Scheduler_Node *)
+  ( (uintptr_t) scheduler_node + _Scheduler_Node_size );
+++scheduler;
 ++scheduler_index;
   }
 
@@ -159,23 +159,23 @@ static void _Thread_Initialize_scheduler_and_wait_nodes(
* The thread is initialized to use exactly one scheduler node which is
* provided by its home scheduler.
*/
-  _Assert( scheduler_node != NULL );
+  _Assert( home_scheduler_node != NULL );
   _Chain_Initialize_one(
 &the_thread->Scheduler.Wait_nodes,
-&scheduler_node->Thread.Wait_node
+&home_scheduler_node->Thread.Wait_node
   );
   _Chain_Initialize_one(
 &the_thread->Scheduler.Scheduler_nodes,
-&scheduler_node->Thread.Scheduler_node.Chain
+&home_scheduler_node->Thread.Scheduler_node.Chain
   );
 #else
   /*
* In uniprocessor configurations, the thread has exactly one scheduler node.
*/
-  scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
+  home_scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
   _Scheduler_Node_initialize(
 config->scheduler,
-scheduler_node,
+home_scheduler_node,
 the_thread,
 config->priority
   );
@@ -189,7 +189,7 @@ static void _Thread_Initialize_scheduler_and_wait_nodes(
*/
   _Priority_Node_initialize( &the_thread->Real_priority, config->priority );
   _Priority_Initialize_one(
-&scheduler_node->Wait.Priority,
+&home_scheduler_node->Wait.Priority,
 &the_thread->Real_priority
   );
 
-- 
2.31.1

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


Re: [PATCH v2 5/5] cpukit: Add AArch64 SMP Support

2021-09-21 Thread Kinsey Moore

On 9/21/2021 00:52, Sebastian Huber wrote:

On 21/09/2021 02:15, Gedare Bloom wrote:

looks good, thanks. I'll follow-up later as I make progress on the
versal smp side too. that's still a bit broken.

On Mon, Sep 20, 2021 at 4:56 PM Kinsey 
Moore  wrote:
Version 1 of this patch did not update the Versal BSP's usage of the 
MMU

calls.


The patch set looks good. The name of the BSP option BSP_CPU_ON_SMC 
could be a bit more descriptive.



Thanks, I'll update the BSP option name before commit.


Kinsey

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

SMP support across architectures

2021-09-21 Thread Kinsey Moore
When Joel was looking over his build scripts, he noticed that ERC32 is listed 
in spec/build/cpukit/optsmp.yml as supporting SMP and yet he isn't aware of any 
ERC32 hardware that was multicore. LEON2 isn't listed there, but has a SMP stub 
that gets linked in with it. It appears that SPARC is the only architecture 
that has a SMP stub for its BSPs that don't support SMP.

A couple of questions:
What is the policy for BSPs that don't support SMP where the BSP's architecture 
does support SMP? Should they recognize the RTEMS_SMP option and build with it?

Does ERC32 need to be removed from the SMP-supported list?


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


Re: [PATCH v4] improve the format of error reporting on i386

2021-09-21 Thread Gedare Bloom
On Mon, Sep 20, 2021 at 7:34 PM zack leung  wrote:
>
>   printk(" EAX = 0%08" PRIx32 "EBX = 0%08" PRIx32 "ECX = 0%08" PRIx32 
> "EDX = 0%08" PRIx32 "\n",
> should it look like this gedare? will send once you give the ok
>
missing x's 0x%08.

>
>
> On Sun, 19 Sept 2021 at 17:42, zack leung  wrote:
>>
>> Bumo
>>
>> Il ven 17 set 2021, 19:57 zack leung  ha scritto:
>>>
>>> Where am i missing it?
>>>
>>> Zack
>>>
>>> On Fri, 17 Sept 2021 at 23:15, Gedare Bloom  wrote:

 Hi Zack,

 I think you have also missed Joel's request to add an 8-character
 width specifier.

 On Thu, Sep 16, 2021 at 6:19 PM zack leung  
 wrote:
 >
 > Thread id is now a Hex value. formatting improved for hex values
 > Updates #4203
 > ---
 >  cpukit/score/cpu/i386/cpu.c | 6 +++---
 >  1 file changed, 3 insertions(+), 3 deletions(-)
 >
 > diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c
 > index 77b7a7161c..0f17cf0148 100644
 > --- a/cpukit/score/cpu/i386/cpu.c
 > +++ b/cpukit/score/cpu/i386/cpu.c
 > @@ -215,16 +215,16 @@ void _CPU_Exception_frame_print (const
 > CPU_Exception_frame *ctx)
 >  {
 >unsigned int faultAddr = 0;
 >
 > printk("--\n");
 > -  printk("Exception %" PRIu32 " caught at PC %" PRIx32 " by thread %"
 > PRId32 "\n",
 > +  printk("Exception %" PRIu32 " caught at PC 0x%" PRIx32 " by thread 
 > 0x%"
 > PRIx32 "\n",
 >   ctx->idtIndex,
 >   ctx->eip,
 >   _Thread_Executing->Object.id);
 >
 > printk("--\n");
 >printk("Processor execution context at time of the fault was  :\n");
 >
 > printk("--\n");
 > -  printk(" EAX = %" PRIx32 "EBX = %" PRIx32 "ECX = %" PRIx32 "
 > EDX = %" PRIx32 "\n",
 > +  printk(" EAX = 0x%" PRIx32 "EBX = 0x%" PRIx32 "ECX = 0x%" 
 > PRIx32
 > "EDX = 0x%" PRIx32 "\n",
 >   ctx->eax, ctx->ebx, ctx->ecx, ctx->edx);
 > -  printk(" ESI = %" PRIx32 "EDI = %" PRIx32 "EBP = %" PRIx32 "
 > ESP = %" PRIx32 "\n",
 > +  printk(" ESI = 0x%" PRIx32 "EDI = 0x%" PRIx32 "EBP = 0x%" 
 > PRIx32
 > "ESP = 0x%" PRIx32 "\n",
 >   ctx->esi, ctx->edi, ctx->ebp, ctx->esp0);
 >
 > printk("--\n");
 >printk("Error code pushed by processor itself (if not 0) = %" PRIx32
 > "\n",
 > --
 > 2.33.0
 > ___
 > 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 rtems-tools v1 0/7] Convert and reformat pt. 3

2021-09-21 Thread Ryan Long
Hi,

These are the last of the backlog of conversion and reformatting patches
I have of rtems-tools currently.

For this series of patches, I followed this series of steps:

1. Convert a file from the C way of doing things to C++.
2. Go through all the files that had to do with the converted file and
make the formatting consistent.

Thanks,
Ryan


Ryan Long (7):
  CoverageRanges.cc: Fix formatting
  TraceReader: Convert to C++
  TraceWriter: Convert to C++
  TraceReaderLogQEMU.cc: Fix formatting
  TraceWriterQEMU.cc: Fix formatting
  TraceReaderLogQEMU.h: Fix formatting
  TraceWriterQEMU.h: Fix formatting

 tester/covoar/CoverageRanges.cc |  13 ++--
 tester/covoar/CoverageRanges.h  |  13 ++--
 tester/covoar/ObjdumpProcessor.cc   |   4 +-
 tester/covoar/ObjdumpProcessor.h|   2 +-
 tester/covoar/TargetBase.cc |   6 +-
 tester/covoar/TargetBase.h  |   4 +-
 tester/covoar/TraceReaderBase.h |   4 +-
 tester/covoar/TraceReaderLogQEMU.cc | 138 +++-
 tester/covoar/TraceReaderLogQEMU.h  |   3 +-
 tester/covoar/TraceWriterBase.h |   3 +-
 tester/covoar/TraceWriterQEMU.cc|  82 ++---
 tester/covoar/TraceWriterQEMU.h |   6 +-
 tester/covoar/qemu-log.h|   4 +-
 13 files changed, 125 insertions(+), 157 deletions(-)

-- 
1.8.3.1

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


[PATCH rtems-tools v1 2/7] TraceReader: Convert to C++

2021-09-21 Thread Ryan Long
---
 tester/covoar/ObjdumpProcessor.cc   |   4 +-
 tester/covoar/ObjdumpProcessor.h|   2 +-
 tester/covoar/TargetBase.cc |   6 +-
 tester/covoar/TargetBase.h  |   4 +-
 tester/covoar/TraceReaderBase.h |   4 +-
 tester/covoar/TraceReaderLogQEMU.cc | 113 +++-
 tester/covoar/TraceReaderLogQEMU.h  |   2 +-
 tester/covoar/qemu-log.h|   4 +-
 8 files changed, 57 insertions(+), 82 deletions(-)

diff --git a/tester/covoar/ObjdumpProcessor.cc 
b/tester/covoar/ObjdumpProcessor.cc
index 4d1e306..c910046 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -188,9 +188,7 @@ namespace Coverage {
 #undef METHOD
   }
 
-  bool ObjdumpProcessor::IsBranch(
-const char *instruction
-  )
+  bool ObjdumpProcessor::IsBranch( const std::string& instruction )
   {
 if ( !targetInfo_m ) {
   fprintf(
diff --git a/tester/covoar/ObjdumpProcessor.h b/tester/covoar/ObjdumpProcessor.h
index 6a207dd..05a667f 100644
--- a/tester/covoar/ObjdumpProcessor.h
+++ b/tester/covoar/ObjdumpProcessor.h
@@ -143,7 +143,7 @@ namespace Coverage {
  *  an instruction that results in a code branch, otherwise
  *  it returns false.
  */
-bool IsBranch( const char *instruction );
+bool IsBranch( const std::string& instruction );
 
 /*!
  *  This method returns true if the instruction from
diff --git a/tester/covoar/TargetBase.cc b/tester/covoar/TargetBase.cc
index 4474fad..7ee45b5 100644
--- a/tester/covoar/TargetBase.cc
+++ b/tester/covoar/TargetBase.cc
@@ -60,9 +60,7 @@ namespace Target {
 return targetName_m.c_str();
   }
 
-  bool TargetBase::isBranch(
-  const char* const instruction
-  )
+  bool TargetBase::isBranch( const std::string& instruction )
   {
 std::list ::iterator i;
 
@@ -76,7 +74,7 @@ namespace Target {
 i = find(
   conditionalBranchInstructions.begin(),
   conditionalBranchInstructions.end(),
-  instruction
+  instruction.c_str()
 );
 if ( i  == conditionalBranchInstructions.end() )
   return false;
diff --git a/tester/covoar/TargetBase.h b/tester/covoar/TargetBase.h
index 6db08f2..e5c143e 100644
--- a/tester/covoar/TargetBase.h
+++ b/tester/covoar/TargetBase.h
@@ -98,9 +98,7 @@ namespace Target {
  *  This method determines if the specified line from an
  *  objdump file is a branch instruction.
  */
-bool isBranch(
-  const char* const instruction
-);
+bool isBranch( const std::string& instruction );
 
 /*!
  *  This method returns the bit set by Qemu in the trace record
diff --git a/tester/covoar/TraceReaderBase.h b/tester/covoar/TraceReaderBase.h
index 3005c62..cbb9a62 100644
--- a/tester/covoar/TraceReaderBase.h
+++ b/tester/covoar/TraceReaderBase.h
@@ -7,6 +7,8 @@
 #ifndef __TRACE_READER_BASE_H__
 #define __TRACE_READER_BASE_H__
 
+#include 
+
 #include "TraceList.h"
 #include "ObjdumpProcessor.h"
 
@@ -47,7 +49,7 @@ namespace Trace {
  *  @return Returns TRUE if the method succeeded and FALSE if it failed.
  */
 virtual bool processFile(
-  const char* const   file,
+  const std::string&  file,
   Coverage::ObjdumpProcessor& objdumpProcessor
 ) = 0;
   };
diff --git a/tester/covoar/TraceReaderLogQEMU.cc 
b/tester/covoar/TraceReaderLogQEMU.cc
index 57bcaa1..c303d08 100644
--- a/tester/covoar/TraceReaderLogQEMU.cc
+++ b/tester/covoar/TraceReaderLogQEMU.cc
@@ -40,6 +40,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include "qemu-log.h"
 #include "TraceReaderBase.h"
 #include "TraceReaderLogQEMU.h"
@@ -48,28 +51,16 @@
 
 #include "rld-process.h"
 
-#if HAVE_STAT64
-#define STAT stat64
-#else
-#define STAT stat
-#endif
-
-#if HAVE_OPEN64
-#define OPEN fopen64
-#else
-#define OPEN fopen
-#endif
-
-#define MAX_LINE_LENGTH 512
-
-bool ReadUntilFound( FILE *file, const char *line )
+bool ReadUntilFound( std::ifstream& file, const char* line )
 {
   char discardBuff[100];
   size_t  len = strlen( line );
 
   do {
-if ( !fgets( discardBuff, 99, file ) )
+file.read( discardBuff, 99 );
+if ( file.fail() ) {
   return false;
+}
 
 if ( strncmp( discardBuff, line, len ) == 0 )
   return true;
@@ -87,7 +78,7 @@ namespace Trace {
   }
 
   bool TraceReaderLogQEMU::processFile(
-const char* const   file,
+const std::string&  file,
 Coverage::ObjdumpProcessor& objdumpProcessor
   )
   {
@@ -96,42 +87,41 @@ namespace Trace {
 QEMU_LOG_IN_Block_t last  = { 0, "", "" };
 QEMU_LOG_IN_Block_t nextExecuted  = { 0, "", "" };
 uint32_tnextlogical;
-struct STAT statbuf;
 int status;
-FILE*   logFile;
+std::ifstream   logFile;
 int result;
-charinputBuffer[MAX_LINE_LENGTH];
+int fileSize;
+charignore;
 
 //
 // Verify that the log file has a non-zero 

[PATCH rtems-tools v1 1/7] CoverageRanges.cc: Fix formatting

2021-09-21 Thread Ryan Long
---
 tester/covoar/CoverageRanges.cc | 13 +
 tester/covoar/CoverageRanges.h  | 13 +++--
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/tester/covoar/CoverageRanges.cc b/tester/covoar/CoverageRanges.cc
index 159c556..cfd58df 100644
--- a/tester/covoar/CoverageRanges.cc
+++ b/tester/covoar/CoverageRanges.cc
@@ -13,7 +13,7 @@ namespace Coverage {
   /*!
*  This member variable tracks a unique index for the ranges_t block.
*/
-  uint32_t  id_m = 0;
+  uint32_t id_m = 0;
 
   CoverageRanges::CoverageRanges()
   {
@@ -41,14 +41,12 @@ namespace Coverage {
 set.push_back(c);
   }
 
-  uint32_t  CoverageRanges::getId( uint32_t lowAddress )
+  uint32_t CoverageRanges::getId( uint32_t lowAddress )
   {
-Coverage::CoverageRanges::ranges_t::iteratorritr;
-uint32_tresult = 0;
+Coverage::CoverageRanges::ranges_t::iterator ritr;
+uint32_t result = 0;
 
-for (ritr =  set.begin() ;
- ritr != set.end() ;
- ritr++ ) {
+for ( ritr =  set.begin() ; ritr != set.end() ; ritr++ ) {
   if ( ritr->lowAddress == lowAddress ) {
 result = ritr->id;
 break;
@@ -57,5 +55,4 @@ namespace Coverage {
 
 return result;
   }
-
 }
diff --git a/tester/covoar/CoverageRanges.h b/tester/covoar/CoverageRanges.h
index e3b651d..3d77df2 100644
--- a/tester/covoar/CoverageRanges.h
+++ b/tester/covoar/CoverageRanges.h
@@ -42,35 +42,35 @@ namespace Coverage {
*  This member contains an identification number for this
*  coverage range.
*/
-  uint32_t  id;
+  uint32_t id;
 
   /*!
*  This member contains the low address of this coverage
*  range.
*/
-  uint32_t  lowAddress;
+  uint32_t lowAddress;
 
   /*!
*  This member contains the source line associated with the
*  low address for this coverage range.
*/
-  std::string   lowSourceLine;
+  std::string lowSourceLine;
 
   /*!
* This member contains the high address for this coverage range.
*/
-  uint32_t  highAddress;
+  uint32_t highAddress;
 
   /*!
*  This member contains the high source line for this coverage range.
*/
-  std::string   highSourceLine;
+  std::string highSourceLine;
 
   /*!
* This member contains an instruction count for this coverage
* address range.
*/
-  uint32_t  instructionCount;
+  uint32_t instructionCount;
 
   /*!
*  This member contains the reason that this area was uncovered.
@@ -104,6 +104,7 @@ namespace Coverage {
  *  @param[in] lowAddressArg specifies the lowest address of the range
  *  @param[in] highAddressArg specifies the highest address of the range
  *  @param[in] why specifies the reason that the range was added
+ *  @param[in] numInstructions specifies the number of instructions
  *
  */
 void add(
-- 
1.8.3.1

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


[PATCH rtems-tools v1 3/7] TraceWriter: Convert to C++

2021-09-21 Thread Ryan Long
---
 tester/covoar/TraceWriterBase.h  |  3 ++-
 tester/covoar/TraceWriterQEMU.cc | 36 
 tester/covoar/TraceWriterQEMU.h  |  2 +-
 3 files changed, 15 insertions(+), 26 deletions(-)

diff --git a/tester/covoar/TraceWriterBase.h b/tester/covoar/TraceWriterBase.h
index 9e80dbc..a18c387 100644
--- a/tester/covoar/TraceWriterBase.h
+++ b/tester/covoar/TraceWriterBase.h
@@ -8,6 +8,7 @@
 #define __TRACE_WRITER_BASE_H__
 
 #include 
+#include 
 #include "TraceReaderBase.h"
 
 namespace Trace {
@@ -41,7 +42,7 @@ namespace Trace {
  *  @return Returns TRUE if the method succeeded and FALSE if it failed.
  */
  virtual bool writeFile(
-   const char* const  file,
+   const std::string& file,
Trace::TraceReaderBase*log,
bool   verbose
  ) =  0;
diff --git a/tester/covoar/TraceWriterQEMU.cc b/tester/covoar/TraceWriterQEMU.cc
index 177b77f..577acab 100644
--- a/tester/covoar/TraceWriterQEMU.cc
+++ b/tester/covoar/TraceWriterQEMU.cc
@@ -38,6 +38,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -47,18 +48,6 @@
 #include "CoverageMap.h"
 #include "qemu-traces.h"
 
-#if HAVE_STAT64
-#define STAT stat64
-#else
-#define STAT stat
-#endif
-
-#if HAVE_OPEN64
-#define OPEN fopen64
-#else
-#define OPEN fopen
-#endif
-
 namespace Trace {
 
   TraceWriterQEMU::TraceWriterQEMU():
@@ -71,14 +60,14 @@ namespace Trace {
   }
 
   bool TraceWriterQEMU::writeFile(
-const char* const  file,
+const std::string& file,
 Trace::TraceReaderBase*log,
 bool   verbose
   )
   {
 struct trace_header header;
 int status;
-FILE*   traceFile;
+std::ofstream   traceFile;
 uint8_t taken;
 uint8_t notTaken;
 
@@ -89,15 +78,16 @@ namespace Trace {
 // Verify that the TraceList has a non-zero size.
 //
 if ( log->Trace.set.begin() == log->Trace.set.end() ){
-  fprintf( stderr, "ERROR: Empty TraceList\n" );
+  std::cerr << "ERROR: Empty TraceList" << std::endl;
   return false;
 }
 
 //
 // Open the trace file.
 //
-traceFile = ::OPEN( file, "w" );
-if (!traceFile) {
+traceFile.open( file );
+
+if ( !traceFile.is_open() ) {
   std::ostringstream what;
   std::cerr << "Unable to open " << file << std::endl;
   return false;
@@ -113,10 +103,10 @@ namespace Trace {
 header.big_endian = false;
 header.machine[0] = 0; // XXX ??
 header.machine[1] = 0; // XXX ??
-status = ::fwrite( &header, sizeof(trace_header), 1, traceFile );
-if (status != 1) {
+
+traceFile.write( (char *) &header, sizeof( trace_header ) );
+if ( traceFile.fail() ) {
   std::cerr << "Unable to write header to " << file << std::endl;
-  ::fclose( traceFile );
   return false;
 }
 
@@ -163,15 +153,13 @@ namespace Trace {
   << std::dec << std::setfill(' ')
   << std::endl;
 
-  status = ::fwrite( &entry, sizeof(entry), 1, traceFile );
-  if (status != 1) {
-::fclose( traceFile );
+  traceFile.write( (char *) &entry, sizeof( entry ) );
+  if ( traceFile.fail() ) {
 std::cerr << "Unable to write entry to " << file << std::endl;
 return false;
   }
 }
 
-::fclose( traceFile );
 return true;
   }
 }
diff --git a/tester/covoar/TraceWriterQEMU.h b/tester/covoar/TraceWriterQEMU.h
index 09c2ddf..aa89860 100644
--- a/tester/covoar/TraceWriterQEMU.h
+++ b/tester/covoar/TraceWriterQEMU.h
@@ -44,7 +44,7 @@ namespace Trace {
  *  @return Returns TRUE if the method succeeded and FALSE if it failed.
  */
  bool writeFile(
-   const char* const  file,
+   const std::string& file,
Trace::TraceReaderBase*log,
bool   verbose
  );
-- 
1.8.3.1

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


[PATCH rtems-tools v1 4/7] TraceReaderLogQEMU.cc: Fix formatting

2021-09-21 Thread Ryan Long
---
 tester/covoar/TraceReaderLogQEMU.cc | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/tester/covoar/TraceReaderLogQEMU.cc 
b/tester/covoar/TraceReaderLogQEMU.cc
index c303d08..91ed5c7 100644
--- a/tester/covoar/TraceReaderLogQEMU.cc
+++ b/tester/covoar/TraceReaderLogQEMU.cc
@@ -53,8 +53,8 @@
 
 bool ReadUntilFound( std::ifstream& file, const char* line )
 {
-  char discardBuff[100];
-  size_t  len = strlen( line );
+  char   discardBuff[100];
+  size_t len = strlen( line );
 
   do {
 file.read( discardBuff, 99 );
@@ -62,9 +62,11 @@ bool ReadUntilFound( std::ifstream& file, const char* line )
   return false;
 }
 
-if ( strncmp( discardBuff, line, len ) == 0 )
+if ( strncmp( discardBuff, line, len ) == 0 ) {
   return true;
-  } while (1);
+}
+
+  } while( 1 );
 }
 
 namespace Trace {
@@ -120,7 +122,7 @@ namespace Trace {
 //
 //  Discard Header section
 //
-if (! ReadUntilFound( logFile, QEMU_LOG_SECTION_END ) ) {
+if ( !ReadUntilFound( logFile, QEMU_LOG_SECTION_END ) ) {
   std::cerr << "Unable to locate end of log file header" << std::endl;
   return false;
 }
@@ -128,7 +130,7 @@ namespace Trace {
 //
 //  Find first IN block
 //
-if (! ReadUntilFound( logFile, QEMU_LOG_IN_KEY )){
+if ( !ReadUntilFound( logFile, QEMU_LOG_IN_KEY ) ) {
   std::cerr << "Error: Unable to locate first IN: Block in Log file"
 << std::endl;
   return false;
@@ -143,12 +145,11 @@ namespace Trace {
 >> first.data;
 
 if ( logFile.fail() ) {
-  std::cerr << "Error Unable to Read Initial First Block"
-<< std::endl;
+  std::cerr << "Error Unable to Read Initial First Block" << std::endl;
   done = true;
 }
 
-while (!done) {
+while ( !done ) {
 
   last = first;
 
@@ -160,9 +161,9 @@ namespace Trace {
 >> last.data;
   } while( !logFile.fail() );
 
-  nextlogical = objdumpProcessor.getAddressAfter(last.address);
+  nextlogical = objdumpProcessor.getAddressAfter( last.address );
 
-  if (! ReadUntilFound( logFile, QEMU_LOG_IN_KEY )) {
+  if ( !ReadUntilFound( logFile, QEMU_LOG_IN_KEY ) ) {
 done = true;
 nextExecuted = last;
   } else {
@@ -178,7 +179,7 @@ namespace Trace {
 
   // If the nextlogical was not found we are throwing away
   // the block; otherwise add the block to the trace list.
-  if (nextlogical != 0) {
+  if ( nextlogical != 0 ) {
 TraceList::exitReason_t reason = TraceList::EXIT_REASON_OTHER;
 
 if ( objdumpProcessor.IsBranch( last.instruction ) ) {
-- 
1.8.3.1

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


[PATCH rtems-tools v1 5/7] TraceWriterQEMU.cc: Fix formatting

2021-09-21 Thread Ryan Long
---
 tester/covoar/TraceWriterQEMU.cc | 48 ++--
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/tester/covoar/TraceWriterQEMU.cc b/tester/covoar/TraceWriterQEMU.cc
index 577acab..6f88b3d 100644
--- a/tester/covoar/TraceWriterQEMU.cc
+++ b/tester/covoar/TraceWriterQEMU.cc
@@ -60,9 +60,9 @@ namespace Trace {
   }
 
   bool TraceWriterQEMU::writeFile(
-const std::string& file,
-Trace::TraceReaderBase*log,
-bool   verbose
+const std::string&  file,
+Trace::TraceReaderBase* log,
+boolverbose
   )
   {
 struct trace_header header;
@@ -77,7 +77,7 @@ namespace Trace {
 //
 // Verify that the TraceList has a non-zero size.
 //
-if ( log->Trace.set.begin() == log->Trace.set.end() ){
+if ( log->Trace.set.begin() == log->Trace.set.end() ) {
   std::cerr << "ERROR: Empty TraceList" << std::endl;
   return false;
 }
@@ -96,13 +96,13 @@ namespace Trace {
 //
 //  Write the Header to the file
 //
-strncpy( header.magic, QEMU_TRACE_MAGIC, sizeof(header.magic) );
-header.version = QEMU_TRACE_VERSION;
-header.kind= QEMU_TRACE_KIND_RAW;  // XXX ??
+strncpy( header.magic, QEMU_TRACE_MAGIC, sizeof( header.magic ) );
+header.version  = QEMU_TRACE_VERSION;
+header.kind = QEMU_TRACE_KIND_RAW;  // XXX ??
 header.sizeof_target_pc = 32;
-header.big_endian = false;
-header.machine[0] = 0; // XXX ??
-header.machine[1] = 0; // XXX ??
+header.big_endian   = false;
+header.machine[0]   = 0; // XXX ??
+header.machine[1]   = 0; // XXX ??
 
 traceFile.write( (char *) &header, sizeof( trace_header ) );
 if ( traceFile.fail() ) {
@@ -110,30 +110,32 @@ namespace Trace {
   return false;
 }
 
-if (verbose)
+if ( verbose ) {
   std::cerr << "magic = " << QEMU_TRACE_MAGIC << std::endl
 << "version = " << header.version << std::endl
 << "kind = " << header.kind << std::endl
 << "sizeof_target_pc = " << header.sizeof_target_pc << 
std::endl
 << "big_endian = " << header.big_endian << std::endl
-<< std::hex << std::setfill('0')
-<< "machine = " << std::setw(2) << header.machine[0]
+<< std::hex << std::setfill( '0' )
+<< "machine = " << std::setw( 2 ) << header.machine[0]
 << ':' << header.machine[1]
-<< std::dec << std::setfill(' ')
+<< std::dec << std::setfill( ' ' )
 << std::endl;
+}
 
 //
 // Loop through log and write each entry.
 //
 
-for (const auto & itr : log->Trace.set) {
-  struct trace_entry32  entry;
+for ( const auto & itr : log->Trace.set ) {
+  struct trace_entry32 entry;
 
   entry._pad[0] = 0;
   entry.pc  = itr.lowAddress;
   entry.size= itr.length;
   entry.op  = TRACE_OP_BLOCK;
-  switch (itr.exitReason) {
+
+  switch ( itr.exitReason ) {
 case TraceList::EXIT_REASON_BRANCH_TAKEN:
   entry.op |= taken;
   break;
@@ -143,15 +145,19 @@ namespace Trace {
 case TraceList::EXIT_REASON_OTHER:
   break;
 default:
-  throw rld::error( "Unknown exit Reason", 
"TraceWriterQEMU::writeFile" );
+  throw rld::error(
+"Unknown exit Reason",
+"TraceWriterQEMU::writeFile"
+  );
   break;
}
 
-  if ( verbose )
-std::cerr << std::hex << std::setfill('0')
+  if ( verbose ) {
+std::cerr << std::hex << std::setfill( '0' )
   << entry.pc << ' ' << entry.size << ' ' << entry.op
-  << std::dec << std::setfill(' ')
+  << std::dec << std::setfill( ' ' )
   << std::endl;
+  }
 
   traceFile.write( (char *) &entry, sizeof( entry ) );
   if ( traceFile.fail() ) {
-- 
1.8.3.1

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


[PATCH rtems-tools v1 7/7] TraceWriterQEMU.h: Fix formatting

2021-09-21 Thread Ryan Long
---
 tester/covoar/TraceWriterQEMU.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tester/covoar/TraceWriterQEMU.h b/tester/covoar/TraceWriterQEMU.h
index aa89860..7078837 100644
--- a/tester/covoar/TraceWriterQEMU.h
+++ b/tester/covoar/TraceWriterQEMU.h
@@ -44,9 +44,9 @@ namespace Trace {
  *  @return Returns TRUE if the method succeeded and FALSE if it failed.
  */
  bool writeFile(
-   const std::string& file,
-   Trace::TraceReaderBase*log,
-   bool   verbose
+   const std::string&  file,
+   Trace::TraceReaderBase* log,
+   boolverbose
  );
   };
 
-- 
1.8.3.1

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


[PATCH rtems-tools v1 6/7] TraceReaderLogQEMU.h: Fix formatting

2021-09-21 Thread Ryan Long
---
 tester/covoar/TraceReaderLogQEMU.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tester/covoar/TraceReaderLogQEMU.h 
b/tester/covoar/TraceReaderLogQEMU.h
index 59b5d23..636df3a 100644
--- a/tester/covoar/TraceReaderLogQEMU.h
+++ b/tester/covoar/TraceReaderLogQEMU.h
@@ -22,7 +22,6 @@ namespace Trace {
 
   public:
 
-
 /*!
  *  This method constructs a TraceReaderLogQEMU instance.
  */
-- 
1.8.3.1

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


[PATCH rtems-docs] posix.rst: Add info for FreeBSD 13

2021-09-21 Thread Ryan Long
Add list of additional packages needed to build RTEMS environment for
FreeBSD 13.
---
 user/hosts/posix.rst | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/user/hosts/posix.rst b/user/hosts/posix.rst
index 6686fc9..284df48 100644
--- a/user/hosts/posix.rst
+++ b/user/hosts/posix.rst
@@ -195,6 +195,16 @@ The RTEMS Source Builder has been tested on FreeBSD 9.1, 
10.3, 11 and
   # pkg install -y python
   # pkg install -y gsed
 
+For FreeBSD 13, you will need to install the packages listed above, as well as
+the following additional ones. They are:
+
+.. code-block:: none
+
+  # pkg install -y bison
+  # pkg install -y texinfo
+  # pkg install -y gmake
+  # pkg install -y binutils
+
 FreeBSD's default C compiler is LLVM and installing the host's GCC compiler
 package may break building GCC. We recommend you do not install the GCC
 package and you use the default C compiler.
-- 
1.8.3.1

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


[PATCHv5] improve the format error reporting on i386

2021-09-21 Thread zack leung
all hex values now have 8 character width
thread id is now hex
---
 cpukit/score/cpu/i386/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c
index 77b7a7161c..786cf8b0b6 100644
--- a/cpukit/score/cpu/i386/cpu.c
+++ b/cpukit/score/cpu/i386/cpu.c
@@ -215,16 +215,16 @@ void _CPU_Exception_frame_print (const
CPU_Exception_frame *ctx)
 {
   unsigned int faultAddr = 0;
   printk("--\n");
-  printk("Exception %" PRIu32 " caught at PC %" PRIx32 " by thread %"
PRId32 "\n",
+  printk("Exception %" PRIu32 " caught at PC %" PRIx32 " by thread %"
PRIx32 "\n",
  ctx->idtIndex,
  ctx->eip,
  _Thread_Executing->Object.id);
   printk("--\n");
   printk("Processor execution context at time of the fault was  :\n");
   printk("--\n");
-  printk(" EAX = %" PRIx32 "EBX = %" PRIx32 "ECX = %" PRIx32 "
EDX = %" PRIx32 "\n",
+  printk(" EAX =  0x%08" PRIx32 "EBX =  0x%08" PRIx32 "ECX =
0x%08" PRIx32 "EDX =  0x%08" PRIx32 "\n",
  ctx->eax, ctx->ebx, ctx->ecx, ctx->edx);
-  printk(" ESI = %" PRIx32 "EDI = %" PRIx32 "EBP = %" PRIx32 "
ESP = %" PRIx32 "\n",
+  printk(" ESI = 0x%08" PRIx32 "EDI =  0x%08" PRIx32 "EBP =
0x%08" PRIx32 "ESP =  0x%08" PRIx32 "\n",
  ctx->esi, ctx->edi, ctx->ebp, ctx->esp0);
   printk("--\n");
   printk("Error code pushed by processor itself (if not 0) = %" PRIx32
"\n",
-- 
2.33.0
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH rtems-docs] posix.rst: Add info for FreeBSD 13

2021-09-21 Thread Chris Johns
On 22/9/21 4:05 am, Ryan Long wrote:
> Add list of additional packages needed to build RTEMS environment for
> FreeBSD 13.
> ---
>  user/hosts/posix.rst | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/user/hosts/posix.rst b/user/hosts/posix.rst
> index 6686fc9..284df48 100644
> --- a/user/hosts/posix.rst
> +++ b/user/hosts/posix.rst
> @@ -195,6 +195,16 @@ The RTEMS Source Builder has been tested on FreeBSD 9.1, 
> 10.3, 11 and
># pkg install -y python
># pkg install -y gsed
>  
> +For FreeBSD 13, you will need to install the packages listed above, as well 
> as
> +the following additional ones. They are:
> +
> +.. code-block:: none
> +
> +  # pkg install -y bison
> +  # pkg install -y texinfo
> +  # pkg install -y gmake
> +  # pkg install -y binutils

If we use this in the documenation:

 # pkg install -y bison texinfo gmake binutils

it is a simple one line copy and paste to use :)

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


Re: [PATCH rtems-tools v1 4/7] TraceReaderLogQEMU.cc: Fix formatting

2021-09-21 Thread Chris Johns
On 22/9/21 2:45 am, Ryan Long wrote:
> ---
>  tester/covoar/TraceReaderLogQEMU.cc | 25 +
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/tester/covoar/TraceReaderLogQEMU.cc 
> b/tester/covoar/TraceReaderLogQEMU.cc
> index c303d08..91ed5c7 100644
> --- a/tester/covoar/TraceReaderLogQEMU.cc
> +++ b/tester/covoar/TraceReaderLogQEMU.cc
> @@ -53,8 +53,8 @@
>  
>  bool ReadUntilFound( std::ifstream& file, const char* line )
>  {
> -  char discardBuff[100];
> -  size_t  len = strlen( line );
> +  char   discardBuff[100];

100 bytes on the stack and not initialised ...

> +  size_t len = strlen( line );>
>do {
>  file.read( discardBuff, 99 );

Read one less than the buffer so index 99 is still not initialised ...

> @@ -62,9 +62,11 @@ bool ReadUntilFound( std::ifstream& file, const char* line 
> )
>return false;
>  }
>  
> -if ( strncmp( discardBuff, line, len ) == 0 )
> +if ( strncmp( discardBuff, line, len ) == 0 ) {

Making a call that assumes index 99 is '\0'! Does the discard buffer need to be
memset to 0?

What if the length of line is greater than 100? Is that a valid find and so a
partial match is OK? Do the lengths need to match?

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


Re: [PATCH rtems-tools v1 5/7] TraceWriterQEMU.cc: Fix formatting

2021-09-21 Thread Chris Johns



On 22/9/21 2:45 am, Ryan Long wrote:
> ---
>  tester/covoar/TraceWriterQEMU.cc | 48 
> ++--
>  1 file changed, 27 insertions(+), 21 deletions(-)
> 
> diff --git a/tester/covoar/TraceWriterQEMU.cc 
> b/tester/covoar/TraceWriterQEMU.cc
> index 577acab..6f88b3d 100644
> --- a/tester/covoar/TraceWriterQEMU.cc
> +++ b/tester/covoar/TraceWriterQEMU.cc
> @@ -60,9 +60,9 @@ namespace Trace {
>}
>  
>bool TraceWriterQEMU::writeFile(
> -const std::string& file,
> -Trace::TraceReaderBase*log,
> -bool   verbose
> +const std::string&  file,
> +Trace::TraceReaderBase* log,
> +boolverbose
>)
>{
>  struct trace_header header;
> @@ -77,7 +77,7 @@ namespace Trace {
>  //
>  // Verify that the TraceList has a non-zero size.
>  //
> -if ( log->Trace.set.begin() == log->Trace.set.end() ){
> +if ( log->Trace.set.begin() == log->Trace.set.end() ) {

Any suitable empty() call?

>std::cerr << "ERROR: Empty TraceList" << std::endl;
>return false;
>  }
> @@ -96,13 +96,13 @@ namespace Trace {
>  //
>  //  Write the Header to the file
>  //
> -strncpy( header.magic, QEMU_TRACE_MAGIC, sizeof(header.magic) );
> -header.version = QEMU_TRACE_VERSION;
> -header.kind= QEMU_TRACE_KIND_RAW;  // XXX ??
> +strncpy( header.magic, QEMU_TRACE_MAGIC, sizeof( header.magic ) );
> +header.version  = QEMU_TRACE_VERSION;
> +header.kind = QEMU_TRACE_KIND_RAW;  // XXX ??
>  header.sizeof_target_pc = 32;
> -header.big_endian = false;
> -header.machine[0] = 0; // XXX ??
> -header.machine[1] = 0; // XXX ??
> +header.big_endian   = false;
> +header.machine[0]   = 0; // XXX ??
> +header.machine[1]   = 0; // XXX ??
>  
>  traceFile.write( (char *) &header, sizeof( trace_header ) );
>  if ( traceFile.fail() ) {
> @@ -110,30 +110,32 @@ namespace Trace {
>return false;
>  }
>  
> -if (verbose)
> +if ( verbose ) {
>std::cerr << "magic = " << QEMU_TRACE_MAGIC << std::endl
>  << "version = " << header.version << std::endl
>  << "kind = " << header.kind << std::endl
>  << "sizeof_target_pc = " << header.sizeof_target_pc << 
> std::endl
>  << "big_endian = " << header.big_endian << std::endl
> -<< std::hex << std::setfill('0')
> -<< "machine = " << std::setw(2) << header.machine[0]
> +<< std::hex << std::setfill( '0' )
> +<< "machine = " << std::setw( 2 ) << header.machine[0]
>  << ':' << header.machine[1]
> -<< std::dec << std::setfill(' ')
> +<< std::dec << std::setfill( ' ' )
>  << std::endl;
> +}
>  
>  //
>  // Loop through log and write each entry.
>  //
>  
> -for (const auto & itr : log->Trace.set) {
> -  struct trace_entry32  entry;
> +for ( const auto & itr : log->Trace.set ) {

I prefer to see `auto&` than `auto &`. :)

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