Re: [PATCH 1/1] libtests/newlib01: Edit assert statements to check initialization

2022-02-15 Thread Sebastian Huber

On 15/02/2022 12:26, Matthew Joyce wrote:

From: Matt Joyce

Edit assert statements in worker thread to check initialization
against the __cleanup member of struct _reent instead of sdidinit.
This will allow the removal of sdidinit in a follow up Newlib
patch.


Thanks, I checked it in with some minor modifications.  The __cleanup 
member is a pointer, so we should test for NULL. Please make sure that 
you don't exceed the line limit for the Git commit subject.


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

[PATCH v1 5/5] cpukit/libdebugger: Add MicroBlaze support

2022-02-15 Thread Kinsey Moore
Add MicroBlaze support for libdebugger. This uses only software break
instructions to provide self-hosted GDB debugging support for
applications since internal control of debug hardware is not possible.
---
 .../libdebugger/rtems-debugger-microblaze.c   | 1440 +
 .../cpu/microblaze/include/rtems/score/cpu.h  |   24 +
 spec/build/cpukit/libdebugger.yml |2 +
 spec/build/cpukit/objdbgmicroblaze.yml|   15 +
 spec/build/cpukit/optlibdebugger.yml  |1 +
 5 files changed, 1482 insertions(+)
 create mode 100644 cpukit/libdebugger/rtems-debugger-microblaze.c
 create mode 100644 spec/build/cpukit/objdbgmicroblaze.yml

