Announce: RTEMS 5.2 Release

2022-12-16 Thread Chris Johns
RTEMS 5.2 Release is available.

 https://ftp.rtems.org/pub/rtems/releases/5/5.2

Please follow the release instructions provided by the link.

We love to hear about your projects and what you use RTEMS on so please let us
know. You can drop by on Discord, post on u...@rtems.org or you can send Joel or
me a private email.

If you find a problem please raise a ticket and select the 5.3 milestone. The
simplest way to create a ticket is to head to the developer Wiki at:

 https://devel.rtems.org/

Then click on the "Next (milestone)" link for the RTEMS 5 Release. You will need
an account.

Thanks to everyone who has contributed to the release over the past few years.
This is a community project and without the support of the community we would
not be able to make these quality releases.

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


[PATCH 1/4] cpukit/include/dev/can: Added debug print configuration under RTEMS_CAN_DEBUG macro.

2022-12-16 Thread Prashanth S
---
 cpukit/include/dev/can/can.h | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/cpukit/include/dev/can/can.h b/cpukit/include/dev/can/can.h
index 9e55395039..4ee51ebc9d 100644
--- a/cpukit/include/dev/can/can.h
+++ b/cpukit/include/dev/can/can.h
@@ -53,13 +53,28 @@
   printf(str, ##__VA_ARGS__); \
 } while (false);
 
+#ifdef RTEMS_CAN_DEBUG
+
 #define CAN_DEBUG(str, ...) DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_BUF(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_ISR(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_LOCK(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_RX(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_TX(str, ...) CAN_DEBUG(str, ##__VA_ARGS__)
-#define CAN_DEBUG_REG(str, ...) //CAN_DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_BUF(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_ISR(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_LOCK(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_RX(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_TX(str, ...) DEBUG(str, ##__VA_ARGS__)
+#define CAN_DEBUG_REG(str, ...) /* CAN_DEBUG(str, ##__VA_ARGS__) */
+
+#else /* RTEMS_CAN_DEBUG */
+
+#define CAN_DEBUG(str, ...)
+#define CAN_DEBUG_BUF(str, ...)
+#define CAN_DEBUG_ISR(str, ...)
+#define CAN_DEBUG_LOCK(str, ...)
+#define CAN_DEBUG_RX(str, ...)
+#define CAN_DEBUG_TX(str, ...)
+#define CAN_DEBUG_REG(str, ...)
+
+#endif /* RTEMS_CAN_DEBUG */
+
 #define CAN_ERR(str, ...) DEBUG(str, ##__VA_ARGS__)
 
 #define CAN_MSG_LEN(msg) ((char *)(&((struct can_msg 
*)msg)->data[(uint16_t)((struct can_msg *)msg)->len]) - (char *)(msg))
-- 
2.25.1

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


[PATCH 4/4] cpukit/dev/can: Fix 64 bit build compilation warnings

2022-12-16 Thread Prashanth S
---
 cpukit/dev/can/can.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/dev/can/can.c b/cpukit/dev/can/can.c
index 7098ce16c2..ca855951d5 100644
--- a/cpukit/dev/can/can.c
+++ b/cpukit/dev/can/can.c
@@ -203,7 +203,7 @@ static ssize_t can_bus_read(rtems_libio_t *iop, void 
*buffer, size_t count)
   len = CAN_MSG_LEN(>can_rx_msg);
 
   if (count < len) {
-CAN_DEBUG("can_bus_read: buffer size is small min sizeof(struct can_msg) = 
%u\n",
+CAN_DEBUG("can_bus_read: buffer size is small min sizeof(struct can_msg) = 
%zu\n",
 sizeof(struct can_msg));
 return -RTEMS_INVALID_SIZE;
   }
-- 
2.25.1

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


[PATCH 2/4] cpukit/dev/can: Removed extra debug prints in CAN Framework

2022-12-16 Thread Prashanth S
---
 cpukit/dev/can/can.c | 20 
 1 file changed, 20 deletions(-)

diff --git a/cpukit/dev/can/can.c b/cpukit/dev/can/can.c
index 2e6d5df65b..7098ce16c2 100644
--- a/cpukit/dev/can/can.c
+++ b/cpukit/dev/can/can.c
@@ -73,19 +73,14 @@ static int try_sem(struct can_bus *);
 static int take_sem(struct can_bus *);
 static int give_sem(struct can_bus *);
 
-
 static void can_bus_obtain(can_bus *bus)
 {
-  CAN_DEBUG("can_bus_obtain Entry\n");
   rtems_mutex_lock(>mutex);
-  CAN_DEBUG("can_bus_obtain Exit\n");
 }
 
 static void can_bus_release(can_bus *bus)
 {
-  CAN_DEBUG("can_bus_release Entry\n");
   rtems_mutex_unlock(>mutex);
-  CAN_DEBUG("can_bus_release Exit\n");
 }
 
 static void can_bus_destroy_mutex(struct can_bus *bus)
@@ -182,8 +177,6 @@ static int try_sem(struct can_bus *bus)
 static ssize_t 
 can_bus_open(rtems_libio_t *iop, const char *path, int oflag, mode_t mode)
 {
-  CAN_DEBUG("can_bus_open\n");
-
   return 0;
 } 
 
@@ -231,21 +224,16 @@ static int can_xmit(struct can_bus *bus)
 
   struct can_msg *msg = NULL;
 
-  CAN_DEBUG(" can_xmit Entry\n");
-
   while (1) {
-CAN_DEBUG("can_dev_ops->dev_tx_ready\n");
 if (bus->can_dev_ops->dev_tx_ready(bus->priv) != true) {
   break;
 }
 
-CAN_DEBUG("can_tx_get_data_buf\n");
 msg = can_bus_tx_get_data_buf(bus);
 if (msg == NULL) {
   break;
 }
 
-CAN_DEBUG("can_dev_ops->dev_tx\n");
 ret = bus->can_dev_ops->dev_tx(bus->priv, msg);
 if (ret != RTEMS_SUCCESSFUL) {
 CAN_ERR("can_xmit: dev_send failed\n");
@@ -259,8 +247,6 @@ static int can_xmit(struct can_bus *bus)
 }
   }
 
-  CAN_DEBUG(" can_xmit Exit\n");
-
   return ret;
 }
 
