[PATCH] aarch64: Memory map the noinit section

2022-07-15 Thread Kinsey Moore
This section was added recently and must be mapped to be accessed
without generating an exception.
---
 bsps/aarch64/include/bsp/aarch64-mmu.h| 4 
 bsps/aarch64/include/bsp/linker-symbols.h | 4 
 2 files changed, 8 insertions(+)

diff --git a/bsps/aarch64/include/bsp/aarch64-mmu.h 
b/bsps/aarch64/include/bsp/aarch64-mmu.h
index bca7e0ce8d..35fc79d73a 100644
--- a/bsps/aarch64/include/bsp/aarch64-mmu.h
+++ b/bsps/aarch64/include/bsp/aarch64-mmu.h
@@ -91,6 +91,10 @@ typedef struct {
 .begin = (uintptr_t) bsp_section_rtemsstack_begin, \
 .end = (uintptr_t) bsp_section_rtemsstack_end, \
 .flags = AARCH64_MMU_DATA_RW_CACHED \
+  }, { \
+.begin = (uintptr_t) bsp_section_noinit_begin, \
+.end = (uintptr_t) bsp_section_noinit_end, \
+.flags = AARCH64_MMU_DATA_RW_CACHED \
   }, { \
 .begin = (uintptr_t) bsp_section_work_begin, \
 .end = (uintptr_t) bsp_section_work_end, \
diff --git a/bsps/aarch64/include/bsp/linker-symbols.h 
b/bsps/aarch64/include/bsp/linker-symbols.h
index 38c655ba97..222c217abb 100644
--- a/bsps/aarch64/include/bsp/linker-symbols.h
+++ b/bsps/aarch64/include/bsp/linker-symbols.h
@@ -108,6 +108,10 @@ LINKER_SYMBOL(bsp_section_rtemsstack_begin)
 LINKER_SYMBOL(bsp_section_rtemsstack_end)
 LINKER_SYMBOL(bsp_section_rtemsstack_size)
 
+LINKER_SYMBOL(bsp_section_noinit_begin)
+LINKER_SYMBOL(bsp_section_noinit_end)
+LINKER_SYMBOL(bsp_section_noinit_size)
+
 LINKER_SYMBOL(bsp_section_work_begin)
 LINKER_SYMBOL(bsp_section_work_end)
 LINKER_SYMBOL(bsp_section_work_size)
-- 
2.30.2

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


RE: [PATCH] score: Restore previous behavior for system state

2022-07-15 Thread Kinsey Moore
Disregard this patch, I see Sebastian has already committed a different fix to 
the test itself.

Kinsey

-Original Message-
From: Kinsey Moore  
Sent: Friday, July 15, 2022 14:54
To: devel@rtems.org
Cc: Kinsey Moore 
Subject: [PATCH] score: Restore previous behavior for system state

Set system state before creating the idle threads. This fixes the
spextensions01 test since it expects this behavior.
---
 cpukit/score/src/threadcreateidle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/score/src/threadcreateidle.c 
b/cpukit/score/src/threadcreateidle.c
index b5e0cfdc9b..dcd8ba0478 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -112,6 +112,8 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control 
*cpu )
 
 void _Thread_Create_idle( void )
 {
+  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
+
 #if defined(RTEMS_SMP)
   uint32_t cpu_max;
   uint32_t cpu_index;
@@ -132,5 +134,4 @@ void _Thread_Create_idle( void )
   _CPU_Use_thread_local_storage(
 &_Per_CPU_Get_executing( _Per_CPU_Get() )->Registers
   );
-  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
 }
-- 
2.30.2

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


[PATCH] score: Restore previous behavior for system state

2022-07-15 Thread Kinsey Moore
Set system state before creating the idle threads. This fixes the
spextensions01 test since it expects this behavior.
---
 cpukit/score/src/threadcreateidle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/score/src/threadcreateidle.c 
b/cpukit/score/src/threadcreateidle.c
index b5e0cfdc9b..dcd8ba0478 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -112,6 +112,8 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control 
*cpu )
 
 void _Thread_Create_idle( void )
 {
+  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
+
 #if defined(RTEMS_SMP)
   uint32_t cpu_max;
   uint32_t cpu_index;
@@ -132,5 +134,4 @@ void _Thread_Create_idle( void )
   _CPU_Use_thread_local_storage(
 &_Per_CPU_Get_executing( _Per_CPU_Get() )->Registers
   );
-  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
 }
-- 
2.30.2

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


[PATCH] cpukit/dev/can: Added CAN support

2022-07-15 Thread Prashanth S
---
 cpukit/dev/can/can-queue.c| 112 +++
 cpukit/dev/can/can.c  | 480 ++
 cpukit/include/dev/can/can.h  | 115 +++
 spec/build/cpukit/librtemscpu.yml |   5 +
 4 files changed, 712 insertions(+)
 create mode 100644 cpukit/dev/can/can-queue.c
 create mode 100644 cpukit/dev/can/can.c
 create mode 100644 cpukit/include/dev/can/can.h

