Re: [PATCH rtems-libbsd v2 0/5] Beagle BSP: USB Template Driver for CDC Ethernet

2021-08-09 Thread Christian MAUDERER

Hello Chris,

Am 09.08.21 um 02:34 schrieb Chris Johns:

On 1/8/21 9:27 pm, Christian Mauderer wrote:

Hello Husni,

just tested that and it works fine. With a simple curl I can reach about 8.5
MByte/s sending to the beagle and 19.5 MByte/s receiving from it.

Please take a look at the points that Chris Johns asked. As soon as these are
addressed, I think the patches could be merged.


Can these patches please wait until my patches are merged? I have not seen any
issues and given the size I am waiting a while.

I ask because the symbol changes in the namespace ripple through the 150K lines
of patches I have posted for review and it is a pain to rebase.

Chris


About when do you plan to merge your patches?

Although not entirely necessary, I think it would be great if we could 
merge the patches before end of GSoC so that Husni can add to his final 
report that code has been merged.


If that doesn't fit your time plan, I'll add them to my branch where I 
collect to-be-merged patches so that I at least don't forget them.


Best regards

Christian
--

embedded brains GmbH
Herr Christian MAUDERER
Dornierstr. 4
82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
phone: +49-89-18 94 741 - 18
fax:   +49-89-18 94 741 - 08

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

Re: [PATCH rtems-libbsd v2 0/5] Beagle BSP: USB Template Driver for CDC Ethernet

2021-08-09 Thread Chris Johns
On 9/8/21 5:02 pm, Christian MAUDERER wrote:
> Hello Chris,
> 
> Am 09.08.21 um 02:34 schrieb Chris Johns:
>> On 1/8/21 9:27 pm, Christian Mauderer wrote:
>>> Hello Husni,
>>>
>>> just tested that and it works fine. With a simple curl I can reach about 8.5
>>> MByte/s sending to the beagle and 19.5 MByte/s receiving from it.
>>>
>>> Please take a look at the points that Chris Johns asked. As soon as these 
>>> are
>>> addressed, I think the patches could be merged.
>>
>> Can these patches please wait until my patches are merged? I have not seen 
>> any
>> issues and given the size I am waiting a while.
>>
>> I ask because the symbol changes in the namespace ripple through the 150K 
>> lines
>> of patches I have posted for review and it is a pain to rebase.
>>
>> Chris
> 
> About when do you plan to merge your patches?

My plan is this week. I have some testing planned.

> Although not entirely necessary, I think it would be great if we could merge 
> the
> patches before end of GSoC so that Husni can add to his final report that code
> has been merged.

Yes it would be nice. I think the changes looks fine so there is issue with them
going in.

> If that doesn't fit your time plan, I'll add them to my branch where I collect
> to-be-merged patches so that I at least don't forget them.

Yeap. If I am slipping I will let you know.

And thank you, it is appreciated.

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


Re: [PATCH rtems-libbsd v2 0/5] Beagle BSP: USB Template Driver for CDC Ethernet

2021-08-09 Thread Chris Johns



On 9/8/21 5:14 pm, Chris Johns wrote:
> On 9/8/21 5:02 pm, Christian MAUDERER wrote:
>> Hello Chris,
>>
>> Am 09.08.21 um 02:34 schrieb Chris Johns:
>>> On 1/8/21 9:27 pm, Christian Mauderer wrote:
 Hello Husni,

 just tested that and it works fine. With a simple curl I can reach about 
 8.5
 MByte/s sending to the beagle and 19.5 MByte/s receiving from it.

 Please take a look at the points that Chris Johns asked. As soon as these 
 are
 addressed, I think the patches could be merged.
>>>
>>> Can these patches please wait until my patches are merged? I have not seen 
>>> any
>>> issues and given the size I am waiting a while.
>>>
>>> I ask because the symbol changes in the namespace ripple through the 150K 
>>> lines
>>> of patches I have posted for review and it is a pain to rebase.
>>>
>>> Chris
>>
>> About when do you plan to merge your patches?
> 
> My plan is this week. I have some testing planned.
> 
>> Although not entirely necessary, I think it would be great if we could merge 
>> the
>> patches before end of GSoC so that Husni can add to his final report that 
>> code
>> has been merged.
> 
> Yes it would be nice. I think the changes looks fine so there is issue with 
> them
> going in.

That should read "no issue"

Chris

> 
>> If that doesn't fit your time plan, I'll add them to my branch where I 
>> collect
>> to-be-merged patches so that I at least don't forget them.
> 
> Yeap. If I am slipping I will let you know.
> 
> And thank you, it is appreciated.
> 
> Chris
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] bsps/raspberrypi: Add SEV Instruction for RPi SMP firmware changes.

2021-08-09 Thread pranav
The Pi firmware added a wfe(wait for event), the cores 1-3 wait
for the start address being written to the mailbox register, followed
by a SEV poke to the mailbox that acts as a wfe wake-up event.
---
 bsps/arm/raspberrypi/start/bspsmp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bsps/arm/raspberrypi/start/bspsmp.c 