diff --git a/cpukit/libdebugger/rtems-debugger-microblaze.c 
b/cpukit/libdebugger/rtems-debugger-microblaze.c
new file mode 100644
index 00..3e7f9a141d
--- /dev/null
+++ b/cpukit/libdebugger/rtems-debugger-microblaze.c
@@ -0,0 +1,1440 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSLibdebugger
+ *
+ * @brief MicroBlaze libdebugger implementation
+ */
+
+/*
+ * Copyright (C) 2022 On-Line Applications Research Corporation (OAR)
+ *
+ * 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.
+ */
+
+#define TARGET_DEBUG 0
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+
+/* Defined by linkcmds.base */
+extern char bsp_section_text_begin[];
+extern char bsp_section_text_end[];
+extern char bsp_section_fast_text_begin[];
+extern char bsp_section_fast_text_end[];
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "rtems-debugger-target.h"
+#include "rtems-debugger-threads.h"
+
+#if TARGET_DEBUG
+#include 
+#endif
+
+/*
+ * Number of registers.
+ */
+#define RTEMS_DEBUGGER_NUMREGS 57
+
+/*
+ * Number of bytes per type of register.
+ */
+#define RTEMS_DEBUGGER_REG_BYTES4
+
+/* Debugger registers layout. See microblaze-core.xml in GDB source. */
+#define REG_R00
+#define REG_R11
+#define REG_R22
+#define REG_R33
+#define REG_R44
+#define REG_R55
+#define REG_R66
+#define REG_R77
+#define REG_R88
+#define REG_R99
+#define REG_R10   10
+#define REG_R11   11
+#define REG_R12   12
+#define REG_R13   13
+#define REG_R14   14
+#define REG_R15   15
+#define REG_R16   16
+#define REG_R17   17
+#define REG_R18   18
+#define REG_R19   19
+#define REG_R20   20
+#define REG_R21   21
+#define REG_R22   22
+#define REG_R23   23
+#define REG_R24   24
+#define REG_R25   25
+#define REG_R26   26
+#define REG_R27   27
+#define REG_R28   28
+#define REG_R29   29
+#define REG_R30   30
+#define REG_R31   31
+#define REG_PC32
+#define REG_MS33
+#define REG_EA34
+#define REG_ES35
+#define REG_FS36
+#define REG_BT37
+#define REG_PV0   38
+#define REG_PV1   39
+#define REG_PV2   40
+#define REG_PV3   41
+#define REG_PV4   42
+#define REG_PV5   43
+#define REG_PV6   44
+#define REG_PV7   45
+#define REG_PV8   46
+#define REG_PV9   47
+#define REG_PV10  48
+#define REG_PV11  49
+#define REG_ED50
+#define REG_PID   51
+#define REG_ZP52
+#define REG_TBLX  53
+#define REG_TBLSX 54
+#define REG_TBLLO 55
+#define REG_TBLHI 56
+
+/**
+ * Register offset table with the total as the last entry.
+ *
+ * Check this table in gdb with the command:
+ *
+ *   maint print registers
+ */
+static const size_t microblaze_reg_offsets[ RTEMS_DEBUGGER_NUMREGS + 1 ] = {
+  REG_R0 * 4,
+  REG_R1 * 4,
+  REG_R2 * 4,
+  REG_R3 * 4,
+  REG_R4 * 4,
+  REG_R5 * 4,
+  REG_R6 * 4,
+  REG_R7 * 4,
+  REG_R8 * 4,
+  REG_R9 * 4,
+  REG_R10 * 4,
+  REG_R11 * 4,
+  REG_R12 * 4,
+  REG_R13 * 4,
+  REG_R14 * 4,
+  REG_R15 * 4,
+  REG_R16 * 4,
+  REG_R17 * 4,
+  REG_R18 * 4,
+  REG_R19 * 4,
+  REG_R20 * 4,
+ 

[PATCH v1 4/5] cpukit/microblaze: Create interrupt flag

2022-02-15 Thread Kinsey Moore
The MicroBlaze Machine Status Register (MSR) does not have a flag that
designates the current execution status of the interrupt handler other
than the Interrupt Enable (IE) bit which may be unset for other reasons.
This makes use of R13 to signal the current interrupt nesting
encompassing the entirety of interrupt execution versus the more limited
scope of ISR_NEST_LEVEL. R13 would typically be used as a TLS data
pointer, but is currently unused by RTEMS. This interrupt flag is
necessary for a pure software break libdebugger backend implementation
since interrupt execution status must be known during thread dispatch.
---
 cpukit/score/cpu/microblaze/cpu_asm.S | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/cpukit/score/cpu/microblaze/cpu_asm.S 
b/cpukit/score/cpu/microblaze/cpu_asm.S
index 6bd81eedd9..1d18f7d95c 100644
--- a/cpukit/score/cpu/microblaze/cpu_asm.S
+++ b/cpukit/score/cpu/microblaze/cpu_asm.S
@@ -41,6 +41,17 @@
.align 2
 
 _ISR_Handler:
+   /*
+* Set interrupt context flag. This TLS register is coopted for this
+* purpose since it is not used by RTEMS. R2 would suffice as well, but
+* would need to be added to Context_Control. This is used by
+* libdebugger since ISR_NEST_LEVEL is not sufficient to indicate
+* execution in interrupt context after the stack is switched back for
+* thread dispatch. There is no MSR bit to indicate Interrupt in
+* Progress.
+*/
+   addik r13, r13, 1
+
/* Save stack frame */
swi  r3, r1, MICROBLAZE_INTERRUPT_FRAME_R3
swi  r4, r1, MICROBLAZE_INTERRUPT_FRAME_R4
@@ -153,5 +164,8 @@ quick_exit:
/* Remove stack frame */
addik r1, r1, CPU_INTERRUPT_FRAME_SIZE
 
+   /* Clear interrupt context flag */
+   addik r13, r13, -1
+
rtid r14, 0
nop
-- 
2.30.2

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


[PATCH v1 3/5] cpukit/microblaze: Add interrupt hooks

2022-02-15 Thread Kinsey Moore
Add hooks for manipulating system state before and after interrupts are
run. These hooks serve primarily to allow the MicroBlaze libdebugger
backend to prevent software breaks from occurring in interrupt context.
---
 cpukit/score/cpu/microblaze/cpu.c | 42 +++
 cpukit/score/cpu/microblaze/cpu_asm.S | 12 ++
 .../cpu/microblaze/include/rtems/score/cpu.h  | 17 
 3 files changed, 71 insertions(+)

diff --git a/cpukit/score/cpu/microblaze/cpu.c 
b/cpukit/score/cpu/microblaze/cpu.c
index fe55ef5546..960ac1bfea 100644
--- a/cpukit/score/cpu/microblaze/cpu.c
+++ b/cpukit/score/cpu/microblaze/cpu.c
@@ -229,3 +229,45 @@ void _MicroBlaze_Debug_handle( CPU_Exception_frame *ef )
 
   rtems_fatal( RTEMS_FATAL_SOURCE_EXCEPTION, (rtems_fatal_code) ef );
 }
