Re: [PATCH rtems-libbsd 1/2] racoon/session: Honor file descriptor maximum

2021-03-01 Thread Christian MAUDERER

Hello Chris,

thanks for the review.

Am 26.02.21 um 19:04 schrieb Chris Johns:

On 26/2/21 2:01 am, Christian Mauderer wrote:

Dynamically allocate a big enough file descriptor set for select(). A
better solution would be to use kqueue() instead of select().
---
  .../racoon/rtems-bsd-racoon-session-data.h|  6 +--
  ipsec-tools/src/racoon/session.c  | 40 +++
  2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/ipsec-tools/src/racoon/rtems-bsd-racoon-session-data.h 
b/ipsec-tools/src/racoon/rtems-bsd-racoon-session-data.h
index b869a1518..196107a35 100644
--- a/ipsec-tools/src/racoon/rtems-bsd-racoon-session-data.h
+++ b/ipsec-tools/src/racoon/rtems-bsd-racoon-session-data.h
@@ -2,11 +2,11 @@
  #include 
  #include "rtems-bsd-racoon-data.h"
  /* session.c */
-RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static fd_set active_mask);
-RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static fd_set preset_mask);
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static _types_fd_set 
*allocated_active_mask);
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static _types_fd_set 
*allocated_preset_mask);
  RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static int nfds);
  RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static int signals[]);
  RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static sig_atomic_t volatile 
volatile sigreq[]);
-RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static struct fd_monitor 
fd_monitors[]);
+RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static struct fd_monitor 
*allocated_fd_monitors);
  RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static struct fd_monitor_list 
fd_monitor_tree[]);
  RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static struct sched scflushsa);
diff --git a/ipsec-tools/src/racoon/session.c b/ipsec-tools/src/racoon/session.c
index 65124c15e..90120c761 100644
--- a/ipsec-tools/src/racoon/session.c
+++ b/ipsec-tools/src/racoon/session.c
@@ -65,6 +65,10 @@
  #include 
  #include 
  #include 
+#ifdef __rtems__
+#include 
+#include 
+#endif /* __rtems__ */
  
  #include 

  #include 
@@ -123,8 +127,16 @@ static void check_sigreq __P((void));
  static void check_flushsa __P((void));
  static int close_sockets __P((void));
  
+#ifndef __rtems__

  static fd_set preset_mask, active_mask;
  static struct fd_monitor fd_monitors[FD_SETSIZE];
+#else /* __rtems__ */
+static fd_set *allocated_preset_mask, *allocated_active_mask;
+static struct fd_monitor *allocated_fd_monitors;
+#define preset_mask (*allocated_preset_mask)
+#define active_mask (*allocated_active_mask)
+#define fd_monitors (allocated_fd_monitors)
+#endif /* __rtems__ */
  static TAILQ_HEAD(fd_monitor_list, fd_monitor) 
fd_monitor_tree[NUM_PRIORITIES];
  static int nfds = 0;
  