b/bsps/arm/raspberrypi/start/bspsmp.c
index 44f7a1d376..9dcfb0fb03 100644
--- a/bsps/arm/raspberrypi/start/bspsmp.c
+++ b/bsps/arm/raspberrypi/start/bspsmp.c
@@ -42,6 +42,7 @@ bool _CPU_SMP_Start_processor( uint32_t cpu_index )
   if (cpu_index != cpu_index_self) {
 
 BCM2835_REG(BCM2836_MAILBOX_3_WRITE_SET_BASE + 0x10 * cpu_index) = 
(uint32_t)_start;
+_ARM_Send_event();
 
 /*
  * Wait for secondary processor to complete its basic initialization so
-- 
2.30.2

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


RE: [PATCH v2] rtems-utils: Change data type definition

2021-08-09 Thread Ryan Long
Without the global namespace prefix, it results in the following error

../linkers/rtems-exeinfo.cpp: In member function ‘void 
rld::exeinfo::image::output_compilation_unit(bool, bool)’:
../linkers/rtems-exeinfo.cpp:370:14: error: ‘rld::rtems::utils’ has not been 
declared
   rtems::utils::ostream_guard old_state( std::cout );
  ^
../linkers/rtems-exeinfo.cpp:370:35: error: expected ‘;’ before ‘old_state’
   rtems::utils::ostream_guard old_state( std::cout );

Alex and I determined that the compiler is thinking that ostream_guard is 
defined in the rld::rtems namespace. This was the only way we figured out how 
to get it to compile without the typedef at the top of the file.

-Original Message-
From: Chris Johns  
Sent: Friday, August 6, 2021 12:46 AM
To: Ryan Long ; devel@rtems.org
Subject: Re: [PATCH v2] rtems-utils: Change data type definition

On 6/8/21 6:43 am, Ryan Long wrote:
> Remove typedef of ostream_guard and change datatype of ostream_guards 
> to have the namespace in the variable declarations.
> ---
>  linkers/rtems-exeinfo.cpp| 6 ++
>  tester/covoar/CoverageMapBase.cc | 4 +---
>  tester/covoar/ReportsHtml.cc | 4 +---
>  tester/covoar/ReportsText.cc | 4 +---
>  4 files changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/linkers/rtems-exeinfo.cpp b/linkers/rtems-exeinfo.cpp 
> index c9bf5b6..caae168 100644
> --- a/linkers/rtems-exeinfo.cpp
> +++ b/linkers/rtems-exeinfo.cpp
> @@ -53,8 +53,6 @@
>  #define kill(p,s) raise(s)
>  #endif
>  
> -typedef rtems::utils::ostream_guard ostream_guard;
> -
>  namespace rld
>  {
>namespace exeinfo
> @@ -369,7 +367,7 @@ namespace rld
> */
>  
>rld::strings all_flags;
> -  ostream_guard old_state( std::cout );
> +  ::rtems::utils::ostream_guard old_state( std::cout );
>  
>size_t source_max = 0;
>  
> @@ -636,7 +634,7 @@ namespace rld
>  
>  void image::output_tls ()
>  {
> -  ostream_guard old_state( std::cout );
> +  ::rtems::utils::ostream_guard old_state( std::cout );

Why the global namespace prefix, ie `::` at the start? I have only seen this 
when referencing a global symbol that is not in a namespace, ie a C call.

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

Re: [PATCH v4] bsps: Move optfdt* files to shared parent directory

2021-08-09 Thread Gedare Bloom
Hi Joel,

On Fri, Jul 16, 2021 at 10:40 AM Joel Sherrill  wrote:
>
> I'm doing a build sweep of all BSPs. When that completes, I plan to
> push this unless there are comments.
>
Did/can you push this?

> On Fri, Jul 16, 2021 at 9:51 AM pranav  wrote:
> >
> > ---
> >  .../arm/altera-cyclone-v/bspalteracyclonev.yml  |  8 
> >  spec/build/bsps/arm/beagle/grp.yml  |  8 
> >  spec/build/bsps/arm/beagle/optfdtcpyro.yml  | 16 
> >  spec/build/bsps/arm/beagle/optfdtmxsz.yml   | 17 -
> >  spec/build/bsps/arm/beagle/optfdtro.yml | 16 
> >  spec/build/bsps/arm/beagle/optfdtuboot.yml  | 16 
> >  spec/build/bsps/arm/imx/bspimx.yml  |  8 
> >  spec/build/bsps/arm/imx/optfdtcpyro.yml | 16 
> >  spec/build/bsps/arm/imx/optfdtmxsz.yml  | 17 -
> >  spec/build/bsps/arm/imx/optfdtro.yml| 16 
> >  spec/build/bsps/arm/imx/optfdtuboot.yml | 16 
> >  spec/build/bsps/arm/raspberrypi/grp.yml |  8 
> >  .../{arm/altera-cyclone-v => }/optfdtcpyro.yml  |  0
> >  .../{arm/altera-cyclone-v => }/optfdtmxsz.yml   |  0
> >  .../{arm/altera-cyclone-v => }/optfdtro.yml |  0
> >  .../{arm/altera-cyclone-v => }/optfdtuboot.yml  |  0
> >  spec/build/bsps/powerpc/qoriq/grp.yml   |  4 ++--
> >  spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml| 17 -
> >  spec/build/bsps/powerpc/qoriq/optfdtro.yml  | 16 
> >  spec/build/bsps/riscv/riscv/grp.yml |  8 
> >  spec/build/bsps/riscv/riscv/optfdtcpyro.yml | 16 
> >  spec/build/bsps/riscv/riscv/optfdtmxsz.yml  | 17 -
> >  spec/build/bsps/riscv/riscv/optfdtro.yml| 16 
> >  spec/build/bsps/riscv/riscv/optfdtuboot.yml | 16 
> >  24 files changed, 26 insertions(+), 246 deletions(-)
> >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtcpyro.yml
> >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtmxsz.yml
> >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtro.yml
> >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtuboot.yml
> >  delete mode 100644 spec/build/bsps/arm/imx/optfdtcpyro.yml
> >  delete mode 100644 spec/build/bsps/arm/imx/optfdtmxsz.yml
> >  delete mode 100644 spec/build/bsps/arm/imx/optfdtro.yml
> >  delete mode 100644 spec/build/bsps/arm/imx/optfdtuboot.yml
> >  rename spec/build/bsps/{arm/altera-cyclone-v => }/optfdtcpyro.yml (100%)
> >  rename spec/build/bsps/{arm/altera-cyclone-v => }/optfdtmxsz.yml (100%)
> >  rename spec/build/bsps/{arm/altera-cyclone-v => }/optfdtro.yml (100%)
> >  rename spec/build/bsps/{arm/altera-cyclone-v => }/optfdtuboot.yml (100%)
> >  delete mode 100644 spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml
> >  delete mode 100644 spec/build/bsps/powerpc/qoriq/optfdtro.yml
> >  delete mode 100644 spec/build/bsps/riscv/riscv/optfdtcpyro.yml
> >  delete mode 100644 spec/build/bsps/riscv/riscv/optfdtmxsz.yml
> >  delete mode 100644 spec/build/bsps/riscv/riscv/optfdtro.yml
> >  delete mode 100644 spec/build/bsps/riscv/riscv/optfdtuboot.yml
> >
> > diff --git a/spec/build/bsps/arm/altera-cyclone-v/bspalteracyclonev.yml 
> > b/spec/build/bsps/arm/altera-cyclone-v/bspalteracyclonev.yml
> > index da567ddd79..a9f3f7dabf 100644
> > --- a/spec/build/bsps/arm/altera-cyclone-v/bspalteracyclonev.yml
> > +++ b/spec/build/bsps/arm/altera-cyclone-v/bspalteracyclonev.yml
> > @@ -73,15 +73,15 @@ links:
> >  - role: build-dependency
> >uid: optconuart1
> >  - role: build-dependency
> > -  uid: optfdtcpyro
> > +  uid: ../../optfdtcpyro
> >  - role: build-dependency
> >uid: optfdten
> >  - role: build-dependency
> > -  uid: optfdtmxsz
> > +  uid: ../../optfdtmxsz
> >  - role: build-dependency
> > -  uid: optfdtro
> > +  uid: ../../optfdtro
> >  - role: build-dependency
> > -  uid: optfdtuboot
> > +  uid: ../../optfdtuboot
> >  - role: build-dependency
> >uid: opti2cspeed
> >  - role: build-dependency
> > diff --git a/spec/build/bsps/arm/beagle/grp.yml 
> > b/spec/build/bsps/arm/beagle/grp.yml
> > index 1375913fd0..3452c3e5c8 100644
> > --- a/spec/build/bsps/arm/beagle/grp.yml
> > +++ b/spec/build/bsps/arm/beagle/grp.yml
> > @@ -22,13 +22,13 @@ links:
> >  - role: build-dependency
> >uid: optdm3730
> >  - role: build-dependency
> > -  uid: optfdtcpyro
> > +  uid: ../../optfdtcpyro
> >  - role: build-dependency
> > -  uid: optfdtmxsz
> > +  uid: ../../optfdtmxsz
> >  - role: build-dependency
> > -  uid: optfdtro
> > +  uid: ../../optfdtro
> >  - role: build-dependency
> > -  uid: optfdtuboot
> > +  uid: ../../optfdtuboot
> >  - role: build-dependency
> >uid: ../grp
> >  - role: build-dependency
> > diff --git a/spec/build/bsps/arm/beagle/optfdtcpyro.yml 
> > b/spec/build/bsps/arm/beagle/optfdtcpyro.yml
> > deleted file mode 100644
> > index 5ec59adf4d..00
> > --- 

Re: [PATCH] user: Update rsb-packages to reflect RTEMS 6 changes

2021-08-09 Thread Gedare Bloom
I have to think about this. The approach taken here just replaces 5.1
-> 6, it isn't updating the screengrabs. This means the tutorial isn't
"real" but that might be fine.

The other issue is that when we release, then this has to become 6 ->
6.1 in the release, and 6 -> 7 in the master. How we manage this
becomes part of the release overhead.

On Fri, Aug 6, 2021 at 3:27 PM Ray Garza  wrote:
>
> This updates all references and examples in the rtems docs: 
> user/start/rsb-packages.rst to RTEMS 6
>
> ---
>  user/start/rsb-packages.rst | 68 ++---
>  1 file changed, 34 insertions(+), 34 deletions(-)
>
> diff --git a/user/start/rsb-packages.rst b/user/start/rsb-packages.rst
> index 3119318..891ea6a 100644
> --- a/user/start/rsb-packages.rst
> +++ b/user/start/rsb-packages.rst
> @@ -19,8 +19,8 @@ Return to here once you have completed these steps.
>
>  You have chosen an installation prefix, the BSP to build, the tool's
>  architecure and prepared the source for the RSB in the previous sections.  We
> -have chosen :file:`$HOME/quick-start/rtems/5` as the installation prefix, the
> -``erc32`` BSP and the SPARC architecture name of ``sparc-rtems5``, and 
> unpacked
> +have chosen :file:`$HOME/quick-start/rtems/6` as the installation prefix, the
> +``erc32`` BSP and the SPARC architecture name of ``sparc-rtems6``, and 
> unpacked
>  the RSB source in :file:`$HOME/quick-start/src`.
>
>  You are now able to build :ref:`BSP Packages` or 3rd party libraries of code 
> if you
> @@ -72,36 +72,36 @@ BSP.
>  .. code-block:: none
>
>  cd $HOME/quick-start/src/rsb/rtems
> -../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/5 \
> +../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 \
>  --with-rtems-tests=yes bsps/erc32
>
>  This command should output something like this:
>
>  .. code-block:: none
>
> -RTEMS Source Builder - Set Builder, 5.1.0
> +RTEMS Source Builder - Set Builder, 6 (4e6dc6431435)
>  Build Set: bsps/erc32
> -Build Set: 5/rtems-sparc.bset
> -Build Set: 5/rtems-autotools.bset
> -Build Set: 5/rtems-autotools-internal.bset
> +Build Set: 6/rtems-sparc.bset
> +Build Set: 6/rtems-autotools.bset
> +Build Set: 6/rtems-autotools-internal.bset
>  config: tools/rtems-autoconf-2.69-1.cfg
>  package: autoconf-2.69-x86_64-freebsd12.1-1
>  building: autoconf-2.69-x86_64-freebsd12.1-1
>  sizes: autoconf-2.69-x86_64-freebsd12.1-1: 7.505MB (installed: 0.000B)
>  ...
> -building: protobuf-2.6.1-sparc-rtems5-1
> -sizes: protobuf-2.6.1-sparc-rtems5-1: 228.079MB (installed: 84.408MB)
> -cleaning: protobuf-2.6.1-sparc-rtems5-1
> -reporting: net/protobuf-2.6.1-1.cfg -> protobuf-2.6.1-sparc-rtems5-1.txt
> -reporting: net/protobuf-2.6.1-1.cfg -> protobuf-2.6.1-sparc-rtems5-1.xml
> -staging: protobuf-2.6.1-sparc-rtems5-1 -> 
> $HOME/quick-start/src/rsb/rtems/build/tmp/sb-500-staging
> -cleaning: protobuf-2.6.1-sparc-rtems5-1
> -Build Set: Time 0:00:23.564992
> -Build Set: Time 0:02:27.380299
> +building: protobuf-2.6.1-sparc-rtems6
> +sizes: protobuf-2.6.1-sparc-rtems6: 228.079MB (installed: 84.408MB)
> +cleaning: protobuf-2.6.1-sparc-rtems6
> +reporting: net/protobuf-2.6.1-1.cfg -> protobuf-2.6.1-sparc-rtems6.txt
> +reporting: net/protobuf-2.6.1-1.cfg -> protobuf-2.6.1-sparc-rtems6.xml
> +staging: protobuf-2.6.1-sparc-rtems6 -> 
> $HOME/quick-start/src/rsb/rtems/build/tmp/sb-500-staging
> +cleaning: protobuf-2.6.1-sparc-rtems6
> +Build Set: Time 0:00:27.784056
> +Build Set: Time 0:02:32.697406
>  installing: bsps/erc32 -> $HOME/quick-start/rtems/
>  clean staging: bsps/erc32
> -Staging Size: 1.372GB
> -Build Set: Time 0:24:17.83979
> +Staging Size: 1.401GB
> +Build Set: Time 0:25:08.37754
>
>  The RSB BSP build can be customised with following RSB command line options:
>
> @@ -147,10 +147,10 @@ be a list of build sets. To view the avaliable build 
> sets run this command:
>  RTEMS package naming is based on the naming FreeBSD uses in its ports
>  collection.
>
> -This Quick Start Guide will build the BSD Library or :file:`5/rtems-libbsd`.
> +This Quick Start Guide will build the BSD Library or :file:`6/rtems-libbsd`.
>
>  An RTEMS package is hosted on RTEMS so the tool suite name needs to be 
> supplied
> -using the ``--host`` option, e.g. ``--host=sparc-rtem5``. The BSP needs to be
> +using the ``--host`` option, e.g. ``--host=sparc-rtem6``. The BSP needs to be
>  provided using the ``--with-rtems-bsp`` option,
>  e.g. ``--with-rtems-bsp=erc32``. The commands to build ``libbsd`` for the
>  ``erc32`` BSP are:
> @@ -158,25 +158,25 @@ e.g. ``--with-rtems-bsp=erc32``. The commands to build 
> ``libbsd`` for the
>  .. code-block:: none
>
>  cd $HOME/quick-start/src/rsb/rtems
> -../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/5 \
> -  --host=sparc-rtems5 --with-rtems-bsp=erc32 

Re: [PATCH v4] bsps: Move optfdt* files to shared parent directory

2021-08-09 Thread Joel Sherrill
On Mon, Aug 9, 2021 at 10:00 AM Gedare Bloom  wrote:
>
> Hi Joel,
>
> On Fri, Jul 16, 2021 at 10:40 AM Joel Sherrill  wrote:
> >
> > I'm doing a build sweep of all BSPs. When that completes, I plan to
> > push this unless there are comments.
> >
> Did/can you push this?

It doesn't apply for me. Could be a rebase is needed or it didn't survive
the email client. If it's just an email issue, just send it to me directly as an
attachment possibly compressed to avoid any chance of email clients
getting smart.

Applying: bsps: Move optfdt* files to shared parent directory
error: patch failed: spec/build/bsps/arm/beagle/optfdtcpyro.yml:1
error: spec/build/bsps/arm/beagle/optfdtcpyro.yml: patch does not apply
error: patch failed: spec/build/bsps/arm/beagle/optfdtmxsz.yml:1
error: spec/build/bsps/arm/beagle/optfdtmxsz.yml: patch does not apply
error: patch failed: spec/build/bsps/arm/beagle/optfdtro.yml:1
error: spec/build/bsps/arm/beagle/optfdtro.yml: patch does not apply
error: patch failed: spec/build/bsps/arm/beagle/optfdtuboot.yml:1
error: spec/build/bsps/arm/beagle/optfdtuboot.yml: patch does not apply
error: patch failed: spec/build/bsps/arm/imx/optfdtcpyro.yml:1
error: spec/build/bsps/arm/imx/optfdtcpyro.yml: patch does not apply
error: patch failed: spec/build/bsps/arm/imx/optfdtmxsz.yml:1
error: spec/build/bsps/arm/imx/optfdtmxsz.yml: patch does not apply
error: patch failed: spec/build/bsps/arm/imx/optfdtro.yml:1
error: spec/build/bsps/arm/imx/optfdtro.yml: patch does not apply
error: patch failed: spec/build/bsps/arm/imx/optfdtuboot.yml:1
error: spec/build/bsps/arm/imx/optfdtuboot.yml: patch does not apply
error: patch failed: spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml:1
error: spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml: patch does not apply
error: patch failed: spec/build/bsps/powerpc/qoriq/optfdtro.yml:1
error: spec/build/bsps/powerpc/qoriq/optfdtro.yml: patch does not apply
error: patch failed: spec/build/bsps/riscv/riscv/optfdtcpyro.yml:1
error: spec/build/bsps/riscv/riscv/optfdtcpyro.yml: patch does not apply
error: patch failed: spec/build/bsps/riscv/riscv/optfdtmxsz.yml:1
error: spec/build/bsps/riscv/riscv/optfdtmxsz.yml: patch does not apply
error: patch failed: spec/build/bsps/riscv/riscv/optfdtro.yml:1
error: spec/build/bsps/riscv/riscv/optfdtro.yml: patch does not apply
error: patch failed: spec/build/bsps/riscv/riscv/optfdtuboot.yml:1
error: spec/build/bsps/riscv/riscv/optfdtuboot.yml: patch does not apply
Patch failed at 0001 bsps: Move optfdt* files to shared parent directory
The copy of the patch that failed is found in:
   /home/joel/rtems-work/rtems/.git/rebase-apply/patch


>
> > On Fri, Jul 16, 2021 at 9:51 AM pranav  wrote:
> > >
> > > ---
> > >  .../arm/altera-cyclone-v/bspalteracyclonev.yml  |  8 
> > >  spec/build/bsps/arm/beagle/grp.yml  |  8 
> > >  spec/build/bsps/arm/beagle/optfdtcpyro.yml  | 16 
> > >  spec/build/bsps/arm/beagle/optfdtmxsz.yml   | 17 -
> > >  spec/build/bsps/arm/beagle/optfdtro.yml | 16 
> > >  spec/build/bsps/arm/beagle/optfdtuboot.yml  | 16 
> > >  spec/build/bsps/arm/imx/bspimx.yml  |  8 
> > >  spec/build/bsps/arm/imx/optfdtcpyro.yml | 16 
> > >  spec/build/bsps/arm/imx/optfdtmxsz.yml  | 17 -
> > >  spec/build/bsps/arm/imx/optfdtro.yml| 16 
> > >  spec/build/bsps/arm/imx/optfdtuboot.yml | 16 
> > >  spec/build/bsps/arm/raspberrypi/grp.yml |  8 
> > >  .../{arm/altera-cyclone-v => }/optfdtcpyro.yml  |  0
> > >  .../{arm/altera-cyclone-v => }/optfdtmxsz.yml   |  0
> > >  .../{arm/altera-cyclone-v => }/optfdtro.yml |  0
> > >  .../{arm/altera-cyclone-v => }/optfdtuboot.yml  |  0
> > >  spec/build/bsps/powerpc/qoriq/grp.yml   |  4 ++--
> > >  spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml| 17 -
> > >  spec/build/bsps/powerpc/qoriq/optfdtro.yml  | 16 
> > >  spec/build/bsps/riscv/riscv/grp.yml |  8 
> > >  spec/build/bsps/riscv/riscv/optfdtcpyro.yml | 16 
> > >  spec/build/bsps/riscv/riscv/optfdtmxsz.yml  | 17 -
> > >  spec/build/bsps/riscv/riscv/optfdtro.yml| 16 
> > >  spec/build/bsps/riscv/riscv/optfdtuboot.yml | 16 
> > >  24 files changed, 26 insertions(+), 246 deletions(-)
> > >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtcpyro.yml
> > >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtmxsz.yml
> > >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtro.yml
> > >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtuboot.yml
> > >  delete mode 100644 spec/build/bsps/arm/imx/optfdtcpyro.yml
> > >  delete mode 100644 spec/build/bsps/arm/imx/optfdtmxsz.yml
> > >  delete mode 100644 spec/build/bsps/arm/imx/optfdtro.yml
> > >  delete mode 100644 

Re: [PATCH v4] bsps: Move optfdt* files to shared parent directory

2021-08-09 Thread Pranav Dangi
Hi joel,
I had sent you a rebased patch as a direct attachment, I will ping that
thread once again. Did that fail too?

Thanks,
pranav

On Mon, 9 Aug 2021, 20:40 Joel Sherrill,  wrote:

> On Mon, Aug 9, 2021 at 10:00 AM Gedare Bloom  wrote:
> >
> > Hi Joel,
> >
> > On Fri, Jul 16, 2021 at 10:40 AM Joel Sherrill  wrote:
> > >
> > > I'm doing a build sweep of all BSPs. When that completes, I plan to
> > > push this unless there are comments.
> > >
> > Did/can you push this?
>
> It doesn't apply for me. Could be a rebase is needed or it didn't survive
> the email client. If it's just an email issue, just send it to me directly
> as an
> attachment possibly compressed to avoid any chance of email clients
> getting smart.
>
> Applying: bsps: Move optfdt* files to shared parent directory
> error: patch failed: spec/build/bsps/arm/beagle/optfdtcpyro.yml:1
> error: spec/build/bsps/arm/beagle/optfdtcpyro.yml: patch does not apply
> error: patch failed: spec/build/bsps/arm/beagle/optfdtmxsz.yml:1
> error: spec/build/bsps/arm/beagle/optfdtmxsz.yml: patch does not apply
> error: patch failed: spec/build/bsps/arm/beagle/optfdtro.yml:1
> error: spec/build/bsps/arm/beagle/optfdtro.yml: patch does not apply
> error: patch failed: spec/build/bsps/arm/beagle/optfdtuboot.yml:1
> error: spec/build/bsps/arm/beagle/optfdtuboot.yml: patch does not apply
> error: patch failed: spec/build/bsps/arm/imx/optfdtcpyro.yml:1
> error: spec/build/bsps/arm/imx/optfdtcpyro.yml: patch does not apply
> error: patch failed: spec/build/bsps/arm/imx/optfdtmxsz.yml:1
> error: spec/build/bsps/arm/imx/optfdtmxsz.yml: patch does not apply
> error: patch failed: spec/build/bsps/arm/imx/optfdtro.yml:1
> error: spec/build/bsps/arm/imx/optfdtro.yml: patch does not apply
> error: patch failed: spec/build/bsps/arm/imx/optfdtuboot.yml:1
> error: spec/build/bsps/arm/imx/optfdtuboot.yml: patch does not apply
> error: patch failed: spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml:1
> error: spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml: patch does not apply
> error: patch failed: spec/build/bsps/powerpc/qoriq/optfdtro.yml:1
> error: spec/build/bsps/powerpc/qoriq/optfdtro.yml: patch does not apply
> error: patch failed: spec/build/bsps/riscv/riscv/optfdtcpyro.yml:1
> error: spec/build/bsps/riscv/riscv/optfdtcpyro.yml: patch does not apply
> error: patch failed: spec/build/bsps/riscv/riscv/optfdtmxsz.yml:1
> error: spec/build/bsps/riscv/riscv/optfdtmxsz.yml: patch does not apply
> error: patch failed: spec/build/bsps/riscv/riscv/optfdtro.yml:1
> error: spec/build/bsps/riscv/riscv/optfdtro.yml: patch does not apply
> error: patch failed: spec/build/bsps/riscv/riscv/optfdtuboot.yml:1
> error: spec/build/bsps/riscv/riscv/optfdtuboot.yml: patch does not apply
> Patch failed at 0001 bsps: Move optfdt* files to shared parent directory
> The copy of the patch that failed is found in:
>/home/joel/rtems-work/rtems/.git/rebase-apply/patch
>
>
> >
> > > On Fri, Jul 16, 2021 at 9:51 AM pranav  wrote:
> > > >
> > > > ---
> > > >  .../arm/altera-cyclone-v/bspalteracyclonev.yml  |  8 
> > > >  spec/build/bsps/arm/beagle/grp.yml  |  8 
> > > >  spec/build/bsps/arm/beagle/optfdtcpyro.yml  | 16
> 
> > > >  spec/build/bsps/arm/beagle/optfdtmxsz.yml   | 17
> -
> > > >  spec/build/bsps/arm/beagle/optfdtro.yml | 16
> 
> > > >  spec/build/bsps/arm/beagle/optfdtuboot.yml  | 16
> 
> > > >  spec/build/bsps/arm/imx/bspimx.yml  |  8 
> > > >  spec/build/bsps/arm/imx/optfdtcpyro.yml | 16
> 
> > > >  spec/build/bsps/arm/imx/optfdtmxsz.yml  | 17
> -
> > > >  spec/build/bsps/arm/imx/optfdtro.yml| 16
> 
> > > >  spec/build/bsps/arm/imx/optfdtuboot.yml | 16
> 
> > > >  spec/build/bsps/arm/raspberrypi/grp.yml |  8 
> > > >  .../{arm/altera-cyclone-v => }/optfdtcpyro.yml  |  0
> > > >  .../{arm/altera-cyclone-v => }/optfdtmxsz.yml   |  0
> > > >  .../{arm/altera-cyclone-v => }/optfdtro.yml |  0
> > > >  .../{arm/altera-cyclone-v => }/optfdtuboot.yml  |  0
> > > >  spec/build/bsps/powerpc/qoriq/grp.yml   |  4 ++--
> > > >  spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml| 17
> -
> > > >  spec/build/bsps/powerpc/qoriq/optfdtro.yml  | 16
> 
> > > >  spec/build/bsps/riscv/riscv/grp.yml |  8 
> > > >  spec/build/bsps/riscv/riscv/optfdtcpyro.yml | 16
> 
> > > >  spec/build/bsps/riscv/riscv/optfdtmxsz.yml  | 17
> -
> > > >  spec/build/bsps/riscv/riscv/optfdtro.yml| 16
> 
> > > >  spec/build/bsps/riscv/riscv/optfdtuboot.yml | 16
> 
> > > >  24 files changed, 26 insertions(+), 246 deletions(-)
> > > >  delete mode 100644 spec/build/bsps/arm/beagle/optfdtcpyro.yml
> > > >  delete mode 100644 spec/build/bsps/arm/bea

Re: [PATCH] user: Update rsb-packages to reflect RTEMS 6 changes

2021-08-09 Thread Joel Sherrill
On Mon, Aug 9, 2021 at 10:07 AM Gedare Bloom  wrote:
>
> I have to think about this. The approach taken here just replaces 5.1
> -> 6, it isn't updating the screengrabs. This means the tutorial isn't
> "real" but that might be fine.

He can replace the screenshots but that is not worth the trouble at
this point IMO.

> The other issue is that when we release, then this has to become 6 ->
> 6.1 in the release, and 6 -> 7 in the master. How we manage this
> becomes part of the release overhead.

As Andrei pointed out, these sections trick you into thinking that
you can ftp "releases" from the master. But they aren't right for the
master if they say 5 or 6. I'm prone to have these type of sections
have prominent warnings that they only apply to releases and not
to fetching from git. At least that keeps the sections and flags them.

But it doesn't do anything about the burden of the release cycle.

--joel

> On Fri, Aug 6, 2021 at 3:27 PM Ray Garza  wrote:
> >
> > This updates all references and examples in the rtems docs: 
> > user/start/rsb-packages.rst to RTEMS 6
> >
> > ---
> >  user/start/rsb-packages.rst | 68 ++---
> >  1 file changed, 34 insertions(+), 34 deletions(-)
> >
> > diff --git a/user/start/rsb-packages.rst b/user/start/rsb-packages.rst
> > index 3119318..891ea6a 100644
> > --- a/user/start/rsb-packages.rst
> > +++ b/user/start/rsb-packages.rst
> > @@ -19,8 +19,8 @@ Return to here once you have completed these steps.
> >
> >  You have chosen an installation prefix, the BSP to build, the tool's
> >  architecure and prepared the source for the RSB in the previous sections.  
> > We
> > -have chosen :file:`$HOME/quick-start/rtems/5` as the installation prefix, 
> > the
> > -``erc32`` BSP and the SPARC architecture name of ``sparc-rtems5``, and 
> > unpacked
> > +have chosen :file:`$HOME/quick-start/rtems/6` as the installation prefix, 
> > the
> > +``erc32`` BSP and the SPARC architecture name of ``sparc-rtems6``, and 
> > unpacked
> >  the RSB source in :file:`$HOME/quick-start/src`.
> >
> >  You are now able to build :ref:`BSP Packages` or 3rd party libraries of 
> > code if you
> > @@ -72,36 +72,36 @@ BSP.
> >  .. code-block:: none
> >
> >  cd $HOME/quick-start/src/rsb/rtems
> > -../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/5 \
> > +../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 \
> >  --with-rtems-tests=yes bsps/erc32
> >
> >  This command should output something like this:
> >
> >  .. code-block:: none
> >
> > -RTEMS Source Builder - Set Builder, 5.1.0
> > +RTEMS Source Builder - Set Builder, 6 (4e6dc6431435)
> >  Build Set: bsps/erc32
> > -Build Set: 5/rtems-sparc.bset
> > -Build Set: 5/rtems-autotools.bset
> > -Build Set: 5/rtems-autotools-internal.bset
> > +Build Set: 6/rtems-sparc.bset
> > +Build Set: 6/rtems-autotools.bset
> > +Build Set: 6/rtems-autotools-internal.bset
> >  config: tools/rtems-autoconf-2.69-1.cfg
> >  package: autoconf-2.69-x86_64-freebsd12.1-1
> >  building: autoconf-2.69-x86_64-freebsd12.1-1
> >  sizes: autoconf-2.69-x86_64-freebsd12.1-1: 7.505MB (installed: 0.000B)
> >  ...
> > -building: protobuf-2.6.1-sparc-rtems5-1
> > -sizes: protobuf-2.6.1-sparc-rtems5-1: 228.079MB (installed: 84.408MB)
> > -cleaning: protobuf-2.6.1-sparc-rtems5-1
> > -reporting: net/protobuf-2.6.1-1.cfg -> 
> > protobuf-2.6.1-sparc-rtems5-1.txt
> > -reporting: net/protobuf-2.6.1-1.cfg -> 
> > protobuf-2.6.1-sparc-rtems5-1.xml
> > -staging: protobuf-2.6.1-sparc-rtems5-1 -> 
> > $HOME/quick-start/src/rsb/rtems/build/tmp/sb-500-staging
> > -cleaning: protobuf-2.6.1-sparc-rtems5-1
> > -Build Set: Time 0:00:23.564992
> > -Build Set: Time 0:02:27.380299
> > +building: protobuf-2.6.1-sparc-rtems6
> > +sizes: protobuf-2.6.1-sparc-rtems6: 228.079MB (installed: 84.408MB)
> > +cleaning: protobuf-2.6.1-sparc-rtems6
> > +reporting: net/protobuf-2.6.1-1.cfg -> protobuf-2.6.1-sparc-rtems6.txt
> > +reporting: net/protobuf-2.6.1-1.cfg -> protobuf-2.6.1-sparc-rtems6.xml
> > +staging: protobuf-2.6.1-sparc-rtems6 -> 
> > $HOME/quick-start/src/rsb/rtems/build/tmp/sb-500-staging
> > +cleaning: protobuf-2.6.1-sparc-rtems6
> > +Build Set: Time 0:00:27.784056
> > +Build Set: Time 0:02:32.697406
> >  installing: bsps/erc32 -> $HOME/quick-start/rtems/
> >  clean staging: bsps/erc32
> > -Staging Size: 1.372GB
> > -Build Set: Time 0:24:17.83979
> > +Staging Size: 1.401GB
> > +Build Set: Time 0:25:08.37754
> >
> >  The RSB BSP build can be customised with following RSB command line 
> > options:
> >
> > @@ -147,10 +147,10 @@ be a list of build sets. To view the avaliable build 
> > sets run this command:
> >  RTEMS package naming is based on the naming FreeBSD uses in its ports
> >  collection.
> >
> > -This Quick Start Guide will build the BSD Library or 
> > :file:`5/rtems-libbsd`

Re: [PATCH rtems-libbsd v3 1/3] rtemsbsd/bus: Add PCI support to the nexus bus

2021-08-09 Thread Gedare Bloom
On Sun, Aug 8, 2021 at 7:22 PM Chris Johns  wrote:
>
> - Add PCI IO region support
>
> - Add support map buffers to PCI address space
>
> - Add BSP conditional IO space support. Some PC implementations
>   have PCI IO space mapped differently to memory space and this needs
>   to be reflected in the busspace.
>
> - Include bsp.h to pick per BSP configuration.
>
> Closes #4245
> ---
>  rtemsbsd/include/machine/bus.h| 370 ++
>  rtemsbsd/rtems/rtems-kernel-bus-dma.c |   5 +-
>  rtemsbsd/rtems/rtems-kernel-nexus.c   |  52 +++-
>  3 files changed, 312 insertions(+), 115 deletions(-)
>
> diff --git a/rtemsbsd/include/machine/bus.h b/rtemsbsd/include/machine/bus.h
> index 2f0e7ad6..999f5d45 100644
> --- a/rtemsbsd/include/machine/bus.h
> +++ b/rtemsbsd/include/machine/bus.h
> @@ -6,9 +6,13 @@
>   * @brief TODO.
>   *
>   * File origin from FreeBSD 'sys/amd64/include/bus.h'.
> + *
> + * Conditionally supports PCI IO regions (IO Ports).
>   */
>
>  /*-
> + * Copyright (c) 2021 Chris Johns.  All rights reserved.
> + *
>   * Copyright (c) 2009, 2015 embedded brains GmbH.  All rights reserved.
>   *
>   *  embedded brains GmbH
> @@ -25,7 +29,7 @@
>   * 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 as
>   *the first lines of this file unmodified.
> @@ -34,7 +38,7 @@
>   *documentation and/or other materials provided with the distribution.
>   * 3. The name of the author may not be used to endorse or promote products
>   *derived from this software without specific prior written permission.
> - *
> + *
>   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
> @@ -123,9 +127,46 @@
>  #endif
>
>  #ifdef __i386__
> -  #error "your include paths are wrong"
> +  #error "x86 has its own bus.h; check your include paths are correct"
>  #endif
>
> +#include 
> +
> +/*
> + * BSP PCI Support
> + *
> + * The RTEMS Nexus bus support can optionaly support PC PCI spaces that
optionally

> + * mapped to BSP speciic address spaces. Add the following define to
specific

> + * the BSP header file to enable this support:
> + *
> + *  #define BSP_HAS_PC_PCI

Is there an rtems.git patch to add this to some BSP?

I might suggest BSP_HAS_PCI_IO_PORTS

> + *
> + * If enabled a BSP must the following IO region calls:
must support?

> + *
> + * inb  : read 8 bits
> + * outb : write 8 bits
> + * inw  : read 16 bits
> + * outw : write 16 bits
> + * inl  : read 32 bits
> + * outl : write 32 bits
> + *
> + * The BSP needs to provide the DRAM address space offset
> + * PCI_DRAM_OFFSET. This is the base address of the DRAM as seen by a
> + * PCI master.
> + *
> + * i386 BSPs have a special bus.h file and do not use this file.
> + */
> +
> +#ifdef BSP_HAS_PC_PCI
> +
> +/*
> + * Values for the bus space tag, not to be used directly by MI code.
> + */
> +#defineBSP_BUS_SPACE_IO0   /* space is i/o space */
> +#defineBSP_BUS_SPACE_MEM   1   /* space is mem space */
> +
> +#endif /* BSP_HAS_PC_PCI */
> +
>  /*
>   * Bus address alignment.
>   */
> @@ -144,6 +185,7 @@
>  /*
>   * Bus access.
>   */
> +#define BUS_SPACE_INVALID_DATA (~0)
Please use 0U here. I get the undefined behavior (UB) willies when I
see bit-twiddling on signed integer types.

>  #define BUS_SPACE_UNRESTRICTED (~0U)
>
>  /*
> @@ -222,6 +264,102 @@ bus_space_barrier(bus_space_tag_t bst __unused, 
> bus_space_handle_t bsh, bus_size
> /* Do nothing */
>  }
>
> +/*
> + * BSP Bus Space Map Support
> + *
> + * Provide as C macros in the BSP header (bsp.h) the following:

Not really clear to me under what conditions these should be provided.
This could be wrapped by #ifndef BSP_HAS_PC_PCI?

> + *
> + *  RTEMS_BSP_READ_1
> + *  RTEMS_BSP_READ_2
> + *  RTEMS_BSP_READ_4
> + *  RTEMS_BSP_READ_8
> + *  RTEMS_BSP_WRITE_1
> + *  RTEMS_BSP_WRITE_2
> + *  RTEMS_BSP_WRITE_4
> + *  RTEMS_BSP_WRITE_8
> + */
> +
> +static __inline uint8_t
> +bsp_bus_space_read_1(const uint8_t __volatile *bsp)
> +{
> +#if defined(RTEMS_BSP_READ_1)
> +   return RTEMS_BSP_READ_1(bsp);
> +#else
> +   return (*bsp);
> +#endif
> +}
> +
> +static __inline uint16_t
> +bsp_bus_space_read_2(const uint16_t __volatile *bsp)
> +{
> +#if defined(RTEMS_BSP_READ_2)
> +   return RTEMS_BSP_READ_2(bsp);
> +#else
> +   return (*bsp);
> +#endif
> +}
> +
> +static __inline uint32_t
> +bsp_bus_space_read_4(const uint32_t __volatile *bsp)
> +{
> +#if defined(RTEMS_BSP_READ_4)
> +   return RTEMS_BSP_READ_4(bsp);
> +#else
> +   return (*bsp);
> +#endif
> +}
> +
> +static __inline uint64_t
> +bsp_bus_space_rea

Re: [PATCH rtems-libbsd v3 2/3] rtemsbsd: Add interface support routines

2021-08-09 Thread Gedare Bloom
On Sun, Aug 8, 2021 at 7:22 PM Chris Johns  wrote:
>
> - Add the ability to check if an interface is up
> ---
>  libbsd.py  |   1 +
>  rtemsbsd/include/rtems/bsd/iface.h |  62 
>  rtemsbsd/rtems/rtems-bsd-iface.c   | 146 +
>  3 files changed, 209 insertions(+)
>  create mode 100644 rtemsbsd/include/rtems/bsd/iface.h
>  create mode 100644 rtemsbsd/rtems/rtems-bsd-iface.c
>
> diff --git a/libbsd.py b/libbsd.py
> index 09a1fbc4..6e09a07c 100644
> --- a/libbsd.py
> +++ b/libbsd.py
> @@ -253,6 +253,7 @@ class rtems(builder.Module):
>  'rtems/rtems-bsd-cxx.cc',
>  'rtems/rtems-bsd-get-ethernet-addr.c',
>  'rtems/rtems-bsd-ifconfig.c',
> +'rtems/rtems-bsd-iface.c',
>  'rtems/rtems-bsd-ifconfig-lo0.c',
>  'rtems/rtems-bsd-init-dhcp.c',
>  'rtems/rtems-bsd-rc-conf-net.c',
> diff --git a/rtemsbsd/include/rtems/bsd/iface.h 
> b/rtemsbsd/include/rtems/bsd/iface.h
> new file mode 100644
> index ..9e583b8a
> --- /dev/null
> +++ b/rtemsbsd/include/rtems/bsd/iface.h
> @@ -0,0 +1,62 @@
> +/**
> + * @file
> + *
> + * @ingroup rtems_bsd_rtems
> + *
> + * @brief This file provide a high level interface to simple interface
> + * support calls.
> + */
> +
> +/*
> + * Copyright (c) 2021. Chris Johns . All rights reserved.
> + *
> + * 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 AUTHOR 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 AUTHOR 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.
> + */
> +
> +#ifndef _RTEMS_BSD_IFACE_H_
> +#define _RTEMS_BSD_IFACE_H_
> +
> +#include 
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +
> +struct rtems_bsd_iface {
> +   char name[IFNAMSIZ];
> +   int unit;
> +   struct in_addr address;
> +   size_t hw_len;
> +   uint8_t hw_address[16];
> +   struct ifreq ifr;
> +   int linkstate;
> +};
> +
> +/*
> + * These calls return 0 is successful and -1 and errno set on error.
> + */
> +int rtems_bsd_iface_get(const char *name, struct rtems_bsd_iface *iface);
> +int rtems_bsd_iface_link_state(const char *name, bool *state);
> +
> +#endif
> diff --git a/rtemsbsd/rtems/rtems-bsd-iface.c 
> b/rtemsbsd/rtems/rtems-bsd-iface.c
> new file mode 100644
> index ..4cf25a9b
> --- /dev/null
> +++ b/rtemsbsd/rtems/rtems-bsd-iface.c
> @@ -0,0 +1,146 @@
> +/**
> + * @file
> + *
> + * @ingroup rtems_bsd_rtems
> + *
> + * @brief Interface support routines
> + */
> +
> +/*
> + * Copyright (c) 2021. Chris Johns   All rights reserved.
> + *
> + * 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 AUTHOR 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 AUTHOR 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 O

Re: [PATCH] user: Update rsb-packages to reflect RTEMS 6 changes

2021-08-09 Thread Gedare Bloom
On Mon, Aug 9, 2021 at 9:18 AM Joel Sherrill  wrote:
>
> On Mon, Aug 9, 2021 at 10:07 AM Gedare Bloom  wrote:
> >
> > I have to think about this. The approach taken here just replaces 5.1
> > -> 6, it isn't updating the screengrabs. This means the tutorial isn't
> > "real" but that might be fine.
>
> He can replace the screenshots but that is not worth the trouble at
> this point IMO.
>
> > The other issue is that when we release, then this has to become 6 ->
> > 6.1 in the release, and 6 -> 7 in the master. How we manage this
> > becomes part of the release overhead.
>
> As Andrei pointed out, these sections trick you into thinking that
> you can ftp "releases" from the master. But they aren't right for the
> master if they say 5 or 6. I'm prone to have these type of sections
> have prominent warnings that they only apply to releases and not
> to fetching from git. At least that keeps the sections and flags them.
>
I'm ok with that.

> But it doesn't do anything about the burden of the release cycle.
>
Either we end up with instructions from an older release in a new one,
or we need a way to (automate) update for a release.

> --joel
>
> > On Fri, Aug 6, 2021 at 3:27 PM Ray Garza  wrote:
> > >
> > > This updates all references and examples in the rtems docs: 
> > > user/start/rsb-packages.rst to RTEMS 6
> > >
> > > ---
> > >  user/start/rsb-packages.rst | 68 ++---
> > >  1 file changed, 34 insertions(+), 34 deletions(-)
> > >
> > > diff --git a/user/start/rsb-packages.rst b/user/start/rsb-packages.rst
> > > index 3119318..891ea6a 100644
> > > --- a/user/start/rsb-packages.rst
> > > +++ b/user/start/rsb-packages.rst
> > > @@ -19,8 +19,8 @@ Return to here once you have completed these steps.
> > >
> > >  You have chosen an installation prefix, the BSP to build, the tool's
> > >  architecure and prepared the source for the RSB in the previous 
> > > sections.  We
> > > -have chosen :file:`$HOME/quick-start/rtems/5` as the installation 
> > > prefix, the
> > > -``erc32`` BSP and the SPARC architecture name of ``sparc-rtems5``, and 
> > > unpacked
> > > +have chosen :file:`$HOME/quick-start/rtems/6` as the installation 
> > > prefix, the
> > > +``erc32`` BSP and the SPARC architecture name of ``sparc-rtems6``, and 
> > > unpacked
> > >  the RSB source in :file:`$HOME/quick-start/src`.
> > >
> > >  You are now able to build :ref:`BSP Packages` or 3rd party libraries of 
> > > code if you
> > > @@ -72,36 +72,36 @@ BSP.
> > >  .. code-block:: none
> > >
> > >  cd $HOME/quick-start/src/rsb/rtems
> > > -../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/5 \
> > > +../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 \
> > >  --with-rtems-tests=yes bsps/erc32
> > >
> > >  This command should output something like this:
> > >
> > >  .. code-block:: none
> > >
> > > -RTEMS Source Builder - Set Builder, 5.1.0
> > > +RTEMS Source Builder - Set Builder, 6 (4e6dc6431435)
> > >  Build Set: bsps/erc32
> > > -Build Set: 5/rtems-sparc.bset
> > > -Build Set: 5/rtems-autotools.bset
> > > -Build Set: 5/rtems-autotools-internal.bset
> > > +Build Set: 6/rtems-sparc.bset
> > > +Build Set: 6/rtems-autotools.bset
> > > +Build Set: 6/rtems-autotools-internal.bset
> > >  config: tools/rtems-autoconf-2.69-1.cfg
> > >  package: autoconf-2.69-x86_64-freebsd12.1-1
> > >  building: autoconf-2.69-x86_64-freebsd12.1-1
> > >  sizes: autoconf-2.69-x86_64-freebsd12.1-1: 7.505MB (installed: 
> > > 0.000B)
> > >  ...
> > > -building: protobuf-2.6.1-sparc-rtems5-1
> > > -sizes: protobuf-2.6.1-sparc-rtems5-1: 228.079MB (installed: 84.408MB)
> > > -cleaning: protobuf-2.6.1-sparc-rtems5-1
> > > -reporting: net/protobuf-2.6.1-1.cfg -> 
> > > protobuf-2.6.1-sparc-rtems5-1.txt
> > > -reporting: net/protobuf-2.6.1-1.cfg -> 
> > > protobuf-2.6.1-sparc-rtems5-1.xml
> > > -staging: protobuf-2.6.1-sparc-rtems5-1 -> 
> > > $HOME/quick-start/src/rsb/rtems/build/tmp/sb-500-staging
> > > -cleaning: protobuf-2.6.1-sparc-rtems5-1
> > > -Build Set: Time 0:00:23.564992
> > > -Build Set: Time 0:02:27.380299
> > > +building: protobuf-2.6.1-sparc-rtems6
> > > +sizes: protobuf-2.6.1-sparc-rtems6: 228.079MB (installed: 84.408MB)
> > > +cleaning: protobuf-2.6.1-sparc-rtems6
> > > +reporting: net/protobuf-2.6.1-1.cfg -> 
> > > protobuf-2.6.1-sparc-rtems6.txt
> > > +reporting: net/protobuf-2.6.1-1.cfg -> 
> > > protobuf-2.6.1-sparc-rtems6.xml
> > > +staging: protobuf-2.6.1-sparc-rtems6 -> 
> > > $HOME/quick-start/src/rsb/rtems/build/tmp/sb-500-staging
> > > +cleaning: protobuf-2.6.1-sparc-rtems6
> > > +Build Set: Time 0:00:27.784056
> > > +Build Set: Time 0:02:32.697406
> > >  installing: bsps/erc32 -> $HOME/quick-start/rtems/
> > >  clean staging: bsps/erc32
> > > -Staging Size: 1.372GB
> > > -Build Set: Time 0:24:17.83979
> > > +Staging Size: 1.40

Re: [PATCH v4] Test needed for timer_create with CLOCK_MONOTONIC

2021-08-09 Thread Gedare Bloom
Hi Zack,

Getting really close. I have just a few minor nits for you to fix up.

On Sun, Aug 8, 2021 at 7:15 PM Zacchaeus Leung  wrote:
>
> the timer_create() method can use CLOCK_MONOTONIC but there was  no test for 
> this. Also it implements the functionality to
Wrap commit message lines before 76 characters. It then looks cleaner
in git-log (which indents a tab).

> create a CLOCK_MONOTONIC timer and gettime() .

I'd like to see a blank line between the commit message and the Closes line.

> Closes #3888
I still don't know why you're closing this ticket?
https://devel.rtems.org/ticket/3888

> ---
>  cpukit/include/rtems/posix/timer.h|  1 +
>  cpukit/posix/src/psxtimercreate.c |  3 +-
>  cpukit/posix/src/timergettime.c   | 50 ---
>  testsuites/psxtests/psxtimer02/psxtimer.c | 26 ++
>  testsuites/psxtests/psxtimer02/psxtimer02.scn |  6 +++
>  5 files changed, 66 insertions(+), 20 deletions(-)
>
> diff --git a/cpukit/include/rtems/posix/timer.h 
> b/cpukit/include/rtems/posix/timer.h
> index bcbf07a65a..7ae089173a 100644
> --- a/cpukit/include/rtems/posix/timer.h
> +++ b/cpukit/include/rtems/posix/timer.h
> @@ -48,6 +48,7 @@ typedef struct {
>uint32_t  ticks;  /* Number of ticks of the initialization */
>uint32_t  overrun;/* Number of expirations of the timer*/
>struct timespec   time;   /* Time at which the timer was started   */
> +  clockid_t clock_type; /* The type of timer */
>  } POSIX_Timer_Control;
>
>  /**
> diff --git a/cpukit/posix/src/psxtimercreate.c 
> b/cpukit/posix/src/psxtimercreate.c
> index a63cf1d100..2b5a10140f 100644
> --- a/cpukit/posix/src/psxtimercreate.c
> +++ b/cpukit/posix/src/psxtimercreate.c
> @@ -40,7 +40,7 @@ int timer_create(
>  {
>POSIX_Timer_Control *ptimer;
>
> -  if ( clock_id != CLOCK_REALTIME )
> +  if (  clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC )
>  rtems_set_errno_and_return_minus_one( EINVAL );
>
>if ( !timerid )
> @@ -91,6 +91,7 @@ int timer_create(
>ptimer->timer_data.it_value.tv_nsec= 0;
>ptimer->timer_data.it_interval.tv_sec  = 0;
>ptimer->timer_data.it_interval.tv_nsec = 0;
> +  ptimer->clock_type = clock_id;
>
>_Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() );
>_Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR );
> diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
> index ee2a566f0e..2ad841d517 100644
> --- a/cpukit/posix/src/timergettime.c
> +++ b/cpukit/posix/src/timergettime.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  /*
>   *  - When a timer is initialized, the value of the time in
> @@ -39,35 +40,46 @@
>  int timer_gettime(
>timer_ttimerid,
>struct itimerspec *value
> )
>  {
>POSIX_Timer_Control *ptimer;
> -  ISR_lock_Context lock_context;
> -  uint64_t now;
> -  uint32_t remaining;
> +  ISR_lock_Context lock_context;
> +  Per_CPU_Control *cpu;
> +  struct timespec now;
> +  struct timespec expire;
> +  struct timespec result;
>
>if ( !value )
>  rtems_set_errno_and_return_minus_one( EINVAL );
>
>ptimer = _POSIX_Timer_Get( timerid, &lock_context );
> -  if ( ptimer != NULL ) {
> -Per_CPU_Control *cpu;
> +  if ( ptimer == NULL ) {
> +rtems_set_errno_and_return_minus_one( EINVAL );
> +  }
>
> -cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
> -now = cpu->Watchdog.ticks;
> +  cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
> +  rtems_timespec_from_ticks( ptimer->Timer.expire, &expire );
>
> -if ( now < ptimer->Timer.expire ) {
> -  remaining = (uint32_t) ( ptimer->Timer.expire - now );
> -} else {
> -  remaining = 0;
> -}
> +  if ( ptimer->clock_type == CLOCK_MONOTONIC ) {
> +  _Timecounter_Nanouptime(&now);
indent

> +  } else  if ( ptimer->clock_type == CLOCK_REALTIME ) {
> +_TOD_Get(&now);
indent

> +  } else {
> +  _POSIX_Timer_Release( cpu, &lock_context );
> +  rtems_set_errno_and_return_minus_one( EINVAL );
indent

> +  }
>
> -_Timespec_From_ticks( remaining, &value->it_value );
> -value->it_interval = ptimer->timer_data.it_interval;
>
> -_POSIX_Timer_Release( cpu, &lock_context );
> -return 0;
> + if ( rtems_timespec_less_than( &now, &expire ) ) {
indent off-by-1

> +  rtems_timespec_subtract( &now, &expire, &result );
too much indent

> +  } else {
> +  result.tv_nsec = 0;
> +  result.tv_sec  = 0;
too much indent

>}
> -
> -  rtems_set_errno_and_return_minus_one( EINVAL );
> +
> +  value->it_value = result;
> +  value->it_interval = ptimer->timer_data.it_interval;
> +
> +  _POSIX_Timer_Release( cpu, &lock_context );
> +  return 0;
>  }
> diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c 
> b/testsuites/psxtests/psxtimer02/psxtimer.c
> index 9f79d33c42..1a79369efb 100644
> --- a/testsuites/psxtests/psxtimer02/psxtimer.c
> +

Re: [PATCH rtems-libbsd v4] NFSv4 Patches

2021-08-09 Thread Gedare Bloom
Things look mostly fine to me. But the last patch:
kern/sys: Add NFSv4 client
* in the buildset configuration, should we use nfsv4 to be explicit?
Or you think 'nfs' is fine?

* freebsd/sys/fs/nfs/nfs_commonkrpc.c: there are random whitespace
changes without guards, and ws changes inside of #ifndef __rtems__.
These might be artifacts of including the .clang-format? Or your
editor got aggressive.

* freebsd/sys/fs/nfsclient/nfs_clvnops.c: ditto

* rtemsbsd/fs/nfsclient/nfs.c: tabs used for indents is inconsistent
with other rtemsbsd sources. Also, you can use the following instead
of memset() with 0:
  int some_array[10] = {0};

On Wed, Aug 4, 2021 at 2:53 AM  wrote:
>
> Hi,
>
> This the first group of patches for the NFSv4 port. This is the only
> part of the patches posted to devel, the complete series of patches
> can be downloaded from:
>
> https://ftp.rtems.org/pub/rtems/people/chrisj/nfsv4/patches/4/
>
> I have pushed the patch series to my personal repo:
>
> https://git.rtems.org/chrisj/rtems-libbsd.git/?h=4475-p4-4475-nfs
>
> The changes here:
>
> 1. Kernel symbols use a FreeBSD format (tab)
>
> 2. Fixed the lock to be as small as possible
>
> 3. Thread name is reference
>
> 4. Added code is now in the FreeBSD format
>
> 5. Other minor changes as highligthed in the first review
>
> Chris
>
> ___
> 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 v4] bsps: Move optfdt* files to shared parent directory

2021-08-09 Thread Joel Sherrill
On Mon, Aug 9, 2021, 10:14 AM Pranav Dangi  wrote:

> Hi joel,
> I had sent you a rebased patch as a direct attachment, I will ping that
> thread once again. Did that fail too?
>

I just pushed a patch you sent me directly. Is it ok on master now?

--joel

>
> Thanks,
> pranav
>
> On Mon, 9 Aug 2021, 20:40 Joel Sherrill,  wrote:
>
>> On Mon, Aug 9, 2021 at 10:00 AM Gedare Bloom  wrote:
>> >
>> > Hi Joel,
>> >
>> > On Fri, Jul 16, 2021 at 10:40 AM Joel Sherrill  wrote:
>> > >
>> > > I'm doing a build sweep of all BSPs. When that completes, I plan to
>> > > push this unless there are comments.
>> > >
>> > Did/can you push this?
>>
>> It doesn't apply for me. Could be a rebase is needed or it didn't survive
>> the email client. If it's just an email issue, just send it to me
>> directly as an
>> attachment possibly compressed to avoid any chance of email clients
>> getting smart.
>>
>> Applying: bsps: Move optfdt* files to shared parent directory
>> error: patch failed: spec/build/bsps/arm/beagle/optfdtcpyro.yml:1
>> error: spec/build/bsps/arm/beagle/optfdtcpyro.yml: patch does not apply
>> error: patch failed: spec/build/bsps/arm/beagle/optfdtmxsz.yml:1
>> error: spec/build/bsps/arm/beagle/optfdtmxsz.yml: patch does not apply
>> error: patch failed: spec/build/bsps/arm/beagle/optfdtro.yml:1
>> error: spec/build/bsps/arm/beagle/optfdtro.yml: patch does not apply
>> error: patch failed: spec/build/bsps/arm/beagle/optfdtuboot.yml:1
>> error: spec/build/bsps/arm/beagle/optfdtuboot.yml: patch does not apply
>> error: patch failed: spec/build/bsps/arm/imx/optfdtcpyro.yml:1
>> error: spec/build/bsps/arm/imx/optfdtcpyro.yml: patch does not apply
>> error: patch failed: spec/build/bsps/arm/imx/optfdtmxsz.yml:1
>> error: spec/build/bsps/arm/imx/optfdtmxsz.yml: patch does not apply
>> error: patch failed: spec/build/bsps/arm/imx/optfdtro.yml:1
>> error: spec/build/bsps/arm/imx/optfdtro.yml: patch does not apply
>> error: patch failed: spec/build/bsps/arm/imx/optfdtuboot.yml:1
>> error: spec/build/bsps/arm/imx/optfdtuboot.yml: patch does not apply
>> error: patch failed: spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml:1
>> error: spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml: patch does not apply
>> error: patch failed: spec/build/bsps/powerpc/qoriq/optfdtro.yml:1
>> error: spec/build/bsps/powerpc/qoriq/optfdtro.yml: patch does not apply
>> error: patch failed: spec/build/bsps/riscv/riscv/optfdtcpyro.yml:1
>> error: spec/build/bsps/riscv/riscv/optfdtcpyro.yml: patch does not apply
>> error: patch failed: spec/build/bsps/riscv/riscv/optfdtmxsz.yml:1
>> error: spec/build/bsps/riscv/riscv/optfdtmxsz.yml: patch does not apply
>> error: patch failed: spec/build/bsps/riscv/riscv/optfdtro.yml:1
>> error: spec/build/bsps/riscv/riscv/optfdtro.yml: patch does not apply
>> error: patch failed: spec/build/bsps/riscv/riscv/optfdtuboot.yml:1
>> error: spec/build/bsps/riscv/riscv/optfdtuboot.yml: patch does not apply
>> Patch failed at 0001 bsps: Move optfdt* files to shared parent directory
>> The copy of the patch that failed is found in:
>>/home/joel/rtems-work/rtems/.git/rebase-apply/patch
>>
>>
>> >
>> > > On Fri, Jul 16, 2021 at 9:51 AM pranav  wrote:
>> > > >
>> > > > ---
>> > > >  .../arm/altera-cyclone-v/bspalteracyclonev.yml  |  8 
>> > > >  spec/build/bsps/arm/beagle/grp.yml  |  8 
>> > > >  spec/build/bsps/arm/beagle/optfdtcpyro.yml  | 16
>> 
>> > > >  spec/build/bsps/arm/beagle/optfdtmxsz.yml   | 17
>> -
>> > > >  spec/build/bsps/arm/beagle/optfdtro.yml | 16
>> 
>> > > >  spec/build/bsps/arm/beagle/optfdtuboot.yml  | 16
>> 
>> > > >  spec/build/bsps/arm/imx/bspimx.yml  |  8 
>> > > >  spec/build/bsps/arm/imx/optfdtcpyro.yml | 16
>> 
>> > > >  spec/build/bsps/arm/imx/optfdtmxsz.yml  | 17
>> -
>> > > >  spec/build/bsps/arm/imx/optfdtro.yml| 16
>> 
>> > > >  spec/build/bsps/arm/imx/optfdtuboot.yml | 16
>> 
>> > > >  spec/build/bsps/arm/raspberrypi/grp.yml |  8 
>> > > >  .../{arm/altera-cyclone-v => }/optfdtcpyro.yml  |  0
>> > > >  .../{arm/altera-cyclone-v => }/optfdtmxsz.yml   |  0
>> > > >  .../{arm/altera-cyclone-v => }/optfdtro.yml |  0
>> > > >  .../{arm/altera-cyclone-v => }/optfdtuboot.yml  |  0
>> > > >  spec/build/bsps/powerpc/qoriq/grp.yml   |  4 ++--
>> > > >  spec/build/bsps/powerpc/qoriq/optfdtmxsz.yml| 17
>> -
>> > > >  spec/build/bsps/powerpc/qoriq/optfdtro.yml  | 16
>> 
>> > > >  spec/build/bsps/riscv/riscv/grp.yml |  8 
>> > > >  spec/build/bsps/riscv/riscv/optfdtcpyro.yml | 16
>> 
>> > > >  spec/build/bsps/riscv/riscv/optfdtmxsz.yml  | 17
>> -
>> > > >  spec/build/bsps/riscv/riscv/optfdtro.yml| 16
>> 
>> > > >  spec/build/bsps/r

[PATCH v5] closes #3889 new defect Test needed for timer_create with CLOCK_MONOTONIC

2021-08-09 Thread Zacchaeus Leung
Closes #3888
---
 cpukit/include/rtems/posix/timer.h|  1 +
 cpukit/posix/src/psxtimercreate.c |  3 +-
 cpukit/posix/src/timergettime.c   | 50 ---
 testsuites/psxtests/psxtimer02/psxtimer.c | 26 ++
 testsuites/psxtests/psxtimer02/psxtimer02.scn |  6 +++
 5 files changed, 66 insertions(+), 20 deletions(-)

diff --git a/cpukit/include/rtems/posix/timer.h 
b/cpukit/include/rtems/posix/timer.h
index bcbf07a65a..7ae089173a 100644
--- a/cpukit/include/rtems/posix/timer.h
+++ b/cpukit/include/rtems/posix/timer.h
@@ -48,6 +48,7 @@ typedef struct {
   uint32_t  ticks;  /* Number of ticks of the initialization */
   uint32_t  overrun;/* Number of expirations of the timer*/
   struct timespec   time;   /* Time at which the timer was started   */