diff --git a/cpukit/dev/can/can-queue.c b/cpukit/dev/can/can-queue.c
new file mode 100644
index 00..1cebed2ca4
--- /dev/null
+++ b/cpukit/dev/can/can-queue.c
@@ -0,0 +1,112 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup CANBus
+ *
+ * @brief Controller Area Network (CAN) Bus Implementation
+ *
+ */
+
+/*
+ * Copyright (C) 2022
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+rtems_status_code can_create_rx_buffers(struct can_bus *bus)
+{
+  static int init = 0;
+
+  return rtems_message_queue_create(rtems_build_name('c', 'a', 'n', '0' + 
init++), CAN_RX_BUF_COUNT, sizeof(struct can_msg),
+RTEMS_FIFO | RTEMS_LOCAL, 
>rx_queue_id);
+}
+
+rtems_status_code can_create_tx_buffers(struct can_bus *bus)
+{
+  if ((bus->tx_fifo.pbuf = (struct can_msg *)malloc(CAN_TX_BUF_COUNT * 
sizeof(struct can_msg))) == NULL) {
+printf("malloc failed\n");
+return RTEMS_NO_MEMORY;
+  }
+
+  bus->tx_fifo.head = bus->tx_fifo.tail = 0;
+  bus->tx_fifo.empty_count = CAN_TX_BUF_COUNT;
+
+  return 0;
+}
+
+bool can_tx_buf_isempty(struct can_bus *bus)
+{
+  if (bus->tx_fifo.empty_count <= 0) {
+/* tx_fifo.empty_count does not go below zero, incase if it goes update to 
zero */
+bus->tx_fifo.empty_count = 0;
+
+return false;
+  }
+
+  return true;
+}
+
+struct can_msg *can_tx_get_data_buf(struct can_bus *bus)
+{
+  struct can_msg *msg = NULL;
+
+  if (bus->tx_fifo.empty_count == CAN_TX_BUF_COUNT) {
+printf("can_tx_get_next_data_buf All buffers are empty\n");
+return NULL;
+  }
+
+  msg = >tx_fifo.pbuf[bus->tx_fifo.tail];
+  bus->tx_fifo.empty_count++;
+  bus->tx_fifo.tail = (bus->tx_fifo.tail + 1) % CAN_TX_BUF_COUNT;
+
+  return msg;
+}
+
+struct can_msg *can_tx_get_empty_buf(struct can_bus *bus)
+{
+  struct can_msg *msg = NULL;
+
+  /* Check whether there is a empty CAN msg buffer */
+  if (can_tx_buf_isempty(bus) == false) {
+printf("can_tx_get_empty_buf No empty buffer\n");
+return NULL;
+  }
+
+  bus->tx_fifo.empty_count--;
+
+  /* tx_fifo.head always points to a empty buffer if there is atleast one */
+  msg = >tx_fifo.pbuf[bus->tx_fifo.head];
+  bus->tx_fifo.head = (bus->tx_fifo.head + 1) % CAN_TX_BUF_COUNT;
+
+  return msg;
+}
diff --git a/cpukit/dev/can/can.c b/cpukit/dev/can/can.c
new file mode 100644
index 00..e8aa9d20ca
--- /dev/null
+++ b/cpukit/dev/can/can.c
@@ -0,0 +1,480 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup CANBus
+ *
+ * @brief Controller Area Network (CAN) Bus Implementation
+ *
+ */
+
+/*
+ * Copyright (C) 2022
+ *
+ * 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, 

Review Request for CAN patch for tx path and minimal rx support

2022-07-15 Thread Prashanth S


This is a review request for the CAN patch with tx and minimal rx support. 

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


Re: [PATCH] score: Use RTEMS_SMP in _Thread_Create_idle()

2022-07-15 Thread Kinsey Moore

On 7/6/2022 13:21, Sebastian Huber wrote:

On 06/07/2022 20:19, Gedare Bloom wrote:

ok, this changes slightly the order of events in the system state
(idle threads are now created in the preceding state,
SYSTEM_STATE_BEFORE_INITIALIZATION) but without thinking too hard
about it, I think it should be fine.


Yes, it doesn't really matter. Logically, setting the new state after 
the work is done is slightly better.


This seems to have broken spextensions01 on AArch64 (both QEMU and on 
hardware) and likely elsewhere:


assertion "_Thread_Dispatch_is_enabled() || before_multitasking()" 
failed: file "../../../testsuites/sptests/spextensions01/init.c", line 
64, function: assert_allocator_protected_thread_context



Kinsey

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


Re: GSoC 2022:

2022-07-15 Thread Prashanth S
Hi Christian,

I created a patch (attached in the mail) for review, which has CAN support.

Shall I send the patch for review to @rtems-de...@rtems.org
?

Regards
Prashanth S

On Mon, 11 Jul 2022 at 10:03, Prashanth S  wrote:

> Hi Christian,
>
> This is to update the status.
>
> Yesterday, pushed a fix for a bug in tx path and added minimal rx path.
>
> Regards
> Prashanth S
>
> On Thu, 7 Jul, 2022, 10:58 am Prashanth S, 
> wrote:
>
>> Hi Gedare,
>>
>> This is to ask for the License on the TI files.
>>
>> As we already confirmed on the license for TI files as BSD, this is to
>> double check.
>>
>> I found two different licenses, I have added both of them.
>>
>>
>> *dcan.c and all header files (except dcan_frame.h)*
>> /**
>>  *  \file   dcan.c
>>  *
>>  *  \brief  DCAN APIs.
>>  *
>>  *   This file contains the device abstraction layer APIs for
>>  *   Dual Controller Area Network(DCAN).
>>  */
>>
>> /*
>> * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
>> */
>> /*
>> *  Redistribution and use in source and binary forms, with or without
>> *  modification, are permitted provided that the following conditions
>> *  are met:
>> *
>> *Redistributions of source code must retain the above copyright
>> *notice, this list of conditions and the following disclaimer.
>> *
>> *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.
>> *
>> *Neither the name of Texas Instruments Incorporated nor the names of
>> *its contributors may be used to endorse or promote products derived
>> *from this software without specific prior written permission.
>> *
>> *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>> *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>> *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
>> *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>> *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>> *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>> *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>> *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>> *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> *
>> */
>>
>>
>> *dcan_frame.c and dcan_frame.h*
>> * \file   dcan_frame.c
>>  *
>>  * \brief  This file consists of wrapper functions which internally call
>>  * DCAN APIs.
>>  */
>>
>> /*
>>  * Copyright (C) 2005 Marc Kleine-Budde, Pengutronix
>>  * Copyright (C) 2006 Andrey Volkov, Varma Electronics
>>  * Copyright (C) 2008-2009 Wolfgang Grandegger 
>>  *
>>  * This program is free software; you can redistribute it and/or modify
>>  * it under the terms of the version 2 of the GNU General Public License
>>  * as published by the Free Software Foundation
>>  *
>>  * This program is distributed in the hope that it will be useful,
>>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>>  * GNU General Public License for more details.
>>  *
>>  * You should have received a copy of the GNU General Public License
>>  * along with this program; if not, write to the Free Software
>>  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
>>  USA
>>  */
>>
>> Regards
>> Prashanth S
>>
>> On Wed, 1 Jun 2022 at 07:15, Gedare Bloom  wrote:
>>
>>> On Sun, May 29, 2022 at 6:09 AM Prashanth S 
>>> wrote:
>>> >
>>> > Hi Christian,
>>> >
>>> > Please make sure to take notes for blog posts or the weekly
>>> > status meeting.
>>> > Ok.
>>> >
>>> > The License mentined in drivers/dcan.c
>>> >
>>> > /*
>>> > * Copyright (C) 2010 Texas Instruments Incorporated -
>>> http://www.ti.com/
>>> > */
>>> > /*
>>> > *  Redistribution and use in source and binary forms, with or without
>>> > *  modification, are permitted provided that the following conditions
>>> > *  are met:
>>> > *
>>> > *Redistributions of source code must retain the above copyright
>>> > *notice, this list of conditions and the following disclaimer.
>>> > *
>>> > *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.
>>> > *
>>> > *Neither the name of Texas Instruments Incorporated nor the names
>>> of
>>> > *its contributors may be used to endorse or promote products
>>> derived
>>> > *from this software without specific prior written permission.
>>> > *
>>> > *  THIS SOFTWARE IS PROVIDED BY 

Re: [PATCH] sppps01: Add test case for early returns of pps_event()

2022-07-15 Thread Kinsey Moore
This change seems to have made the test intermittently failing on 
AArch64 under QEMU:


*** BEGIN OF TEST SPPPS 1 ***
*** TEST VERSION: 6.0.0.4142fd12385473426b461560b76cee6e903dc2cd
*** TEST STATE: EXPECTED_PASS
*** TEST BUILD: RTEMS_POSIX_API RTEMS_SMP
*** TEST TOOLS: 12.1.1 20220622 (RTEMS 6, RSB 
a4608ce16e94066aea82f22849e24d4fcd90699b, Newlib 27fd806)

A:SPPPS 1
S:Platform:RTEMS
S:Compiler:12.1.1 20220622 (RTEMS 6, RSB 
a4608ce16e94066aea82f22849e24d4fcd90699b, Newlib 27fd806)

S:Version:6.0.0.4142fd12385473426b461560b76cee6e903dc2cd
S:BSP:xilinx_zynqmp_lp64_qemu
S:BuildLabel:DEFAULT
S:TargetHash:SHA256:huGRj7kHeBWgSJolmeboNSyCgeX2U62J9RiNQ18YPFc=
S:RTEMS_DEBUG:0
S:RTEMS_MULTIPROCESSING:0
S:RTEMS_POSIX_API:1
S:RTEMS_PROFILING:0
S:RTEMS_SMP:1
B:WakeupTaskWithPPSEvent
P:0:0:UI1:init.c:195
P:1:0:UI1:init.c:209
P:2:0:UI1:init.c:211
P:3:0:PPSE:init.c:160
P:4:0:UI1:init.c:214
P:5:0:PPSE:init.c:162
P:6:0:PPSE:init.c:164
P:7:0:UI1:init.c:221
E:WakeupTaskWithPPSEvent:N:8:F:0:D:0.008009
B:WaitPPSEventDefaultHandler
P:0:0:UI1:init.c:73
P:1:0:UI1:init.c:77
E:WaitPPSEventDefaultHandler:N:2:F:0:D:0.000508
B:PPSEventEarlyReturns
P:0:0:UI1:init.c:103
P:1:0:UI1:init.c:110
F:2:0:UI1:init.c:115:1 == 0
F:3:0:UI1:init.c:119:2 == 1
E:PPSEventEarlyReturns:N:4:F:2:D:0.001525
Z:SPPPS 1:C:3:N:14:F:2:D:0.013109
Y:ReportHash:SHA256:B-CITRKa5X9NJy8JfEPbCr_F_tm6UNBuwfKzHcxhWks=

[ RTEMS shutdown ]
CPU: 0
RTEMS version: 6.0.0.4142fd12385473426b461560b76cee6e903dc2cd
RTEMS tools: 12.1.1 20220622 (RTEMS 6, RSB 
a4608ce16e94066aea82f22849e24d4fcd90699b, Newlib 27fd806)

executing thread ID: 0x08a010001
executing thread name: UI1


It appears to work consistently on hardware (at least for a sample size 
of around 10 test runs) and before this patch it worked consistently on 
QEMU as well.



Kinsey


On 6/30/2022 01:26, Sebastian Huber wrote:



On 15/06/2022 15:08, Gabriel Moyano wrote:

---
  testsuites/sptests/sppps01/init.c | 42 +++
  1 file changed, 42 insertions(+)

diff --git a/testsuites/sptests/sppps01/init.c 
b/testsuites/sptests/sppps01/init.c

index 996a3a1e16..ee3fe1645b 100644
--- a/testsuites/sptests/sppps01/init.c
+++ b/testsuites/sptests/sppps01/init.c
@@ -76,6 +76,48 @@ T_TEST_CASE( WaitPPSEventDefaultHandler )
    T_eq_int( status, ETIMEDOUT );
  }
  +static int wokenup = 0;
+
+static void fake_wakeup(struct pps_state *pps)
+{
+    wokenup++;
+}


I would move the wokenup into struct test_pps_device.

In the existing code, use rtems_task_exit() instead of 
rtems_task_delete(rtems_task_self()).



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

GSoC 2022 - Release Note Generated PDF prototypes (resend)

2022-07-15 Thread Mahmoud Abumandour
Hello,

This didn't pass through the mailing list due to large files, so I am
resending it. I have uploaded the sample generated files to Google Drive
and included the links here instead of attaching them directly. If you have
accessibility issues, please let me know.

RTEMS 4.11.3 release notes PDF file with GitHub-Markdown-like styles:

https://drive.google.com/file/d/1G7XMhio3DXDTYjiuedF8cbzcAQRdT68X/view?usp=sharing

Release notes generated PDF file with Trac CSS styles and minor
improvements on top of the previous version:

https://drive.google.com/file/d/10coBYgSEJ_Vetdqiax-yifg1P6JRn7J0/view?usp=sharing


Please let me know if you have any suggestions for improvements to the
generated formats.

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

Re: [PATCH v3 1/2] bsp/riscv: Work area size based on stack pointer

2022-07-15 Thread Sebastian Huber

On 14.07.22 16:03, Daniel Cederman wrote:

diff --git a/bsps/riscv/shared/start/start.S b/bsps/riscv/shared/start/start.S
index 3702f8ac2f..21945a99f5 100644
--- a/bsps/riscv/shared/start/start.S
+++ b/bsps/riscv/shared/start/start.S
@@ -35,6 +35,16 @@
  #include 
  #include 
  
+#if __riscv_xlen == 32

+#define PTR_ALIGN 2
+#define PTR_SIZE 4
+#define PTR_VALUE .word
+#elif __riscv_xlen == 64
+#define PTR_ALIGN 3
+#define PTR_SIZE 8
+#define PTR_VALUE .dword
+#endif


Maybe this should move to asm.h.


+
  PUBLIC(_start)
  
  	.section	.bsp_start_text, "wax", @progbits

@@ -60,6 +70,9 @@ SYM(_start):
LADDR   t0, _RISCV_Exception_handler
csrwmtvec, t0
  
+	/* Save stack pointer so it can mark end of work area later on */