+
+MicroBlaze_Interrupt_hook installed_preint_hook = NULL;
+
+void _MicroBlaze_Pre_Interrupt_install_hook(
+  MicroBlaze_Interrupt_hook  new_hook,
+  MicroBlaze_Interrupt_hook *old_hook
+)
+{
+  if ( old_hook != NULL ) {
+*old_hook = installed_preint_hook;
+  }
+
+  installed_preint_hook = new_hook;
+}
+
+void _MicroBlaze_Pre_Interrupt_hook()
+{
+  if ( installed_preint_hook != NULL ) {
+installed_preint_hook();
+  }
+}
+
+MicroBlaze_Interrupt_hook installed_postint_hook = NULL;
+
+void _MicroBlaze_Post_Interrupt_install_hook(
+  MicroBlaze_Interrupt_hook  new_hook,
+  MicroBlaze_Interrupt_hook *old_hook
+)
+{
+  if ( old_hook != NULL ) {
+*old_hook = installed_postint_hook;
+  }
+
+  installed_postint_hook = new_hook;
+}
+
+void _MicroBlaze_Post_Interrupt_hook()
+{
+  if ( installed_postint_hook != NULL ) {
+installed_postint_hook();
+  }
+}
diff --git a/cpukit/score/cpu/microblaze/cpu_asm.S 
b/cpukit/score/cpu/microblaze/cpu_asm.S
index 0a2c5d8fff..6bd81eedd9 100644
--- a/cpukit/score/cpu/microblaze/cpu_asm.S
+++ b/cpukit/score/cpu/microblaze/cpu_asm.S
@@ -82,6 +82,15 @@ switch_to_interrupt_stack:
swi r4, r1, 0
 
 on_interrupt_stack:
+   /*
+* Temporarily stash param 1 into r2 which is a special register not
+* used by RTEMS
+*/
+   addik r2, r5, 0
+   bralid r15, _MicroBlaze_Pre_Interrupt_hook
+   nop
+   addik r5, r2, 0
+
/* Add 1 to ISR_NEST_LEVEL */
lwi r3, r0, _Per_CPU_Information + 8
addik r3, r3, 1
@@ -120,6 +129,9 @@ after_stack_switch:
/* Fall through to quick exit */
 
 quick_exit:
+   bralid r15, _MicroBlaze_Post_Interrupt_hook
+   nop
+
/* Simple return from nested interrupt */
/* Restore registers */
lwi  r3, r1, MICROBLAZE_INTERRUPT_FRAME_MSR
diff --git a/cpukit/score/cpu/microblaze/include/rtems/score/cpu.h 
b/cpukit/score/cpu/microblaze/include/rtems/score/cpu.h
index 5ca0609e91..9c6b213e20 100644
--- a/cpukit/score/cpu/microblaze/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/microblaze/include/rtems/score/cpu.h
@@ -362,6 +362,23 @@ void _CPU_Context_switch(
   Context_Control  *heir
 );
 
+/* Interrupt hooks used by libdebugger */
+typedef void ( *MicroBlaze_Interrupt_hook )( void );
+
+void _MicroBlaze_Pre_Interrupt_install_hook(
+  MicroBlaze_Interrupt_hook  new_hook,
+  MicroBlaze_Interrupt_hook *old_hook
+);
+
+void _MicroBlaze_Pre_Interrupt_hook( void );
+
+void _MicroBlaze_Post_Interrupt_install_hook(
+  MicroBlaze_Interrupt_hook  new_hook,
+  MicroBlaze_Interrupt_hook *old_hook
+);
+
+void _MicroBlaze_Post_Interrupt_hook( void );
+
 /* Selects the appropriate resume function based on CEF state */
 RTEMS_NO_RETURN void _CPU_Exception_resume( CPU_Exception_frame *frame );
 
-- 
2.30.2

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


[PATCH v1 2/5] cpukit/libdebugger: Add pure swbreak capability