+  clockid_t clock_type; /* The type of timer */
 } POSIX_Timer_Control;
 
 /**
diff --git a/cpukit/posix/src/psxtimercreate.c 
b/cpukit/posix/src/psxtimercreate.c
index a63cf1d100..2b5a10140f 100644
--- a/cpukit/posix/src/psxtimercreate.c
+++ b/cpukit/posix/src/psxtimercreate.c
@@ -40,7 +40,7 @@ int timer_create(
 {
   POSIX_Timer_Control *ptimer;
 
-  if ( clock_id != CLOCK_REALTIME )
+  if (  clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC )
 rtems_set_errno_and_return_minus_one( EINVAL );
 
   if ( !timerid )
@@ -91,6 +91,7 @@ int timer_create(
   ptimer->timer_data.it_value.tv_nsec= 0;
   ptimer->timer_data.it_interval.tv_sec  = 0;
   ptimer->timer_data.it_interval.tv_nsec = 0;
+  ptimer->clock_type = clock_id;
 
   _Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() );
   _Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR );
diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
index ee2a566f0e..2ad841d517 100644
--- a/cpukit/posix/src/timergettime.c
+++ b/cpukit/posix/src/timergettime.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  *  - When a timer is initialized, the value of the time in
@@ -39,35 +40,46 @@
 int timer_gettime(
   timer_ttimerid,
   struct itimerspec *value
-)
+) 
 {
   POSIX_Timer_Control *ptimer;
-  ISR_lock_Context lock_context;
-  uint64_t now;
-  uint32_t remaining;
+  ISR_lock_Context lock_context;
+  Per_CPU_Control *cpu;
+  struct timespec now;
+  struct timespec expire;
+  struct timespec result;
 
   if ( !value )
 rtems_set_errno_and_return_minus_one( EINVAL );
 
   ptimer = _POSIX_Timer_Get( timerid, &lock_context );
-  if ( ptimer != NULL ) {
-Per_CPU_Control *cpu;
+  if ( ptimer == NULL ) {
+rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
-cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
-now = cpu->Watchdog.ticks;
+  cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
+  rtems_timespec_from_ticks( ptimer->Timer.expire, &expire );
 
-if ( now < ptimer->Timer.expire ) {
-  remaining = (uint32_t) ( ptimer->Timer.expire - now );
-} else {
-  remaining = 0;
-}
+  if ( ptimer->clock_type == CLOCK_MONOTONIC ) {
+  _Timecounter_Nanouptime(&now);
+  } else  if ( ptimer->clock_type == CLOCK_REALTIME ) {
+_TOD_Get(&now);
+  } else {
+_POSIX_Timer_Release( cpu, &lock_context );   
+rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
-_Timespec_From_ticks( remaining, &value->it_value );
-value->it_interval = ptimer->timer_data.it_interval;
 
-_POSIX_Timer_Release( cpu, &lock_context );
-return 0;
+ if ( rtems_timespec_less_than( &now, &expire ) ) {
+  rtems_timespec_subtract( &now, &expire, &result );
+  } else {
+  result.tv_nsec = 0;
+  result.tv_sec  = 0;
   }
-
-  rtems_set_errno_and_return_minus_one( EINVAL );
+  
+  value->it_value = result;
+  value->it_interval = ptimer->timer_data.it_interval;
+  
+  _POSIX_Timer_Release( cpu, &lock_context );
+  return 0;
 }
diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c 
b/testsuites/psxtests/psxtimer02/psxtimer.c
index 9f79d33c42..1a79369efb 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer.c
+++ b/testsuites/psxtests/psxtimer02/psxtimer.c
@@ -126,6 +126,32 @@ void *POSIX_Init (
   puts( "timer_delete - bad id - EINVAL" );
   status = timer_delete( timer );
   fatal_posix_service_status_errno( status, EINVAL, "bad id" );
+  
+  puts( "timer_create (monotonic) - bad timer id pointer - EINVAL" );
+  status = timer_create( CLOCK_MONOTONIC, &event, NULL );
+  fatal_posix_service_status_errno( status, EINVAL, "bad timer id" );
+
+  puts( "timer_create (monotonic) - OK" );
+  status = timer_create( CLOCK_MONOTONIC, NULL, &timer );
+  posix_service_failed( status, "timer_create OK" );
+
+  puts( "timer_create (monotonic) - too many - EAGAIN" );
+  status = timer_create( CLOCK_MONOTONIC, NULL, &timer1 );
+  fatal_posix_service_status_errno( status, EAGAIN, "too many" );
+  
+  clock_gettime( CLOCK_MONOTONIC, &now );
+  itimer.it_value = now;
+  itimer.it_value

Re: [PATCH v5] closes #3889 new defect Test needed for timer_create with CLOCK_MONOTONIC

2021-08-09 Thread Gedare Bloom
Your commit message was a little better before, just needed some
reformatting. This commit message you are using is not good, as
mentioned previously.

On Mon, Aug 9, 2021 at 12:44 PM Zacchaeus Leung
 wrote:
>
> Closes #3888
> ---
>  cpukit/include/rtems/posix/timer.h|  1 +
>  cpukit/posix/src/psxtimercreate.c |  3 +-
>  cpukit/posix/src/timergettime.c   | 50 ---
>  testsuites/psxtests/psxtimer02/psxtimer.c | 26 ++
>  testsuites/psxtests/psxtimer02/psxtimer02.scn |  6 +++
>  5 files changed, 66 insertions(+), 20 deletions(-)
>
> diff --git a/cpukit/include/rtems/posix/timer.h 
> b/cpukit/include/rtems/posix/timer.h
> index bcbf07a65a..7ae089173a 100644
> --- a/cpukit/include/rtems/posix/timer.h
> +++ b/cpukit/include/rtems/posix/timer.h
> @@ -48,6 +48,7 @@ typedef struct {
>uint32_t  ticks;  /* Number of ticks of the initialization */
>uint32_t  overrun;/* Number of expirations of the timer*/
>struct timespec   time;   /* Time at which the timer was started   */
> +  clockid_t clock_type; /* The type of timer */
>  } POSIX_Timer_Control;
>
>  /**
> diff --git a/cpukit/posix/src/psxtimercreate.c 
> b/cpukit/posix/src/psxtimercreate.c
> index a63cf1d100..2b5a10140f 100644
> --- a/cpukit/posix/src/psxtimercreate.c
> +++ b/cpukit/posix/src/psxtimercreate.c
> @@ -40,7 +40,7 @@ int timer_create(
>  {
>POSIX_Timer_Control *ptimer;
>
> -  if ( clock_id != CLOCK_REALTIME )
> +  if (  clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC )
Too many spaces after the ( I think?

>  rtems_set_errno_and_return_minus_one( EINVAL );
>
>if ( !timerid )
> @@ -91,6 +91,7 @@ int timer_create(
>ptimer->timer_data.it_value.tv_nsec= 0;
>ptimer->timer_data.it_interval.tv_sec  = 0;
>ptimer->timer_data.it_interval.tv_nsec = 0;
> +  ptimer->clock_type = clock_id;
>
>_Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() );
>_Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR );
> diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
> index ee2a566f0e..2ad841d517 100644
> --- a/cpukit/posix/src/timergettime.c
> +++ b/cpukit/posix/src/timergettime.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  /*
>   *  - When a timer is initialized, the value of the time in
> @@ -39,35 +40,46 @@
>  int timer_gettime(
>timer_ttimerid,
>struct itimerspec *value
> -)
> +)
what's changing here?

>  {
>POSIX_Timer_Control *ptimer;
> -  ISR_lock_Context lock_context;
> -  uint64_t now;
> -  uint32_t remaining;
> +  ISR_lock_Context lock_context;
> +  Per_CPU_Control *cpu;
> +  struct timespec now;
> +  struct timespec expire;
> +  struct timespec result;
>
>if ( !value )
>  rtems_set_errno_and_return_minus_one( EINVAL );
>
>ptimer = _POSIX_Timer_Get( timerid, &lock_context );
> -  if ( ptimer != NULL ) {
> -Per_CPU_Control *cpu;
> +  if ( ptimer == NULL ) {
> +rtems_set_errno_and_return_minus_one( EINVAL );
> +  }
>
> -cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
> -now = cpu->Watchdog.ticks;
> +  cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
> +  rtems_timespec_from_ticks( ptimer->Timer.expire, &expire );
>
> -if ( now < ptimer->Timer.expire ) {
> -  remaining = (uint32_t) ( ptimer->Timer.expire - now );
> -} else {
> -  remaining = 0;
> -}
> +  if ( ptimer->clock_type == CLOCK_MONOTONIC ) {
> +  _Timecounter_Nanouptime(&now);
still need to fix the indent level here
> +  } else  if ( ptimer->clock_type == CLOCK_REALTIME ) {
> +_TOD_Get(&now);
> +  } else {
> +_POSIX_Timer_Release( cpu, &lock_context );
> +rtems_set_errno_and_return_minus_one( EINVAL );
> +  }
>
> -_Timespec_From_ticks( remaining, &value->it_value );
> -value->it_interval = ptimer->timer_data.it_interval;
>
> -_POSIX_Timer_Release( cpu, &lock_context );
> -return 0;
> + if ( rtems_timespec_less_than( &now, &expire ) ) {
> +  rtems_timespec_subtract( &now, &expire, &result );
> +  } else {
> +  result.tv_nsec = 0;
> +  result.tv_sec  = 0;
>}
The indents here are still wrong. should be two spaces before if, and
four within the indented blocks. Also looks like there are two blank
spaces after result.tv_sec, it should only be 1

> -
> -  rtems_set_errno_and_return_minus_one( EINVAL );
> +
> +  value->it_value = result;
> +  value->it_interval = ptimer->timer_data.it_interval;
> +
> +  _POSIX_Timer_Release( cpu, &lock_context );
> +  return 0;
>  }
> diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c 
> b/testsuites/psxtests/psxtimer02/psxtimer.c
> index 9f79d33c42..1a79369efb 100644
> --- a/testsuites/psxtests/psxtimer02/psxtimer.c
> +++ b/testsuites/psxtests/psxtimer02/psxtimer.c
> @@ -126,6 +126,32 @@ void *POSIX_Init (
>puts( "timer_delete - bad id - EINVAL" );
>status = tim

[PATCH v6] Test needed for timer_create with CLOCK_MONOTONIC

2021-08-09 Thread Zacchaeus Leung
Closes #3888
---
 cpukit/include/rtems/posix/timer.h|  1 +
 cpukit/posix/src/psxtimercreate.c |  3 +-
 cpukit/posix/src/timergettime.c   | 50 ---
 testsuites/psxtests/psxtimer02/psxtimer.c | 26 ++
 testsuites/psxtests/psxtimer02/psxtimer02.scn |  6 +++
 5 files changed, 66 insertions(+), 20 deletions(-)

diff --git a/cpukit/include/rtems/posix/timer.h 
b/cpukit/include/rtems/posix/timer.h
index bcbf07a65a..7ae089173a 100644
--- a/cpukit/include/rtems/posix/timer.h
+++ b/cpukit/include/rtems/posix/timer.h
@@ -48,6 +48,7 @@ typedef struct {
   uint32_t  ticks;  /* Number of ticks of the initialization */
   uint32_t  overrun;/* Number of expirations of the timer*/
   struct timespec   time;   /* Time at which the timer was started   */