@@ -134,7 +146,11 @@ static struct sched scflushsa = SCHED_INITIALIZER();

  void
  monitor_fd(int fd, int (*callback)(void *, int), void *ctx, int priority)
  {
+#ifndef __rtems__
if (fd < 0 || fd >= FD_SETSIZE) {
+#else /* __rtems__ */
+   if (fd < 0 || fd >= rtems_libio_number_iops) {
+#endif /* __rtems__ */
plog(LLV_ERROR, LOCATION, NULL, "fd_set overrun");
exit(1);
}
@@ -158,7 +174,11 @@ monitor_fd(int fd, int (*callback)(void *, int), void 
*ctx, int priority)
  void
  unmonitor_fd(int fd)
  {
+#ifndef __rtems__
if (fd < 0 || fd >= FD_SETSIZE) {
+#else /* __rtems__ */
+   if (fd < 0 || fd >= rtems_libio_number_iops) {
+#endif /* __rtems__ */
plog(LLV_ERROR, LOCATION, NULL, "fd_set overrun");
exit(1);
}
@@ -186,7 +206,22 @@ session(void)
struct fd_monitor *fdm;
  
  	nfds = 0;

+#ifndef __rtems__
FD_ZERO(&preset_mask);
+#else /* __rtems__ */
+   allocated_preset_mask = calloc(sizeof(fd_set),
+   howmany(rtems_libio_number_iops, sizeof(fd_set) * 8));


Does `maxfiles` work here?



To be honest: I'm not sure.

According to the comment in file.h:

extern int maxfiles; /* kernel limit on number of open files */

Sounds like it _can_ be the same as the maximum file number but doesn't 
have to. I didn't find where we implement it. It's declared as an extern 
int maxfiles but I didn't find any definition. I found it only in libbsd 
in freebsd/sys/kern/uipc_socket.c where it is defined like follows:


#define maxfiles rtems_libio_number_iops

So question is: Where and how is maxfiles defined?


+   if (allocated_preset_mask == NULL)
+   errx(1, "failed to allocate preset_mask");
+   allocated_active_mask = calloc(sizeof(fd_set),
+   howmany(rtems_libio_number_iops, sizeof(fd_set) * 8));
+   if (allocated_active_mask == NULL)
+   errx(1, "failed to allocate active_mask");
+   allocated_fd_monitors = calloc(
+   rtems_libio_number_iops, sizeof(struct fd_monitor));
+   if (allocated_fd_monitors == NULL)
+   errx(1, "failed to allocate fd_monitors");


At the core of this issue is the rotating fd allocation that we have in libio. 

[PATCH 4/4] validation: Add comments to task tests

2021-03-01 Thread Sebastian Huber
---
 .../validation/tc-task-construct-errors.c | 123 ++
 testsuites/validation/tc-task-create-errors.c | 108 +++
 2 files changed, 231 insertions(+)

diff --git a/testsuites/validation/tc-task-construct-errors.c 
b/testsuites/validation/tc-task-construct-errors.c
index cb8106e270..72baefb5ff 100644
--- a/testsuites/validation/tc-task-construct-errors.c
+++ b/testsuites/validation/tc-task-construct-errors.c
@@ -337,11 +337,17 @@ static void RtemsTaskReqConstructErrors_Pre_Id_Prepare(
 {
   switch ( state ) {
 case RtemsTaskReqConstructErrors_Pre_Id_Valid: {
+  /*
+   * The id parameter shall reference an object identifier value.
+   */
   ctx->id = &ctx->id_value;
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_Id_Null: {
+  /*
+   * The id parameter shall be NULL.
+   */
   ctx->id = NULL;
   break;
 }
@@ -358,11 +364,17 @@ static void RtemsTaskReqConstructErrors_Pre_Name_Prepare(
 {
   switch ( state ) {
 case RtemsTaskReqConstructErrors_Pre_Name_Valid: {
+  /*
+   * The name of the task configuration shall be valid.
+   */
   ctx->config.name = NAME;
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_Name_Inv: {
+  /*
+   * The name of the task configuration shall be invalid.
+   */
   ctx->config.name = 0;
   break;
 }
@@ -379,11 +391,18 @@ static void 
RtemsTaskReqConstructErrors_Pre_SysTsk_Prepare(
 {
   switch ( state ) {
 case RtemsTaskReqConstructErrors_Pre_SysTsk_Yes: {
+  /*
+   * The attributes of the task configuration shall specify a system task.
+   */
   ctx->config.attributes |= RTEMS_SYSTEM_TASK;
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_SysTsk_No: {
+  /*
+   * The attributes of the task configuration shall specify an application
+   * task.
+   */
   /* Nothing to do */
   break;
 }
@@ -400,16 +419,25 @@ static void RtemsTaskReqConstructErrors_Pre_Prio_Prepare(
 {
   switch ( state ) {
 case RtemsTaskReqConstructErrors_Pre_Prio_Valid: {
+  /*
+   * The initial priority of the task configuration shall be valid.
+   */
   ctx->config.initial_priority = 254;
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_Prio_Zero: {
+  /*
+   * The initial priority of the task configuration shall be zero.
+   */
   ctx->config.initial_priority = 0;
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_Prio_Inv: {
+  /*
+   * The initial priority of the task configuration shall be invalid.
+   */
   ctx->config.initial_priority = 0x;
   break;
 }
@@ -426,11 +454,17 @@ static void RtemsTaskReqConstructErrors_Pre_Free_Prepare(
 {
   switch ( state ) {
 case RtemsTaskReqConstructErrors_Pre_Free_Yes: {
+  /*
+   * The system shall have at least one inactive task object available.
+   */
   /* Nothing to do */
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_Free_No: {
+  /*
+   * The system shall have no inactive task object available.
+   */
   ctx->seized_objects = T_seize_objects( Create, ctx );
   break;
 }
@@ -447,11 +481,19 @@ static void RtemsTaskReqConstructErrors_Pre_TLS_Prepare(
 {
   switch ( state ) {
 case RtemsTaskReqConstructErrors_Pre_TLS_Enough: {
+  /*
+   * The maximum thread-local storage size of the task configuration shall 
be
+   * greater than or equal to the thread-local storage size.
+   */
   ctx->config.maximum_thread_local_storage_size = MAX_TLS_SIZE;
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_TLS_Small: {
+  /*
+   * The maximum thread-local storage size of the task configuration shall 
be
+   * less than the thread-local storage size.
+   */
   ctx->config.maximum_thread_local_storage_size = 0;
   break;
 }
@@ -468,11 +510,19 @@ static void RtemsTaskReqConstructErrors_Pre_Stack_Prepare(
 {
   switch ( state ) {
 case RtemsTaskReqConstructErrors_Pre_Stack_Enough: {
+  /*
+   * The task stack size of the task configuration shall be greater than or
+   * equal to the configured minimum size.
+   */
   ctx->stack_size = RTEMS_MINIMUM_STACK_SIZE;
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_Stack_Small: {
+  /*
+   * The task stack size of the task configuration shall be less than the
+   * configured minimum size.
+   */
   ctx->stack_size = 0;
   break;
 }
@@ -489,11 +539,17 @@ static void RtemsTaskReqConstructErrors_Pre_Ext_Prepare(
 {
   switch ( state ) {
 case RtemsTaskReqConstructErrors_Pre_Ext_Ok: {
+  /*
+   * None of the task create extensions shall fail.
+   */
   ctx->create_extension_status = true;
   break;
 }
 
 case RtemsTaskReqConstructErrors_Pre_Ext_Err: {
+  /*
+   * At least one of the task create extensions sha

[PATCH 2/4] validation: Add comments to signal tests

2021-03-01 Thread Sebastian Huber
---
 testsuites/validation/tc-signal-catch.c | 106 
 testsuites/validation/tc-signal-send.c  |  78 +
 2 files changed, 184 insertions(+)

diff --git a/testsuites/validation/tc-signal-catch.c 
b/testsuites/validation/tc-signal-catch.c
index 9c14cc93a3..7c3292ba71 100644
--- a/testsuites/validation/tc-signal-catch.c
+++ b/testsuites/validation/tc-signal-catch.c
@@ -251,11 +251,17 @@ static void RtemsSignalReqCatch_Pre_Handler_Prepare(
 {
   switch ( state ) {
 case RtemsSignalReqCatch_Pre_Handler_Invalid: {
+  /*
+   * The ``asr_handler`` parameter shall be NULL.
+   */
   ctx->handler = NULL;
   break;
 }
 
 case RtemsSignalReqCatch_Pre_Handler_Valid: {
+  /*
+   * The ``asr_handler`` parameter shall be a valid ASR handler.
+   */
   ctx->handler = SignalHandler;
   break;
 }
@@ -272,6 +278,10 @@ static void RtemsSignalReqCatch_Pre_Preempt_Prepare(
 {
   switch ( state ) {
 case RtemsSignalReqCatch_Pre_Preempt_Yes: {
+  /*
+   * The ``mode_set`` parameter shall specify that
+   * preemption is enabled.
+   */
   #if defined(RTEMS_SMP)
   if ( rtems_configuration_get_maximum_processors() == 1 ) {
 ctx->normal_mode |= RTEMS_NO_PREEMPT;
@@ -283,6 +293,10 @@ static void RtemsSignalReqCatch_Pre_Preempt_Prepare(
 }
 
 case RtemsSignalReqCatch_Pre_Preempt_No: {
+  /*
+   * The ``mode_set`` parameter shall specify that
+   * preemption is disabled.
+   */
   ctx->mode |= RTEMS_NO_PREEMPT;
   break;
 }
@@ -299,11 +313,19 @@ static void RtemsSignalReqCatch_Pre_Timeslice_Prepare(
 {
   switch ( state ) {
 case RtemsSignalReqCatch_Pre_Timeslice_Yes: {
+  /*
+   * The ``mode_set`` parameter shall specify that
+   * timeslicing is enabled.
+   */
   ctx->mode |= RTEMS_TIMESLICE;
   break;
 }
 
 case RtemsSignalReqCatch_Pre_Timeslice_No: {
+  /*
+   * The ``mode_set`` parameter shall specify that
+   * timeslicing is disabled.
+   */
   ctx->normal_mode |= RTEMS_TIMESLICE;
   break;
 }
@@ -320,11 +342,19 @@ static void RtemsSignalReqCatch_Pre_ASR_Prepare(
 {
   switch ( state ) {
 case RtemsSignalReqCatch_Pre_ASR_Yes: {
+  /*
+   * The ``mode_set`` parameter shall specify that
+   * ASR processing is enabled.
+   */
   /* We cannot disable ASR processing at normal task level for this test */
   break;
 }
 
 case RtemsSignalReqCatch_Pre_ASR_No: {
+  /*
+   * The ``mode_set`` parameter shall specify that
+   * ASR processing is disabled.
+   */
   ctx->mode |= RTEMS_NO_ASR;
   break;
 }
@@ -341,6 +371,10 @@ static void RtemsSignalReqCatch_Pre_IntLvl_Prepare(
 {
   switch ( state ) {
 case RtemsSignalReqCatch_Pre_IntLvl_Zero: {
+  /*
+   * The ``mode_set`` parameter shall specify an interrupt
+   * level of zero.
+   */
   #if !defined(RTEMS_SMP) && CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
   ctx->normal_mode |= RTEMS_INTERRUPT_LEVEL( 1 );
   #endif
@@ -348,6 +382,10 @@ static void RtemsSignalReqCatch_Pre_IntLvl_Prepare(
 }
 
 case RtemsSignalReqCatch_Pre_IntLvl_Positive: {
+  /*
+   * The ``mode_set`` parameter shall specify a positive
+   * interrupt level.
+   */
   ctx->mode |= RTEMS_INTERRUPT_LEVEL( 1 );
   break;
 }
@@ -364,11 +402,21 @@ static void RtemsSignalReqCatch_Post_Status_Check(
 {
   switch ( state ) {
 case RtemsSignalReqCatch_Post_Status_Ok: {
+  /*
+   * The return status of rtems_signal_catch() shall be
+   * RTEMS_SUCCESSFUL.
+   */
   T_rsc_success( ctx->catch_status );
   break;
 }
 
 case RtemsSignalReqCatch_Post_Status_NotImplNoPreempt: {
+  /*
+   * Where the system is configured with SMP support, if the scheduler does
+   * not support the no-preempt mode, then the return status of
+   * rtems_signal_catch() shall be RTEMS_NOT_IMPLEMENTED,
+   * otherwise the return status shall be RTEMS_SUCCESSFUL.
+   */
   #if defined(RTEMS_SMP)
   if ( rtems_configuration_get_maximum_processors() > 1 ) {
 T_rsc( ctx->catch_status, RTEMS_NOT_IMPLEMENTED );
@@ -382,6 +430,13 @@ static void RtemsSignalReqCatch_Post_Status_Check(
 }
 
 case RtemsSignalReqCatch_Post_Status_NotImplIntLvl: {
+  /*
+   * Where the system is configured with SMP support and the configured
+   * processor maximum is greater than one, or the CPU port enabled robust
+   * thread dispatching, the return status of rtems_signal_catch() shall be
+   * RTEMS_NOT_IMPLEMENTED, otherwise the return status
+   * shall be RTEMS_SUCCESSFUL.
+   */
   #if CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
   T_rsc( ctx->catch_status, RTEMS_NOT_IMPLEMENTED );
   #elif defined(RTEMS_SMP)
@@ -408,6 +463,11 @@ static void RtemsSignalReqCatch_Post_Send_Check(
 {
   switch ( state ) {
 

[PATCH 1/4] validation: Add comments to barrier tests

2021-03-01 Thread Sebastian Huber
Unify code sections across tests.
---
 testsuites/validation/tc-barrier-create.c  | 86 +-
 testsuites/validation/tc-barrier-delete.c  | 27 +++
 testsuites/validation/tc-barrier-release.c | 44 +++
 testsuites/validation/tc-barrier-wait.c| 53 +
 4 files changed, 207 insertions(+), 3 deletions(-)

diff --git a/testsuites/validation/tc-barrier-create.c 
b/testsuites/validation/tc-barrier-create.c
index 3b8a4d3ea0..f55e3311d1 100644
--- a/testsuites/validation/tc-barrier-create.c
+++ b/testsuites/validation/tc-barrier-create.c
@@ -54,8 +54,6 @@
 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 
@@ -252,11 +250,17 @@ static void RtemsBarrierReqCreate_Pre_Name_Prepare(
 {
   switch ( state ) {
 case RtemsBarrierReqCreate_Pre_Name_Valid: {
+  /*
+   * The ``name`` parameter shall be valid.
+   */
   ctx->name = NAME;
   break;
 }
 
 case RtemsBarrierReqCreate_Pre_Name_Invalid: {
+  /*
+   * The ``name`` parameter shall be invalid.
+   */
   ctx->name = 0;
   break;
 }
@@ -273,16 +277,28 @@ static void RtemsBarrierReqCreate_Pre_Class_Prepare(
 {
   switch ( state ) {
 case RtemsBarrierReqCreate_Pre_Class_Default: {
+  /*
+   * The ``attribute_set`` parameter shall specify the default
+   * class.
+   */
   /* Nothing to do */
   break;
 }
 
 case RtemsBarrierReqCreate_Pre_Class_Manual: {
+  /*
+   * The ``attribute_set`` parameter shall specify the manual
+   * release class.
+   */
   ctx->attribute_set |= RTEMS_BARRIER_MANUAL_RELEASE;
   break;
 }
 
 case RtemsBarrierReqCreate_Pre_Class_Auto: {
+  /*
+   * The ``attribute_set`` parameter shall specify the
+   * automatic release class.
+   */
   ctx->attribute_set |= RTEMS_BARRIER_AUTOMATIC_RELEASE;
   break;
 }
@@ -299,11 +315,17 @@ static void RtemsBarrierReqCreate_Pre_MaxWait_Prepare(
 {
   switch ( state ) {
 case RtemsBarrierReqCreate_Pre_MaxWait_Zero: {
+  /*
+   * The ``maximum_waiters`` parameter shall be zero.
+   */
   ctx->maximum_waiters = 0;
   break;
 }
 
 case RtemsBarrierReqCreate_Pre_MaxWait_Positive: {
+  /*
+   * The ``maximum_waiters`` parameter shall be positive.
+   */
   ctx->maximum_waiters = 1;
   break;
 }
@@ -320,11 +342,19 @@ static void RtemsBarrierReqCreate_Pre_Id_Prepare(
 {
   switch ( state ) {
 case RtemsBarrierReqCreate_Pre_Id_Valid: {
+  /*
+   * The ``id`` parameter shall reference an object
+   * identifier value.
+   */
   ctx->id = &ctx->id_value;
   break;
 }
 
 case RtemsBarrierReqCreate_Pre_Id_Null: {
+  /*
+   * The ``id`` parameter shall be
+   * NULL.
+   */
   ctx->id = NULL;
   break;
 }
@@ -341,11 +371,17 @@ static void RtemsBarrierReqCreate_Pre_Free_Prepare(
 {
   switch ( state ) {
 case RtemsBarrierReqCreate_Pre_Free_Yes: {
+  /*
+   * The system shall have at least one inactive barrier object available.
+   */
   /* Nothing to do */
   break;
 }
 
 case RtemsBarrierReqCreate_Pre_Free_No: {
+  /*
+   * The system shall have no inactive partition object available.
+   */
   ctx->seized_objects = T_seize_objects( Create, NULL );
   break;
 }
@@ -362,26 +398,46 @@ static void RtemsBarrierReqCreate_Post_Status_Check(
 {
   switch ( state ) {
 case RtemsBarrierReqCreate_Post_Status_Ok: {
+  /*
+   * The return status of rtems_barrier_create() shall be
+   * RTEMS_SUCCESSFUL.
+   */
   T_rsc_success( ctx->status );
   break;
 }
 
 case RtemsBarrierReqCreate_Post_Status_InvName: {
+  /*
+   * The return status of rtems_barrier_create() shall be
+   * RTEMS_INVALID_NAME.
+   */
   T_rsc( ctx->status, RTEMS_INVALID_NAME );
   break;
 }
 
 case RtemsBarrierReqCreate_Post_Status_InvAddr: {
+  /*
+   * The return status of rtems_barrier_create() shall be
+   * RTEMS_INVALID_ADDRESS.
+   */
   T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
   break;
 }
 
 case RtemsBarrierReqCreate_Post_Status_InvNum: {
+  /*
+   * The return status of rtems_barrier_create() shall be
+   * RTEMS_INVALID_NUMBER.
+   */
   T_rsc( ctx->status, RTEMS_INVALID_NUMBER );
   break;
 }
 
 case RtemsBarrierReqCreate_Post_Status_TooMany: {
+  /*
+   * The return status of rtems_barrier_create() shall be
+   * RTEMS_TOO_MANY.
+   */
   T_rsc( ctx->status, RTEMS_TOO_MANY );
   break;
 }
@@ -401,7 +457,11 @@ static void RtemsBarrierReqCreate_Post_Name_Check(
 
   switch ( state ) {
 case RtemsBarrierReqCreate_Post_Name_Valid: {
-  id = INVALID_ID;
+  /*
+   * The unique object name shall identify the barrier created by the
+   * rtems_barrier_create() call.
+   */
+  id = 0;
   sc = rtems_b

[PATCH 3/4] validation: Add comments to message queue tests

2021-03-01 Thread Sebastian Huber
Split up post-condition.
---
 .../validation/tc-message-construct-errors.c  | 1364 +
 1 file changed, 1056 insertions(+), 308 deletions(-)

diff --git a/testsuites/validation/tc-message-construct-errors.c 
b/testsuites/validation/tc-message-construct-errors.c
index 0792e29d48..d5e0b301fd 100644
--- a/testsuites/validation/tc-message-construct-errors.c
+++ b/testsuites/validation/tc-message-construct-errors.c
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2020, 2021 embedded brains GmbH 
(http://www.embedded-brains.de)
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -54,8 +54,6 @@
 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 
@@ -123,6 +121,18 @@ typedef enum {
   RtemsMessageReqConstructErrors_Post_Status_NA
 } RtemsMessageReqConstructErrors_Post_Status;
 
+typedef enum {
+  RtemsMessageReqConstructErrors_Post_Name_Valid,
+  RtemsMessageReqConstructErrors_Post_Name_Invalid,
+  RtemsMessageReqConstructErrors_Post_Name_NA
+} RtemsMessageReqConstructErrors_Post_Name;
+
+typedef enum {
+  RtemsMessageReqConstructErrors_Post_IdValue_Assigned,
+  RtemsMessageReqConstructErrors_Post_IdValue_Unchanged,
+  RtemsMessageReqConstructErrors_Post_IdValue_NA
+} RtemsMessageReqConstructErrors_Post_IdValue;
+
 /**
  * @brief Test context for spec:/rtems/message/req/construct-errors test case.
  */
@@ -207,6 +217,10 @@ static const char * const * const 
RtemsMessageReqConstructErrors_PreDesc[] = {
   NULL
 };
 
+#define NAME rtems_build_name( 'T', 'E', 'S', 'T' )
+
+#define INVALID_ID 0x
+
 #define MAX_MESSAGE_QUEUES 4
 
 #define MAX_PENDING_MESSAGES 1
@@ -247,11 +261,17 @@ static void RtemsMessageReqConstructErrors_Pre_Id_Prepare(
 {
   switch ( state ) {
 case RtemsMessageReqConstructErrors_Pre_Id_Id: {
+  /*
+   * The id parameter shall reference an object identifier value.
+   */
   ctx->id = &ctx->id_value;
   break;
 }
 
 case RtemsMessageReqConstructErrors_Pre_Id_Null: {
+  /*
+   * The id parameter shall be NULL.
+   */
   ctx->id = NULL;
   break;
 }
@@ -268,11 +288,17 @@ static void 
RtemsMessageReqConstructErrors_Pre_Name_Prepare(
 {
   switch ( state ) {
 case RtemsMessageReqConstructErrors_Pre_Name_Valid: {
-  ctx->config.name = rtems_build_name( 'N', 'A', 'M', 'E' );
+  /*
+   * The name of the message queue configuration shall be valid.
+   */
+  ctx->config.name = NAME;
   break;
 }
 
 case RtemsMessageReqConstructErrors_Pre_Name_Invalid: {
+  /*
+   * The name of the message queue configuration shall be invalid.
+   */
   ctx->config.name = 0;
   break;
 }
@@ -289,16 +315,29 @@ static void 
RtemsMessageReqConstructErrors_Pre_MaxPending_Prepare(
 {
   switch ( state ) {
 case RtemsMessageReqConstructErrors_Pre_MaxPending_Valid: {
+  /*
+   * The maximum number of pending messages of the message queue 
configuration
+   * shall be valid.
+   */
   ctx->config.maximum_pending_messages = MAX_PENDING_MESSAGES;
   break;
 }
 
 case RtemsMessageReqConstructErrors_Pre_MaxPending_Zero: {
+  /*
+   * The maximum number of pending messages of the message queue 
configuration
+   * shall be zero.
+   */
   ctx->config.maximum_pending_messages = 0;
   break;
 }
 
 case RtemsMessageReqConstructErrors_Pre_MaxPending_Big: {
+  /*
+   * The maximum number of pending messages of the message queue 
configuration
+   * shall be big enough so that a calculation to get the message buffer
+   * storage area size overflows.
+   */
   ctx->config.maximum_pending_messages = UINT32_MAX;
   break;
 }
@@ -315,16 +354,29 @@ static void 
RtemsMessageReqConstructErrors_Pre_MaxSize_Prepare(
 {
   switch ( state ) {
 case RtemsMessageReqConstructErrors_Pre_MaxSize_Valid: {
+  /*
+   * The maximum message size of the message queue configuration shall be
+   * valid.
+   */
   ctx->config.maximum_message_size = MAX_MESSAGE_SIZE;
   break;
 }
 
 case RtemsMessageReqConstructErrors_Pre_MaxSize_Zero: {
+  /*
+   * The maximum message size of the message queue configuration shall be
+   * zero.
+   */
   ctx->config.maximum_message_size = 0;
   break;
 }
 
 case RtemsMessageReqConstructErrors_Pre_MaxSize_Big: {
+  /*
+   * The maximum message size of the message queue configuration
+   * shall be big enough so that a calculation to get the message buffer
+   * storage area size overflows.
+   */
   ctx->config.maximum_message_size = SIZE_MAX;
   break;
 }
@@ -343,11 +395,18 @@ static void 
RtemsMessageReqConstructErrors_Pre_Free_Prepare(
 
   switch ( state ) {
 case RtemsMessageReqConstructErrors_Pre_Free_Yes: {
+  /*

Re: About HEAP error

2021-03-01 Thread Gedare Bloom
On Sun, Feb 28, 2021 at 10:53 PM Richi Dubey  wrote:
>
> Hi,
>
> I get this error on sp02:
>
> *** FATAL ***
> fatal source: 13 (RTEMS_FATAL_SOURCE_HEAP)
> CPU: 0
> fatal code: 2125180 (0x00206d7c)
> RTEMS version: 6.0.0.44ae183090f3bc1a4ee281ff98525209b3fda7a7-modified
> RTEMS tools: 10.2.1 20210125 (RTEMS 6, RSB 
> ade089253e70d75105a8311844f82f6d20cc30a8, Newlib cb41c37)
> executing thread ID: 0x08a010001
> executing thread name: UI1
>
> On checking docs, it says the fatal code indicates address of heap context. I 
> could not find any further information about this. How do I use 2125180 
> (0x00206d7c) to get more information about my error? Please advise.

Good that you found that much.
https://docs.rtems.org/branches/master/c-user/fatal_error.html
Then, you can put that address in gdb cast it as a Heap_Error_context
and investigate it.

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


Re: [PATCH] score: Simplify _Objects_Name_to_id_u32()

2021-03-01 Thread Gedare Bloom
Looks good.

On Mon, Mar 1, 2021 at 12:25 AM Sebastian Huber
 wrote:
>
> Remove superfluous check for the objects maximum since the maximum is
> also used as a loop limit.
>
> Fix formatting.
> ---
>  cpukit/score/src/objectnametoid.c | 41 ---
>  1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/cpukit/score/src/objectnametoid.c 
> b/cpukit/score/src/objectnametoid.c
> index da5cbabbc4..c70410d955 100644
> --- a/cpukit/score/src/objectnametoid.c
> +++ b/cpukit/score/src/objectnametoid.c
> @@ -22,6 +22,11 @@
>
>  #include 
>
> +static bool _Objects_Is_local_node_search( uint32_t node )
> +{
> +  return node == OBJECTS_SEARCH_LOCAL_NODE || _Objects_Is_local_node( node );
> +}
> +
>  Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
>uint32_t   name,
>uint32_t   node,
> @@ -29,36 +34,31 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
>const Objects_Information *information
>  )
>  {
> -  bool   search_local_node;
> -  const Objects_Control *the_object;
> -  Objects_Maximummaximum;
> -  Objects_Maximumindex;
>  #if defined(RTEMS_MULTIPROCESSING)
> -  Objects_Name   name_for_mp;
> +  Objects_Name name_for_mp;
>  #endif
>
> -  /* ASSERT: information->is_string == false */
> +  _Assert( !_Objects_Has_string_name( information ) );
>
> -  if ( !id )
> +  if ( id == NULL ) {
>  return OBJECTS_INVALID_ADDRESS;
> +  }
>
> -  maximum = _Objects_Get_maximum_index( information );
> -  search_local_node = false;
> +  if (
> +node == OBJECTS_SEARCH_ALL_NODES ||
> +_Objects_Is_local_node_search( node )
> +  ) {
> +Objects_Maximum maximum;
> +Objects_Maximum index;
>
> -  if ( maximum > 0 &&
> -  (node == OBJECTS_SEARCH_ALL_NODES ||
> -   node == OBJECTS_SEARCH_LOCAL_NODE ||
> -   _Objects_Is_local_node( node )
> -  ))
> -   search_local_node = true;
> +maximum = _Objects_Get_maximum_index( information );
>
> -  if ( search_local_node ) {
>  for ( index = 0; index < maximum; ++index ) {
> +  const Objects_Control *the_object;
> +
>the_object = information->local_table[ index ];
> -  if ( !the_object )
> -continue;
>
> -  if ( name == the_object->name.name_u32 ) {
> +  if ( the_object != NULL && name == the_object->name.name_u32 ) {
>  *id = the_object->id;
>  _Assert( name != 0 );
>  return OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL;
> @@ -67,8 +67,9 @@ Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
>}
>
>  #if defined(RTEMS_MULTIPROCESSING)
> -  if ( _Objects_Is_local_node( node ) || node == OBJECTS_SEARCH_LOCAL_NODE )
> +  if ( _Objects_Is_local_node_search( node ) ) {
>  return OBJECTS_INVALID_NAME;
> +  }
>
>name_for_mp.name_u32 = name;
>return _Objects_MP_Global_name_search( information, name_for_mp, node, id 
> );
> --
> 2.26.2
>
> ___
> 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 0/3] Fix Unchecked return value Coverity errors upstream

2021-03-01 Thread Ryan Long
Hi,

These are patches for the third party Coverity issues. I forgot to
include them with the other patch last week. The only file that I used
the _Assert_Unused_variable_equals() macro with was grspw.c. The others, I just 
used (void) to "use" them.

Thanks,
Ryan

Ryan Long (3):
  fdt_rw.c: Fix Unchecked return value (CID #1047324)
  grspw.c: Fix Unchecked return value (CID #1399781)
  main_edit.c: Fix Unchecked return value (CID #1255318)

 bsps/shared/grlib/spw/grspw.c| 7 +--
 cpukit/dtc/libfdt/fdt_rw.c   | 6 +-
 cpukit/libmisc/shell/main_edit.c | 6 +-
 3 files changed, 15 insertions(+), 4 deletions(-)

-- 
1.8.3.1

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


[PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Ryan Long
CID 1047324: Unchecked return value in fdt_add_subnode_namelen().

Updates #4256
---
 cpukit/dtc/libfdt/fdt_rw.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
index 1385425..d6f7d93 100644
--- a/cpukit/dtc/libfdt/fdt_rw.c
+++ b/cpukit/dtc/libfdt/fdt_rw.c
@@ -348,7 +348,11 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
return offset;
 
/* Try to place the new node after the parent's properties */
-   fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
+#ifdef __rtems__
+ (void)fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the 
BEGIN_NODE */
+#else
+  fdt_next_tag(fdt, parentoffset, &nextoffset);
+#endif
do {
offset = nextoffset;
tag = fdt_next_tag(fdt, offset, &nextoffset);
-- 
1.8.3.1

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


[PATCH 2/3] grspw.c: Fix Unchecked return value (CID #1399781)

2021-03-01 Thread Ryan Long
CID 1399781: Unchecked return value in grspw_device_init().

Closes #4259
---
 bsps/shared/grlib/spw/grspw.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bsps/shared/grlib/spw/grspw.c b/bsps/shared/grlib/spw/grspw.c
index 1b50cc6..74a0fc7 100644
--- a/bsps/shared/grlib/spw/grspw.c
+++ b/bsps/shared/grlib/spw/grspw.c
@@ -465,6 +465,7 @@ int grspw_device_init(GRSPW_DEV *pDev)
struct amba_dev_info *ambadev;
struct ambapp_core *pnpinfo;
union drvmgr_key_value *value;
+rtems_status_code status;
 
/* Get device information from AMBA PnP information */
ambadev = (struct amba_dev_info *)pDev->dev->businfo;
@@ -555,21 +556,23 @@ int grspw_device_init(GRSPW_DEV *pDev)
return RTEMS_NO_MEMORY;
 
/* Create semaphores */
-   rtems_semaphore_create(
+   status = rtems_semaphore_create(
rtems_build_name('T', 'x', 'S', '0' + pDev->minor), 
0, 
RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE | 
RTEMS_NO_INHERIT_PRIORITY | \
RTEMS_NO_PRIORITY_CEILING, 
0, 
&(pDev->txsp));
+_Assert_Unused_variable_equals(status,RTEMS_SUCCESSFUL);
 
-   rtems_semaphore_create(
+   status = rtems_semaphore_create(
rtems_build_name('R', 'x', 'S', '0' + pDev->minor), 
0, 
RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE | 
RTEMS_NO_INHERIT_PRIORITY | \
RTEMS_NO_PRIORITY_CEILING, 
0, 
&(pDev->rxsp));
+_Assert_Unused_variable_equals(status,RTEMS_SUCCESSFUL);
 
grspw_hw_init(pDev);
 
-- 
1.8.3.1

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


[PATCH 3/3] main_edit.c: Fix Unchecked return value (CID #1255318)

2021-03-01 Thread Ryan Long
CID 1255318: Unchecked return value in display_line().

Updates #4257
---
 cpukit/libmisc/shell/main_edit.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c
index a011049..8730b21 100644
--- a/cpukit/libmisc/shell/main_edit.c
+++ b/cpukit/libmisc/shell/main_edit.c
@@ -1089,7 +1089,11 @@ static void display_line(struct editor *ed, int pos, int 
fullline) {
   int selstart, selend, ch;
   char *s;
 
-  get_selection(ed, &selstart, &selend);
+  #ifdef __rtems__
+(void)get_selection(ed, &selstart, &selend);
+  #else
+get_selection(ed, &selstart, &selend);
+  #endif
   while (col < maxcol) {
 if (margin == 0) {
   if (!hilite && pos >= selstart && pos < selend) {
-- 
1.8.3.1

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


Re: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Gedare Bloom
On Mon, Mar 1, 2021 at 9:24 AM Ryan Long  wrote:
>
> CID 1047324: Unchecked return value in fdt_add_subnode_namelen().
>
> Updates #4256
> ---
>  cpukit/dtc/libfdt/fdt_rw.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
I think it was suggested to attempt to provide this in the upstream for dtc?

> index 1385425..d6f7d93 100644
> --- a/cpukit/dtc/libfdt/fdt_rw.c
> +++ b/cpukit/dtc/libfdt/fdt_rw.c
> @@ -348,7 +348,11 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
> return offset;
>
> /* Try to place the new node after the parent's properties */
> -   fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE 
> */
> +#ifdef __rtems__
> + (void)fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the 
> BEGIN_NODE */
I think we usually put a space after (void)
(void) fdt...

but, it should be consistent with the upstream

> +#else
> +  fdt_next_tag(fdt, parentoffset, &nextoffset);
> +#endif
> do {
> offset = nextoffset;
> tag = fdt_next_tag(fdt, offset, &nextoffset);
> --
> 1.8.3.1
>
> ___
> 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


Re: [PATCH 2/3] grspw.c: Fix Unchecked return value (CID #1399781)

2021-03-01 Thread Gedare Bloom
Someone (Daniel) from Gaisler should review.

On Mon, Mar 1, 2021 at 9:24 AM Ryan Long  wrote:
>
> CID 1399781: Unchecked return value in grspw_device_init().
>
> Closes #4259
> ---
>  bsps/shared/grlib/spw/grspw.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/bsps/shared/grlib/spw/grspw.c b/bsps/shared/grlib/spw/grspw.c
> index 1b50cc6..74a0fc7 100644
> --- a/bsps/shared/grlib/spw/grspw.c
> +++ b/bsps/shared/grlib/spw/grspw.c
> @@ -465,6 +465,7 @@ int grspw_device_init(GRSPW_DEV *pDev)
> struct amba_dev_info *ambadev;
> struct ambapp_core *pnpinfo;
> union drvmgr_key_value *value;
> +rtems_status_code status;
>
> /* Get device information from AMBA PnP information */
> ambadev = (struct amba_dev_info *)pDev->dev->businfo;
> @@ -555,21 +556,23 @@ int grspw_device_init(GRSPW_DEV *pDev)
> return RTEMS_NO_MEMORY;
>
> /* Create semaphores */
> -   rtems_semaphore_create(
> +   status = rtems_semaphore_create(
> rtems_build_name('T', 'x', 'S', '0' + pDev->minor),
> 0,
> RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE | 
> RTEMS_NO_INHERIT_PRIORITY | \
> RTEMS_NO_PRIORITY_CEILING,
> 0,
> &(pDev->txsp));
> +_Assert_Unused_variable_equals(status,RTEMS_SUCCESSFUL);
space needed after comma

>
> -   rtems_semaphore_create(
> +   status = rtems_semaphore_create(
> rtems_build_name('R', 'x', 'S', '0' + pDev->minor),
> 0,
> RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE | 
> RTEMS_NO_INHERIT_PRIORITY | \
> RTEMS_NO_PRIORITY_CEILING,
> 0,
> &(pDev->rxsp));
> +_Assert_Unused_variable_equals(status,RTEMS_SUCCESSFUL);
space needed after comma

>
> grspw_hw_init(pDev);
>
> --
> 1.8.3.1
>
> ___
> 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


Re: [PATCH 3/3] main_edit.c: Fix Unchecked return value (CID #1255318)

2021-03-01 Thread Gedare Bloom
On Mon, Mar 1, 2021 at 9:24 AM Ryan Long  wrote:
>
> CID 1255318: Unchecked return value in display_line().
>
> Updates #4257
> ---
>  cpukit/libmisc/shell/main_edit.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/libmisc/shell/main_edit.c 
> b/cpukit/libmisc/shell/main_edit.c
> index a011049..8730b21 100644
> --- a/cpukit/libmisc/shell/main_edit.c
> +++ b/cpukit/libmisc/shell/main_edit.c
> @@ -1089,7 +1089,11 @@ static void display_line(struct editor *ed, int pos, 
> int fullline) {
>int selstart, selend, ch;
>char *s;
>
> -  get_selection(ed, &selstart, &selend);
> +  #ifdef __rtems__
We own this code? no need to ifdef it?

> +(void)get_selection(ed, &selstart, &selend);
add whitespace

> +  #else
> +get_selection(ed, &selstart, &selend);
> +  #endif
>while (col < maxcol) {
>  if (margin == 0) {
>if (!hilite && pos >= selstart && pos < selend) {
> --
> 1.8.3.1
>
> ___
> 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


Re: Standalone repository for libnetworking stack

2021-03-01 Thread Vijay Kumar Banerjee
Hi,

I have shifted the testsuites and have checked that all the tests run
successfully with pc-qemu. I have also updated the README.waf as per the
review and have fixed formatting according to PEP8. Please review the repos
and let me know if there's something else that needs to be improved to make
it mergeable.
RTEMS: https://git.rtems.org/vijay/rtems.git/log/?h=devel-no-libnet
rtems-net-legacy:
https://git.rtems.org/vijay/rtems-net-legacy.git/log/?h=main

I have also made a patch for rtems-docs to rename networking to legacy
networking:
https://git.rtems

.org/vijay/rtems-docs.git/commit/?id=92b53d211b4d9ad795ef8b2ad1ac0deed5a25f9a


I haven't added any LICENSE file as I really didn't understand what we can
put in there. I can add the RTEMS LICENSE file from
https://www.rtems.org/license/LICENSE as it was discussed in the list
before. Please let me know what is desirable.

Best regards,
Vijay

On Fri, Feb 26, 2021 at 12:30 PM Joel Sherrill  wrote:
>
>
>
> On Fri, Feb 26, 2021, 11:49 AM Chris Johns  wrote:
>>
>> On 27/2/21 4:40 am, Vijay Kumar Banerjee wrote:
>> > Hi all,
>> >
>> > Thanks for reviewing
>> >
>> > On Fri, Feb 26, 2021 at 10:13 AM Joel Sherrill  wrote:
>> >>
>> >> Some odd questions that are mostly about making this a self-contained
entity with no loose ends.
>> >>
>> >> + Can the network demos be merged also?
>> >>
>> > Are we talking about testsuites tests that use legacy networking? If
>> > so, then I have already shifted the networking01.exe and will shift
>> > other tests using the same approach.
>> >
>> >> + rtems-docs has the Network Users Guide which is legacy only. As a
minimum, it needs to be renamed to have Legacy in the title. Better would
be to convert it to markdown/asciidoc and just toss it in the legacy repo.
>> >>
>> > This is a good point! I'll probably just keep it as a README in the
>> > net-legacy repo.
>> >
>> >> + Gaisler needs a poke about the grlib NIC drivers. And Daniel
expects it. File a ticket that it is time for them to support libbsd and
assign it to him. :)
>> >>
>> >> I'm ok with Chris' proposal to give notice  Grep'ing for
NETWORK_DRIVER_NAME did turn up more files than I expected. Perhaps that is
simply a list of driver names and attach functions for a readme in the
repo. That's all that should have been in the bsp.h files.
>> >>
>> > Yes, these are mostly bsp.h files. I'll file a ticket and post to
>> > users and devel about it. There are also quite a few with
>> > RTEMS_NETWORKING defined.
>> >
>> >> This is awesome work and much appreciated.
>> >>
>> > Thank you. :)
>> >
>> >> On Fri, Feb 26, 2021 at 12:12 AM Gedare Bloom 
wrote:
>> >>>
>> >>> On Thu, Feb 25, 2021 at 6:06 PM Chris Johns  wrote:
>> 
>>  On 26/2/21 4:49 am, Vijay Kumar Banerjee wrote:
>> > The stand-alone repository is very close to completion now and I
could
>> > use the networking01 test with the standalone repo and it
successfully
>> > runs on pc-qemu.
>> 
>>  Fantastic news.
>> 
>> > The following are the links to the branches with the
>> > final version of the commits and I would really appreciate a review
>> > and suggestions on what else needs to be done (I'm not sending
patches
>> > as they're big and would hit the devel limit):
>> 
>>  I am fine reviewing the changes in the repos.
>> 
>> > RTEMS: https://git.rtems.org/vijay/rtems.git/log/?h=devel-no-libnet
>> 
>>  Looks good. The only observation is a bisect will probability break
as the
>>  nfsclient depends on rpc but I am OK with now things are.
>> 
>>  I checked rtems_waf and I think it is OK dealing with no networking
defined in
>>  the RTEMS opts header.
>> 
>> > Great!
>> >
>> > rtems-net-legacy:
https://git.rtems.org/vijay/rtems-net-legacy.git/log/?h=main
>> 
>>  Would calling lnetwork.py netlegacy.py be a better match for that
name? Closer
>>  to the repo naming.
>> 
>> > Sure, I'll rename it and force push.
>>
>> Thanks
>>
>> >
>>  Do the new python files need to pep8 formatted? :)
>>  [ https://gitlab.com/ita1024/waf/-/tree/master/playground/pep8 ]
>> 
>> > pep8 does work for me when used manually but with waf module I'm
>> > getting the following error:
>> >
>> > ```
>> >   File "/home/vijay/.local/lib/python3.8/site-packages/pep8.py", line
>> > 253, in maximum_line_length
>> > if length > options.max_line_length:
>> > AttributeError: 'Values' object has no attribute 'max_line_length'
>> > ```
>> > This is strange because it looks like an error in the pep8 module
itself.
>> >
>> > I have tried different versions of pep8 and it looks like each version
>> > has a different error. I think this needs some work from the waf side
>> > to get it working with the new pycodestyle instead of the pep8 module.
>>
>> R

[PATCH v2 0/3] Fix upstream Unchecked return value Coverity errors

2021-03-01 Thread Ryan Long
Hi,

Here are the patches with the suggested changes.

Thanks,
Ryan

Ryan Long (3):
  fdt_rw.c: Fix Unchecked return value (CID #1047324)
  grspw.c: Fix Unchecked return value (CID #1399781)
  main_edit.c: Fix Unchecked return value (CID #1255318)

 bsps/shared/grlib/spw/grspw.c| 7 +--
 cpukit/dtc/libfdt/fdt_rw.c   | 6 +-
 cpukit/libmisc/shell/main_edit.c | 6 +-
 3 files changed, 15 insertions(+), 4 deletions(-)

-- 
1.8.3.1

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


[PATCH v2 2/3] grspw.c: Fix Unchecked return value (CID #1399781)

2021-03-01 Thread Ryan Long
CID 1399781: Unchecked return value in grspw_device_init().

Closes #4259
---
 bsps/shared/grlib/spw/grspw.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bsps/shared/grlib/spw/grspw.c b/bsps/shared/grlib/spw/grspw.c
index 1b50cc6..32740d4 100644
--- a/bsps/shared/grlib/spw/grspw.c
+++ b/bsps/shared/grlib/spw/grspw.c
@@ -465,6 +465,7 @@ int grspw_device_init(GRSPW_DEV *pDev)
struct amba_dev_info *ambadev;
struct ambapp_core *pnpinfo;
union drvmgr_key_value *value;
+rtems_status_code status;
 
/* Get device information from AMBA PnP information */
ambadev = (struct amba_dev_info *)pDev->dev->businfo;
@@ -555,21 +556,23 @@ int grspw_device_init(GRSPW_DEV *pDev)
return RTEMS_NO_MEMORY;
 
/* Create semaphores */
-   rtems_semaphore_create(
+   status = rtems_semaphore_create(
rtems_build_name('T', 'x', 'S', '0' + pDev->minor), 
0, 
RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE | 
RTEMS_NO_INHERIT_PRIORITY | \
RTEMS_NO_PRIORITY_CEILING, 
0, 
&(pDev->txsp));
+_Assert_Unused_variable_equals(status, RTEMS_SUCCESSFUL);
 
-   rtems_semaphore_create(
+   status = rtems_semaphore_create(
rtems_build_name('R', 'x', 'S', '0' + pDev->minor), 
0, 
RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE | 
RTEMS_NO_INHERIT_PRIORITY | \
RTEMS_NO_PRIORITY_CEILING, 
0, 
&(pDev->rxsp));
+_Assert_Unused_variable_equals(status, RTEMS_SUCCESSFUL);
 
grspw_hw_init(pDev);
 
-- 
1.8.3.1

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


[PATCH v2 3/3] main_edit.c: Fix Unchecked return value (CID #1255318)

2021-03-01 Thread Ryan Long
CID 1255318: Unchecked return value in display_line().

Updates #4257
---
 cpukit/libmisc/shell/main_edit.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c
index a011049..9819a94 100644
--- a/cpukit/libmisc/shell/main_edit.c
+++ b/cpukit/libmisc/shell/main_edit.c
@@ -1089,7 +1089,11 @@ static void display_line(struct editor *ed, int pos, int 
fullline) {
   int selstart, selend, ch;
   char *s;
 
-  get_selection(ed, &selstart, &selend);
+  #ifdef __rtems__
+(void) get_selection(ed, &selstart, &selend);
+  #else
+get_selection(ed, &selstart, &selend);
+  #endif
   while (col < maxcol) {
 if (margin == 0) {
   if (!hilite && pos >= selstart && pos < selend) {
-- 
1.8.3.1

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


[PATCH v2 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Ryan Long
CID 1047324: Unchecked return value in fdt_add_subnode_namelen().

Updates #4256
---
 cpukit/dtc/libfdt/fdt_rw.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
index 1385425..41abd8c 100644
--- a/cpukit/dtc/libfdt/fdt_rw.c
+++ b/cpukit/dtc/libfdt/fdt_rw.c
@@ -348,7 +348,11 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
return offset;
 
/* Try to place the new node after the parent's properties */
-   fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
+#ifdef __rtems__
+ (void) fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the 
BEGIN_NODE */
+#else
+  fdt_next_tag(fdt, parentoffset, &nextoffset);
+#endif
do {
offset = nextoffset;
tag = fdt_next_tag(fdt, offset, &nextoffset);
-- 
1.8.3.1

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


Re: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Sebastian Huber

On 01/03/2021 17:56, Gedare Bloom wrote:


On Mon, Mar 1, 2021 at 9:24 AM Ryan Long  wrote:

CID 1047324: Unchecked return value in fdt_add_subnode_namelen().

Updates #4256
---
  cpukit/dtc/libfdt/fdt_rw.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c

I think it was suggested to attempt to provide this in the upstream for dtc?
Yes, please at least report the issue upstream and send a patch to their 
mailing list. They are usually quite responsive.


--
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: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Gedare Bloom
On Mon, Mar 1, 2021 at 11:49 AM Sebastian Huber
 wrote:
>
> On 01/03/2021 17:56, Gedare Bloom wrote:
>
> > On Mon, Mar 1, 2021 at 9:24 AM Ryan Long  wrote:
> >> CID 1047324: Unchecked return value in fdt_add_subnode_namelen().
> >>
> >> Updates #4256
> >> ---
> >>   cpukit/dtc/libfdt/fdt_rw.c | 6 +-
> >>   1 file changed, 5 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/cpukit/dtc/libfdt/fdt_rw.c b/cpukit/dtc/libfdt/fdt_rw.c
> > I think it was suggested to attempt to provide this in the upstream for dtc?
> Yes, please at least report the issue upstream and send a patch to their
> mailing list. They are usually quite responsive.
>
+1  send the patch to them before we consider including it in rtems.

> --
> 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: [PATCH v2 3/3] main_edit.c: Fix Unchecked return value (CID #1255318)

2021-03-01 Thread Gedare Bloom
On Mon, Mar 1, 2021 at 11:47 AM Ryan Long  wrote:
>
> CID 1255318: Unchecked return value in display_line().
>
> Updates #4257
> ---
>  cpukit/libmisc/shell/main_edit.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/libmisc/shell/main_edit.c 
> b/cpukit/libmisc/shell/main_edit.c
> index a011049..9819a94 100644
> --- a/cpukit/libmisc/shell/main_edit.c
> +++ b/cpukit/libmisc/shell/main_edit.c
> @@ -1089,7 +1089,11 @@ static void display_line(struct editor *ed, int pos, 
> int fullline) {
>int selstart, selend, ch;
>char *s;
>
> -  get_selection(ed, &selstart, &selend);
> +  #ifdef __rtems__
> +(void) get_selection(ed, &selstart, &selend);
> +  #else
> +get_selection(ed, &selstart, &selend);
> +  #endif

I think we have made changes to this file, that forked it from its
upstream. We can get rid of this #ifdef ... #endif construct.

>while (col < maxcol) {
>  if (margin == 0) {
>if (!hilite && pos >= selstart && pos < selend) {
> --
> 1.8.3.1
>
> ___
> 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


Re: Standalone repository for libnetworking stack

2021-03-01 Thread Gedare Bloom
On Mon, Mar 1, 2021 at 11:28 AM Vijay Kumar Banerjee  wrote:
>
> Hi,
>
> I have shifted the testsuites and have checked that all the tests run 
> successfully with pc-qemu. I have also updated the README.waf as per the 
> review and have fixed formatting according to PEP8. Please review the repos 
> and let me know if there's something else that needs to be improved to make 
> it mergeable.
> RTEMS: https://git.rtems.org/vijay/rtems.git/log/?h=devel-no-libnet
> rtems-net-legacy: https://git.rtems.org/vijay/rtems-net-legacy.git/log/?h=main
>
> I have also made a patch for rtems-docs to rename networking to legacy 
> networking:
> https://git.rtems.org/vijay/rtems-docs.git/commit/?id=92b53d211b4d9ad795ef8b2ad1ac0deed5a25f9a
>
> I haven't added any LICENSE file as I really didn't understand what we can 
> put in there. I can add the RTEMS LICENSE file from 
> https://www.rtems.org/license/LICENSE as it was discussed in the list before. 
> Please let me know what is desirable.
>
I don't think we should have a LICENSE file, instead I think there
should be a section of the README that discusses the licensing
situation.

The code is licensed under a mix of the rtems.org/LICENSE and various
BSD licenses. That is all that needs to be said, if anything.

Do we need to put out a call for anyone to step up to deal with
anything in BSPs?

> Best regards,
> Vijay
>
> On Fri, Feb 26, 2021 at 12:30 PM Joel Sherrill  wrote:
> >
> >
> >
> > On Fri, Feb 26, 2021, 11:49 AM Chris Johns  wrote:
> >>
> >> On 27/2/21 4:40 am, Vijay Kumar Banerjee wrote:
> >> > Hi all,
> >> >
> >> > Thanks for reviewing
> >> >
> >> > On Fri, Feb 26, 2021 at 10:13 AM Joel Sherrill  wrote:
> >> >>
> >> >> Some odd questions that are mostly about making this a self-contained 
> >> >> entity with no loose ends.
> >> >>
> >> >> + Can the network demos be merged also?
> >> >>
> >> > Are we talking about testsuites tests that use legacy networking? If
> >> > so, then I have already shifted the networking01.exe and will shift
> >> > other tests using the same approach.
> >> >
> >> >> + rtems-docs has the Network Users Guide which is legacy only. As a 
> >> >> minimum, it needs to be renamed to have Legacy in the title. Better 
> >> >> would be to convert it to markdown/asciidoc and just toss it in the 
> >> >> legacy repo.
> >> >>
> >> > This is a good point! I'll probably just keep it as a README in the
> >> > net-legacy repo.
> >> >
> >> >> + Gaisler needs a poke about the grlib NIC drivers. And Daniel expects 
> >> >> it. File a ticket that it is time for them to support libbsd and assign 
> >> >> it to him. :)
> >> >>
> >> >> I'm ok with Chris' proposal to give notice  Grep'ing for 
> >> >> NETWORK_DRIVER_NAME did turn up more files than I expected. Perhaps 
> >> >> that is simply a list of driver names and attach functions for a readme 
> >> >> in the repo. That's all that should have been in the bsp.h files.
> >> >>
> >> > Yes, these are mostly bsp.h files. I'll file a ticket and post to
> >> > users and devel about it. There are also quite a few with
> >> > RTEMS_NETWORKING defined.
> >> >
> >> >> This is awesome work and much appreciated.
> >> >>
> >> > Thank you. :)
> >> >
> >> >> On Fri, Feb 26, 2021 at 12:12 AM Gedare Bloom  wrote:
> >> >>>
> >> >>> On Thu, Feb 25, 2021 at 6:06 PM Chris Johns  wrote:
> >> 
> >>  On 26/2/21 4:49 am, Vijay Kumar Banerjee wrote:
> >> > The stand-alone repository is very close to completion now and I 
> >> > could
> >> > use the networking01 test with the standalone repo and it 
> >> > successfully
> >> > runs on pc-qemu.
> >> 
> >>  Fantastic news.
> >> 
> >> > The following are the links to the branches with the
> >> > final version of the commits and I would really appreciate a review
> >> > and suggestions on what else needs to be done (I'm not sending 
> >> > patches
> >> > as they're big and would hit the devel limit):
> >> 
> >>  I am fine reviewing the changes in the repos.
> >> 
> >> > RTEMS: https://git.rtems.org/vijay/rtems.git/log/?h=devel-no-libnet
> >> 
> >>  Looks good. The only observation is a bisect will probability break 
> >>  as the
> >>  nfsclient depends on rpc but I am OK with now things are.
> >> 
> >>  I checked rtems_waf and I think it is OK dealing with no networking 
> >>  defined in
> >>  the RTEMS opts header.
> >> 
> >> > Great!
> >> >
> >> > rtems-net-legacy: 
> >> > https://git.rtems.org/vijay/rtems-net-legacy.git/log/?h=main
> >> 
> >>  Would calling lnetwork.py netlegacy.py be a better match for that 
> >>  name? Closer
> >>  to the repo naming.
> >> 
> >> > Sure, I'll rename it and force push.
> >>
> >> Thanks
> >>
> >> >
> >>  Do the new python files need to pep8 formatted? :)
> >>  [ https://gitlab.com/ita1024/waf/-/tree/master/playground/pep8 ]
> >> 
> >> > pep8 does work for me when used manually but with waf module I'm
> >> 

Re: Standalone repository for libnetworking stack

2021-03-01 Thread Joel Sherrill
On Mon, Mar 1, 2021 at 1:05 PM Gedare Bloom  wrote:

> On Mon, Mar 1, 2021 at 11:28 AM Vijay Kumar Banerjee 
> wrote:
> >
> > Hi,
> >
> > I have shifted the testsuites and have checked that all the tests run
> successfully with pc-qemu. I have also updated the README.waf as per the
> review and have fixed formatting according to PEP8. Please review the repos
> and let me know if there's something else that needs to be improved to make
> it mergeable.
> > RTEMS: https://git.rtems.org/vijay/rtems.git/log/?h=devel-no-libnet
> > rtems-net-legacy:
> https://git.rtems.org/vijay/rtems-net-legacy.git/log/?h=main
> >
> > I have also made a patch for rtems-docs to rename networking to legacy
> networking:
> >
> https://git.rtems.org/vijay/rtems-docs.git/commit/?id=92b53d211b4d9ad795ef8b2ad1ac0deed5a25f9a


This looks good. If it can easily be moved to the bottom of the list of
docs, that would be great.


>
> >
> > I haven't added any LICENSE file as I really didn't understand what we
> can put in there. I can add the RTEMS LICENSE file from
> https://www.rtems.org/license/LICENSE as it was discussed in the list
> before. Please let me know what is desirable.
> >
> I don't think we should have a LICENSE file, instead I think there
> should be a section of the README that discusses the licensing
> situation.
>
> The code is licensed under a mix of the rtems.org/LICENSE and various
> BSD licenses. That is all that needs to be said, if anything.
>

+1 It is what is always has been.

>
> Do we need to put out a call for anyone to step up to deal with
> anything in BSPs?
>

To be completely above board and proper, I think so. please post to
both devel@ and users@ that your repo needs testing and that the
legacy stack is soon to be removed from the main rtems.git.

And make it VERY clear that anyone who plans to test, please
speak up. We can't demand they do it immediately but it would
be helpful to know someone is going to do it.

Which NIC did you test the PC with?


>
> > Best regards,
> > Vijay
> >
> > On Fri, Feb 26, 2021 at 12:30 PM Joel Sherrill  wrote:
> > >
> > >
> > >
> > > On Fri, Feb 26, 2021, 11:49 AM Chris Johns  wrote:
> > >>
> > >> On 27/2/21 4:40 am, Vijay Kumar Banerjee wrote:
> > >> > Hi all,
> > >> >
> > >> > Thanks for reviewing
> > >> >
> > >> > On Fri, Feb 26, 2021 at 10:13 AM Joel Sherrill 
> wrote:
> > >> >>
> > >> >> Some odd questions that are mostly about making this a
> self-contained entity with no loose ends.
> > >> >>
> > >> >> + Can the network demos be merged also?
> > >> >>
> > >> > Are we talking about testsuites tests that use legacy networking? If
> > >> > so, then I have already shifted the networking01.exe and will shift
> > >> > other tests using the same approach.
> > >> >
> > >> >> + rtems-docs has the Network Users Guide which is legacy only. As
> a minimum, it needs to be renamed to have Legacy in the title. Better would
> be to convert it to markdown/asciidoc and just toss it in the legacy repo.
> > >> >>
> > >> > This is a good point! I'll probably just keep it as a README in the
> > >> > net-legacy repo.
> > >> >
> > >> >> + Gaisler needs a poke about the grlib NIC drivers. And Daniel
> expects it. File a ticket that it is time for them to support libbsd and
> assign it to him. :)
> > >> >>
> > >> >> I'm ok with Chris' proposal to give notice  Grep'ing for
> NETWORK_DRIVER_NAME did turn up more files than I expected. Perhaps that is
> simply a list of driver names and attach functions for a readme in the
> repo. That's all that should have been in the bsp.h files.
> > >> >>
> > >> > Yes, these are mostly bsp.h files. I'll file a ticket and post to
> > >> > users and devel about it. There are also quite a few with
> > >> > RTEMS_NETWORKING defined.
> > >> >
> > >> >> This is awesome work and much appreciated.
> > >> >>
> > >> > Thank you. :)
> > >> >
> > >> >> On Fri, Feb 26, 2021 at 12:12 AM Gedare Bloom 
> wrote:
> > >> >>>
> > >> >>> On Thu, Feb 25, 2021 at 6:06 PM Chris Johns 
> wrote:
> > >> 
> > >>  On 26/2/21 4:49 am, Vijay Kumar Banerjee wrote:
> > >> > The stand-alone repository is very close to completion now and
> I could
> > >> > use the networking01 test with the standalone repo and it
> successfully
> > >> > runs on pc-qemu.
> > >> 
> > >>  Fantastic news.
> > >> 
> > >> > The following are the links to the branches with the
> > >> > final version of the commits and I would really appreciate a
> review
> > >> > and suggestions on what else needs to be done (I'm not sending
> patches
> > >> > as they're big and would hit the devel limit):
> > >> 
> > >>  I am fine reviewing the changes in the repos.
> > >> 
> > >> > RTEMS:
> https://git.rtems.org/vijay/rtems.git/log/?h=devel-no-libnet
> > >> 
> > >>  Looks good. The only observation is a bisect will probability
> break as the
> > >>  nfsclient depends on rpc but I am OK with now things are.
> > >> 
> > >>  I checked rtems_waf and 

RE: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Ryan Long
So just send this patch to them?

-Original Message-
From: devel  On Behalf Of Gedare Bloom
Sent: Monday, March 1, 2021 1:03 PM
To: Sebastian Huber 
Cc: Ryan Long ; devel@rtems.org
Subject: Re: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

On Mon, Mar 1, 2021 at 11:49 AM Sebastian Huber 
 wrote:
>
> On 01/03/2021 17:56, Gedare Bloom wrote:
>
> > On Mon, Mar 1, 2021 at 9:24 AM Ryan Long  wrote:
> >> CID 1047324: Unchecked return value in fdt_add_subnode_namelen().
> >>
> >> Updates #4256
> >> ---
> >>   cpukit/dtc/libfdt/fdt_rw.c | 6 +-
> >>   1 file changed, 5 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/cpukit/dtc/libfdt/fdt_rw.c 
> >> b/cpukit/dtc/libfdt/fdt_rw.c
> > I think it was suggested to attempt to provide this in the upstream for dtc?
> Yes, please at least report the issue upstream and send a patch to 
> their mailing list. They are usually quite responsive.
>
+1  send the patch to them before we consider including it in rtems.

> --
> 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
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Gedare Bloom
On Mon, Mar 1, 2021 at 12:26 PM Ryan Long  wrote:
>
> So just send this patch to them?
>
Without the ifdef construct

> -Original Message-
> From: devel  On Behalf Of Gedare Bloom
> Sent: Monday, March 1, 2021 1:03 PM
> To: Sebastian Huber 
> Cc: Ryan Long ; devel@rtems.org
> Subject: Re: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)
>
> On Mon, Mar 1, 2021 at 11:49 AM Sebastian Huber 
>  wrote:
> >
> > On 01/03/2021 17:56, Gedare Bloom wrote:
> >
> > > On Mon, Mar 1, 2021 at 9:24 AM Ryan Long  wrote:
> > >> CID 1047324: Unchecked return value in fdt_add_subnode_namelen().
> > >>
> > >> Updates #4256
> > >> ---
> > >>   cpukit/dtc/libfdt/fdt_rw.c | 6 +-
> > >>   1 file changed, 5 insertions(+), 1 deletion(-)
> > >>
> > >> diff --git a/cpukit/dtc/libfdt/fdt_rw.c
> > >> b/cpukit/dtc/libfdt/fdt_rw.c
> > > I think it was suggested to attempt to provide this in the upstream for 
> > > dtc?
> > Yes, please at least report the issue upstream and send a patch to
> > their mailing list. They are usually quite responsive.
> >
> +1  send the patch to them before we consider including it in rtems.
>
> > --
> > 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
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Sebastian Huber

On 01/03/2021 20:35, Gedare Bloom wrote:


On Mon, Mar 1, 2021 at 12:26 PM Ryan Long  wrote:

So just send this patch to them?


Without the ifdef construct

And with a more detailed commit message.



--
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 03/22] covoar/TargetBase: Update branchInstructions variable name

2021-03-01 Thread Alex White
The TargetBase class contains a member variable named
branchInstructions. The name omits the fact that it is only meant to
contain conditional branch instructions. Its name has been changed to
conditionalBranchInstructions to avoid confusion.
---
 tester/covoar/TargetBase.cc | 10 +++-
 tester/covoar/TargetBase.h  |  4 +-
 tester/covoar/Target_arm.cc | 34 ++--
 tester/covoar/Target_i386.cc| 64 ++---
 tester/covoar/Target_lm32.cc| 12 ++--
 tester/covoar/Target_m68k.cc| 98 -
 tester/covoar/Target_powerpc.cc | 56 +--
 tester/covoar/Target_riscv.cc   | 22 
 tester/covoar/Target_sparc.cc   | 66 +++---
 9 files changed, 185 insertions(+), 181 deletions(-)

diff --git a/tester/covoar/TargetBase.cc b/tester/covoar/TargetBase.cc
index 354a580..4474fad 100644
--- a/tester/covoar/TargetBase.cc
+++ b/tester/covoar/TargetBase.cc
@@ -66,15 +66,19 @@ namespace Target {
   {
 std::list ::iterator i;
 
-if (branchInstructions.empty()) {
+if (conditionalBranchInstructions.empty()) {
   throw rld::error(
 "DETERMINE BRANCH INSTRUCTIONS FOR THIS ARCHITECTURE! -- fix me",
 "TargetBase::isBranch"
   );
 }
 
-i = find(branchInstructions.begin(), branchInstructions.end(), 
instruction);
-if ( i  == branchInstructions.end() )
+i = find(
+  conditionalBranchInstructions.begin(),
+  conditionalBranchInstructions.end(),
+  instruction
+);
+if ( i  == conditionalBranchInstructions.end() )
   return false;
 
 return true;
diff --git a/tester/covoar/TargetBase.h b/tester/covoar/TargetBase.h
index 14cd6f2..e566c15 100644
--- a/tester/covoar/TargetBase.h
+++ b/tester/covoar/TargetBase.h
@@ -135,10 +135,10 @@ namespace Target {
 bool objdumpHasTabs;
 
 /*!
- * This member variable is an array of all branch instructions
+ * This member variable is an array of all conditional branch instructions
  * for this target.
  */
-std::list  branchInstructions;
+std::list  conditionalBranchInstructions;
 
   private:
 
diff --git a/tester/covoar/Target_arm.cc b/tester/covoar/Target_arm.cc
index a33ec80..4b7b2e1 100644
--- a/tester/covoar/Target_arm.cc
+++ b/tester/covoar/Target_arm.cc
@@ -19,24 +19,24 @@ namespace Target {
   Target_arm::Target_arm( std::string targetName ):
 TargetBase( targetName )
   {
-branchInstructions.push_back("bcc");
-branchInstructions.push_back("bcs");
-branchInstructions.push_back("beq");
-branchInstructions.push_back("bge");
-branchInstructions.push_back("bgt");
-branchInstructions.push_back("bhi");
-branchInstructions.push_back("bl-hi");
-branchInstructions.push_back("bl-lo");
-branchInstructions.push_back("ble");
-branchInstructions.push_back("bls");
-branchInstructions.push_back("blt");
-branchInstructions.push_back("bmi");
-branchInstructions.push_back("bne");
-branchInstructions.push_back("bpl");
-branchInstructions.push_back("bvc");
-branchInstructions.push_back("bvs");
+conditionalBranchInstructions.push_back("bcc");
+conditionalBranchInstructions.push_back("bcs");
+conditionalBranchInstructions.push_back("beq");
+conditionalBranchInstructions.push_back("bge");
+conditionalBranchInstructions.push_back("bgt");
+conditionalBranchInstructions.push_back("bhi");
+conditionalBranchInstructions.push_back("bl-hi");
+conditionalBranchInstructions.push_back("bl-lo");
+conditionalBranchInstructions.push_back("ble");
+conditionalBranchInstructions.push_back("bls");
+conditionalBranchInstructions.push_back("blt");
+conditionalBranchInstructions.push_back("bmi");
+conditionalBranchInstructions.push_back("bne");
+conditionalBranchInstructions.push_back("bpl");
+conditionalBranchInstructions.push_back("bvc");
+conditionalBranchInstructions.push_back("bvs");
 
-branchInstructions.sort();
+conditionalBranchInstructions.sort();
 
   }
 
diff --git a/tester/covoar/Target_i386.cc b/tester/covoar/Target_i386.cc
index 0f82f18..e0c9c0f 100644
--- a/tester/covoar/Target_i386.cc
+++ b/tester/covoar/Target_i386.cc
@@ -16,39 +16,39 @@ namespace Target {
   Target_i386::Target_i386( std::string targetName ):
 TargetBase( targetName )
   {
-branchInstructions.push_back("ja");
-branchInstructions.push_back("jb");
-branchInstructions.push_back("jc");
-branchInstructions.push_back("je");
-branchInstructions.push_back("jg");
-branchInstructions.push_back("jl");
-branchInstructions.push_back("jo");
-branchInstructions.push_back("jp");
-branchInstructions.push_back("js");
-branchInstructions.push_back("jz");
-branchInstructions.push_back("jae");
-branchInstructions.push_back("jbe");
-branchInstructions.push_back("jge");
-branchInstructions.push_back("jle");
-branchInstructions.push_back("jne");
-branchInstructions.push

[PATCH 02/22] tester: Add coverage variants for a few BSPs

2021-03-01 Thread Alex White
Adds coverage variants for the following BSPs: a53_qemu, pc686,
xilinx_zynq_a9_qemu, and xilinx_zynqmp.
---
 tester/rtems/testing/bsps/a53_qemu-cov.ini| 41 ++
 tester/rtems/testing/bsps/pc-qemu-cov.ini | 42 +++
 .../testing/bsps/xilinx_zynq_a9_qemu-cov.ini  | 41 ++
 .../rtems/testing/bsps/xilinx_zynqmp-cov.ini  | 41 ++
 4 files changed, 165 insertions(+)
 create mode 100644 tester/rtems/testing/bsps/a53_qemu-cov.ini
 create mode 100644 tester/rtems/testing/bsps/pc-qemu-cov.ini
 create mode 100644 tester/rtems/testing/bsps/xilinx_zynq_a9_qemu-cov.ini
 create mode 100644 tester/rtems/testing/bsps/xilinx_zynqmp-cov.ini

diff --git a/tester/rtems/testing/bsps/a53_qemu-cov.ini 
b/tester/rtems/testing/bsps/a53_qemu-cov.ini
new file mode 100644
index 000..782ce35
--- /dev/null
+++ b/tester/rtems/testing/bsps/a53_qemu-cov.ini
@@ -0,0 +1,41 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2021 Alex White(alex.wh...@oarcorp.com)
+# 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 AArch64 Cortex-A53 BSP with coverage
+#
+[a53_qemu-cov]
+bsp   = a53_qemu
+arch  = aarch64
+tester= %{_rtscripts}/qemu.cfg
+target= aarch64
+bsp_qemu_opts = %{qemu_opts_base} -serial mon:stdio -machine 
virt,gic-version=3 -cpu cortex-a53 -m 4096
+bsp_qemu_cov_opts = -exec-trace %{test_executable}.cov
+bsp_covoar_cmd= -T aarch64-rtems6 -S %{bsp_symbol_path} -E 
%{cov_explanations}
diff --git a/tester/rtems/testing/bsps/pc-qemu-cov.ini 
b/tester/rtems/testing/bsps/pc-qemu-cov.ini
new file mode 100644
index 000..eb67e7e
--- /dev/null
+++ b/tester/rtems/testing/bsps/pc-qemu-cov.ini
@@ -0,0 +1,42 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2021 Alex White(alex.wh...@oarcorp.com)
+# 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 pc QEMU BSP with coverage
+#
+[pc-qemu-cov]
+bsp   = pc686
+arch  = i386
+qemu_use_serial_console = yes
+target= i386
+tester= %{_rtscripts}/qemu.cfg
+bsp_qemu_opts = %{qemu_opts_base} %{qemu_opts_serial} -append 
--console=/dev/com1
+bsp_qemu_cov_opts = -exec-trace %{test_executable}.cov
+bsp_covoar_cmd= -T i386-rtems6 -S %{bsp_symbol_

[PATCH 01/22] tester: Update to support new build system

2021-03-01 Thread Alex White
The tester configurations had not been updated to match the paths and
conventions used by the new build system. These have been updated,
and a few more libraries have been enabled in symbol-sets.ini.
---
 tester/rtems/testing/bsps/griscv-sis-cov.ini  |  4 +-
 tester/rtems/testing/bsps/leon3-qemu-cov.ini  |  4 +-
 tester/rtems/testing/bsps/leon3-sis-cov.ini   |  4 +-
 tester/rtems/testing/coverage/symbol-sets.ini | 91 ++-
 4 files changed, 52 insertions(+), 51 deletions(-)

diff --git a/tester/rtems/testing/bsps/griscv-sis-cov.ini 
b/tester/rtems/testing/bsps/griscv-sis-cov.ini
index 7249af6..e8de95f 100644
--- a/tester/rtems/testing/bsps/griscv-sis-cov.ini
+++ b/tester/rtems/testing/bsps/griscv-sis-cov.ini
@@ -35,7 +35,7 @@
 bsp= griscv-sis
 arch   = riscv
 tester = %{_rtscripts}/run.cfg
-target = riscv-rtems5
+target = riscv
 bsp_run_cmd= %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
 bsp_run_opts   = -nouartrx -r -tlim 300 s -m 4 -cov
-bsp_covoar_cmd = -S %{bsp_symbol_path} -E %{cov_explanations} -f TSIM
+bsp_covoar_cmd = -T riscv-rtems6 -S %{bsp_symbol_path} -E %{cov_explanations} 
-f TSIM
diff --git a/tester/rtems/testing/bsps/leon3-qemu-cov.ini 
b/tester/rtems/testing/bsps/leon3-qemu-cov.ini
index 3b183e6..3d558db 100644
--- a/tester/rtems/testing/bsps/leon3-qemu-cov.ini
+++ b/tester/rtems/testing/bsps/leon3-qemu-cov.ini
@@ -34,8 +34,8 @@
 [leon3-qemu-cov]
 bsp   = leon3-qemu
 arch  = sparc
-target= sparc-rtems5
+target= sparc
 tester= %{_rtscripts}/qemu.cfg
 bsp_qemu_opts = %{qemu_opts_base} %{qemu_opts_serial} -M leon3_generic
 bsp_qemu_cov_opts = -exec-trace %{test_executable}.cov
-bsp_covoar_cmd= -S %{bsp_symbol_path} -E %{cov_explanations}
+bsp_covoar_cmd= -T sparc-rtems6 -S %{bsp_symbol_path} -E 
%{cov_explanations}
diff --git a/tester/rtems/testing/bsps/leon3-sis-cov.ini 
b/tester/rtems/testing/bsps/leon3-sis-cov.ini
index 626d314..66dae87 100644
--- a/tester/rtems/testing/bsps/leon3-sis-cov.ini
+++ b/tester/rtems/testing/bsps/leon3-sis-cov.ini
@@ -35,7 +35,7 @@
 bsp= leon3-sis
 arch   = sparc
 tester = %{_rtscripts}/run.cfg
-target = sparc-rtems5
+target = sparc
 bsp_run_cmd= %{rtems_tools}/%{bsp_arch}-rtems%{rtems_version}-sis
 bsp_run_opts   = -leon3 -nouartrx -r -tlim 200 s -cov
-bsp_covoar_cmd = -S %{bsp_symbol_path} -E %{cov_explanations} -f TSIM
+bsp_covoar_cmd = -T sparc-rtems6 -S %{bsp_symbol_path} -E %{cov_explanations} 
-f TSIM
diff --git a/tester/rtems/testing/coverage/symbol-sets.ini 
b/tester/rtems/testing/coverage/symbol-sets.ini
index 8f85533..9617dd8 100644
--- a/tester/rtems/testing/coverage/symbol-sets.ini
+++ b/tester/rtems/testing/coverage/symbol-sets.ini
@@ -29,50 +29,51 @@
 #
 
 [symbol-sets]
-sets = 
score,rtems,sapi,libdl,posix,librfs,libdosfs,libdevfs,libimfs,libbspcmdline,libcpuuse,libstackchk,libfsmount,libstringto,libdevnull,libdumpbuf,libblock
+sets = 
score,rtems,sapi,posix,librfs,libpipe,libdosfs,libimfs,libjffs2,libcsupport,libbspcmdline,libcpuuse,libstackchk,libfsmount,libstringto,libdevnull,libdumpbuf,libuntar,libblock,libcrypt,libmd,libstdthreads
 
 [libraries]
-score = @BUILD-TARGET@/c/@BSP@/cpukit/score/src
-rtems = @BUILD-TARGET@/c/@BSP@/cpukit/rtems/src
-sapi  = @BUILD-TARGET@/c/@BSP@/cpukit/sapi/src
-libdl = @BUILD-TARGET@/c/@BSP@/cpukit/libdl
-posix = @BUILD-TARGET@/c/@BSP@/cpukit/posix/src
-librfs   = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/src/rfs
-libdosfs  = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/src/dosfs
-libdevfs  = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/src/devfs
-libimfs   = @BUILD-TARGET@/c/@BSP@/cpukit/libfs/src/imfs
-#libdefaultsfs = @BUiLD-TARGET@/c/@BSP@/cpukit/libfs
-#libjffs2  = @BUILD-TARGET@/c/@BSP@/cpukit/libfs
-#dtc   = @BUILD-TARGET@/c/@BSP@/cpukit/libfdt
-#libdrvmgr = @BUILD-TARGET@/c/@BSP@/cpukit/libdrvmgr
-#libi2c= @BUILD-TARGET@/c/@BSP@/cpukit/libi2c
-#libcsupport   = @BUILD-TARGET@/c/@BSP@/cpukit/libcsupport/src
-libbspcmdline = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/bspcmdline
-libcpuuse = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/cpuuse
-libstackchk   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/stackchk
-libfsmount= @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/fsmount
-libstringto   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/stringto
-libdevnull= @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/devnull
-libdumpbuf= @BUILD-TARGET@/c/@BSP@/cpukit/libmisc/dumpbuf
-#libcapture= @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
-#libdummy  = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
-#libmonitor= @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
-#libmouse  = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
-#libmw-fb  = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
-#libredirector = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
-#librtemsfdt   = @BUILD-TARGET@/c/@BSP@/cpukit/libmisc
-#libserdbg = @BUILD-TARGET@/c/@BSP

[PATCH 04/22] covoar/Target_i386: Add NOP patterns

2021-03-01 Thread Alex White
A couple of NOP patterns found with the pc686 BSP were not detected.
This has been fixed.
---
 tester/covoar/Target_i386.cc | 9 +
 1 file changed, 9 insertions(+)

diff --git a/tester/covoar/Target_i386.cc b/tester/covoar/Target_i386.cc
index e0c9c0f..4567c1e 100644
--- a/tester/covoar/Target_i386.cc
+++ b/tester/covoar/Target_i386.cc
@@ -87,6 +87,15 @@ namespace Target {
   size = 3;
   return true;
 }
+if (!strncmp( &line[strlen(line)-28], "lea0x0(%esi,%eiz,1),%esi", 28)) 
{
+  // Could be 4 or 7 bytes of padding.
+  if (!strncmp( &line[strlen(line)-32], "00", 2)) {
+size = 7;
+  } else {
+size = 4;
+  }
+  return true;
+}
 
 return false;
   }
-- 
2.27.0

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


[PATCH 00/22] tester: Update covoar for new build system

2021-03-01 Thread Alex White
This patch set updates the covoar tool to allow it to work with the
outputs of the current build system. It includes various fixes and
improvements needed to successfully produce coverage reports for the
following BSP configurations: griscv-sis, leon3-sis, pc-qemu,
xilinx_zynqmp, and xilinx_zynq_a9_qemu.

Here is a link to the final coverage reports that I got for the five
configurations mentioned above:
https://ftp.rtems.org/pub/rtems/people/joel/coverage/coverage-2021-02-28/


Alex White (22):
  tester: Update to support new build system
  tester: Add coverage variants for a few BSPs
  covoar/TargetBase: Update branchInstructions variable name
  covoar/Target_i386: Add NOP patterns
  covoar/Target_arm: Add THUMB branch instructions
  covoar: Add aarch64 target
  covoar/CoverageReaderQEMU: Fix infinite loop
  covoar/TargetBase: Fix QEMU branch info
  covoar: Fix DWARF reading
  dwarf: Fix get_source
  covoar: Account for build path change
  covoar: Fix NOP execution marking
  covoar: Handle periods in symbols from objdump
  covoar/reports: Add new statistics to summary
  coverage/reports: Improve formatting and clarity
  coverage/reports: Share common JS and CSS in reports
  covoar: Fix null pointer dereference
  covoar: Add option to create named objdumps
  covoar: Catch exceptional case
  covoar: Allow symbols from objdump to be skipped
  covoar: Fix overflow of high PC address
  covoar/Reports: Fix empty branch report

 rtemstoolkit/rld-dwarf.cpp|  13 +-
 rtemstoolkit/rld-dwarf.h  |   5 +
 rtemstoolkit/rld-process.cpp  |  12 +
 rtemstoolkit/rld-process.h|   9 +
 tester/covoar/CoverageMapBase.cc  |  10 +
 tester/covoar/CoverageMapBase.h   |   4 +
 tester/covoar/CoverageReaderQEMU.cc   |  11 +-
 tester/covoar/DesiredSymbols.cc   |  48 +++-
 tester/covoar/DesiredSymbols.h|  34 ++-
 tester/covoar/ExecutableInfo.cc   |  95 ++-
 tester/covoar/ObjdumpProcessor.cc | 145 ---
 tester/covoar/ReportsBase.cc  |  80 --
 tester/covoar/ReportsHtml.cc  | 243 +-
 tester/covoar/ReportsText.cc  |  76 +++---
 tester/covoar/SymbolTable.cc  |  12 +-
 tester/covoar/TargetBase.cc   |  14 +-
 tester/covoar/TargetBase.h|   4 +-
 tester/covoar/TargetFactory.cc|   2 +
 tester/covoar/Target_aarch64.cc   | 100 +++
 tester/covoar/Target_aarch64.h|  77 ++
 tester/covoar/Target_arm.cc   |  70 +++--
 tester/covoar/Target_i386.cc  |  73 +++---
 tester/covoar/Target_lm32.cc  |  12 +-
 tester/covoar/Target_m68k.cc  |  98 +++
 tester/covoar/Target_powerpc.cc   |  56 ++--
 tester/covoar/Target_riscv.cc |  22 +-
 tester/covoar/Target_sparc.cc |  66 ++---
 tester/covoar/app_common.cc   |  10 +
 tester/covoar/app_common.h|   1 +
 tester/covoar/covoar.cc   | 135 +-
 tester/covoar/wscript |   1 +
 tester/rt/coverage.py |  63 +++--
 tester/rtems/testing/bsps/a53_qemu-cov.ini|  41 +++
 tester/rtems/testing/bsps/griscv-sis-cov.ini  |   4 +-
 tester/rtems/testing/bsps/leon3-qemu-cov.ini  |   4 +-
 tester/rtems/testing/bsps/leon3-sis-cov.ini   |   4 +-
 tester/rtems/testing/bsps/pc-qemu-cov.ini |  42 +++
 .../testing/bsps/xilinx_zynq_a9_qemu-cov.ini  |  41 +++
 .../rtems/testing/bsps/xilinx_zynqmp-cov.ini  |  41 +++
 tester/rtems/testing/coverage/symbol-sets.ini |  91 +++
 40 files changed, 1327 insertions(+), 542 deletions(-)
 create mode 100644 tester/covoar/Target_aarch64.cc
 create mode 100644 tester/covoar/Target_aarch64.h
 create mode 100644 tester/rtems/testing/bsps/a53_qemu-cov.ini
 create mode 100644 tester/rtems/testing/bsps/pc-qemu-cov.ini
 create mode 100644 tester/rtems/testing/bsps/xilinx_zynq_a9_qemu-cov.ini
 create mode 100644 tester/rtems/testing/bsps/xilinx_zynqmp-cov.ini

-- 
2.27.0

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


[PATCH 05/22] covoar/Target_arm: Add THUMB branch instructions

2021-03-01 Thread Alex White
The ".n" and ".w" variants of the THUMB branch instructions were not
included in the list of conditional branch instructions. They have
been added.
---
 tester/covoar/Target_arm.cc | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/tester/covoar/Target_arm.cc b/tester/covoar/Target_arm.cc
index 4b7b2e1..75ec406 100644
--- a/tester/covoar/Target_arm.cc
+++ b/tester/covoar/Target_arm.cc
@@ -36,6 +36,40 @@ namespace Target {
 conditionalBranchInstructions.push_back("bvc");
 conditionalBranchInstructions.push_back("bvs");
 
+conditionalBranchInstructions.push_back("beq.n");
+conditionalBranchInstructions.push_back("bne.n");
+conditionalBranchInstructions.push_back("bcs.n");
+conditionalBranchInstructions.push_back("bhs.n");
+conditionalBranchInstructions.push_back("bcc.n");
+conditionalBranchInstructions.push_back("blo.n");
+conditionalBranchInstructions.push_back("bmi.n");
+conditionalBranchInstructions.push_back("bpl.n");
+conditionalBranchInstructions.push_back("bvs.n");
+conditionalBranchInstructions.push_back("bvc.n");
+conditionalBranchInstructions.push_back("bhi.n");
+conditionalBranchInstructions.push_back("bls.n");
+conditionalBranchInstructions.push_back("bge.n");
+conditionalBranchInstructions.push_back("blt.n");
+conditionalBranchInstructions.push_back("bgt.n");
+conditionalBranchInstructions.push_back("ble.n");
+
+conditionalBranchInstructions.push_back("beq.w");
+conditionalBranchInstructions.push_back("bne.w");
+conditionalBranchInstructions.push_back("bcs.w");
+conditionalBranchInstructions.push_back("bhs.w");
+conditionalBranchInstructions.push_back("bcc.w");
+conditionalBranchInstructions.push_back("blo.w");
+conditionalBranchInstructions.push_back("bmi.w");
+conditionalBranchInstructions.push_back("bpl.w");
+conditionalBranchInstructions.push_back("bvs.w");
+conditionalBranchInstructions.push_back("bvc.w");
+conditionalBranchInstructions.push_back("bhi.w");
+conditionalBranchInstructions.push_back("bls.w");
+conditionalBranchInstructions.push_back("bge.w");
+conditionalBranchInstructions.push_back("blt.w");
+conditionalBranchInstructions.push_back("bgt.w");
+conditionalBranchInstructions.push_back("ble.w");
+
 conditionalBranchInstructions.sort();
 
   }
-- 
2.27.0

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


[PATCH 06/22] covoar: Add aarch64 target

2021-03-01 Thread Alex White
---
 tester/covoar/TargetFactory.cc  |   2 +
 tester/covoar/Target_aarch64.cc | 100 
 tester/covoar/Target_aarch64.h  |  77 
 tester/covoar/wscript   |   1 +
 4 files changed, 180 insertions(+)
 create mode 100644 tester/covoar/Target_aarch64.cc
 create mode 100644 tester/covoar/Target_aarch64.h

diff --git a/tester/covoar/TargetFactory.cc b/tester/covoar/TargetFactory.cc
index 12de94d..57ba686 100644
--- a/tester/covoar/TargetFactory.cc
+++ b/tester/covoar/TargetFactory.cc
@@ -17,6 +17,7 @@
 
 #include "TargetFactory.h"
 
+#include "Target_aarch64.h"
 #include "Target_arm.h"
 #include "Target_i386.h"
 #include "Target_m68k.h"
@@ -51,6 +52,7 @@ namespace Target {
   //! All must be derived from TargetBase.
   //!
   static FactoryEntry_t FactoryTable[] = {
+{ "aarch64", Target_aarch64_Constructor },
 { "arm", Target_arm_Constructor },
 { "i386",Target_i386_Constructor },
 { "lm32",Target_lm32_Constructor },
diff --git a/tester/covoar/Target_aarch64.cc b/tester/covoar/Target_aarch64.cc
new file mode 100644
index 000..64472d6
--- /dev/null
+++ b/tester/covoar/Target_aarch64.cc
@@ -0,0 +1,100 @@
+/*! @file Target_aarch64.cc
+ *  @brief Target_aarch64 Implementation
+ *
+ *  This file contains the implementation of the base class for
+ *  functions supporting target unique functionallity.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "Target_aarch64.h"
+
+namespace Target {
+
+  Target_aarch64::Target_aarch64( std::string targetName ):
+TargetBase( targetName )
+  {
+conditionalBranchInstructions.push_back("cbnz");
+conditionalBranchInstructions.push_back("cbz");
+conditionalBranchInstructions.push_back("tbnz");
+conditionalBranchInstructions.push_back("tbz");
+conditionalBranchInstructions.push_back("b.eq");
+conditionalBranchInstructions.push_back("b.ne");
+conditionalBranchInstructions.push_back("b.cs");
+conditionalBranchInstructions.push_back("b.hs");
+conditionalBranchInstructions.push_back("b.cc");
+conditionalBranchInstructions.push_back("b.lo");
+conditionalBranchInstructions.push_back("b.mi");
+conditionalBranchInstructions.push_back("b.pl");
+conditionalBranchInstructions.push_back("b.vs");
+conditionalBranchInstructions.push_back("b.vc");
+conditionalBranchInstructions.push_back("b.hi");
+conditionalBranchInstructions.push_back("b.ls");
+conditionalBranchInstructions.push_back("b.ge");
+conditionalBranchInstructions.push_back("b.lt");
+conditionalBranchInstructions.push_back("b.gt");
+conditionalBranchInstructions.push_back("b.le");
+
+conditionalBranchInstructions.sort();
+  }
+
+  Target_aarch64::~Target_aarch64()
+  {
+  }
+
+  bool Target_aarch64::isNopLine(
+const char* const line,
+int&  size
+  )
+  {
+if (!strcmp( &line[strlen(line)-3], "nop")) {
+  size = 4;
+  return true;
+}
+
+if (!strncmp( &line[strlen(line)-6], "udf", 3)) {
+  size = 4;
+  return true;
+}
+
+// On ARM, there are literal tables at the end of methods.
+// We need to avoid them.
+if (!strncmp( &line[strlen(line)-10], ".byte", 5)) {
+  size = 1;
+  return true;
+}
+if (!strncmp( &line[strlen(line)-13], ".short", 6)) {
+  size = 2;
+  return true;
+}
+if (!strncmp( &line[strlen(line)-16], ".word", 5)) {
+  size = 4;
+  return true;
+}
+
+return false;
+  }
+
+  bool Target_aarch64::isBranch(
+  const char* instruction
+  )
+  {
+throw rld::error(
+  "DETERMINE BRANCH INSTRUCTIONS FOR THIS ARCHITECTURE! -- fix me",
+  "Target_aarch64::isBranch"
+);
+  }
+
+  TargetBase *Target_aarch64_Constructor(
+std::string  targetName
+  )
+  {
+return new Target_aarch64( targetName );
+  }
+
+}
diff --git a/tester/covoar/Target_aarch64.h b/tester/covoar/Target_aarch64.h
new file mode 100644
index 000..8c15daa
--- /dev/null
+++ b/tester/covoar/Target_aarch64.h
@@ -0,0 +1,77 @@
+/*! @file Target_aarch64.h
+ *  @brief Target_aarch64 Specification
+ *
+ *  This file contains the specification of the Target_aarch64 class.
+ */
+
+#ifndef __TARGET_AARCH64_H__
+#define __TARGET_AARCH64_H__
+
+#include 
+#include 
+#include "TargetBase.h"
+
+namespace Target {
+
+  /*! @class Target_aarch64
+   *
+   *  This class is the Target class for the aarch64 processor.
+   *
+   */
+  class Target_aarch64: public TargetBase {
+
+  public:
+
+/*!
+ *  This method constructs an Target_aarch64 instance.
+ */
+Target_aarch64( std::string targetName );
+
+/*!
+ *  This method destructs an Target_aarch64 instance.
+ */
+virtual ~Target_aarch64();
+
+/*!
+ *  This method determines whether the specified line from a 
+ *  objdump file is a nop instruction.
+ *
+ *  @param[in] line contains the object dump line to check
+ *  @param[out] size is se

[PATCH 07/22] covoar/CoverageReaderQEMU: Fix infinite loop

2021-03-01 Thread Alex White
There was a potential that the branch info loop never terminated.
This has been fixed by adding a more reliable termination condition
and logging an error if it cannot find the branch target.
---
 tester/covoar/CoverageReaderQEMU.cc | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tester/covoar/CoverageReaderQEMU.cc 
b/tester/covoar/CoverageReaderQEMU.cc
index 7c344e4..fb1709d 100644
--- a/tester/covoar/CoverageReaderQEMU.cc
+++ b/tester/covoar/CoverageReaderQEMU.cc
@@ -76,7 +76,7 @@ namespace Coverage {
 //
 // Read ENTRIES number of trace entries.
 //
-#define ENTRIES 1024
+#define ENTRIES 2
 while (true) {
   CoverageMapBase *aCoverageMap = NULL;
   struct trace_entry  entries[ENTRIES];
@@ -118,8 +118,15 @@ namespace Coverage {
 // Determine if additional branch information is available.
 if ( (entry->op & branchInfo) != 0 ) {
   uint32_t  a = entry->pc + entry->size - 1;
-while (!aCoverageMap->isStartOfInstruction(a))
+while (a > entry->pc && !aCoverageMap->isStartOfInstruction(a))
   a--;
+if (a == entry->pc && !aCoverageMap->isStartOfInstruction(a)) {
+  // Something went wrong parsing the objdump.
+  std::ostringstream what;
+  what << "Reached beginning of range in " << file
+<< " at " << entry->pc << " with no start of instruction.";
+  throw rld::error( what, "CoverageReaderQEMU::processFile" );
+}
 if (entry->op & taken) {
   aCoverageMap->setWasTaken( a );
 } else if (entry->op & notTaken) {
-- 
2.27.0

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


[PATCH 11/22] covoar: Account for build path change

2021-03-01 Thread Alex White
Covoar had not been updated to account for the paths used by the new
build system. This has been fixed.
---
 tester/covoar/covoar.cc | 5 -
 1 file changed, 5 deletions(-)

diff --git a/tester/covoar/covoar.cc b/tester/covoar/covoar.cc
index 84d883a..bf95cb4 100644
--- a/tester/covoar/covoar.cc
+++ b/tester/covoar/covoar.cc
@@ -69,11 +69,6 @@ static void createBuildPath(Executables& 
executablesToAnalyze,
   }
 }
 ++pri;
-if (pri == eparts.rend() || *pri != "c") {
-  fail = "invalid executable path, no 'c'";
-  break;
-}
-++pri;
 if (pri == eparts.rend()) {
   fail = "invalid executable path, no arch prefix";
   break;
-- 
2.27.0

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


[PATCH 12/22] covoar: Fix NOP execution marking

2021-03-01 Thread Alex White
Some NOP instructions were not being marked as executed because they
are located at the end of uncovered ranges. This has been fixed.
---
 tester/covoar/CoverageMapBase.cc  |  10 +++
 tester/covoar/CoverageMapBase.h   |   4 ++
 tester/covoar/DesiredSymbols.cc   |  38 --
 tester/covoar/DesiredSymbols.h|  10 ++-
 tester/covoar/ObjdumpProcessor.cc | 112 +++---
 5 files changed, 139 insertions(+), 35 deletions(-)

diff --git a/tester/covoar/CoverageMapBase.cc b/tester/covoar/CoverageMapBase.cc
index ad0080d..6ca5cf7 100644
--- a/tester/covoar/CoverageMapBase.cc
+++ b/tester/covoar/CoverageMapBase.cc
@@ -142,6 +142,11 @@ namespace Coverage {
 return size;
   }
 
+  uint32_t CoverageMapBase::getSizeOfRange( size_t index ) const
+  {
+return Ranges.at(index).size();
+  }
+
   bool CoverageMapBase::getBeginningOfInstruction(
 uint32_t  address,
 uint32_t* beginning
@@ -178,6 +183,11 @@ namespace Coverage {
 return Ranges.front().lowAddress;
   }
 
+  uint32_t CoverageMapBase::getLowAddressOfRange( size_t index ) const
+  {
+return Ranges.at(index).lowAddress;
+  }
+
   bool CoverageMapBase::getRange( uint32_t address, AddressRange& range ) const
   {
 for ( auto r : Ranges ) {
diff --git a/tester/covoar/CoverageMapBase.h b/tester/covoar/CoverageMapBase.h
index 6ad76d3..a58c696 100644
--- a/tester/covoar/CoverageMapBase.h
+++ b/tester/covoar/CoverageMapBase.h
@@ -156,6 +156,8 @@ namespace Coverage {
  */
 int32_t getFirstLowAddress() const;
 
+uint32_t getLowAddressOfRange( size_t index ) const;
+
 /*!
  *  This method returns true and sets the address range if
  *  the address falls with the bounds of an address range
@@ -177,6 +179,8 @@ namespace Coverage {
  */
 uint32_t getSize() const;
 
+uint32_t getSizeOfRange( size_t index ) const;
+
 /*!
  *  This method returns the address of the beginning of the
  *  instruction that contains the specified address.
diff --git a/tester/covoar/DesiredSymbols.cc b/tester/covoar/DesiredSymbols.cc
index b9a5bb7..c97b25c 100644
--- a/tester/covoar/DesiredSymbols.cc
+++ b/tester/covoar/DesiredSymbols.cc
@@ -142,7 +142,7 @@ namespace Coverage {
   CoverageMapBase* theCoverageMap = s.second.unifiedCoverageMap;
   if (theCoverageMap)
   {
-// Increment the total sizeInBytes byt the bytes in the symbol
+// Increment the total sizeInBytes by the bytes in the symbol
 stats.sizeInBytes += s.second.stats.sizeInBytes;
 
 // Now scan through the coverage map of this symbol.
@@ -202,6 +202,26 @@ namespace Coverage {
 uint32_t count;
 
 // Mark NOPs as executed
+a = s.second.stats.sizeInBytes - 1;
+count = 0;
+while (a > 0) {
+  if (theCoverageMap->isStartOfInstruction( a )) {
+break;
+  }
+
+  count++;
+
+  if (theCoverageMap->isNop( a )) {
+for (la = a; la < (a + count); la++) {
+  theCoverageMap->setWasExecuted( la );
+}
+
+count = 0;
+  }
+
+  a--;
+}
+
 endAddress = s.second.stats.sizeInBytes - 1;
 a = 0;
 while (a < endAddress) {
@@ -223,12 +243,13 @@ namespace Coverage {
   ha++;
   if ( ha >= endAddress )
 break;
-} while ( !theCoverageMap->isStartOfInstruction( ha ) );
+} while ( !theCoverageMap->isStartOfInstruction( ha ) ||
+  theCoverageMap->isNop( ha ) );
   a = ha;
 }
 
 // Now scan through the coverage map of this symbol.
-endAddress = s.second.stats.sizeInBytes - 1;
+endAddress = s.second.stats.sizeInBytesWithoutNops - 1;
 a = 0;
 while (a <= endAddress) {
   // If an address was NOT executed, find consecutive unexecuted
@@ -316,7 +337,8 @@ namespace Coverage {
   void DesiredSymbols::createCoverageMap(
 const std::string& exefileName,
 const std::string& symbolName,
-uint32_t   size
+uint32_t   size,
+uint32_t   sizeWithoutNops
   )
   {
 CoverageMapBase* aCoverageMap;
@@ -354,9 +376,10 @@ namespace Coverage {
   << '/' << size << ')'
   << std::endl;
 
-if ( itr->second.stats.sizeInBytes < size )
+if ( itr->second.stats.sizeInBytes < size ) {
   itr->second.stats.sizeInBytes = size;
-else
+  itr->second.stats.sizeInBytesWithoutNops = sizeWithoutNops;
+} else
   size = itr->second.stats.sizeInBytes;
   }
 }
@@ -376,6 +399,7 @@ namespace Coverage {
 );
   itr->second.unifiedCoverageMap = aCoverageMap;
   itr->second.stats.sizeInBytes = size;
+  itr->second.stats.sizeInBytesWithoutNops = sizeWithoutNops;
 }
   }
 
@@ -479,7 +503,7 @@ namespace Coverage {
 // are the same size.
 // Changed from ERROR msg to INFO, because size mi

[PATCH 10/22] dwarf: Fix get_source

2021-03-01 Thread Alex White
The file::get_source method was giving "unknown:-1" for valid
addresses. This has been fixed.
---
 rtemstoolkit/rld-dwarf.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/rtemstoolkit/rld-dwarf.cpp b/rtemstoolkit/rld-dwarf.cpp
index acb4fd4..2fce0e4 100644
--- a/rtemstoolkit/rld-dwarf.cpp
+++ b/rtemstoolkit/rld-dwarf.cpp
@@ -2167,12 +2167,11 @@ namespace rld
 r = cu.get_source (addr, line);
 if (r)
 {
-  if (match.valid () &&
-  (match.is_an_end_sequence () || !!line.is_an_end_sequence ()))
+  if (!match.valid ())
   {
 match = line;
   }
-  else
+  else if (match.is_an_end_sequence () || !line.is_an_end_sequence ())
   {
 match = line;
   }
-- 
2.27.0

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


[PATCH 09/22] covoar: Fix DWARF reading

2021-03-01 Thread Alex White
There were a couple of issues with the way the DWARF info was being
read. The first issue was that it inefficiently included all symbols,
even symbols that were not desired. The second issue is that it did
not handle inline functions correctly. These have been fixed.
---
 rtemstoolkit/rld-dwarf.cpp  |   8 ++-
 rtemstoolkit/rld-dwarf.h|   5 ++
 tester/covoar/ExecutableInfo.cc |  30 -
 tester/covoar/covoar.cc | 110 
 4 files changed, 94 insertions(+), 59 deletions(-)

diff --git a/rtemstoolkit/rld-dwarf.cpp b/rtemstoolkit/rld-dwarf.cpp
index d9ac6f3..acb4fd4 100644
--- a/rtemstoolkit/rld-dwarf.cpp
+++ b/rtemstoolkit/rld-dwarf.cpp
@@ -884,6 +884,12 @@ namespace rld
   return addr;
 }
 
+bool
+function::has_entry_pc () const
+{
+  return has_entry_pc_;
+}
+
 bool
 function::has_machine_code () const
 {
@@ -1702,7 +1708,7 @@ namespace rld
 if (daddr.is_an_end_sequence ())
   seq_base = 0;
 address addr (daddr, loc);
-if (loc >= pc_low_ && loc < pc_high_)
+if (loc >= pc_low_ && loc <= pc_high_)
 {
   pc = loc;
   addr_lines_.push_back (addr);
diff --git a/rtemstoolkit/rld-dwarf.h b/rtemstoolkit/rld-dwarf.h
index 45fbab1..1210813 100644
--- a/rtemstoolkit/rld-dwarf.h
+++ b/rtemstoolkit/rld-dwarf.h
@@ -376,6 +376,11 @@ namespace rld
*/
   dwarf_unsigned pc_high () const;
 
+  /**
+   * Does the function have an entry PC?
+   */
+  bool has_entry_pc () const;
+
   /**
* Does the function have machine code in the image?
*/
diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
index c593e1d..c4257f0 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -45,10 +45,34 @@ namespace Coverage {
 try {
   for (auto& cu : debug.get_cus()) {
 for (auto& func : cu.get_functions()) {
-  if (func.has_machine_code() && (!func.is_inlined() || 
func.is_external())) {
-createCoverageMap (cu.name(), func.name(),
-   func.pc_low(), func.pc_high() - 1);
+  if (!func.has_machine_code()) {
+continue;
   }
+
+  if (!SymbolsToAnalyze->isDesired(func.name())) {
+continue;
+  }
+
+  if (func.is_inlined()) {
+if (func.is_external()) {
+  // Flag it
+  std::cerr << "Function is both external and inlined: "
+<< func.name() << std::endl;
+}
+
+if (func.has_entry_pc()) {
+  continue;
+}
+
+// If the low PC address is zero, the symbol does not appear in
+// this executable.
+if (func.pc_low() == 0) {
+  continue;
+}
+  }
+
+  createCoverageMap (cu.name(), func.name(),
+  func.pc_low(), func.pc_high() - 1);
 }
   }
 } catch (...) {
diff --git a/tester/covoar/covoar.cc b/tester/covoar/covoar.cc
index cbb0e4f..84d883a 100644
--- a/tester/covoar/covoar.cc
+++ b/tester/covoar/covoar.cc
@@ -222,6 +222,61 @@ int covoar(
   if ( !projectName )
 throw option_error( "project name -p" );
 
+  //
+  // Find the top of the BSP's build tree and if we have found the top
+  // check the executable is under the same path and BSP.
+  //
+  std::string buildPath;
+  std::string buildTarget;
+  std::string buildBSP;
+  createBuildPath(executablesToAnalyze,
+  buildPath,
+  buildTarget,
+  buildBSP);
+
+  //
+  // Use a command line target if provided.
+  //
+  if (!target.empty()) {
+buildTarget = target;
+  }
+
+  if (Verbose) {
+if (singleExecutable) {
+  std::cerr << "Processing a single executable and multiple coverage files"
+<< std::endl;
+} else {
+  std::cerr << "Processing multiple executable/coverage file pairs" << 
std::endl;
+}
+std::cerr << "Coverage Format : " << format << std::endl
+  << "Target  : " << buildTarget.c_str() << std::endl
+  << std::endl;
+
+// Process each executable/coverage file pair.
+Executables::iterator eitr = executablesToAnalyze.begin();
+for (const auto& cname : coverageFileNames) {
+  std::cerr << "Coverage file " << cname
+<< " for executable: " << (*eitr)->getFileName() << std::endl;
+  if (!singleExecutable)
+eitr++;
+}
+  }
+
+  //
+  // Create data to support analysis.
+  //
+
+  // Create data based on target.
+  TargetInfo = Target::TargetFactory( buildTarget );
+
+  // Create the set of desired symbols.
+  SymbolsToAnalyze = new Coverage::DesiredSymbols();
+
+  //
+  // Read symbol configuration file and load needed symbols.
+  //
+  SymbolsToAnalyze->load( symbolSet, buildTarget, buildBSP, Verbose );
+
   // If a single executable w

[PATCH 13/22] covoar: Handle periods in symbols from objdump

2021-03-01 Thread Alex White
Occasionally the compiler will generate symbols that look similar to
symbols defined in RTEMS code except that they contain some suffix.
This looks to be related to compiler optimizations. Such symbols were
being treated as unique. For our purposes, they should be mapped to
the equivalent symbols in the DWARF info. This has been fixed.
---
 tester/covoar/ExecutableInfo.cc   | 35 ++-
 tester/covoar/ObjdumpProcessor.cc |  6 ++
 tester/covoar/SymbolTable.cc  | 12 ---
 3 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
index c4257f0..1396519 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -119,6 +119,22 @@ namespace Coverage {
 itsSymbol = theSymbolTable.getSymbol( address );
 if (itsSymbol != "") {
   it = coverageMaps.find( itsSymbol );
+  if (it == coverageMaps.end()) {
+size_t periodIndex = itsSymbol.find(".");
+
+if (periodIndex == std::string::npos) {
+  // Symbol name has no '.', can't do another lookup.
+  throw rld::error (itsSymbol, "ExecutableInfo::getCoverageMap");
+}
+
+it = coverageMaps.find(
+  itsSymbol.substr(0, periodIndex)
+);
+
+if (it == coverageMaps.end()) {
+  throw rld::error (itsSymbol, "ExecutableInfo::getCoverageMap");
+}
+  }
   aCoverageMap = (*it).second;
 }
 
@@ -150,8 +166,25 @@ namespace Coverage {
   )
   {
 CoverageMaps::iterator cmi = coverageMaps.find( symbolName );
-if ( cmi == coverageMaps.end() )
+if ( cmi != coverageMaps.end() ) {
+  return *(cmi->second);
+}
+
+size_t periodIndex = symbolName.find(".");
+
+if (periodIndex == std::string::npos) {
+  // Symbol name has no '.', can't do another lookup.
   throw rld::error (symbolName, "ExecutableInfo::findCoverageMap");
+}
+
+cmi = coverageMaps.find(
+  symbolName.substr(0, periodIndex)
+);
+
+if ( cmi == coverageMaps.end() ) {
+  throw rld::error (symbolName, "ExecutableInfo::findCoverageMap");
+}
+
 return *(cmi->second);
   }
 
diff --git a/tester/covoar/ObjdumpProcessor.cc 
b/tester/covoar/ObjdumpProcessor.cc
index bf39fe9..f4769b5 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -420,6 +420,12 @@ namespace Coverage {
 processSymbol = false;
 theInstructions.clear();
 
+// Look for a '.' character and strip everything after it.
+char *periodIndex = strstr(symbol, ".");
+if (periodIndex != NULL) {
+  *periodIndex = 0;
+}
+
 // See if the new symbol is one that we care about.
 if (SymbolsToAnalyze->isDesired( symbol )) {
   currentSymbol = symbol;
diff --git a/tester/covoar/SymbolTable.cc b/tester/covoar/SymbolTable.cc
index 53bc8af..00062cc 100644
--- a/tester/covoar/SymbolTable.cc
+++ b/tester/covoar/SymbolTable.cc
@@ -46,12 +46,18 @@ namespace Coverage {
 symbolData.startingAddress = start;
 symbolData.length = length;
 
-if ( info[ symbol ].empty() == false ) {
-  if ( info[ symbol ].front().length != length ) {
+for (auto& symData : info[ symbol ]) {
+  // The starting address could differ since we strip any suffixes 
beginning
+  // with a '.'
+  if (symData.startingAddress != start) {
+continue;
+  }
+
+  if (symData.length != length) {
 std::ostringstream what;
 what << "Different lengths for the symbol "
  << symbol
- << " (" << info[ symbol ].front().length
+ << " (" << symData.length
  << " and " << length
  << ")";
 throw rld::error( what, "SymbolTable::addSymbol" );
-- 
2.27.0

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


[PATCH 08/22] covoar/TargetBase: Fix QEMU branch info

2021-03-01 Thread Alex White
The taken/not taken bit was being interpreted incorrectly. This led
to branches being marked "always taken" when they were never taken.
This has been fixed.
---
 tester/covoar/TargetBase.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tester/covoar/TargetBase.cc b/tester/covoar/TargetBase.cc
index 4474fad..c11129b 100644
--- a/tester/covoar/TargetBase.cc
+++ b/tester/covoar/TargetBase.cc
@@ -130,12 +130,12 @@ namespace Target {
 
   uint8_t TargetBase::qemuTakenBit(void)
   {
-return TRACE_OP_BR0;
+return TRACE_OP_BR1;
   }
 
   uint8_t TargetBase::qemuNotTakenBit(void)
   {
-return TRACE_OP_BR1;
+return TRACE_OP_BR0;
   }
 
 }
-- 
2.27.0

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


[PATCH 17/22] covoar: Fix null pointer dereference

2021-03-01 Thread Alex White
---
 tester/covoar/ExecutableInfo.cc | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
index 1396519..187bb77 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -82,13 +82,16 @@ namespace Coverage {
   throw;
 }
 
-debug.end();
-executable.end();
-executable.close();
+// Can't cleanup handles until the destructor because the information is
+// referenced elsewhere. NOTE: This could cause problems from too many open
+// file descriptors.
   }
 
   ExecutableInfo::~ExecutableInfo()
   {
+debug.end();
+executable.end();
+executable.close();
   }
 
   void ExecutableInfo::dumpCoverageMaps( void ) {
-- 
2.27.0

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


[PATCH 18/22] covoar: Add option to create named objdumps

2021-03-01 Thread Alex White
This adds a new macro USE_TEMPLFILE which allows the creation of named
objdump outputs in the /tmp directory. This allows the outputs to be
reused on subsequent runs of covoar rather than running objdump again.
---
 rtemstoolkit/rld-process.cpp  | 12 
 rtemstoolkit/rld-process.h|  9 +
 tester/covoar/ObjdumpProcessor.cc | 16 +++-
 tester/covoar/app_common.cc   | 10 ++
 tester/covoar/app_common.h|  1 +
 tester/covoar/covoar.cc   | 20 
 6 files changed, 63 insertions(+), 5 deletions(-)

diff --git a/rtemstoolkit/rld-process.cpp b/rtemstoolkit/rld-process.cpp
index 30e0605..d0352cb 100644
--- a/rtemstoolkit/rld-process.cpp
+++ b/rtemstoolkit/rld-process.cpp
@@ -169,6 +169,18 @@ namespace rld
   _name = temporaries.get (suffix, _keep);
 }
 
+tempfile::tempfile (
+  const std::string& name,
+  const std::string& suffix,
+  bool _keep
+) : _name(name + suffix),
+suffix(suffix),
+overridden (false),
+fd (-1),
+level (0)
+{
+}
+
 tempfile::~tempfile ()
 {
   try
diff --git a/rtemstoolkit/rld-process.h b/rtemstoolkit/rld-process.h
index fc9b7bc..16e0322 100644
--- a/rtemstoolkit/rld-process.h
+++ b/rtemstoolkit/rld-process.h
@@ -114,6 +114,15 @@ namespace rld
*/
   tempfile (const std::string& suffix = ".rldxx", bool keep = false);
 
+  /**
+   * Get a temporary file name given a name and a suffix.
+   */
+  tempfile (
+const std::string& name,
+const std::string& suffix,
+bool _keep = false
+  );
+
   /**
* Clean up the temporary file.
*/
diff --git a/tester/covoar/ObjdumpProcessor.cc 
b/tester/covoar/ObjdumpProcessor.cc
index 00824f1..f130819 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -245,12 +245,18 @@ namespace Coverage {
  fileName };
 try
 {
-  status = rld::process::execute( TargetInfo->getObjdump(),
-  args, objdumpFile.name(), err.name() );
-  if ( (status.type != rld::process::status::normal)
-   || (status.code != 0) ) {
-throw rld::error( "Objdump error", "generating objdump" );
+  #ifndef USE_TEMPFILE
+  if (FileIsNewer( fileName.c_str(), objdumpFile.name().c_str() )) {
+  #endif
+status = rld::process::execute( TargetInfo->getObjdump(),
+args, objdumpFile.name(), err.name() );
+if ( (status.type != rld::process::status::normal)
+ || (status.code != 0) ) {
+  throw rld::error( "Objdump error", "generating objdump" );
+}
+  #ifndef USE_TEMPFILE
   }
+  #endif
 } catch( rld::error& err )
   {
 std::cout << "Error while running " << TargetInfo->getObjdump()
diff --git a/tester/covoar/app_common.cc b/tester/covoar/app_common.cc
index 8b490ed..0f3c8e2 100644
--- a/tester/covoar/app_common.cc
+++ b/tester/covoar/app_common.cc
@@ -116,3 +116,13 @@ bool ReadUntilFound( FILE *file, const char *line )
   } while (1);
 }
 
+std::string GetFileNameFromPath( const std::string& path )
+{
+  size_t idx = path.rfind('/', path.length());
+  if (idx == std::string::npos) {
+return "";
+  }
+
+  return path.substr(idx + 1, path.length() - idx);
+}
+
diff --git a/tester/covoar/app_common.h b/tester/covoar/app_common.h
index ac32bbd..21e8cfa 100644
--- a/tester/covoar/app_common.h
+++ b/tester/covoar/app_common.h
@@ -30,5 +30,6 @@ extern char 
inputBuffer2[MAX_LINE_LENGTH];
 bool FileIsNewer( const char *f1, const char *f2 );
 bool FileIsReadable( const char *f1 );
 bool ReadUntilFound( FILE *file, const char *line );
+std::string GetFileNameFromPath( const std::string& path );
 
 #endif
diff --git a/tester/covoar/covoar.cc b/tester/covoar/covoar.cc
index bf95cb4..bc1b7cf 100644
--- a/tester/covoar/covoar.cc
+++ b/tester/covoar/covoar.cc
@@ -162,7 +162,9 @@ int covoar(
   FILE* gcnosFile = NULL;
   Gcov::GcovData*   gcovFile;
   const char*   singleExecutable = NULL;
+  #ifdef USE_TEMPFILE
   rld::process::tempfileobjdumpFile( ".dmp" );
+  #endif
   rld::process::tempfileerr( ".err" );
   rld::process::tempfilesyms( ".syms" );
   bool  debug = false;
@@ -373,6 +375,22 @@ int covoar(
   exe->setLoadAddress( objdumpProcessor->determineLoadAddress( exe ) );
 }
 
+#ifndef USE_TEMPFILE
+std::string name;
+
+if ( !exe->hasDynamicLibrary() ) {
+  name = exe->getFileName();
+} else {
+  name = exe->getLibraryName();
+}
+
+name = GetFileNameFromPath( name );
+name = buildTarget + "-" + name;
+name.insert( 0, "/tmp/" );
+
+rld::process::tempfile objdumpFile( name, ".dmp", true );
+#endif
+
 // Load the objdump for the symbols in

[PATCH 20/22] covoar: Allow symbols from objdump to be skipped

2021-03-01 Thread Alex White
There is at least one symbol that is shown as having no machine code in
the DWARF info but obviously contains machine code if inspected using
objdump. This results in an exception being thrown when that symbol's
coverage map is looked up. That exception is now caught and a message
is printed to stderr rather than crashing the program.
---
 tester/covoar/ExecutableInfo.cc   | 8 ++--
 tester/covoar/ObjdumpProcessor.cc | 8 +++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
index 5a730fd..30828a6 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -177,7 +177,9 @@ namespace Coverage {
 
 if (periodIndex == std::string::npos) {
   // Symbol name has no '.', can't do another lookup.
-  throw rld::error (symbolName, "ExecutableInfo::findCoverageMap");
+  std::ostringstream what;
+  what << "Could not find " << symbolName;
+  throw rld::error (what, "ExecutableInfo::findCoverageMap");
 }
 
 cmi = coverageMaps.find(
@@ -185,7 +187,9 @@ namespace Coverage {
 );
 
 if ( cmi == coverageMaps.end() ) {
-  throw rld::error (symbolName, "ExecutableInfo::findCoverageMap");
+  std::ostringstream what;
+  what << "Could not find " << symbolName;
+  throw rld::error (what, "ExecutableInfo::findCoverageMap");
 }
 
 return *(cmi->second);
diff --git a/tester/covoar/ObjdumpProcessor.cc 
b/tester/covoar/ObjdumpProcessor.cc
index f130819..23661be 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -119,7 +119,13 @@ namespace Coverage {
 executableInfo->getFileName().c_str(), symbolName, size, 
sizeWithoutNops
   );
 } catch (rld::error& e) {
-  throw rld::error( e.what, "Coverage::finalizeSymbol" );
+  if (e.where == "ExecutableInfo::findCoverageMap") {
+// Allow execution to continue even if a coverage map could not be
+// found.
+std::cerr << e.where << ": " << e.what << std::endl;
+  } else {
+throw rld::error( e.what, "Coverage::finalizeSymbol" );
+  }
 }
   }
 
-- 
2.27.0

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


[PATCH 19/22] covoar: Catch exceptional case

2021-03-01 Thread Alex White
---
 tester/covoar/ExecutableInfo.cc | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
index 187bb77..5a730fd 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -201,6 +201,16 @@ namespace Coverage {
 CoverageMapBase*theMap;
 CoverageMaps::iterator  itr;
 
+if ( lowAddress > highAddress ) {
+  std::ostringstream what;
+  what << "Low address is greater than high address for symbol "
+<< symbolName
+<< " (" << lowAddress
+<< " and " << highAddress
+<< ")";
+  throw rld::error( what, "ExecutableInfo::createCoverageMap" );
+}
+
 itr = coverageMaps.find( symbolName );
 if ( itr == coverageMaps.end() ) {
   theMap = new CoverageMap( fileName, lowAddress, highAddress );
-- 
2.27.0

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


[PATCH 21/22] covoar: Fix overflow of high PC address

2021-03-01 Thread Alex White
This fixes an integer overflow that would occur if a function's high PC
address were zero in the DWARF info.
---
 tester/covoar/ExecutableInfo.cc | 5 +
 1 file changed, 5 insertions(+)

diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
index 30828a6..7f33f20 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -71,6 +71,11 @@ namespace Coverage {
 }
   }
 
+  // We can't process a zero size function.
+  if (func.pc_high() == 0) {
+continue;
+  }
+
   createCoverageMap (cu.name(), func.name(),
   func.pc_low(), func.pc_high() - 1);
 }
-- 
2.27.0

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


[PATCH 22/22] covoar/Reports: Fix empty branch report

2021-03-01 Thread Alex White
This makes the branch report more consistent with the other reports when
there is no branch information found.
---
 tester/covoar/ReportsBase.cc | 12 ++
 tester/covoar/ReportsHtml.cc | 82 
 2 files changed, 39 insertions(+), 55 deletions(-)

diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc
index 8252959..3eb546f 100644
--- a/tester/covoar/ReportsBase.cc
+++ b/tester/covoar/ReportsBase.cc
@@ -291,15 +291,9 @@ void ReportsBase::WriteBranchReport(
   if (!report)
 return;
 
-  // If no branches were found of branch coverage is not supported
-  if ((SymbolsToAnalyze->getNumberBranchesFound() == 0) ||
-  (BranchInfoAvailable == false) ) {
-
-PutNoBranchInfo(report);
-
-// If branches were found, ...
-  } else {
-
+  // If no branches were found then branch coverage is not supported
+  if ((SymbolsToAnalyze->getNumberBranchesFound() != 0) &&
+  (BranchInfoAvailable == true) ) {
 // Process uncovered branches for each symbol.
 count = 0;
 for (ditr = SymbolsToAnalyze->set.begin();
diff --git a/tester/covoar/ReportsHtml.cc b/tester/covoar/ReportsHtml.cc
index 3d20aec..6406a48 100644
--- a/tester/covoar/ReportsHtml.cc
+++ b/tester/covoar/ReportsHtml.cc
@@ -172,45 +172,43 @@ namespace Coverage {
 // Open the file
 aFile = OpenFile(fileName);
 
-if ( hasBranches ) {
-  // Put header information into the file
-  fprintf(
-aFile,
-"Branch Report\n"
-""
-  );
-
-  if (projectName)
-fprintf(
-  aFile,
-  "%s",
-  projectName
-);
+// Put header information into the file
+fprintf(
+  aFile,
+  "Branch Report\n"
+  ""
+);
 
+if (projectName)
   fprintf(
 aFile,
-"Branch Report\n"
-"%s\n"
-"\n"
-"\n"
-"\n"
-"\n"
-"Symbol\n"
-"Line\n"
-"File\n"
-"Size 
Bytes\n"
-"Reason\n"
-"Taken\n"
-   "Not Taken\n"
-"Classification\n"
-"Explanation\n"
-"\n"
-"\n"
-"\n",
-asctime( localtime(×tamp_m) )
+"%s",
+projectName
   );
-}
+
+fprintf(
+  aFile,
+  "Branch Report\n"
+  "%s\n"
+  "\n"
+  "\n"
+  "\n"
+  "\n"
+  "Symbol\n"
+  "Line\n"
+  "File\n"
+  "Size 
Bytes\n"
+  "Reason\n"
+  "Taken\n"
+  "Not Taken\n"
+  "Classification\n"
+  "Explanation\n"
+  "\n"
+  "\n"
+  "\n",
+  asctime( localtime(×tamp_m) )
+);
 
 return aFile;
   }
@@ -985,19 +983,11 @@ namespace Coverage {
 bool   hasBranches
   )
   {
-if ( hasBranches ) {
-  fprintf(
-aFile,
-TABLE_FOOTER
-"\n"
-"\n"
-  );
-}
 fprintf(
   aFile,
-  "\n"
-  "\n"
-  ""
+  TABLE_FOOTER
+  "\n"
+  "\n"
 );
 
 CloseFile(aFile);
-- 
2.27.0

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


Re: [PATCH 1/3] fdt_rw.c: Fix Unchecked return value (CID #1047324)

2021-03-01 Thread Gedare Bloom
On Mon, Mar 1, 2021 at 1:00 PM Sebastian Huber
 wrote:
>
> On 01/03/2021 20:35, Gedare Bloom wrote:
>
> > On Mon, Mar 1, 2021 at 12:26 PM Ryan Long  wrote:
> >> So just send this patch to them?
> >>
> > Without the ifdef construct
> And with a more detailed commit message.
> >

yes, thanks for noting. The CID and our ticket number will be
meaningless to them :)

> --
> 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
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Announcement: Legacy libnetworking will be removed from RTEMS and will be placed in a separate repository

2021-03-01 Thread Vijay Kumar Banerjee
Hello all,

In RTEMS 6, there will be no cpukit/libnetworking in the RTEMS repository
and it will be moved to its own separate repository. There are ongoing
efforts in this direction and it is very close to completion. What's
remaining, is to collect feedback from the users of the libnetworking stack.

I request you to test the new standalone legacy networking repository with
your regular targets and let me know if I have broken something in RTEMS or
in the new repository. The legacy repo, in its current state, has been
tested with pc-qemu and it can successfully run the legacy networking tests.

The following are the links to the repositories with the latest version of
changes:
RTEMS: https://git.rtems.org/vijay/rtems.git/log/?h=devel-no-libnet
Legacy Network: https://git.rtems.org/vijay/rtems-net-legacy.git/log/?h=main

The following BSP family in RTEMS has been used with the old legacy
networking stack:
Zynq, PC, Motorola Shared, Beatnik, mvme3100, mvme5500, gen68360, uc5282,
mvme 162/167

If anyone is maintaining/working with one (or more) of these BSPs, please
let me know if you're able to test the separate legacy-net repository and
if you have any feedback. If you're planning to test it, please add your
comments here so that we know someone is going to do it and wait for your
feedback. The changes will not be pushed right away and we'll wait for some
feedback.

What's next?

The legacy networking repository will stay at git.rtems.org for any
projects that are still using it. It is recommended that the new projects
use the libbsd networking stack which is more full-featured.

Thank you for your patient reading. Any suggestion is welcome and I'm more
than happy to work with you to get it more thoroughly tested before getting
it merged.

Best regards,
Vijay
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

RE: [PATCH v1 1/2] score: Enforce stack_end alignment

2021-03-01 Thread Kinsey Moore
I think this got lost in the deluge. For the second comment, were you 
suggesting that the allocated size isn't guaranteed to be correctly aligned?

Kinsey

-Original Message-
From: devel  On Behalf Of Kinsey Moore
Sent: Friday, February 19, 2021 11:56
To: Sebastian Huber ; devel@rtems.org
Subject: RE: [PATCH v1 1/2] score: Enforce stack_end alignment

On 2021/02/19 01:08, Sebastian Huber wrote:
> On 19/02/2021 07:12, Sebastian Huber wrote:
>> I think the bug is in _TLS_Get_allocation_size(). It assumes
>> CPU_HEAP_ALIGNMENT >= CPU_STACK_ALIGNMENT. It should probably use the
>> maximum of these two values.

The only usage of CPU_HEAP_ALIGNMENT in _TLS_Get_allocation_size() doesn't 
enforce alignment of the TLS allocation size, this pads the allocation to 
ensure that the space used by TLS can be aligned properly. In the case of 
AArch64, both are specified to be 16 bytes, so changing this wouldn't affect 
the issue that caused this patch to be necessary.

> There is also an issue in the stack allocation, for example
>
> static rtems_status_code _RTEMS_tasks_Allocate_and_prepare_stack(
>Thread_Configuration*thread_config,
>const rtems_task_config *config
> )
> {
>size_t size;
>
>thread_config->stack_free = _Stack_Free;
>size = _Stack_Ensure_minimum( config->storage_size );
>size = _Stack_Extend_size( size, thread_config->is_fp );
>thread_config->stack_size = size;
>thread_config->stack_area = _Stack_Allocate( size );
>
>if ( thread_config->stack_area == NULL ) {
>  return RTEMS_UNSATISFIED;
>}
>
>return RTEMS_SUCCESSFUL;
> }
>
> and
>
> /* Generated from spec:/rtems/task/if/storage-alignment */
>
> /**
>   * @ingroup RTEMSAPIClassicTasks
>   *
>   * @brief This constant defines the recommended alignment of a task storage
>   *   area in bytes.
>   *
>   * @par Notes
>   * Use it with RTEMS_ALIGNED() to define the alignment of a statically
>   * allocated task storage area.
>   */
> #define RTEMS_TASK_STORAGE_ALIGNMENT CPU_HEAP_ALIGNMENT

I'm not sure I follow on this part.

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


Re: [PATCH rtems-libbsd 1/2] racoon/session: Honor file descriptor maximum

2021-03-01 Thread Chris Johns
On 1/3/21 7:24 pm, Christian MAUDERER wrote:
> Hello Chris,
> 
> thanks for the review.
> 
> Am 26.02.21 um 19:04 schrieb Chris Johns:
>> On 26/2/21 2:01 am, Christian Mauderer wrote:
>>> Dynamically allocate a big enough file descriptor set for select(). A
>>> better solution would be to use kqueue() instead of select().
>>> ---
>>>   .../racoon/rtems-bsd-racoon-session-data.h    |  6 +--
>>>   ipsec-tools/src/racoon/session.c  | 40 +++
>>>   2 files changed, 43 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/ipsec-tools/src/racoon/rtems-bsd-racoon-session-data.h
>>> b/ipsec-tools/src/racoon/rtems-bsd-racoon-session-data.h
>>> index b869a1518..196107a35 100644
>>> --- a/ipsec-tools/src/racoon/rtems-bsd-racoon-session-data.h
>>> +++ b/ipsec-tools/src/racoon/rtems-bsd-racoon-session-data.h
>>> @@ -2,11 +2,11 @@
>>>   #include 
>>>   #include "rtems-bsd-racoon-data.h"
>>>   /* session.c */
>>> -RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static fd_set active_mask);
>>> -RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static fd_set preset_mask);
>>> +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static _types_fd_set
>>> *allocated_active_mask);
>>> +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static _types_fd_set
>>> *allocated_preset_mask);
>>>   RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static int nfds);
>>>   RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static int signals[]);
>>>   RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static sig_atomic_t volatile
>>> volatile sigreq[]);
>>> -RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static struct fd_monitor
>>> fd_monitors[]);
>>> +RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static struct fd_monitor
>>> *allocated_fd_monitors);
>>>   RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static struct fd_monitor_list
>>> fd_monitor_tree[]);
>>>   RTEMS_LINKER_RWSET_CONTENT(bsd_prog_racoon, static struct sched 
>>> scflushsa);
>>> diff --git a/ipsec-tools/src/racoon/session.c 
>>> b/ipsec-tools/src/racoon/session.c
>>> index 65124c15e..90120c761 100644
>>> --- a/ipsec-tools/src/racoon/session.c
>>> +++ b/ipsec-tools/src/racoon/session.c
>>> @@ -65,6 +65,10 @@
>>>   #include 
>>>   #include 
>>>   #include 
>>> +#ifdef __rtems__
>>> +#include 
>>> +#include 
>>> +#endif /* __rtems__ */
>>>     #include 
>>>   #include 
>>> @@ -123,8 +127,16 @@ static void check_sigreq __P((void));
>>>   static void check_flushsa __P((void));
>>>   static int close_sockets __P((void));
>>>   +#ifndef __rtems__
>>>   static fd_set preset_mask, active_mask;
>>>   static struct fd_monitor fd_monitors[FD_SETSIZE];
>>> +#else /* __rtems__ */
>>> +static fd_set *allocated_preset_mask, *allocated_active_mask;
>>> +static struct fd_monitor *allocated_fd_monitors;
>>> +#define preset_mask (*allocated_preset_mask)
>>> +#define active_mask (*allocated_active_mask)
>>> +#define fd_monitors (allocated_fd_monitors)
>>> +#endif /* __rtems__ */
>>>   static TAILQ_HEAD(fd_monitor_list, fd_monitor)
>>> fd_monitor_tree[NUM_PRIORITIES];
>>>   static int nfds = 0;
>>>   @@ -134,7 +146,11 @@ static struct sched scflushsa = SCHED_INITIALIZER();
>>>   void
>>>   monitor_fd(int fd, int (*callback)(void *, int), void *ctx, int priority)
>>>   {
>>> +#ifndef __rtems__
>>>   if (fd < 0 || fd >= FD_SETSIZE) {
>>> +#else /* __rtems__ */
>>> +    if (fd < 0 || fd >= rtems_libio_number_iops) {
>>> +#endif /* __rtems__ */
>>>   plog(LLV_ERROR, LOCATION, NULL, "fd_set overrun");
>>>   exit(1);
>>>   }
>>> @@ -158,7 +174,11 @@ monitor_fd(int fd, int (*callback)(void *, int), void
>>> *ctx, int priority)
>>>   void
>>>   unmonitor_fd(int fd)
>>>   {
>>> +#ifndef __rtems__
>>>   if (fd < 0 || fd >= FD_SETSIZE) {
>>> +#else /* __rtems__ */
>>> +    if (fd < 0 || fd >= rtems_libio_number_iops) {
>>> +#endif /* __rtems__ */
>>>   plog(LLV_ERROR, LOCATION, NULL, "fd_set overrun");
>>>   exit(1);
>>>   }
>>> @@ -186,7 +206,22 @@ session(void)
>>>   struct fd_monitor *fdm;
>>>     nfds = 0;
>>> +#ifndef __rtems__
>>>   FD_ZERO(&preset_mask);
>>> +#else /* __rtems__ */
>>> +    allocated_preset_mask = calloc(sizeof(fd_set),
>>> +    howmany(rtems_libio_number_iops, sizeof(fd_set) * 8));
>>
>> Does `maxfiles` work here?
>>
> 
> To be honest: I'm not sure.
> 
> According to the comment in file.h:
> 
> extern int maxfiles; /* kernel limit on number of open files */
> 

Yes.

> Sounds like it _can_ be the same as the maximum file number but doesn't have 
> to.

I think we need to have them be the same value.

> I didn't find where we implement it. It's declared as an extern int maxfiles 
> but
> I didn't find any definition. I found it only in libbsd in
> freebsd/sys/kern/uipc_socket.c where it is defined like follows:
> 
> #define maxfiles rtems_libio_number_iops

Ah OK. I knew it had been assigned somewhere and yes it looks like it is local
to that file.

> 
> So question is: Where and how is maxfiles defined?
>

I have provided a value in the rtemsbs

Re: [PATCH 00/22] tester: Update covoar for new build system

2021-03-01 Thread Chris Johns
On 2/3/21 7:01 am, Alex White wrote:
> This patch set updates the covoar tool to allow it to work with the
> outputs of the current build system. It includes various fixes and
> improvements needed to successfully produce coverage reports for the
> following BSP configurations: griscv-sis, leon3-sis, pc-qemu,
> xilinx_zynqmp, and xilinx_zynq_a9_qemu.
> 
> Here is a link to the final coverage reports that I got for the five
> configurations mentioned above:
> https://ftp.rtems.org/pub/rtems/people/joel/coverage/coverage-2021-02-28/

What hosts have you tested this on?

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


Re: About HEAP error

2021-03-01 Thread Richi Dubey
Oh, that makes sense. Thank you.

I got this:

(gdb) p *(Heap_Error_context*)(0x00206d7c)
$5 = {
  heap = 0x202ba8 <_Workspace_Area>,
  block = 0x206fec,
  reason = HEAP_ERROR_FREE_PATTERN
}

HEAP_ERROR_FREE_PATTERN
There is an unexpected value in the free pattern of a free heap block.

I will try to find out more about this error.

On Mon, Mar 1, 2021 at 8:30 PM Gedare Bloom  wrote:

> On Sun, Feb 28, 2021 at 10:53 PM Richi Dubey  wrote:
> >
> > Hi,
> >
> > I get this error on sp02:
> >
> > *** FATAL ***
> > fatal source: 13 (RTEMS_FATAL_SOURCE_HEAP)
> > CPU: 0
> > fatal code: 2125180 (0x00206d7c)
> > RTEMS version: 6.0.0.44ae183090f3bc1a4ee281ff98525209b3fda7a7-modified
> > RTEMS tools: 10.2.1 20210125 (RTEMS 6, RSB
> ade089253e70d75105a8311844f82f6d20cc30a8, Newlib cb41c37)
> > executing thread ID: 0x08a010001
> > executing thread name: UI1
> >
> > On checking docs, it says the fatal code indicates address of heap
> context. I could not find any further information about this. How do I use
> 2125180 (0x00206d7c) to get more information about my error? Please advise.
>
> Good that you found that much.
> https://docs.rtems.org/branches/master/c-user/fatal_error.html
> Then, you can put that address in gdb cast it as a Heap_Error_context
> and investigate it.
>
> > ___
> > 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

Re: Need help in deciding GSoC project also want to know project Scope

2021-03-01 Thread Sebastian Huber

Hello Prateek Pardeshi,

an interesting LLVM related project could be trying out MULL with RTEMS.

https://github.com/mull-project/mull

I had only a brief look at it and I am not sure if it is feasible or 
makes sense for RTEMS. Maybe someone on the mailing list has already 
experience with mutation testing for embedded systems applications.


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