+   mv  t3, sp
+
/* Load stack pointer and branch to secondary processor start if 
necessary */
  #ifdef RTEMS_SMP
LADDR   sp, _ISR_Stack_area_begin
@@ -75,6 +88,9 @@ SYM(_start):
LADDR   sp, _ISR_Stack_area_end
  #endif
  
+	LADDR	t0, riscv_start_stack_pointer

+   SREGt3, 0(t0)
+
  #ifdef BSP_START_COPY_FDT_FROM_U_BOOT
mv  a0, a1
callbsp_fdt_copy
@@ -146,3 +162,12 @@ SYM(_start):
  #endif
  
  #endif /* RTEMS_SMP */

+
+   .section.data, "aw"


This should be .bsp_start_data


+   .align  PTR_ALIGN
+
+   .globl  riscv_start_stack_pointer
+   .type   riscv_start_stack_pointer, @object
+   .size   riscv_start_stack_pointer, PTR_SIZE
+riscv_start_stack_pointer:
+   PTR_VALUE   0


--
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 v3 1/2] bsp/riscv: Work area size based on stack pointer

2022-07-15 Thread Sebastian Huber

On 14.07.22 16:03, Daniel Cederman wrote:

+/*
+ * This variable is initialized by the first CPU entering the BSP start code.
+ * The value is the stack pointer at entry.
+ */
+extern uintptr_t riscv_start_stack_pointer;