+  clockid_t clock_type; /* The type of timer */
 } POSIX_Timer_Control;
 
 /**
diff --git a/cpukit/posix/src/psxtimercreate.c 
b/cpukit/posix/src/psxtimercreate.c
index a63cf1d100..2b5a10140f 100644
--- a/cpukit/posix/src/psxtimercreate.c
+++ b/cpukit/posix/src/psxtimercreate.c
@@ -40,7 +40,7 @@ int timer_create(
 {
   POSIX_Timer_Control *ptimer;
 
-  if ( clock_id != CLOCK_REALTIME )
+  if (  clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC )
 rtems_set_errno_and_return_minus_one( EINVAL );
 
   if ( !timerid )
@@ -91,6 +91,7 @@ int timer_create(
   ptimer->timer_data.it_value.tv_nsec= 0;
   ptimer->timer_data.it_interval.tv_sec  = 0;
   ptimer->timer_data.it_interval.tv_nsec = 0;
+  ptimer->clock_type = clock_id;
 
   _Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() );
   _Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR );
diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
index ee2a566f0e..2ad841d517 100644
--- a/cpukit/posix/src/timergettime.c
+++ b/cpukit/posix/src/timergettime.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  *  - When a timer is initialized, the value of the time in
@@ -39,35 +40,46 @@
 int timer_gettime(
   timer_ttimerid,
   struct itimerspec *value
) 
 {
   POSIX_Timer_Control *ptimer;
-  ISR_lock_Context lock_context;
-  uint64_t now;
-  uint32_t remaining;
+  ISR_lock_Context lock_context;
+  Per_CPU_Control *cpu;
+  struct timespec now;
+  struct timespec expire;
+  struct timespec result;
 
   if ( !value )
 rtems_set_errno_and_return_minus_one( EINVAL );
 
   ptimer = _POSIX_Timer_Get( timerid, &lock_context );
-  if ( ptimer != NULL ) {
-Per_CPU_Control *cpu;
+  if ( ptimer == NULL ) {
+rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
-cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
-now = cpu->Watchdog.ticks;
+  cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
+  rtems_timespec_from_ticks( ptimer->Timer.expire, &expire );
 
-if ( now < ptimer->Timer.expire ) {
-  remaining = (uint32_t) ( ptimer->Timer.expire - now );
-} else {
-  remaining = 0;
-}
+  if ( ptimer->clock_type == CLOCK_MONOTONIC ) {
+_Timecounter_Nanouptime(&now);
+  } else  if ( ptimer->clock_type == CLOCK_REALTIME ) {
+_TOD_Get(&now);
+  } else {
+_POSIX_Timer_Release( cpu, &lock_context );   
+rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
-_Timespec_From_ticks( remaining, &value->it_value );
-value->it_interval = ptimer->timer_data.it_interval;
 
-_POSIX_Timer_Release( cpu, &lock_context );
-return 0;
+  if ( rtems_timespec_less_than( &now, &expire ) ) {
+rtems_timespec_subtract( &now, &expire, &result );
+  } else {
+result.tv_nsec = 0;
+result.tv_sec = 0;
   }
-
-  rtems_set_errno_and_return_minus_one( EINVAL );
+  
+  value->it_value = result;
+  value->it_interval = ptimer->timer_data.it_interval;
+  
+  _POSIX_Timer_Release( cpu, &lock_context );
+  return 0;
 }
diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c 
b/testsuites/psxtests/psxtimer02/psxtimer.c
index 9f79d33c42..1a79369efb 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer.c
+++ b/testsuites/psxtests/psxtimer02/psxtimer.c
@@ -126,6 +126,32 @@ void *POSIX_Init (
   puts( "timer_delete - bad id - EINVAL" );
   status = timer_delete( timer );
   fatal_posix_service_status_errno( status, EINVAL, "bad id" );
+  
+  puts( "timer_create (monotonic) - bad timer id pointer - EINVAL" );
+  status = timer_create( CLOCK_MONOTONIC, &event, NULL );
+  fatal_posix_service_status_errno( status, EINVAL, "bad timer id" );
+
+  puts( "timer_create (monotonic) - OK" );
+  status = timer_create( CLOCK_MONOTONIC, NULL, &timer );
+  posix_service_failed( status, "timer_create OK" );
+
+  puts( "timer_create (monotonic) - too many - EAGAIN" );
+  status = timer_create( CLOCK_MONOTONIC, NULL, &timer1 );
+  fatal_posix_service_status_errno( status, EAGAIN, "too many" );
+  
+  clock_gettime( CLOCK_MONOTONIC, &now );
+  itimer.it_value = now;
+  itimer.it_value.tv_sec 

[PATCH v7] Test needed for timer_create with CLOCK_MONOTONI

2021-08-09 Thread Zacchaeus Leung
Closes #3889 
---
 cpukit/include/rtems/posix/timer.h|  1 +
 cpukit/posix/src/psxtimercreate.c |  3 +-
 cpukit/posix/src/timergettime.c   | 50 ---
 testsuites/psxtests/psxtimer02/psxtimer.c | 26 ++
 testsuites/psxtests/psxtimer02/psxtimer02.scn |  6 +++
 5 files changed, 66 insertions(+), 20 deletions(-)

diff --git a/cpukit/include/rtems/posix/timer.h 
b/cpukit/include/rtems/posix/timer.h
index bcbf07a65a..7ae089173a 100644
--- a/cpukit/include/rtems/posix/timer.h
+++ b/cpukit/include/rtems/posix/timer.h
@@ -48,6 +48,7 @@ typedef struct {
   uint32_t  ticks;  /* Number of ticks of the initialization */
   uint32_t  overrun;/* Number of expirations of the timer*/
   struct timespec   time;   /* Time at which the timer was started   */