2022-02-15 Thread Kinsey Moore
Add a capability that allows for implementations that operate purely
using software breaks. Due to this implementation method, software
breaks must not be restored until just before returning control to the
thread itself and will be handled by the implementation through thread
switch and interrupt hooks.
---
 cpukit/libdebugger/rtems-debugger-target.h  | 14 +++---
 cpukit/libdebugger/rtems-debugger-threads.c |  4 +++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index 1e132fb28c..7836f93bd6 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -49,9 +49,17 @@ extern "C" {
 /**
  * Target capabilities mask.
  */
-#define RTEMS_DEBUGGER_TARGET_CAP_SWBREAK   (1 << 0)
-#define RTEMS_DEBUGGER_TARGET_CAP_HWBREAK   (1 << 1)
-#define RTEMS_DEBUGGER_TARGET_CAP_HWWATCH   (1 << 2)
+#define RTEMS_DEBUGGER_TARGET_CAP_SWBREAK  (1 << 0)
+#define RTEMS_DEBUGGER_TARGET_CAP_HWBREAK  (1 << 1)
+#define RTEMS_DEBUGGER_TARGET_CAP_HWWATCH  (1 << 2)
+/*
+ * This target capability indicates that the target implementation uses a pure
+ * software break implementation which must not allow breakpoints to be
+ * inserted before the actual switch to the thread, be it in interrupt context
+ * or otherwise. Such implementations must necessarily implement a thread
+ * switch hook and interrupt hooks to handle these situations.
+ */
+#define RTEMS_DEBUGGER_TARGET_CAP_PURE_SWBREAK (1 << 3)
 
 /**
  * Types of hardware breakpoints.
diff --git a/cpukit/libdebugger/rtems-debugger-threads.c 
b/cpukit/libdebugger/rtems-debugger-threads.c
index c628c0250e..841199bfe3 100644
--- a/cpukit/libdebugger/rtems-debugger-threads.c
+++ b/cpukit/libdebugger/rtems-debugger-threads.c
@@ -355,9 +355,11 @@ rtems_debugger_thread_system_resume(bool detaching)
   current = rtems_debugger_thread_current(threads);
   if (current != NULL) {
 size_t i;
+rtems_debugger_target* target = rtems_debugger->target;
 if (rtems_debugger_verbose())
   rtems_debugger_printf("rtems-db: sys:: resuming\n");
-if (!detaching) {
+if (!detaching
+  && (target->capabilities & RTEMS_DEBUGGER_TARGET_CAP_PURE_SWBREAK) == 0) 
{
   r = rtems_debugger_target_swbreak_insert();
   if (r == 0)
 r = rtems_debugger_target_hwbreak_insert();
-- 
2.30.2

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


[PATCH v1 0/5] Add libdebugger support for MicroBlaze

2022-02-15 Thread Kinsey Moore
This patch set adds libdebugger support for the MicroBlaze CPU port
along with the support necessary for a pure software-break
implementation of a libdebugger backend. This also fixes a bug
discovered during development.


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


[PATCH v1 1/5] cpukit/libdebugger: Avoid missed swbreak removal

2022-02-15 Thread Kinsey Moore
It is possible to remove software breaks without actually restoring the
original instruction to memory. When this happens, the original
instruction is lost. This ensures that when a software break is removed,
its original instruction is restored.
---
 cpukit/libdebugger/rtems-debugger-target.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index 04b274909b..c298a62357 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -191,6 +191,22 @@ rtems_debugger_target_swbreak_control(bool insert, 
uintptr_t addr, DB_UINT kind)
 if (loc == swbreaks[i].address) {
   size_t remaining;
   if (!insert) {
+if (target->breakpoint_size > 4)
+  memcpy(loc, swbreaks[i].contents, target->breakpoint_size);
+else {
+  switch (target->breakpoint_size) {
+  case 4:
+loc[3] = swbreaks[i].contents[3];
+  case 3:
+loc[2] = swbreaks[i].contents[2];
+  case 2:
+loc[1] = swbreaks[i].contents[1];
+  case 1:
+loc[0] = swbreaks[i].contents[0];
+break;
+  }
+}
+rtems_debugger_target_cache_sync([i]);
 --target->swbreaks.level;
 remaining = (target->swbreaks.level - i) * swbreak_size;
 memmove([i], [i + 1], remaining);
-- 
2.30.2

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


Re: [PATCH rtems-tools] bin2c: Add option for alignment

2022-02-15 Thread Christian MAUDERER
Thanks. I pushed it. I'll update the RTEMS source builder as soon as I 
have tested whether I get the hash right.


Am 14.02.22 um 17:06 schrieb Joel Sherrill:

I think this looks ok

On Mon, Feb 14, 2022, 9:44 AM Christian Mauderer 
> wrote:


Sometimes it's useful if structures are aligned. This patch add a

   -A alignment

option. Note that this doesn't check for valid alignments. It accepts
any positive number in decimal or hex format. If for example an
alignment of 7 is specified, the compiler will complain that it is not a
power of 2. But it's not really useful to duplicate this check here.
---
  misc/bin2c/rtems-bin2c.c | 42 
  1 file changed, 38 insertions(+), 4 deletions(-)

diff --git a/misc/bin2c/rtems-bin2c.c b/misc/bin2c/rtems-bin2c.c
index 462ecf0..8d0e6a1 100644
--- a/misc/bin2c/rtems-bin2c.c
+++ b/misc/bin2c/rtems-bin2c.c
@@ -42,6 +42,7 @@ int verbose = 0;
  int zeroterminated = 0;
  int createC = 1;
  int createH = 1;
+unsigned int align = 0;

  static void sanitize_file_name(char *p)
  {
@@ -175,11 +176,22 @@ void process(const char *ifname, const char
*ofname, const char *forced_name)
      /* print structure */
      fprintf(
        ocfile,
-      "%s%sunsigned char %s[] = {\n  ",
+      "%s%sunsigned char %s[] ",
        ((usestatic) ? "static " : ""),
        ((useconst) ? "const " : ""),
        buf
      );
+    if (align > 0) {
+      fprintf(
+        ocfile,
+        "__attribute__(( __aligned__(%d) )) ",
+        align
+      );
+    }
+    fprintf(
+      ocfile,
+      "= {\n  "
+    );
      int c, col = 1;
      while ((c = myfgetc(ifile)) != EOF) {
        if (col >= 78 - 6) {
@@ -238,15 +250,22 @@ void process(const char *ifname, const char
*ofname, const char *forced_name)
      /* print structure */
      fprintf(
        ohfile,
-      "extern %s%sunsigned char %s[];",
+      "extern %s%sunsigned char %s[]",
        ((usestatic) ? "static " : ""),
        ((useconst) ? "const " : ""),
        buf
      );
+    if (align > 0) {
+      fprintf(
+        ohfile,
+        " __attribute__(( __aligned__(%d) ))",
+        align
+      );
+    };
      /* print sizeof */
      fprintf(
        ohfile,
-      "\n"
+      ";\n"
        "extern %s%ssize_t %s_size;\n",
        ((usestatic) ? "static " : ""),
        ((useconst) ? "const " : ""),
@@ -274,7 +293,7 @@ void usage(void)
  {
    fprintf(
       stderr,
-     "usage: bin2c [-csvzCH] [-N name]  \n"
+     "usage: bin2c [-csvzCH] [-N name] [-A alignment] 
\n"
       "   is the binary file to convert\n"
       "   should not have a .c or .h extension\n"
       "\n"
@@ -285,6 +304,7 @@ void usage(void)
       "  -H - create c-header only\n"
       "  -C - create c-source file only\n"
       "  -N - force name of data array\n"
+     "  -A - add alignment - parameter can be a hexadecimal or
decimal number\n"
      );
    exit(1);
  }
@@ -329,6 +349,20 @@ int main(int argc, char **argv)
        name = argv[1];
        --argc;
        ++argv;
+    } else if (!strcmp(argv[1], "-A")) {
+      --argc;
+      ++argv;
+      if (argc <= 1) {
+        fprintf(stderr, "error: -A needs an alignment\n");
+        usage();
+      }
+      align = strtoul(argv[1], NULL, 0);
+      if (align == 0) {
+        fprintf(stderr, "error: Couldn't convert argument of -A\n");
+        usage();
+      }
+      --argc;
+      ++argv;
      } else {
        usage();
      }
-- 
2.31.1


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




--

embedded brains GmbH
Herr Christian MAUDERER
Dornierstr. 4
82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
phone: +49-89-18 94 741 - 18
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: [PATCH] bsp/atsam: Improve UART / USART tx performance

2022-02-15 Thread Christian MAUDERER

Thanks. I pushed it.

Am 13.02.22 um 17:36 schrieb Gedare Bloom:

ok for 5 and master

On Fri, Feb 11, 2022 at 1:07 AM Christian Mauderer
 wrote:


Put the next character into the send buffer if the buffer is empty and
not when the last character has been sent out to the line. This improves
the performance slightly.

Before that patch, the receive path was faster than the transmit path.
Therefore a simple echo could drop characters on a busy connection.
With this patch sending and receiving has about the same performance so
that no characters are lost.

Fixes #4610
---


Note: The problem exists on 5 and master. The ticket for 5 is #4611. I would
like to push this patch to both branches.



  bsps/arm/atsam/console/console.c | 9 +
  1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bsps/arm/atsam/console/console.c b/bsps/arm/atsam/console/console.c
index 5ef4327e11..0802ca2155 100644
--- a/bsps/arm/atsam/console/console.c
+++ b/bsps/arm/atsam/console/console.c
@@ -145,8 +145,9 @@ static void atsam_uart_interrupt(void *arg)
  }
}

-  if (ctx->transmitting && (sr & UART_SR_TXEMPTY) != 0) {
+  while (ctx->transmitting && (sr & UART_SR_TXRDY) != 0) {
  rtems_termios_dequeue_characters(tty, 1);
+sr = regs->UART_SR;
}
  }
  #endif
@@ -408,16 +409,16 @@ static void atsam_uart_write(
if (len > 0) {
  ctx->transmitting = true;
  regs->UART_THR = buf[0];
-regs->UART_IER = UART_IDR_TXEMPTY;
+regs->UART_IER = UART_IDR_TXRDY;
} else {
  ctx->transmitting = false;
-regs->UART_IDR = UART_IDR_TXEMPTY;
+regs->UART_IDR = UART_IDR_TXRDY;
}
  #else
size_t i;

for (i = 0; i < len; ++i) {
-while ((regs->UART_SR & UART_SR_TXEMPTY) == 0) {
+while ((regs->UART_SR & UART_SR_TXRDY) == 0) {
/* Wait */
  }

--
2.31.1

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


--

embedded brains GmbH
Herr Christian MAUDERER
Dornierstr. 4
82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
phone: +49-89-18 94 741 - 18
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

[PATCH 1/1] libtests/newlib01: Edit assert statements to check initialization

2022-02-15 Thread Matthew Joyce
From: Matt Joyce 

Edit assert statements in worker thread to check initialization
against the __cleanup member of struct _reent instead of sdidinit.
This will allow the removal of sdidinit in a follow up Newlib
patch.
---
 testsuites/libtests/newlib01/init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/testsuites/libtests/newlib01/init.c 
b/testsuites/libtests/newlib01/init.c
index 383abf41f6..adea8d84ca 100644
--- a/testsuites/libtests/newlib01/init.c
+++ b/testsuites/libtests/newlib01/init.c
@@ -70,7 +70,7 @@ static void worker_task(rtems_task_argument arg)
   char buf[1] = { 'x' };
   size_t n;
 
-  rtems_test_assert(reent->__sdidinit == 0);
+  rtems_test_assert(reent->__cleanup == 0);
 
   output = stdout = fopen(_path[0], "r+");
   rtems_test_assert(stdout != NULL);
@@ -78,9 +78,9 @@ static void worker_task(rtems_task_argument arg)
   /*
* Check newlib's __sinit does not touch our assigned file pointer.
*/
-  rtems_test_assert(reent->__sdidinit == 0);
+  rtems_test_assert(reent->__cleanup == 0);
   rtems_test_assert(fflush(stdout) == 0);
-  rtems_test_assert(reent->__sdidinit != 0);
+  rtems_test_assert(reent->__cleanup != 0);
   rtems_test_assert(stdout == output);
 
   n = fwrite([0], sizeof(buf), 1, stdout);
-- 
2.31.1

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


[PATCH 0/1] libtests/newlib01: Edit assert statements to check initialization

2022-02-15 Thread Matthew Joyce
From: Matt Joyce 

Edit assert statements to check initialization against __cleanup
member of Newlib's struct _reent instead of __sdidinit. This will
allow the removal of __sdidinit in a follow up Newlib patch.

Matt Joyce (1):
  libtests/newlib01: Edit assert statements to check initialization

 testsuites/libtests/newlib01/init.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.31.1

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


Re: New validation test suites

2022-02-15 Thread Sebastian Huber

On 15/02/2022 02:16, Chris Johns wrote:

On 15/2/22 12:43 am, Sebastian Huber wrote:

On 03/02/2022 09:09, Sebastian Huber wrote:

On 30/01/2022 23:26, Chris Johns wrote:

We just have to create a
release branch for RTEMS 6 and reference release branch commits in the
submodules.

How do you validate the generated sources in the sub-modules match those in
the
branched submodules? I think this should be done as part of the release
procedure to catch any mistakes.

I will write something about this in the release procedure documentation.

Thank you, I appreciate this. This is a big help.


I added a note to the post-branch procedure:

https://docs.rtems.org/branches/master/eng/release-process.html#post-branch-procedure




Thank you.

I noticed the documenting of branches in the procedure. Is it required they be
present to run the procedure? An important phase of making a release is the
release candidates and these are run off master. Branching before we know we are
close to working is an important aspect of the pre-release testing as it brings
a range of parts together. This should happen before branching.


At the moment there is a gap between the RTEMS sources used by 
rtems-central.git and the RTEMS sources in rtems.git. The goal is to 
close this gap so that rtems-central.git can point to a commit in 
rtems.git. However, this is a process which may need a couple of months. 
On the master branches this gap is not really an issue. On a release 
branch it would be an issue and this is covered by the post-branch 
procedure in the manual now.





How do we want to proceed here?


I am currently rather busy on something and will be for a while. As a result I
have been a little distracted and I apologise for this.


I have no idea what should I do next.


As has been stated, making a release takes some time and effort and my
experience of doing it has taught me all the detail needs to be covered. Until I
can see rtems-central integrated into a release we cannot not depend on it.
Given the way the validation tests have been created merging makes rtems.git
depend on rtems-central if merged. In the past we have not taken care of these
things and it has fallen to me to sort out and I prefer that does not happen in
this case.


From my point of view, the release related activities for 
rtems-central.git are covered in the Software Release Management chapter.



I should also state the rtems-central repo is on probation and even if it is
added to a release it will still remain like that for a reasonable period of
time. It is still not clear where the line of responsibility lies with that repo
and the long term maintenance of the qual effort. This may appear abrupt however
I need to be clear about this so there is no misunderstanding.


My ability to predict the future is also rather limited. I focus 
currently on the integration of the remaining work done for the 
pre-qualification activity. This is enough work to keep me busy for a while.





The new validation tests are not the only work from the pre-qualification
activity I would like to integrate. We also have work from Andrew Butterfields
related to formal methods. There are changes in the GR712RC and GR740 BSPs, the
gcov code coverage support, and build system changes to support the build of
RTEMS libraries which contain only the pre-qualified feature set.


Making a release is documented here:

https://git.rtems.org/rtems-release/tree/README.txt

I run a single command that creates a complete release. How will the procedure
outlined in the eng manual be implemented here? [1]

What will an rtems-central tarball look like? I am specifically concerned the
export process to turn a git repo into a tarball will include a copy of the
sub-modules. This is the current way the release scripts work. If this is the
case we will have 2 copies of some repos in the release and I think that is a
bad idea.


We don't need a rtems-central tarball for releases. This repository 
contains nothing directly relevant to an RTEMS user. In theory the 
rtems-central.git repository could be used to make releases. It could 
make sense to move the stuff in rtems-release.git to rtems-central.git.




Chris

[1] The release scripts assume an autoconf RTEMS and so I suspect what is there
is broken. This makes the rtems-central integration more complicated than it
need be. I have not looked at what is needed


I updated the scripts so that they support the new RTEMS build system. I 
fixed also some FreeBSD/GNU compatibility issues. It still doesn't run 
completely on Linux. One issue is the missing "sha512" command line tool.


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