Since C code should not modify this, maybe declare it as const.

--
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 v3 2/2] bsp/riscv: Add NOEL-V BSP

2022-07-15 Thread Sebastian Huber



On 14.07.22 16:03, Daniel Cederman wrote:

diff --git a/spec/build/bsps/riscv/noel/optconirq.yml 
b/spec/build/bsps/riscv/noel/optconirq.yml
new file mode 100644
index 00..d836822efb
--- /dev/null
+++ b/spec/build/bsps/riscv/noel/optconirq.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+actions:
+- get-integer: null
+- define: null
+build-type: option
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+default: 0
+default-by-variant: []
+description: |
+  The APBUART console driver can operate in either polled or interrupt mode.
+enabled-by: true
+format: '{}'
+links: []
+name: CONSOLE_USE_INTERRUPTS
+type: build


Please use

spec/build/bsps/optconsoleirq.yml


diff --git a/spec/build/bsps/riscv/noel/optextirqmax.yml 
b/spec/build/bsps/riscv/noel/optextirqmax.yml
new file mode 100644
index 00..ffa84748b6
--- /dev/null
+++ b/spec/build/bsps/riscv/noel/optextirqmax.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+actions:
+- get-integer: null
+- define: null
+build-type: option
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+default: 64
+default-by-variant: []
+description: |
+  maximum number of external interrupts supported by the BSP (default 64)
+enabled-by: true
+format: '{}'
+links: []
+name: RISCV_MAXIMUM_EXTERNAL_INTERRUPTS
+type: build


Please move this one level up and reuse it in the other riscv BSPs.


--
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] score: Remove PRIORITY_PSEUDO_ISR thread priority

2022-07-15 Thread Sebastian Huber
The uniprocessor schedulers had some special case logic for the
PRIORITY_PSEUDO_ISR priority.  Tasks with a priority of PRIORITY_PSEUDO_ISR
were allowed to preempt a not preemptible task.  If other higher priority task
are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible
task, then the other tasks run before the not preemptible task.  This made the
RTEMS_NO_PREEMPT mode ineffective.

Remove the PRIORITY_PSEUDO_ISR special case logic.  This simplifies the
uniprocessor schedulers.  Move the uniprocessor-specific scheduler support to
the new header file .

Close #2365.
---
 cpukit/include/rtems/posix/priorityimpl.h |   2 +-
 cpukit/include/rtems/score/priority.h |   7 -
 cpukit/include/rtems/score/scheduleredfimpl.h |  19 +-
 cpukit/include/rtems/score/schedulerimpl.h|  65 --
 .../rtems/score/schedulerpriorityimpl.h   |  30 +--
 .../include/rtems/score/schedulersimpleimpl.h |  22 +-
 cpukit/include/rtems/score/scheduleruniimpl.h | 221 ++
 cpukit/rtems/src/timerserver.c|   2 +-
 cpukit/score/src/mpci.c   |   2 +-
 cpukit/score/src/scheduleredfblock.c  |   4 +-
 cpukit/score/src/scheduleredfchangepriority.c |   5 +-
 cpukit/score/src/scheduleredfschedule.c   |   5 +-
 cpukit/score/src/scheduleredfunblock.c|  20 +-
 cpukit/score/src/scheduleredfyield.c  |   2 +-
 cpukit/score/src/schedulerpriorityblock.c |   4 +-
 .../src/schedulerprioritychangepriority.c |   5 +-
 cpukit/score/src/schedulerpriorityschedule.c  |   5 +-
 cpukit/score/src/schedulerpriorityunblock.c   |  16 +-
 cpukit/score/src/schedulerpriorityyield.c |   5 +-
 cpukit/score/src/schedulersimpleblock.c   |   4 +-
 .../score/src/schedulersimplechangepriority.c |   5 +-
 cpukit/score/src/schedulersimpleschedule.c|   5 +-
 cpukit/score/src/schedulersimpleunblock.c |  20 +-
 cpukit/score/src/schedulersimpleyield.c   |   5 +-
 spec/build/cpukit/librtemscpu.yml |   1 +
 testsuites/sptests/sptasknopreempt01/init.c   |  18 +-
 26 files changed, 295 insertions(+), 204 deletions(-)
 create mode 100644 cpukit/include/rtems/score/scheduleruniimpl.h