+  clockid_t clock_type; /* The type of timer */
 } POSIX_Timer_Control;
 
 /**
diff --git a/cpukit/posix/src/psxtimercreate.c 
b/cpukit/posix/src/psxtimercreate.c
index a63cf1d100..2b5a10140f 100644
--- a/cpukit/posix/src/psxtimercreate.c
+++ b/cpukit/posix/src/psxtimercreate.c
@@ -40,7 +40,7 @@ int timer_create(
 {
   POSIX_Timer_Control *ptimer;
 
-  if ( clock_id != CLOCK_REALTIME )
+  if ( clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC )
 rtems_set_errno_and_return_minus_one( EINVAL );
 
   if ( !timerid )
@@ -91,6 +91,7 @@ int timer_create(
   ptimer->timer_data.it_value.tv_nsec= 0;
   ptimer->timer_data.it_interval.tv_sec  = 0;
   ptimer->timer_data.it_interval.tv_nsec = 0;
+  ptimer->clock_type = clock_id;
 
   _Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() );
   _Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR );
diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
index ee2a566f0e..2ad841d517 100644
--- a/cpukit/posix/src/timergettime.c
+++ b/cpukit/posix/src/timergettime.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  *  - When a timer is initialized, the value of the time in
@@ -39,35 +40,46 @@
 int timer_gettime(
   timer_ttimerid,
   struct itimerspec *value
) 
 {
   POSIX_Timer_Control *ptimer;
-  ISR_lock_Context lock_context;
-  uint64_t now;
-  uint32_t remaining;
+  ISR_lock_Context lock_context;
+  Per_CPU_Control *cpu;
+  struct timespec now;
+  struct timespec expire;
+  struct timespec result;
 
   if ( !value )
 rtems_set_errno_and_return_minus_one( EINVAL );
 
   ptimer = _POSIX_Timer_Get( timerid, &lock_context );
-  if ( ptimer != NULL ) {
-Per_CPU_Control *cpu;
+  if ( ptimer == NULL ) {
+rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
-cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
-now = cpu->Watchdog.ticks;
+  cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
+  rtems_timespec_from_ticks( ptimer->Timer.expire, &expire );
 
-if ( now < ptimer->Timer.expire ) {
-  remaining = (uint32_t) ( ptimer->Timer.expire - now );
-} else {
-  remaining = 0;
-}
+  if ( ptimer->clock_type == CLOCK_MONOTONIC ) {
+_Timecounter_Nanouptime( &now );
+  } else  if ( ptimer->clock_type == CLOCK_REALTIME ) {
+_TOD_Get( &now );
+  } else {
+_POSIX_Timer_Release( cpu, &lock_context );   
+rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
-_Timespec_From_ticks( remaining, &value->it_value );
-value->it_interval = ptimer->timer_data.it_interval;
 
-_POSIX_Timer_Release( cpu, &lock_context );
-return 0;
+  if ( rtems_timespec_less_than( &now, &expire ) ) {
+rtems_timespec_subtract( &now, &expire, &result );
+  } else {
+result.tv_nsec = 0;
+result.tv_sec = 0;
   }
-
-  rtems_set_errno_and_return_minus_one( EINVAL );
+  
+  value->it_value = result;
+  value->it_interval = ptimer->timer_data.it_interval;
+  
+  _POSIX_Timer_Release( cpu, &lock_context );
+  return 0;
 }
diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c 
b/testsuites/psxtests/psxtimer02/psxtimer.c
index 9f79d33c42..1a79369efb 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer.c
+++ b/testsuites/psxtests/psxtimer02/psxtimer.c
@@ -126,6 +126,32 @@ void *POSIX_Init (
   puts( "timer_delete - bad id - EINVAL" );
   status = timer_delete( timer );
   fatal_posix_service_status_errno( status, EINVAL, "bad id" );
+  
+  puts( "timer_create (monotonic) - bad timer id pointer - EINVAL" );
+  status = timer_create( CLOCK_MONOTONIC, &event, NULL );
+  fatal_posix_service_status_errno( status, EINVAL, "bad timer id" );
+
+  puts( "timer_create (monotonic) - OK" );
+  status = timer_create( CLOCK_MONOTONIC, NULL, &timer );
+  posix_service_failed( status, "timer_create OK" );
+
+  puts( "timer_create (monotonic) - too many - EAGAIN" );
+  status = timer_create( CLOCK_MONOTONIC, NULL, &timer1 );
+  fatal_posix_service_status_errno( status, EAGAIN, "too many" );
+  
+  clock_gettime( CLOCK_MONOTONIC, &now );
+  itimer.it_value = now;
+  itimer.it_value.tv_

[PATCH v6] test needed for timer_create with CLOCK_MONOTONIC

2021-08-09 Thread Zacchaeus Leung
Closes #3889
---
 cpukit/include/rtems/posix/timer.h|  1 +
 cpukit/posix/src/psxtimercreate.c |  3 +-
 cpukit/posix/src/timergettime.c   | 50 ---
 testsuites/psxtests/psxtimer02/psxtimer.c | 26 ++
 testsuites/psxtests/psxtimer02/psxtimer02.scn |  6 +++
 5 files changed, 66 insertions(+), 20 deletions(-)

diff --git a/cpukit/include/rtems/posix/timer.h 
b/cpukit/include/rtems/posix/timer.h
index bcbf07a65a..7ae089173a 100644
--- a/cpukit/include/rtems/posix/timer.h
+++ b/cpukit/include/rtems/posix/timer.h
@@ -48,6 +48,7 @@ typedef struct {
   uint32_t  ticks;  /* Number of ticks of the initialization */
   uint32_t  overrun;/* Number of expirations of the timer*/
   struct timespec   time;   /* Time at which the timer was started   */