@@ -284,13 +270,11 @@ void can_print_msg(struct can_msg const *msg)
 /* can_tx_done should be called only with CAN interrupts disabled */
 int can_tx_done(struct can_bus *bus)
 {
-  CAN_DEBUG(" can_tx_done Entry\n");
   int ret = RTEMS_SUCCESSFUL;
 
   if (bus->can_dev_ops->dev_tx_ready(bus->priv) == true) {
 ret = can_xmit(bus);
   }
-  CAN_DEBUG(" can_tx_done Exit\n");
   
   return ret;
 }
@@ -312,7 +296,6 @@ can_bus_write(rtems_libio_t *iop, const void *buffer, 
size_t count)
 
   uint32_t msg_size = CAN_MSG_LEN(msg);
 
-  CAN_DEBUG_TX("can_bus_write: can_msg_size = %u\n", msg_size);
   if (msg_size > sizeof(struct can_msg)) {
 CAN_ERR("can_bus_write:"
   "can message len error msg_size = %u struct can_msg = %u\n", 
@@ -343,9 +326,7 @@ can_bus_write(rtems_libio_t *iop, const void *buffer, 
size_t count)
 goto release_lock_and_return;
   }
 
-  CAN_DEBUG_TX("can_bus_write: empty_count = %u\n", bus->tx_fifo.empty_count);
 
-  CAN_DEBUG_TX("can_bus_write: copying msg from application to driver 
buffer\n");
   memcpy(fifo_buf, msg, msg_size);
 
   if (bus->can_dev_ops->dev_tx_ready(bus->priv) == true) {
@@ -426,7 +407,6 @@ rtems_status_code can_bus_register(can_bus *bus, const char 
*bus_path)
   }
 
   bus->index = index++;
-  CAN_DEBUG("Registering CAN bus index = %u\n", bus->index);
 
   ret = IMFS_make_generic_node(bus_path, S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
   _bus_node_control, bus);
-- 
2.25.1

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


[PATCH 3/4] testsuites/libtests/can01: Serialize CAN write and read messages among the tasks

2022-12-16 Thread Prashanth S
The CAN framework has minimal Rx implementation, so to test loopback
driver the test application is modified to write and read atomically
---
 testsuites/libtests/can01/init.c | 69 ++--
 1 file changed, 30 insertions(+), 39 deletions(-)

diff --git a/testsuites/libtests/can01/init.c b/testsuites/libtests/can01/init.c
index 0675fe606f..235651d06d 100644
--- a/testsuites/libtests/can01/init.c
+++ b/testsuites/libtests/can01/init.c
@@ -63,6 +63,10 @@
  else   \
c4++ \
 
+struct test_thread {
+  rtems_mutex mutex;
+};
+
 static void test_task(rtems_task_argument);
 int can_loopback_init(const char *);
 int create_task(int);
@@ -70,60 +74,54 @@ int create_task(int);
 static rtems_id task_id[TASKS];
 static rtems_id task_test_status[TASKS] = {[0 ... (TASKS - 1)] = false};
 
+static struct test_thread thread;
+
 const char rtems_test_name[] = "CAN test TX, RX with CAN loopback driver";
 
-/*FIXME: Should Implement one more test application for the 
- * RTR support
- *
- * For testing, the number of successful read and write 
- * count is verified.
- */
 static void test_task(rtems_task_argument data)
 {
-  //sleep so that other tasks will be created.
   sleep(1);
 
   int fd, task_num = (uint32_t)data;
   uint32_t count = 0, msg_size;
 
-  struct can_msg msg;
+  struct can_msg send_msg, recv_msg;
 
   printf("CAN tx and rx for %s\n", CAN_DEV_FILE);
 
   fd = open(CAN_DEV_FILE, O_RDWR);
   if (fd < 0) {
-printf("open error: task = %u %s: %s\n", task_num, CAN_DEV_FILE, 
strerror(errno));
+printf("error: open task = %u %s: %s\n", task_num, CAN_DEV_FILE, 
strerror(errno));
   }
 
   rtems_test_assert(fd >= 0);
 
   for (int i = 0; i < NUM_TEST_MSGS; i++) {
-printf("test_task %u\n", task_num);
-
-msg.id = task_num;
-//FIXME: Implement Test cases for other flags also.
-msg.flags = 0;
-msg.len = (i + 1) % 9;
+send_msg.id = task_num;
+send_msg.flags = 0;
+send_msg.len = (i + 1) % 9;
 
-for (int j = 0; j < msg.len; j++) {
-  msg.data[j] = 'a' + j;
+for (int j = 0; j < send_msg.len; j++) {
+  send_msg.data[j] = 'a' + j;
 }
   
-msg_size = ((char *)[msg.len] - (char *));
+msg_size = ((char *)_msg.data[send_msg.len] - (char *)_msg);
 
-printf("calling write task = %u\n", task_num);
+rtems_mutex_lock();
 
-count = write(fd, , sizeof(msg));
+count = write(fd, _msg, sizeof(send_msg));
 rtems_test_assert(count == msg_size);
-printf("task = %u write count = %u\n", task_num, count);
 
-printf("calling read task = %u\n", task_num);
-count = read(fd, , sizeof(msg));
-rtems_test_assert(count > 0);
-printf("task = %u read count = %u\n", task_num, count);
+count = read(fd, _msg, sizeof(recv_msg));
+rtems_test_assert(send_msg.len == recv_msg.len);
+
+for (int i = 0; i < recv_msg.len; i++) {   
   
+  rtems_test_assert(send_msg.data[i] == recv_msg.data[i]);
+}  
   
 
-printf("received message\n");
-can_print_msg();
+rtems_mutex_unlock();
+
+can_print_msg(_msg);
 
 sleep(1);
   }
@@ -131,14 +129,11 @@ static void test_task(rtems_task_argument data)
 
   task_test_status[task_num] = true;
 
-  printf("task exited = %u\n", task_num);
   rtems_task_exit();
 }
 
 int create_task(int i)
 {
-  printf("Creating task %d\n", i);
-
   rtems_status_code result;
   rtems_name name;
 
@@ -156,21 +151,18 @@ int create_task(int i)
  RTEMS_FIFO | RTEMS_FLOATING_POINT,
  _id[i]);
   if (result != RTEMS_SUCCESSFUL) {
-printf("rtems_task_create error: %s\n", rtems_status_text(result));
+printf("error rtems_task_create: %s\n", rtems_status_text(result));
 rtems_test_assert(result == RTEMS_SUCCESSFUL);
   }
 
-  printf("number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ", i, 
task_id[i]);
-
   fflush(stdout);
 
-  printf("starting task\n");
   result = rtems_task_start(task_id[i],
 test_task,
 (rtems_task_argument)i);
 
   if (result != RTEMS_SUCCESSFUL) {
-printf("rtems_task_start failed %s\n", rtems_status_text(result));
+printf("error rtems_task_start: %s\n", rtems_status_text(result));
 rtems_test_assert(result == RTEMS_SUCCESSFUL);
   }
 
@@ -183,8 +175,6 @@ static rtems_task Init(
   rtems_task_argument ignored
 )
 {
-  printf("Init\n");
-
   int ret;
 
   rtems_print_printer_fprintf_putc(_test_printer);
@@ -199,10 +189,12 @@ static rtems_task Init(
 
   ret = can_loopback_init(CAN_DEV_FILE);
   if (ret != RTEMS_SUCCESSFUL) {
-printf("%s failed\n", rtems_test_name);
+printf("error: %s failed\n", rtems_test_name);
 rtems_test_assert(ret == RTEMS_SUCCESSFUL);
   }
 
+  rtems_mutex_init(, "CAN test");
+
   for (int i = 0; i < TASKS; i++) {