diff --git a/cpukit/include/rtems/posix/priorityimpl.h 
b/cpukit/include/rtems/posix/priorityimpl.h
index e391448372..ce26787294 100644
--- a/cpukit/include/rtems/posix/priorityimpl.h
+++ b/cpukit/include/rtems/posix/priorityimpl.h
@@ -84,7 +84,7 @@ RTEMS_INLINE_ROUTINE int _POSIX_Priority_Get_maximum(
  * Thus, SuperCore has priorities run in the opposite sense of the POSIX API.
  *
  * Let N be the maximum priority of this scheduler instance.   The SuperCore
- * priority zero is system reserved (PRIORITY_PSEUDO_ISR).  There are only
+ * priority zero is system reserved (PRIORITY_MINIMUM).  There are only
  * N - 1 POSIX API priority levels since a thread at SuperCore priority N would
  * never run because of the idle threads.  This is necessary because GNAT maps
  * the lowest Ada task priority to the lowest thread priority.  The lowest
diff --git a/cpukit/include/rtems/score/priority.h 
b/cpukit/include/rtems/score/priority.h
index 568e3c4e3e..6f6cc12bac 100644
--- a/cpukit/include/rtems/score/priority.h
+++ b/cpukit/include/rtems/score/priority.h
@@ -95,13 +95,6 @@ typedef uint64_t Priority_Control;
  */
 #define PRIORITY_MINIMUM  0
 
-/**
- * @brief The priority value of pseudo-ISR threads.
- *
- * Examples are the MPCI and timer server threads.
- */
-#define PRIORITY_PSEUDO_ISR   PRIORITY_MINIMUM
-
 /**
  * @brief The default lowest (least important) thread priority value.
  *
diff --git a/cpukit/include/rtems/score/scheduleredfimpl.h 
b/cpukit/include/rtems/score/scheduleredfimpl.h
index e0a07a8915..06a35ae95f 100644
--- a/cpukit/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/include/rtems/score/scheduleredfimpl.h
@@ -39,7 +39,7 @@
 #define _RTEMS_SCORE_SCHEDULEREDFIMPL_H
 
 #include 
-#include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -216,30 +216,23 @@ RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract_body(
 }
 
 /**
- * @brief Schedules the next ready thread as the heir.
+ * @brief Gets the highest priority ready thread of the scheduler.
  *
- * @param scheduler The scheduler instance to schedule the minimum of the 
context of.
- * @param the_thread This parameter is not used.
- * @param force_dispatch Indicates whether the current heir is blocked even if 
it is
- *  not set as preemptible.
+ * @param scheduler is the scheduler.
  */
-RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
-  const Scheduler_Control *scheduler,
-  Thread_Control  *the_thread,
-  bool force_dispatch
+RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_EDF_Get_highest_ready(
+  const Scheduler_Control *scheduler
 )
 {
   Scheduler_EDF_Context *context;
   RBTree_Node   *first;
   Scheduler_EDF_Node*node;
 
-  (void) the_thread;
-
   context = _Scheduler_EDF_Get_context( scheduler );
   first = 

Re: [PATCH v2 0/3] Reduce system initialization time

2022-07-15 Thread Chris Johns
OK to push

Chris

On 15/7/2022 4:38 pm, Sebastian Huber wrote:
> This patch set reduces the system initialization time in the default
> configuration.  Applications can change the default behaviour through the
> CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY and CONFIGURE_DIRTY_MEMORY 
> configuration
> options.
> 
> v2:
> 
> * Reference ticket
> 
> * Improve sp54
> 
> Sebastian Huber (3):
>   bsps: Sort .noinit* sections
>   score: Place object controls into .noinit sections
>   score: Extend memory dirty/zero actions
> 
>  bsps/aarch64/shared/start/linkcmds.base   |  2 +-
>  bsps/arm/shared/start/linkcmds.base   |  2 +-
>  bsps/bfin/TLL6527M/start/linkcmds |  2 +-
>  bsps/bfin/bf537Stamp/start/linkcmds   |  2 +-
>  bsps/bfin/eZKit533/start/linkcmds |  2 +-
>  bsps/i386/pc386/start/linkcmds|  2 +-
>  bsps/lm32/lm32_evr/start/linkcmds |  2 +-
>  bsps/lm32/milkymist/start/linkcmds|  2 +-
>  bsps/m68k/av5282/start/linkcmds   |  2 +-
>  bsps/m68k/av5282/start/linkcmdsflash  |  2 +-
>  bsps/m68k/av5282/start/linkcmdsram|  2 +-
>  bsps/m68k/csb360/start/linkcmds   |  2 +-
>  bsps/m68k/gen68340/start/linkcmds |  2 +-
>  bsps/m68k/gen68360/start/linkcmds |  2 +-
>  bsps/m68k/gen68360/start/linkcmds.bootp   |  2 +-
>  bsps/m68k/gen68360/start/linkcmds.prom|  2 +-
>  bsps/m68k/mcf5206elite/start/linkcmds |  2 +-
>  bsps/m68k/mcf5206elite/start/linkcmds.flash   |  2 +-
>  bsps/m68k/mcf52235/start/linkcmds |  2 +-
>  bsps/m68k/mcf5225x/start/linkcmds |  2 +-
>  bsps/m68k/mcf5235/start/linkcmds  |  2 +-
>  bsps/m68k/mcf5235/start/linkcmdsflash |  2 +-
>  bsps/m68k/mcf5235/start/linkcmdsram   |  2 +-
>  bsps/m68k/mcf5329/start/linkcmds  |  2 +-
>  bsps/m68k/mcf5329/start/linkcmdsflash |  2 +-
>  bsps/m68k/mrm332/start/linkcmds   |  2 +-
>  bsps/m68k/shared/start/linkcmds.base  |  2 +-
>  bsps/m68k/uC5282/start/linkcmds   |  2 +-
>  bsps/mips/csb350/start/linkcmds   |  2 +-
>  bsps/mips/hurricane/start/linkcmds|  2 +-
>  bsps/mips/jmr3904/start/linkcmds  |  2 +-
>  bsps/mips/malta/start/linkcmds|  2 +-
>  bsps/mips/rbtx4925/start/linkcmds |  2 +-
>  bsps/mips/rbtx4938/start/linkcmds |  2 +-
>  bsps/moxie/moxiesim/start/linkcmds|  2 +-
>  bsps/nios2/nios2_iss/start/linkcmds   |  2 +-
>  bsps/or1k/shared/start/linkcmds.base  |  2 +-
>  .../gen5200/start/linkcmds.gen5200_base   |  2 +-
>  bsps/powerpc/mpc8260ads/start/linkcmds|  2 +-
>  bsps/powerpc/shared/start/linkcmds.base   |  2 +-
>  bsps/powerpc/shared/start/linkcmds.share  |  2 +-
>  bsps/powerpc/ss555/start/linkcmds |  2 +-
>  bsps/powerpc/virtex4/start/linkcmds   |  2 +-
>  bsps/powerpc/virtex5/start/linkcmds   |  2 +-
>  bsps/sh/gensh1/start/linkcmds |  2 +-
>  bsps/sh/gensh2/start/linkcmds |  2 +-
>  bsps/sh/gensh2/start/linkcmds.ram |  2 +-
>  bsps/sh/gensh2/start/linkcmds.rom |  2 +-
>  bsps/sh/gensh4/start/linkcmds |  2 +-
>  bsps/sh/gensh4/start/linkcmds.rom |  2 +-
>  bsps/sh/gensh4/start/linkcmds.rom2ram |  2 +-
>  bsps/sh/shsim/start/linkcmds  |  2 +-
>  bsps/sparc/shared/start/linkcmds.base |  2 +-
>  bsps/sparc64/shared/start/linkcmds|  2 +-
>  bsps/v850/gdbv850sim/start/linkcmds   |  2 +-
>  bsps/x86_64/amd64/start/linkcmds  |  2 +-
>  cpukit/include/rtems/score/memory.h   | 14 +-
>  cpukit/include/rtems/score/objectdata.h   |  7 ++-
>  cpukit/include/rtems/score/thread.h   |  9 ++--
>  cpukit/score/src/memorydirtyfreeareas.c   |  9 +++-
>  cpukit/score/src/memorynoinit.c   | 45 +
>  cpukit/score/src/memoryzerofreeareas.c|  9 +++-
>  spec/build/cpukit/librtemscpu.yml |  1 +
>  testsuites/sptests/sp01/init.c|  3 +-
>  testsuites/sptests/sp54/init.c| 48 ---
>  65 files changed, 186 insertions(+), 71 deletions(-)
>  create mode 100644 cpukit/score/src/memorynoinit.c
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 2/3] score: Place object controls into .noinit sections

2022-07-15 Thread Chris Johns
On 15/7/2022 3:41 pm, Sebastian Huber wrote:
> On 15.07.22 04:03, Chris Johns wrote:
>> On 14/7/2022 11:13 pm, Sebastian Huber wrote:
>>> Place the statically allocated object control blocks, local tables, and 
>>> thread
>>> queue heads into the dedicated .noinit intput sections.  The output section 
>>> is
>>> not zero initialized.
>> Does the data held in no-init rely on code having to initialise all fields? 
>> Is
>> the saving because there is code that already does this?
> 
> Yes, we have a double initialization. These elements were allocated from the
> workspace before the static allocation. The workspace allocates uninitialized
> data. We still have this uninitialized data if unlimited objects are used.

Yes it does and in this case it is covered.

>>> Placing these elements into the .noinit section reduces
>>> the system initialization time by decreasing the .bss section size.
>> How much data do you see that is being moved out of .bss to .noinit?
> 
> It depends on your application configuration. You have for example about 700
> bytes per task. I noticed this in an application which hit the watchdog due to
> an update to RTEMS 6 because of the longer boot time to the initialization 
> task.

Ouch.

And thanks for the ticket.

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

[PATCH v2 1/3] bsps: Sort .noinit* sections

2022-07-15 Thread Sebastian Huber
Sort the .noinit* input sections by name first, then by alignment if two
sections have the same name.  This allows the placement of begin/end symbols to
initialize some areas with a special value.

Update #4678.
---
 bsps/aarch64/shared/start/linkcmds.base  | 2 +-
 bsps/arm/shared/start/linkcmds.base  | 2 +-
 bsps/bfin/TLL6527M/start/linkcmds| 2 +-
 bsps/bfin/bf537Stamp/start/linkcmds  | 2 +-
 bsps/bfin/eZKit533/start/linkcmds| 2 +-
 bsps/i386/pc386/start/linkcmds   | 2 +-
 bsps/lm32/lm32_evr/start/linkcmds| 2 +-
 bsps/lm32/milkymist/start/linkcmds   | 2 +-
 bsps/m68k/av5282/start/linkcmds  | 2 +-
 bsps/m68k/av5282/start/linkcmdsflash | 2 +-
 bsps/m68k/av5282/start/linkcmdsram   | 2 +-
 bsps/m68k/csb360/start/linkcmds  | 2 +-
 bsps/m68k/gen68340/start/linkcmds| 2 +-
 bsps/m68k/gen68360/start/linkcmds| 2 +-
 bsps/m68k/gen68360/start/linkcmds.bootp  | 2 +-
 bsps/m68k/gen68360/start/linkcmds.prom   | 2 +-
 bsps/m68k/mcf5206elite/start/linkcmds| 2 +-
 bsps/m68k/mcf5206elite/start/linkcmds.flash  | 2 +-
 bsps/m68k/mcf52235/start/linkcmds| 2 +-
 bsps/m68k/mcf5225x/start/linkcmds| 2 +-
 bsps/m68k/mcf5235/start/linkcmds | 2 +-
 bsps/m68k/mcf5235/start/linkcmdsflash| 2 +-
 bsps/m68k/mcf5235/start/linkcmdsram  | 2 +-
 bsps/m68k/mcf5329/start/linkcmds | 2 +-
 bsps/m68k/mcf5329/start/linkcmdsflash| 2 +-
 bsps/m68k/mrm332/start/linkcmds  | 2 +-
 bsps/m68k/shared/start/linkcmds.base | 2 +-
 bsps/m68k/uC5282/start/linkcmds  | 2 +-
 bsps/mips/csb350/start/linkcmds  | 2 +-
 bsps/mips/hurricane/start/linkcmds   | 2 +-
 bsps/mips/jmr3904/start/linkcmds | 2 +-
 bsps/mips/malta/start/linkcmds   | 2 +-
 bsps/mips/rbtx4925/start/linkcmds| 2 +-
 bsps/mips/rbtx4938/start/linkcmds| 2 +-
 bsps/moxie/moxiesim/start/linkcmds   | 2 +-
 bsps/nios2/nios2_iss/start/linkcmds  | 2 +-
 bsps/or1k/shared/start/linkcmds.base | 2 +-
 bsps/powerpc/gen5200/start/linkcmds.gen5200_base | 2 +-
 bsps/powerpc/mpc8260ads/start/linkcmds   | 2 +-
 bsps/powerpc/shared/start/linkcmds.base  | 2 +-
 bsps/powerpc/shared/start/linkcmds.share | 2 +-
 bsps/powerpc/ss555/start/linkcmds| 2 +-
 bsps/powerpc/virtex4/start/linkcmds  | 2 +-
 bsps/powerpc/virtex5/start/linkcmds  | 2 +-
 bsps/sh/gensh1/start/linkcmds| 2 +-
 bsps/sh/gensh2/start/linkcmds| 2 +-
 bsps/sh/gensh2/start/linkcmds.ram| 2 +-
 bsps/sh/gensh2/start/linkcmds.rom| 2 +-
 bsps/sh/gensh4/start/linkcmds| 2 +-
 bsps/sh/gensh4/start/linkcmds.rom| 2 +-
 bsps/sh/gensh4/start/linkcmds.rom2ram| 2 +-
 bsps/sh/shsim/start/linkcmds | 2 +-
 bsps/sparc/shared/start/linkcmds.base| 2 +-
 bsps/sparc64/shared/start/linkcmds   | 2 +-
 bsps/v850/gdbv850sim/start/linkcmds  | 2 +-
 bsps/x86_64/amd64/start/linkcmds | 2 +-
 56 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/bsps/aarch64/shared/start/linkcmds.base 
b/bsps/aarch64/shared/start/linkcmds.base
index d3b5485777..bcdf4715d7 100644
--- a/bsps/aarch64/shared/start/linkcmds.base
+++ b/bsps/aarch64/shared/start/linkcmds.base
@@ -323,7 +323,7 @@ SECTIONS {
 
.noinit (NOLOAD) : ALIGN_WITH_INPUT {
bsp_section_noinit_begin = .;
-   *(.noinit*)
+   *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*)))
bsp_section_noinit_end = .;
} > REGION_WORK AT > REGION_WORK
bsp_section_noinit_size = bsp_section_noinit_end - 
bsp_section_noinit_begin;
diff --git a/bsps/arm/shared/start/linkcmds.base 
b/bsps/arm/shared/start/linkcmds.base
index 10d2c54028..c9cf360ee7 100644
--- a/bsps/arm/shared/start/linkcmds.base
+++ b/bsps/arm/shared/start/linkcmds.base
@@ -334,7 +334,7 @@ SECTIONS {
 
.noinit (NOLOAD) : ALIGN_WITH_INPUT {
bsp_section_noinit_begin = .;
-   *(.noinit*)
+   *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*)))
bsp_section_noinit_end = .;
} > REGION_WORK AT > REGION_WORK
bsp_section_noinit_size = bsp_section_noinit_end - 
bsp_section_noinit_begin;
diff --git a/bsps/bfin/TLL6527M/start/linkcmds 
b/bsps/bfin/TLL6527M/start/linkcmds
index 315f1b7149..2185678184 100644
--- a/bsps/bfin/TLL6527M/start/linkcmds
+++ b/bsps/bfin/TLL6527M/start/linkcmds
@@ -129,7 +129,7 @@ SECTIONS
 } > sdram
 
 .noinit (NOLOAD) : {
-*(.noinit*)
+*(SORT_BY_NAME 

[PATCH v2 2/3] score: Place object controls into .noinit sections

2022-07-15 Thread Sebastian Huber
Place the statically allocated object control blocks, local tables, and thread
queue heads into the dedicated .noinit intput sections.  The output section is
not zero initialized.  Placing these elements into the .noinit section reduces
the system initialization time by decreasing the .bss section size.

It may improve the cache efficiency since the mostly read local tables are
placed in a contiguous memory area.

Update #4678.
---
 cpukit/include/rtems/score/objectdata.h | 7 +--
 cpukit/include/rtems/score/thread.h | 9 ++---
 testsuites/sptests/sp01/init.c  | 3 ++-
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/cpukit/include/rtems/score/objectdata.h 
b/cpukit/include/rtems/score/objectdata.h
index d624f182f9..dc03f23461 100644
--- a/cpukit/include/rtems/score/objectdata.h
+++ b/cpukit/include/rtems/score/objectdata.h
@@ -447,9 +447,12 @@ Objects_Information name##_Information = { \
  *   multiprocessing (RTEMS_MULTIPROCESSING) is enabled.
  */
 #define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \
-static Objects_Control * \
+static RTEMS_SECTION( ".noinit.rtems.content.local_table" ) \
+Objects_Control * \
 name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
-static type name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
+static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \
+type \
+name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
 Objects_Information name##_Information = { \
   _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
   name##_Local_table, \
diff --git a/cpukit/include/rtems/score/thread.h 
b/cpukit/include/rtems/score/thread.h
index 94eab18ea3..f5a56887a4 100644
--- a/cpukit/include/rtems/score/thread.h
+++ b/cpukit/include/rtems/score/thread.h
@@ -1149,11 +1149,14 @@ Thread_Information name##_Information = { \
 Objects_Control *_Thread_Allocate_unlimited( Objects_Information *information 
);
 
 #define THREAD_INFORMATION_DEFINE( name, api, cls, max ) \
-static Objects_Control * \
+static RTEMS_SECTION( ".noinit.rtems.content.local_table" ) \
+Objects_Control * \
 name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
-static Thread_Configured_control \
+static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \
+Thread_Configured_control \
 name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
-static Thread_queue_Configured_heads \
+static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \
+Thread_queue_Configured_heads \
 name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \
 Thread_Information name##_Information = { \
   { \
diff --git a/testsuites/sptests/sp01/init.c b/testsuites/sptests/sp01/init.c
index 2384430824..26d715b0ba 100644
--- a/testsuites/sptests/sp01/init.c
+++ b/testsuites/sptests/sp01/init.c
@@ -35,7 +35,8 @@
 
 const char rtems_test_name[] = "SP 1";
 
-RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char Task_1_storage[
+static RTEMS_NOINIT RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) char
+Task_1_storage[
   RTEMS_TASK_STORAGE_SIZE( 2 * RTEMS_MINIMUM_STACK_SIZE, RTEMS_FLOATING_POINT )
 ];
 
-- 
2.35.3

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


[PATCH v2 3/3] score: Extend memory dirty/zero actions

2022-07-15 Thread Sebastian Huber
Dirty or zero also the part of the .noinit section used by RTEMS.

Close #4678.
---
 cpukit/include/rtems/score/memory.h | 14 +++-
 cpukit/score/src/memorydirtyfreeareas.c |  9 -
 cpukit/score/src/memorynoinit.c | 45 +++
 cpukit/score/src/memoryzerofreeareas.c  |  9 -
 spec/build/cpukit/librtemscpu.yml   |  1 +
 testsuites/sptests/sp54/init.c  | 48 +
 6 files changed, 117 insertions(+), 9 deletions(-)
 create mode 100644 cpukit/score/src/memorynoinit.c

diff --git a/cpukit/include/rtems/score/memory.h 
b/cpukit/include/rtems/score/memory.h
index 5761402711..fa17ea164c 100644
--- a/cpukit/include/rtems/score/memory.h
+++ b/cpukit/include/rtems/score/memory.h
@@ -10,7 +10,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (C) 2019 embedded brains GmbH
+ * Copyright (C) 2019, 2022 embedded brains GmbH
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -352,6 +352,18 @@ void _Memory_Zero_free_areas( void );
  */
 void _Memory_Dirty_free_areas( void );
 
+/**
+ * @brief This symbol marks the begin of the non-initialized section used by
+ *   RTEMS.
+ */
+extern char _Memory_Noinit_begin[];
+
+/**
+ * @brief This symbol marks the end of the non-initialized section used by
+ *   RTEMS.
+ */
+extern char _Memory_Noinit_end[];
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/score/src/memorydirtyfreeareas.c 
b/cpukit/score/src/memorydirtyfreeareas.c
index fc6c2630bf..8a817c2208 100644
--- a/cpukit/score/src/memorydirtyfreeareas.c
+++ b/cpukit/score/src/memorydirtyfreeareas.c
@@ -10,7 +10,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (C) 2020 embedded brains GmbH
+ * Copyright (C) 2020, 2022 embedded brains GmbH
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -40,7 +40,14 @@
 
 #include 
 
+#include 
+
 void _Memory_Dirty_free_areas( void )
 {
   _Memory_Fill( _Memory_Get(), 0xcf );
+  memset(
+_Memory_Noinit_begin,
+0xcf,
+(uintptr_t) _Memory_Noinit_end - (uintptr_t) _Memory_Noinit_begin
+  );
 }
diff --git a/cpukit/score/src/memorynoinit.c b/cpukit/score/src/memorynoinit.c
new file mode 100644
index 00..19772356cd
--- /dev/null
+++ b/cpukit/score/src/memorynoinit.c
@@ -0,0 +1,45 @@
+/**
+ * @file
+ *
+ * @ingroup RTEMSScoreMemory
+ *
+ * @brief This source file contains the definition of ::_Memory_Noinit_begin
+ *   and ::_Memory_Noinit_end.
+ */
+
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2022 embedded brains GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+
+RTEMS_SECTION( ".noinit.rtems.begin" ) char _Memory_Noinit_begin[ 0 ];
+
+RTEMS_SECTION( ".noinit.rtems.end" ) char _Memory_Noinit_end[ 0 ];
diff --git a/cpukit/score/src/memoryzerofreeareas.c 
b/cpukit/score/src/memoryzerofreeareas.c
index 4ea0812426..b1cef47ef9 100644
--- a/cpukit/score/src/memoryzerofreeareas.c
+++ b/cpukit/score/src/memoryzerofreeareas.c
@@ -10,7 +10,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (C) 2020 embedded brains GmbH
+ * Copyright (C) 2020, 2022 embedded brains GmbH
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -40,7 +40,14 @@
 
 #include 
 
+#include 
+
 void _Memory_Zero_free_areas( void )
 {
   _Memory_Fill( _Memory_Get(), 0 );
+  memset(
+_Memory_Noinit_begin,
+0,
+(uintptr_t) _Memory_Noinit_end - 

[PATCH v2 0/3] Reduce system initialization time

2022-07-15 Thread Sebastian Huber
This patch set reduces the system initialization time in the default
configuration.  Applications can change the default behaviour through the
CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY and CONFIGURE_DIRTY_MEMORY configuration
options.

v2:

* Reference ticket

* Improve sp54

Sebastian Huber (3):
  bsps: Sort .noinit* sections
  score: Place object controls into .noinit sections
  score: Extend memory dirty/zero actions

 bsps/aarch64/shared/start/linkcmds.base   |  2 +-
 bsps/arm/shared/start/linkcmds.base   |  2 +-
 bsps/bfin/TLL6527M/start/linkcmds |  2 +-
 bsps/bfin/bf537Stamp/start/linkcmds   |  2 +-
 bsps/bfin/eZKit533/start/linkcmds |  2 +-
 bsps/i386/pc386/start/linkcmds|  2 +-
 bsps/lm32/lm32_evr/start/linkcmds |  2 +-
 bsps/lm32/milkymist/start/linkcmds|  2 +-
 bsps/m68k/av5282/start/linkcmds   |  2 +-
 bsps/m68k/av5282/start/linkcmdsflash  |  2 +-
 bsps/m68k/av5282/start/linkcmdsram|  2 +-
 bsps/m68k/csb360/start/linkcmds   |  2 +-
 bsps/m68k/gen68340/start/linkcmds |  2 +-
 bsps/m68k/gen68360/start/linkcmds |  2 +-
 bsps/m68k/gen68360/start/linkcmds.bootp   |  2 +-
 bsps/m68k/gen68360/start/linkcmds.prom|  2 +-
 bsps/m68k/mcf5206elite/start/linkcmds |  2 +-
 bsps/m68k/mcf5206elite/start/linkcmds.flash   |  2 +-
 bsps/m68k/mcf52235/start/linkcmds |  2 +-
 bsps/m68k/mcf5225x/start/linkcmds |  2 +-
 bsps/m68k/mcf5235/start/linkcmds  |  2 +-
 bsps/m68k/mcf5235/start/linkcmdsflash |  2 +-
 bsps/m68k/mcf5235/start/linkcmdsram   |  2 +-
 bsps/m68k/mcf5329/start/linkcmds  |  2 +-
 bsps/m68k/mcf5329/start/linkcmdsflash |  2 +-
 bsps/m68k/mrm332/start/linkcmds   |  2 +-
 bsps/m68k/shared/start/linkcmds.base  |  2 +-
 bsps/m68k/uC5282/start/linkcmds   |  2 +-
 bsps/mips/csb350/start/linkcmds   |  2 +-
 bsps/mips/hurricane/start/linkcmds|  2 +-
 bsps/mips/jmr3904/start/linkcmds  |  2 +-
 bsps/mips/malta/start/linkcmds|  2 +-
 bsps/mips/rbtx4925/start/linkcmds |  2 +-
 bsps/mips/rbtx4938/start/linkcmds |  2 +-
 bsps/moxie/moxiesim/start/linkcmds|  2 +-
 bsps/nios2/nios2_iss/start/linkcmds   |  2 +-
 bsps/or1k/shared/start/linkcmds.base  |  2 +-
 .../gen5200/start/linkcmds.gen5200_base   |  2 +-
 bsps/powerpc/mpc8260ads/start/linkcmds|  2 +-
 bsps/powerpc/shared/start/linkcmds.base   |  2 +-
 bsps/powerpc/shared/start/linkcmds.share  |  2 +-
 bsps/powerpc/ss555/start/linkcmds |  2 +-
 bsps/powerpc/virtex4/start/linkcmds   |  2 +-
 bsps/powerpc/virtex5/start/linkcmds   |  2 +-
 bsps/sh/gensh1/start/linkcmds |  2 +-
 bsps/sh/gensh2/start/linkcmds |  2 +-
 bsps/sh/gensh2/start/linkcmds.ram |  2 +-
 bsps/sh/gensh2/start/linkcmds.rom |  2 +-
 bsps/sh/gensh4/start/linkcmds |  2 +-
 bsps/sh/gensh4/start/linkcmds.rom |  2 +-
 bsps/sh/gensh4/start/linkcmds.rom2ram |  2 +-
 bsps/sh/shsim/start/linkcmds  |  2 +-
 bsps/sparc/shared/start/linkcmds.base |  2 +-
 bsps/sparc64/shared/start/linkcmds|  2 +-
 bsps/v850/gdbv850sim/start/linkcmds   |  2 +-
 bsps/x86_64/amd64/start/linkcmds  |  2 +-
 cpukit/include/rtems/score/memory.h   | 14 +-
 cpukit/include/rtems/score/objectdata.h   |  7 ++-
 cpukit/include/rtems/score/thread.h   |  9 ++--
 cpukit/score/src/memorydirtyfreeareas.c   |  9 +++-
 cpukit/score/src/memorynoinit.c   | 45 +
 cpukit/score/src/memoryzerofreeareas.c|  9 +++-
 spec/build/cpukit/librtemscpu.yml |  1 +
 testsuites/sptests/sp01/init.c|  3 +-
 testsuites/sptests/sp54/init.c| 48 ---
 65 files changed, 186 insertions(+), 71 deletions(-)
 create mode 100644 cpukit/score/src/memorynoinit.c

-- 
2.35.3

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


Re: [PATCH 2/3] score: Place object controls into .noinit sections

2022-07-15 Thread Sebastian Huber

On 15.07.22 07:41, Sebastian Huber wrote:

Placing these elements into the .noinit section reduces
the system initialization time by decreasing the .bss section size.

How much data do you see that is being moved out of .bss to .noinit?


It depends on your application configuration. You have for example about 
700 bytes per task. I noticed this in an application which hit the 
watchdog due to an update to RTEMS 6 because of the longer boot time to 
the initialization task.


I added a ticket for this:

https://devel.rtems.org/ticket/4678

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