+  clockid_t clock_type; /* The type of timer */
 } POSIX_Timer_Control;
 
 /**
diff --git a/cpukit/posix/src/psxtimercreate.c 
b/cpukit/posix/src/psxtimercreate.c
index a63cf1d100..2b5a10140f 100644
--- a/cpukit/posix/src/psxtimercreate.c
+++ b/cpukit/posix/src/psxtimercreate.c
@@ -40,7 +40,7 @@ int timer_create(
 {
   POSIX_Timer_Control *ptimer;
 
-  if ( clock_id != CLOCK_REALTIME )
+  if (  clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC )
 rtems_set_errno_and_return_minus_one( EINVAL );
 
   if ( !timerid )
@@ -91,6 +91,7 @@ int timer_create(
   ptimer->timer_data.it_value.tv_nsec= 0;
   ptimer->timer_data.it_interval.tv_sec  = 0;
   ptimer->timer_data.it_interval.tv_nsec = 0;
+  ptimer->clock_type = clock_id;
 
   _Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() );
   _Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR );
diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
index ee2a566f0e..2ad841d517 100644
--- a/cpukit/posix/src/timergettime.c
+++ b/cpukit/posix/src/timergettime.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  *  - When a timer is initialized, the value of the time in
@@ -39,35 +40,46 @@
 int timer_gettime(
   timer_ttimerid,
   struct itimerspec *value
) 
 {
   POSIX_Timer_Control *ptimer;
-  ISR_lock_Context lock_context;
-  uint64_t now;
-  uint32_t remaining;
+  ISR_lock_Context lock_context;
+  Per_CPU_Control *cpu;
+  struct timespec now;
+  struct timespec expire;
+  struct timespec result;
 
   if ( !value )
 rtems_set_errno_and_return_minus_one( EINVAL );
 
   ptimer = _POSIX_Timer_Get( timerid, &lock_context );
-  if ( ptimer != NULL ) {
-Per_CPU_Control *cpu;
+  if ( ptimer == NULL ) {
+rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
-cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
-now = cpu->Watchdog.ticks;
+  cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
+  rtems_timespec_from_ticks( ptimer->Timer.expire, &expire );
 
-if ( now < ptimer->Timer.expire ) {
-  remaining = (uint32_t) ( ptimer->Timer.expire - now );
-} else {
-  remaining = 0;
-}
+  if ( ptimer->clock_type == CLOCK_MONOTONIC ) {
+_Timecounter_Nanouptime(&now);
+  } else  if ( ptimer->clock_type == CLOCK_REALTIME ) {
+_TOD_Get(&now);
+  } else {
+_POSIX_Timer_Release( cpu, &lock_context );   
+rtems_set_errno_and_return_minus_one( EINVAL );
+  }
 
-_Timespec_From_ticks( remaining, &value->it_value );
-value->it_interval = ptimer->timer_data.it_interval;
 
-_POSIX_Timer_Release( cpu, &lock_context );
-return 0;
+  if ( rtems_timespec_less_than( &now, &expire ) ) {
+rtems_timespec_subtract( &now, &expire, &result );
+  } else {
+result.tv_nsec = 0;
+result.tv_sec = 0;
   }
-
-  rtems_set_errno_and_return_minus_one( EINVAL );
+  
+  value->it_value = result;
+  value->it_interval = ptimer->timer_data.it_interval;
+  
+  _POSIX_Timer_Release( cpu, &lock_context );
+  return 0;
 }
diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c 
b/testsuites/psxtests/psxtimer02/psxtimer.c
index 9f79d33c42..1a79369efb 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer.c
+++ b/testsuites/psxtests/psxtimer02/psxtimer.c
@@ -126,6 +126,32 @@ void *POSIX_Init (
   puts( "timer_delete - bad id - EINVAL" );
   status = timer_delete( timer );
   fatal_posix_service_status_errno( status, EINVAL, "bad id" );
+  
+  puts( "timer_create (monotonic) - bad timer id pointer - EINVAL" );
+  status = timer_create( CLOCK_MONOTONIC, &event, NULL );
+  fatal_posix_service_status_errno( status, EINVAL, "bad timer id" );
+
+  puts( "timer_create (monotonic) - OK" );
+  status = timer_create( CLOCK_MONOTONIC, NULL, &timer );
+  posix_service_failed( status, "timer_create OK" );
+
+  puts( "timer_create (monotonic) - too many - EAGAIN" );
+  status = timer_create( CLOCK_MONOTONIC, NULL, &timer1 );
+  fatal_posix_service_status_errno( status, EAGAIN, "too many" );
+  
+  clock_gettime( CLOCK_MONOTONIC, &now );
+  itimer.it_value = now;
+  itimer.it_value.tv_sec 

Re: [PATCH v7] Test needed for timer_create with CLOCK_MONOTONI

2021-08-09 Thread Gedare Bloom
Joel: This looks fine to me.

On Mon, Aug 9, 2021 at 3:58 PM Zacchaeus Leung  wrote:
>
> Closes #3889
> ---
>  cpukit/include/rtems/posix/timer.h|  1 +
>  cpukit/posix/src/psxtimercreate.c |  3 +-
>  cpukit/posix/src/timergettime.c   | 50 ---
>  testsuites/psxtests/psxtimer02/psxtimer.c | 26 ++
>  testsuites/psxtests/psxtimer02/psxtimer02.scn |  6 +++
>  5 files changed, 66 insertions(+), 20 deletions(-)
>
> diff --git a/cpukit/include/rtems/posix/timer.h 
> b/cpukit/include/rtems/posix/timer.h
> index bcbf07a65a..7ae089173a 100644
> --- a/cpukit/include/rtems/posix/timer.h
> +++ b/cpukit/include/rtems/posix/timer.h
> @@ -48,6 +48,7 @@ typedef struct {
>uint32_t  ticks;  /* Number of ticks of the initialization */
>uint32_t  overrun;/* Number of expirations of the timer*/
>struct timespec   time;   /* Time at which the timer was started   */
> +  clockid_t clock_type; /* The type of timer */
>  } POSIX_Timer_Control;
>
>  /**
> diff --git a/cpukit/posix/src/psxtimercreate.c 
> b/cpukit/posix/src/psxtimercreate.c
> index a63cf1d100..2b5a10140f 100644
> --- a/cpukit/posix/src/psxtimercreate.c
> +++ b/cpukit/posix/src/psxtimercreate.c
> @@ -40,7 +40,7 @@ int timer_create(
>  {
>POSIX_Timer_Control *ptimer;
>
> -  if ( clock_id != CLOCK_REALTIME )
> +  if ( clock_id != CLOCK_REALTIME && clock_id != CLOCK_MONOTONIC )
>  rtems_set_errno_and_return_minus_one( EINVAL );
>
>if ( !timerid )
> @@ -91,6 +91,7 @@ int timer_create(
>ptimer->timer_data.it_value.tv_nsec= 0;
>ptimer->timer_data.it_interval.tv_sec  = 0;
>ptimer->timer_data.it_interval.tv_nsec = 0;
> +  ptimer->clock_type = clock_id;
>
>_Watchdog_Preinitialize( &ptimer->Timer, _Per_CPU_Get_snapshot() );
>_Watchdog_Initialize( &ptimer->Timer, _POSIX_Timer_TSR );
> diff --git a/cpukit/posix/src/timergettime.c b/cpukit/posix/src/timergettime.c
> index ee2a566f0e..2ad841d517 100644
> --- a/cpukit/posix/src/timergettime.c
> +++ b/cpukit/posix/src/timergettime.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  /*
>   *  - When a timer is initialized, the value of the time in
> @@ -39,35 +40,46 @@
>  int timer_gettime(
>timer_ttimerid,
>struct itimerspec *value
> )
>  {
>POSIX_Timer_Control *ptimer;
> -  ISR_lock_Context lock_context;
> -  uint64_t now;
> -  uint32_t remaining;
> +  ISR_lock_Context lock_context;
> +  Per_CPU_Control *cpu;
> +  struct timespec now;
> +  struct timespec expire;
> +  struct timespec result;
>
>if ( !value )
>  rtems_set_errno_and_return_minus_one( EINVAL );
>
>ptimer = _POSIX_Timer_Get( timerid, &lock_context );
> -  if ( ptimer != NULL ) {
> -Per_CPU_Control *cpu;
> +  if ( ptimer == NULL ) {
> +rtems_set_errno_and_return_minus_one( EINVAL );
> +  }
>
> -cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
> -now = cpu->Watchdog.ticks;
> +  cpu = _POSIX_Timer_Acquire_critical( ptimer, &lock_context );
> +  rtems_timespec_from_ticks( ptimer->Timer.expire, &expire );
>
> -if ( now < ptimer->Timer.expire ) {
> -  remaining = (uint32_t) ( ptimer->Timer.expire - now );
> -} else {
> -  remaining = 0;
> -}
> +  if ( ptimer->clock_type == CLOCK_MONOTONIC ) {
> +_Timecounter_Nanouptime( &now );
> +  } else  if ( ptimer->clock_type == CLOCK_REALTIME ) {
> +_TOD_Get( &now );
> +  } else {
> +_POSIX_Timer_Release( cpu, &lock_context );
> +rtems_set_errno_and_return_minus_one( EINVAL );
> +  }
>
> -_Timespec_From_ticks( remaining, &value->it_value );
> -value->it_interval = ptimer->timer_data.it_interval;
>
> -_POSIX_Timer_Release( cpu, &lock_context );
> -return 0;
> +  if ( rtems_timespec_less_than( &now, &expire ) ) {
> +rtems_timespec_subtract( &now, &expire, &result );
> +  } else {
> +result.tv_nsec = 0;
> +result.tv_sec = 0;
>}
> -
> -  rtems_set_errno_and_return_minus_one( EINVAL );
> +
> +  value->it_value = result;
> +  value->it_interval = ptimer->timer_data.it_interval;
> +
> +  _POSIX_Timer_Release( cpu, &lock_context );
> +  return 0;
>  }
> diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c 
> b/testsuites/psxtests/psxtimer02/psxtimer.c
> index 9f79d33c42..1a79369efb 100644
> --- a/testsuites/psxtests/psxtimer02/psxtimer.c
> +++ b/testsuites/psxtests/psxtimer02/psxtimer.c
> @@ -126,6 +126,32 @@ void *POSIX_Init (
>puts( "timer_delete - bad id - EINVAL" );
>status = timer_delete( timer );
>fatal_posix_service_status_errno( status, EINVAL, "bad id" );
> +
> +  puts( "timer_create (monotonic) - bad timer id pointer - EINVAL" );
> +  status = timer_create( CLOCK_MONOTONIC, &event, NULL );
> +  fatal_posix_service_status_errno( status, EINVAL, "bad timer id" );
> +
> +  puts( "timer_create (monotonic) - OK" );
> +  status = timer_create( CLOCK_MONOTONIC, NULL, &timer );
> +  posix

Re: [PATCH v2] rtems-utils: Change data type definition

2021-08-09 Thread Chris Johns
On 9/8/21 10:48 pm, Ryan Long wrote:
> Without the global namespace prefix, it results in the following error
> 
> ../linkers/rtems-exeinfo.cpp: In member function ‘void 
> rld::exeinfo::image::output_compilation_unit(bool, bool)’:
> ../linkers/rtems-exeinfo.cpp:370:14: error: ‘rld::rtems::utils’ has not been 
> declared
>rtems::utils::ostream_guard old_state( std::cout );
>   ^
> ../linkers/rtems-exeinfo.cpp:370:35: error: expected ‘;’ before ‘old_state’
>rtems::utils::ostream_guard old_state( std::cout );
> 
> Alex and I determined that the compiler is thinking that ostream_guard is 
> defined in the rld::rtems namespace. This was the only way we figured out how 
> to get it to compile without the typedef at the top of the file.

Ah OK. This makes sense and I think it is better to have the global prefix there
so the full path is known.

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

Having a problem with an out of the box setup for STM32F4

2021-08-09 Thread Mr. Andrei Chichak
In an attempt to make some progress, I’ve gone back to trying to install RTEMS6 
built for STM32F4. Should be straight forward.

To make things clean, I don’t do any modifications to any of the code being 
pulled out of git.

I followed the Quick Start section of the RTEMS User Manual, Release 6 efb8e7c

1) 
mkdir -p $HOME/quick-start/src
cd $HOME/quick-start/src
git clone git://git.rtems.org/rtems-source-builder.git rsb
git clone git://git.rtems.org/rtems.git

It looks good here.

2)
cd $HOME/quick-start/src/rsb/rtems
../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 6/rtems-arm

It looks good here too.

3)
$HOME/quick-start/rtems/6/bin/arm-rtems6-gcc --version

This gives me:

arm-rtems6-gcc (GCC) 10.3.1 20210409 (RTEMS 6, RSB 
ec495e091743061d4e140e2d0bd8aab1a8d69ae7, Newlib 0c0f3df)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

4)
cd $HOME/quick-start/src/rsb/rtems
../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 
--target=arm-rtems6 --with-rtems-bsp=stm32f4 --with-rtems-tests=yes 
6/rtems-kernel

Gives me:
RTEMS Source Builder - Set Builder, 6 (ec495e091743)
Build Set: 6/rtems-kernel
config: tools/rtems-kernel-6.cfg
package: arm-rtems6-kernel-stm32f4-1
download: 
https://git.rtems.org/rtems/snapshot/rtems-3ec5f20484cc4201e1d7b87844505644533b6148.tar.bz2
 -> sources/rtems-kernel-3ec5f20484cc4201e1d7b87844505644533b6148.tar.bz2
downloading: 
sources/rtems-kernel-3ec5f20484cc4201e1d7b87844505644533b6148.tar.bz2 - 8.1MB   
  
building: arm-rtems6-kernel-stm32f4-1
error: building arm-rtems6-kernel-stm32f4-1
Build FAILED
  See error report: rsb-report-arm-rtems6-kernel-stm32f4-1.txt
error: building arm-rtems6-kernel-stm32f4-1
Build Set: Time 0:03:03.592335
Build FAILED

Inside of rsb-report-arm-rtems6-kernel-stm32f4-1.txt the compiles are bombing 
with :

/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 ./../../cpukit/librtemscpu.a(armv7m-context-initialize.o): in function 
`_CPU_Context_Initialize':
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_Alignment'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_Size'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_Data_begin'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_Data_size'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_BSS_begin'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_BSS_size'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 warning: cannot find entry symbol _start; defaulting to 8018

If I compile with tests turned off, the set

Re: [PATCH rtems-libbsd v3 2/3] rtemsbsd: Add interface support routines

2021-08-09 Thread Chris Johns
On 10/8/21 1:50 am, Gedare Bloom wrote:
> On Sun, Aug 8, 2021 at 7:22 PM Chris Johns  wrote:
>>
>> - Add the ability to check if an interface is up
>> ---
>>  libbsd.py  |   1 +
>>  rtemsbsd/include/rtems/bsd/iface.h |  62 
>>  rtemsbsd/rtems/rtems-bsd-iface.c   | 146 +
>>  3 files changed, 209 insertions(+)
>>  create mode 100644 rtemsbsd/include/rtems/bsd/iface.h
>>  create mode 100644 rtemsbsd/rtems/rtems-bsd-iface.c
>>
>> diff --git a/libbsd.py b/libbsd.py
>> index 09a1fbc4..6e09a07c 100644
>> --- a/libbsd.py
>> +++ b/libbsd.py
>> @@ -253,6 +253,7 @@ class rtems(builder.Module):
>>  'rtems/rtems-bsd-cxx.cc',
>>  'rtems/rtems-bsd-get-ethernet-addr.c',
>>  'rtems/rtems-bsd-ifconfig.c',
>> +'rtems/rtems-bsd-iface.c',
>>  'rtems/rtems-bsd-ifconfig-lo0.c',
>>  'rtems/rtems-bsd-init-dhcp.c',
>>  'rtems/rtems-bsd-rc-conf-net.c',
>> diff --git a/rtemsbsd/include/rtems/bsd/iface.h 
>> b/rtemsbsd/include/rtems/bsd/iface.h
>> new file mode 100644
>> index ..9e583b8a
>> --- /dev/null
>> +++ b/rtemsbsd/include/rtems/bsd/iface.h
>> @@ -0,0 +1,62 @@
>> +/**
>> + * @file
>> + *
>> + * @ingroup rtems_bsd_rtems
>> + *
>> + * @brief This file provide a high level interface to simple interface
>> + * support calls.
>> + */
>> +
>> +/*
>> + * Copyright (c) 2021. Chris Johns . All rights reserved.
>> + *
>> + * 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 AUTHOR 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 AUTHOR 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.
>> + */
>> +
>> +#ifndef _RTEMS_BSD_IFACE_H_
>> +#define _RTEMS_BSD_IFACE_H_
>> +
>> +#include 
>> +
>> +#include 
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +struct rtems_bsd_iface {
>> +   char name[IFNAMSIZ];
>> +   int unit;
>> +   struct in_addr address;
>> +   size_t hw_len;
>> +   uint8_t hw_address[16];
>> +   struct ifreq ifr;
>> +   int linkstate;
>> +};
>> +
>> +/*
>> + * These calls return 0 is successful and -1 and errno set on error.
>> + */
>> +int rtems_bsd_iface_get(const char *name, struct rtems_bsd_iface *iface);
>> +int rtems_bsd_iface_link_state(const char *name, bool *state);
>> +
>> +#endif
>> diff --git a/rtemsbsd/rtems/rtems-bsd-iface.c 
>> b/rtemsbsd/rtems/rtems-bsd-iface.c
>> new file mode 100644
>> index ..4cf25a9b
>> --- /dev/null
>> +++ b/rtemsbsd/rtems/rtems-bsd-iface.c
>> @@ -0,0 +1,146 @@
>> +/**
>> + * @file
>> + *
>> + * @ingroup rtems_bsd_rtems
>> + *
>> + * @brief Interface support routines
>> + */
>> +
>> +/*
>> + * Copyright (c) 2021. Chris Johns   All rights reserved.
>> + *
>> + * 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 AUTHOR 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 AUTHOR 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;

Re: [PATCH rtems-libbsd v3 1/3] rtemsbsd/bus: Add PCI support to the nexus bus

2021-08-09 Thread Chris Johns
On 10/8/21 1:43 am, Gedare Bloom wrote:
> On Sun, Aug 8, 2021 at 7:22 PM Chris Johns  wrote:
>>
>> - Add PCI IO region support
>>
>> - Add support map buffers to PCI address space
>>
>> - Add BSP conditional IO space support. Some PC implementations
>>   have PCI IO space mapped differently to memory space and this needs
>>   to be reflected in the busspace.
>>
>> - Include bsp.h to pick per BSP configuration.
>>
>> Closes #4245
>> ---
>>  rtemsbsd/include/machine/bus.h| 370 ++
>>  rtemsbsd/rtems/rtems-kernel-bus-dma.c |   5 +-
>>  rtemsbsd/rtems/rtems-kernel-nexus.c   |  52 +++-
>>  3 files changed, 312 insertions(+), 115 deletions(-)
>>
>> diff --git a/rtemsbsd/include/machine/bus.h b/rtemsbsd/include/machine/bus.h
>> index 2f0e7ad6..999f5d45 100644
>> --- a/rtemsbsd/include/machine/bus.h
>> +++ b/rtemsbsd/include/machine/bus.h
>> @@ -6,9 +6,13 @@
>>   * @brief TODO.
>>   *
>>   * File origin from FreeBSD 'sys/amd64/include/bus.h'.
>> + *
>> + * Conditionally supports PCI IO regions (IO Ports).
>>   */
>>
>>  /*-
>> + * Copyright (c) 2021 Chris Johns.  All rights reserved.
>> + *
>>   * Copyright (c) 2009, 2015 embedded brains GmbH.  All rights reserved.
>>   *
>>   *  embedded brains GmbH
>> @@ -25,7 +29,7 @@
>>   * 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 as
>>   *the first lines of this file unmodified.
>> @@ -34,7 +38,7 @@
>>   *documentation and/or other materials provided with the distribution.
>>   * 3. The name of the author may not be used to endorse or promote products
>>   *derived from this software without specific prior written permission.
>> - *
>> + *
>>   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
>> @@ -123,9 +127,46 @@
>>  #endif
>>
>>  #ifdef __i386__
>> -  #error "your include paths are wrong"
>> +  #error "x86 has its own bus.h; check your include paths are correct"
>>  #endif
>>
>> +#include 
>> +
>> +/*
>> + * BSP PCI Support
>> + *
>> + * The RTEMS Nexus bus support can optionaly support PC PCI spaces that
> optionally
> 
>> + * mapped to BSP speciic address spaces. Add the following define to
> specific
> 
>> + * the BSP header file to enable this support:
>> + *
>> + *  #define BSP_HAS_PC_PCI
> 
> Is there an rtems.git patch to add this to some BSP?

Yes that is to come once we have this sorted or it just keeps changing.

> 
> I might suggest BSP_HAS_PCI_IO_PORTS
> 

I think using PC PCI is better because the PCI originally came from the PC and
it defines the IO space and the memory space so the define means the bus space
will support the IO _and_ the memory spaces. The default is what exists and that
is a flat 1:1 mapping.

>> + *
>> + * If enabled a BSP must the following IO region calls:
> must support?
> 
>> + *
>> + * inb  : read 8 bits
>> + * outb : write 8 bits
>> + * inw  : read 16 bits
>> + * outw : write 16 bits
>> + * inl  : read 32 bits
>> + * outl : write 32 bits
>> + *
>> + * The BSP needs to provide the DRAM address space offset
>> + * PCI_DRAM_OFFSET. This is the base address of the DRAM as seen by a
>> + * PCI master.
>> + *
>> + * i386 BSPs have a special bus.h file and do not use this file.
>> + */
>> +
>> +#ifdef BSP_HAS_PC_PCI
>> +
>> +/*
>> + * Values for the bus space tag, not to be used directly by MI code.
>> + */
>> +#defineBSP_BUS_SPACE_IO0   /* space is i/o space */
>> +#defineBSP_BUS_SPACE_MEM   1   /* space is mem space */
>> +
>> +#endif /* BSP_HAS_PC_PCI */
>> +
>>  /*
>>   * Bus address alignment.
>>   */
>> @@ -144,6 +185,7 @@
>>  /*
>>   * Bus access.
>>   */
>> +#define BUS_SPACE_INVALID_DATA (~0)
> Please use 0U here. I get the undefined behavior (UB) willies when I
> see bit-twiddling on signed integer types.

Sure but I was just keeping the code as close to FB as I could ...

https://github.com/freebsd/freebsd-src/blob/main/sys/x86/include/bus.h#L132

> 
>>  #define BUS_SPACE_UNRESTRICTED (~0U)
>>
>>  /*
>> @@ -222,6 +264,102 @@ bus_space_barrier(bus_space_tag_t bst __unused, 
>> bus_space_handle_t bsh, bus_size
>> /* Do nothing */
>>  }
>>
>> +/*
>> + * BSP Bus Space Map Support
>> + *
>> + * Provide as C macros in the BSP header (bsp.h) the following:
> 
> Not really clear to me under what conditions these should be provided.
> This could be wrapped by #ifndef BSP_HAS_PC_PCI?

The PC PCI is about the type of bus spaces, IO at one location or a special
instruction and memory being cache coherent somewhere else, either at the PCI
config offset or that offset being offset again. The READ_* API is abou

Having a problem with an out of the box setup for STM32F4

2021-08-09 Thread Mr . Andrei Chichak
In an attempt to make some progress, I’ve gone back to trying to install RTEMS6 
built for STM32F4. Should be straight forward.

To make things clean, I don’t do any modifications to any of the code being 
pulled out of git.

I followed the Quick Start section of the RTEMS User Manual, Release 6 efb8e7c

1) 
mkdir -p $HOME/quick-start/src
cd $HOME/quick-start/src
git clone git://git.rtems.org/rtems-source-builder.git 
 rsb
git clone git://git.rtems.org/rtems.git 

It looks good here.

2)
cd $HOME/quick-start/src/rsb/rtems
../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 6/rtems-arm

It looks good here too.

3)
$HOME/quick-start/rtems/6/bin/arm-rtems6-gcc --version

This gives me:

arm-rtems6-gcc (GCC) 10.3.1 20210409 (RTEMS 6, RSB 
ec495e091743061d4e140e2d0bd8aab1a8d69ae7, Newlib 0c0f3df)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

4)
cd $HOME/quick-start/src/rsb/rtems
../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 
--target=arm-rtems6 --with-rtems-bsp=stm32f4 --with-rtems-tests=yes 
6/rtems-kernel

Gives me:
RTEMS Source Builder - Set Builder, 6 (ec495e091743)
Build Set: 6/rtems-kernel
config: tools/rtems-kernel-6.cfg
package: arm-rtems6-kernel-stm32f4-1
download: 
https://git.rtems.org/rtems/snapshot/rtems-3ec5f20484cc4201e1d7b87844505644533b6148.tar.bz2
 

 -> sources/rtems-kernel-3ec5f20484cc4201e1d7b87844505644533b6148.tar.bz2
downloading: 
sources/rtems-kernel-3ec5f20484cc4201e1d7b87844505644533b6148.tar.bz2 - 8.1MB   
  
building: arm-rtems6-kernel-stm32f4-1
error: building arm-rtems6-kernel-stm32f4-1
Build FAILED
  See error report: rsb-report-arm-rtems6-kernel-stm32f4-1.txt
error: building arm-rtems6-kernel-stm32f4-1
Build Set: Time 0:03:03.592335
Build FAILED

Inside of rsb-report-arm-rtems6-kernel-stm32f4-1.txt the compiles are bombing 
with :

/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 ./../../cpukit/librtemscpu.a(armv7m-context-initialize.o): in function 
`_CPU_Context_Initialize':
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_Alignment'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_Size'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_Data_begin'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_Data_size'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_BSS_begin'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 
/Users/andreichichak/quick-start/src/rsb/rtems/build/arm-rtems6-kernel-stm32f4-1/arm-rtems6-kernel-stm32f4-1-3ec5f20484cc4201e1d7b87844505644533b6148/build/arm-rtems6/c/stm32f4/cpukit/../../../../../rtems-3ec5f20484cc4201e1d7b87844505644533b6148/c/src/../../cpukit/score/cpu/arm/armv7m-context-initialize.c:53:
 undefined reference to `_TLS_BSS_size'
/Users/andreichichak/quick-start/rtems/6/lib/gcc/arm-rtems6/10.3.1/../../../../arm-rtems6/bin/ld:
 warning: cannot fi

Re: Guidance on constructing an RTEMS6 BSP

2021-08-09 Thread groups
Hi Sebastian,

So far there is no code. The BSP won’t build. The only code is:

../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 
--target=arm-rtems6 --with-rtems-bsp=stm32f4 --with-rtems-tests=yes 
6/rtems-kernel


Andrei



> On 2021-August-10, at 00:20, Sebastian Huber 
>  > wrote:
> 
> Hello Andrei,
> 
> sorry, I am a bit busy at the moment. I would try to share as much code as 
> possible (not easy with the STM source code organization) and use BSP options 
> to customize for the variants.
> 
> -- 
> 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: Guidance on constructing an RTEMS6 BSP

2021-08-09 Thread Sebastian Huber

On 10/08/2021 08:31, gro...@chichak.ca wrote:
../source-builder/sb-set-builder --prefix=$HOME/quick-start/rtems/6 
--target=arm-rtems6 --with-rtems-bsp=stm32f4 --with-rtems-tests=yes 
6/rtems-kernel


I usually build the tools with the RSB and then separately build the BSP 
from a Git clone.


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