Minimum RAM for "libbsd"? Can't run in 8MB on "imxrt".

2021-06-21 Thread Peter Dufault
What's the minimum RAM for "libbsd"?  I'm getting concerned since I assumed 8MB 
would be enough, but there are data structures that default to that size, e.g. 
rtems_bsd_allocator_domain_page_mbuf_size defaults to 
RTEMS_BSD_CFGDECL_DOMAIN_PAGE_MBUF_DEFAULT which is 8MB.

I committed to run in 8MB RAM and 16MB FLASH on the "imxrt" BSP.

I've got 7.8MB of RTEMS work space out of my 8MB of RAM and can't get a network 
application to start up after trying to reduce the configuration.

Peter
-
Peter Dufault
HD Associates, Inc.  Software and System Engineering

This email is delivered through the public internet using protocols subject to 
interception and tampering.



signature.asc
Description: Message signed with OpenPGP
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Minimum RAM for "libbsd"? Can't run in 8MB on "imxrt".

2021-06-21 Thread Sebastian Huber

On 21/06/2021 14:41, Peter Dufault wrote:

I've got 7.8MB of RTEMS work space out of my 8MB of RAM and can't get a network 
application to start up after trying to reduce the configuration.


What happens when you reduce the memory space for the mbufs to 4MiB? 
What is the "RTEMS work space"?


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

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


Re: [PATCH rtems 2/2] bsps/imxrt: Simplify linkcmds and make it flexible

2021-06-21 Thread Sebastian Huber




On 19/06/2021 16:35, dufa...@hda.com wrote:

I'm getting back to this as I have the HyperRAM working so I'm trying to set up 
appropriate linker settings.


On Jun 10, 2021, at 01:43 , Sebastian Huber 
 wrote:

The initial stack needs to be in an accessible memory area. Currently it is 
placed in this linker output section:

.rtemsstack (NOLOAD) : ALIGN_WITH_INPUT {
bsp_section_rtemsstack_begin = .;
*(SORT_BY_ALIGNMENT (SORT_BY_NAME (.rtemsstack*)))
bsp_section_rtemsstack_end = .;
} > REGION_WORK AT > REGION_WORK
bsp_section_rtemsstack_size = bsp_section_rtemsstack_end - 
bsp_section_rtemsstack_begin;

Maybe we should place the .rtemsstack.interrupt input section into the 
REGION_VECTOR memory region.

On the "imxrt" REGION_VECTOR is in FLASH, at least ".vector' in the app I'm 
testing is at 0x6004653c which is in HyperFLASH.


Then place the .rtemsstack.interrupt input section into the REGION_STACK 
memory region and make sure REGIION_STACK is located in the OCRAM.


In HyperRAM I see these regions allocated:

REGION_DATA: .rwbarrier
REGION_DATA_LOAD: .data, .rtemsrwset
REGION_BSS: .bss
REGION_WORK: .rtemsstack, .work
REGION_STACK: .stack

So I put REGION_WORK in the OCRAM to get .rtemsstack out of HyperRAM to get 
started.  My application is now running out of HyperFLASH and HyperRAM though 
I'm sure I'll find issues.

- What's in "REGION_WORK"?  Does that have anything to do with the RTEMS work 
space?


Yes, the RTEMS Workspace and C Program Heap use this region.


- What's the proper solution?  I don't particularly want to redo my HyperRAM 
initialization to avoid using stack since I'm calling some NXP functions.  I'd 
like a small amount of stack available in the context of bsp_start_hook_0() to 
set up the external RAM.
- What's going on in the shared ARM _start with bsp_start_hook_0_done and the 
branch to bsp_start_hook_0()?


Some arm BSPs don't have a boot loader and relocate during startup from 
flash to RAM. See comment in start.S.


--
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: Minimum RAM for "libbsd"? Can't run in 8MB on "imxrt".

2021-06-21 Thread dufault


> On Jun 21, 2021, at 08:52 , Sebastian Huber 
>  wrote:
> 
> What happens when you reduce the memory space for the mbufs to 4MiB? What is 
> the "RTEMS work space"?

By "RTEMS work space" I mean the space between bsp_section_work_begin and 
bsp_section_work_end, which I assume is handed over to the unified work space.  
I also assume allocated "libbsd" data structures come from there.

After reducing the space for the mbufs I still run out of RAM.  I've been 
patching rtems_bsd_allocator_domain_page_mbuf_size in the debugger for test.  
I'll put it in at compile time but looking at the code that won't make a 
difference.

Peter
-
Peter Dufault
HD Associates, Inc.  Software and System Engineering

This email is delivered through the public internet using protocols subject to 
interception and tampering.



signature.asc
Description: Message signed with OpenPGP
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH rtems] i2c: Add non blocking read / write

2021-06-21 Thread Christian MAUDERER

Ping.

Am 26.05.21 um 16:39 schrieb Christian Mauderer:

This adds the possibility to open an I2C bus with O_NONBLOCK (or set it
later via fcntl) to get non-blocking transmissions. This means that if
the bus is busy, a read, write or transfer ioctl will return with a
EAGAIN errno.
---
NOTE: This patch needs
https://lists.rtems.org/pipermail/devel/2021-May/067462.html applied too.

  cpukit/dev/i2c/i2c-bus.c |  45 ++--
  cpukit/include/dev/i2c/i2c.h |  44 ++-
  testsuites/libtests/i2c01/init.c | 121 ++-
  3 files changed, 203 insertions(+), 7 deletions(-)

diff --git a/cpukit/dev/i2c/i2c-bus.c b/cpukit/dev/i2c/i2c-bus.c
index 47c4ab..618a817b1a 100644
--- a/cpukit/dev/i2c/i2c-bus.c
+++ b/cpukit/dev/i2c/i2c-bus.c
@@ -31,6 +31,11 @@
  #include 
  #include 
  
+int i2c_bus_try_obtain(i2c_bus *bus)

+{
+  return rtems_recursive_mutex_try_lock(&bus->mutex);
+}
+
  void i2c_bus_obtain(i2c_bus *bus)
  {
rtems_recursive_mutex_lock(&bus->mutex);
@@ -41,7 +46,12 @@ void i2c_bus_release(i2c_bus *bus)
rtems_recursive_mutex_unlock(&bus->mutex);
  }
  
-int i2c_bus_transfer(i2c_bus *bus, i2c_msg *msgs, uint32_t msg_count)

+int i2c_bus_do_transfer(
+  i2c_bus *bus,
+  i2c_msg *msgs,
+  uint32_t msg_count,
+  uint32_t flags
+)
  {
int err;
uint32_t i;
@@ -63,13 +73,24 @@ int i2c_bus_transfer(i2c_bus *bus, i2c_msg *msgs, uint32_t 
msg_count)
  }
}
  
-  i2c_bus_obtain(bus);

+  if ((flags & I2C_BUS_NOBLOCK) != 0) {
+if (i2c_bus_try_obtain(bus) != 0) {
+  return -EAGAIN;
+}
+  } else {
+i2c_bus_obtain(bus);
+  }
err = (*bus->transfer)(bus, msgs, msg_count);
i2c_bus_release(bus);
  
return err;

  }
  
+int i2c_bus_transfer(i2c_bus *bus, i2c_msg *msgs, uint32_t msg_count)

+{
+  return i2c_bus_do_transfer(bus, msgs, msg_count, 0);
+}
+
  static ssize_t i2c_bus_read(
rtems_libio_t *iop,
void *buffer,
@@ -84,12 +105,17 @@ static ssize_t i2c_bus_read(
  .buf = buffer
};
int err;
+  unsigned flags = 0;
  
if (bus->ten_bit_address) {

  msg.flags |= I2C_M_TEN;
}
  
-  err = i2c_bus_transfer(bus, &msg, 1);

+  if (rtems_libio_iop_is_no_delay(iop)) {
+flags |= I2C_BUS_NOBLOCK;
+  }
+
+  err = i2c_bus_do_transfer(bus, &msg, 1, flags);
if (err == 0) {
  return msg.len;
} else {
@@ -111,12 +137,17 @@ static ssize_t i2c_bus_write(
  .buf = RTEMS_DECONST(void *, buffer)
};
int err;
+  unsigned flags = 0;
  
if (bus->ten_bit_address) {

  msg.flags |= I2C_M_TEN;
}
  
-  err = i2c_bus_transfer(bus, &msg, 1);

+  if (rtems_libio_iop_is_no_delay(iop)) {
+flags |= I2C_BUS_NOBLOCK;
+  }
+
+  err = i2c_bus_do_transfer(bus, &msg, 1, flags);
if (err == 0) {
  return msg.len;
} else {
@@ -133,12 +164,16 @@ static int i2c_bus_ioctl(
i2c_bus *bus = IMFS_generic_get_context_by_iop(iop);
i2c_rdwr_ioctl_data *rdwr;
int err;
+  unsigned flags = 0;
  
switch (command) {

  case I2C_RDWR:
rdwr = arg;
if (rdwr->nmsgs > 0) {
-err = i2c_bus_transfer(bus, rdwr->msgs, rdwr->nmsgs);
+if (rtems_libio_iop_is_no_delay(iop)) {
+  flags |= I2C_BUS_NOBLOCK;
+}
+err = i2c_bus_do_transfer(bus, rdwr->msgs, rdwr->nmsgs, flags);
} else {
  err = 0;
}
diff --git a/cpukit/include/dev/i2c/i2c.h b/cpukit/include/dev/i2c/i2c.h
index ac2c369785..5aa45e390c 100644
--- a/cpukit/include/dev/i2c/i2c.h
+++ b/cpukit/include/dev/i2c/i2c.h
@@ -242,6 +242,16 @@ int i2c_bus_register(
const char *bus_path
  );
  
+/**

+ * @brief Try to obtain the bus.
+ *
+ * @param[in] bus The bus control.
+ *
+ * @retval 0 Successful operation.
+ * @retval EBUSY if mutex is already locked.
+ */
+int i2c_bus_try_obtain(i2c_bus *bus);
+
  /**
   * @brief Obtains the bus.
   *
@@ -259,7 +269,8 @@ void i2c_bus_release(i2c_bus *bus);
  /**
   * @brief Transfers I2C messages.
   *
- * The bus is obtained before the transfer and released afterwards.
+ * The bus is obtained before the transfer and released afterwards. This is the
+ * same like calling @ref i2c_bus_do_transfer with flags set to 0.
   *
   * @param[in] bus The bus control.
   * @param[in] msgs The messages to transfer.
@@ -271,6 +282,37 @@ void i2c_bus_release(i2c_bus *bus);
   */
  int i2c_bus_transfer(i2c_bus *bus, i2c_msg *msgs, uint32_t msg_count);
  
+/**

+ * @brief Transfers I2C messages with optional flags.
+ *
+ * The bus is obtained before the transfer and released afterwards. If the flag
+ * I2C_BUS_NOBLOCK is set and the bus is already obtained, nothing will be
+ * transfered and the function returns with an -EAGAIN.
+ *
+ * @param[in] bus The bus control.
+ * @param[in] msgs The messages to transfer.
+ * @param[in] msg_count The count of messages to transfer.  It must be
+ * positive.
+ * @param[in] flags Options for the whole transfer.
+ *
+ * @retval 0 Successful operation.
+ * @retval -EAGAIN if @ref I2C_BUS_NOBLOCK is set and th

Re: [PATCH rtems 1/2] bsps/imxrt: Allow different ARM PLL setting

2021-06-21 Thread Christian MAUDERER

Hello Gedare,

sorry, I nearly missed that mail.

Am 04.06.21 um 19:43 schrieb Gedare Bloom:

On Fri, Jun 4, 2021 at 1:48 AM Christian Mauderer
 wrote:


Update #4180
---
  .../nxp/boards/evkbimxrt1050/clock_config.c   |  5 +++
  bsps/arm/imxrt/start/clock-arm-pll-config.c   | 33 +++
  spec/build/bsps/arm/imxrt/bspimxrt.yml|  1 +
  3 files changed, 39 insertions(+)
  create mode 100644 bsps/arm/imxrt/start/clock-arm-pll-config.c

diff --git a/bsps/arm/imxrt/nxp/boards/evkbimxrt1050/clock_config.c 
b/bsps/arm/imxrt/nxp/boards/evkbimxrt1050/clock_config.c
index c23d5da356..ea28d06dd8 100644
--- a/bsps/arm/imxrt/nxp/boards/evkbimxrt1050/clock_config.c
+++ b/bsps/arm/imxrt/nxp/boards/evkbimxrt1050/clock_config.c
@@ -33,6 +33,7 @@ board: IMXRT1050-EVKB
  #ifndef __rtems__
  #include "clock_config.h"
  #else /* __rtems__ */
+#include 
  #include "fsl_clock_config.h"
  #endif /* __rtems__ */
  #include "fsl_iomuxc.h"
@@ -146,10 +147,14 @@ sources:
  
/***
   * Variables for BOARD_BootClockRUN configuration
   
**/
+#ifndef __rtems__
  const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = {
  .loopDivider = 100, /* PLL loop divider, Fout = Fin * 50 */
  .src = 0,   /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and 
CLK1_N */
  };
+#else /* __rtems__ */
+/* Moved to a separate file so an application can overwrite it. */

although it may be trivial, perhaps add the filename/path
(bsps/arm/imxrt/start/clock-arm-pll-config.c) in the comment?


I'll do that.



BSP doco provided how to override it?


I already have a patch prepared for it. But it seems that I missed to 
send it. I'll send it soon.


Best regards

Christian




+#endif /* __rtems__ */
  const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN = {
  .loopDivider = 1, /* PLL loop divider, Fout = Fin * ( 20 + loopDivider*2 
+ numerator / denominator ) */
  .numerator   = 0, /* 30 bit numerator of fractional loop divider */
diff --git a/bsps/arm/imxrt/start/clock-arm-pll-config.c 
b/bsps/arm/imxrt/start/clock-arm-pll-config.c
new file mode 100644
index 00..12ad1867eb
--- /dev/null
+++ b/bsps/arm/imxrt/start/clock-arm-pll-config.c
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "fsl_clock_config.h"
+
+const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = {
+.loopDivider = 100,
+.src = 0,
+};
diff --git a/spec/build/bsps/arm/imxrt/bspimxrt.yml 
b/spec/build/bsps/arm/imxrt/bspimxrt.yml
index f543a14394..c6ea904754 100644
--- a/spec/build/bsps/arm/imxrt/bspimxrt.yml
+++ b/spec/build/bsps/arm/imxrt/bspimxrt.yml
@@ -238,6 +238,7 @@ source:
  - bsps/arm/imxrt/spi/imxrt-lpspi.c
  - bsps/arm/imxrt/start/bspstart.c
  - bsps/arm/imxrt/start/bspstarthooks.c
+- bsps/arm/imxrt/start/clock-arm-pll-config.c
  - bsps/arm/imxrt/start/flash-boot-data.c
  - bsps/arm/imxrt/start/flash-config.c
  - bsps/arm/imxrt/start/flash-dcd.c
--
2.26.2

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


--

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

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler

[PATCH 0/1 rtems-docs] user/bsps/imxrt: Info about ARM PLL frequency

2021-06-21 Thread Christian Mauderer
Hello,

this adds the documentation discussed in

https://lists.rtems.org/pipermail/devel/2021-June/067580.html

Best regards

Christian


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


[PATCH rtems-docs] user/bsps/imxrt: Info about ARM PLL frequency

2021-06-21 Thread Christian Mauderer
---
 user/bsps/arm/imxrt.rst | 20 
 1 file changed, 20 insertions(+)

diff --git a/user/bsps/arm/imxrt.rst b/user/bsps/arm/imxrt.rst
index 8a5ee28..3f8b270 100644
--- a/user/bsps/arm/imxrt.rst
+++ b/user/bsps/arm/imxrt.rst
@@ -123,6 +123,26 @@ with your FDT source names)::
 
 Make sure that your new C file is compiled and linked into the application.
 
+PLL Settings
+
+
+The commercial variant of the i.MXRT1052 on the evaluation board allows a clock
+up to 600MHz for the ARM core. For some industrial variants only up to 528MHz
+are specified. To make it possible to adapt to these variants the application
+can overwrite the following constant:
+
+.. code-block:: c
+
+  #include "fsl_clock_config.h"
+  
+  const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = {
+  .loopDivider = 100,
+  .src = 0,
+  };
+
+With the default configuration of a 24MHz oscillator, the loopDivider has to be
+88 for the 528MHz.
+
 Clock Driver
 
 
-- 
2.26.2

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


rtems6 master build tests for erc32 fail : undefined reference to `_Timespec_Is_non_negative'

2021-06-21 Thread junkes

Making all-am in fstests
make[5]: Entering directory 
'/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/testsuites/fstests'
sparc-rtems6-gcc  -mcpu=cypress -O2 -g -ffunction-sections 
-fdata-sections -Wall -Wmissing-prototypes 
-Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs 
-B./../../lib/libbsp/sparc/erc32 
-B/home/junkes/VE/kernel/bsps/sparc/erc32/start -specs bsp_specs -qrtems 
-L./../../cpukit -L/home/junkes/VE/kernel/bsps/sparc/shared/start 
-Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar -Wl,--gc-sections 
-o fsimfsconfig01.exe fsimfsconfig01/fsimfsconfig01-init.o 
./../../lib/libbsp/sparc/erc32/librtemsbsp.a 
./../../cpukit/librtemscpu.a ./../../cpukit/librtemstest.a
/home/junkes/VE/rtems/6/lib/gcc/sparc-rtems6/10.3.1/../../../../sparc-rtems6/bin/ld: 
./../../cpukit/librtemscpu.a(utimensat.o): in function 
`rtems_filesystem_utime_update':
/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/cpukit/../../../../../../kernel/c/src/../../cpukit/libcsupport/src/utimensat.c:153: 
undefined reference to `_Timespec_Is_non_negative'
/home/junkes/VE/rtems/6/lib/gcc/sparc-rtems6/10.3.1/../../../../sparc-rtems6/bin/ld: 
/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/cpukit/../../../../../../kernel/c/src/../../cpukit/libcsupport/src/utimensat.c:157: 
undefined reference to `_Timespec_Is_non_negative'

collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:1905: fsimfsconfig01.exe] Error 1
make[5]: Leaving directory 
'/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/testsuites/fstests'

make[4]: *** [Makefile:663: fstests] Error 2
make[4]: Leaving directory 
'/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/testsuites'

make[3]: *** [Makefile:1342: testsuites] Error 2
make[3]: Leaving directory 
'/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32'

make[2]: *** [Makefile:822: all-recursive] Error 1
make[2]: Leaving directory 
'/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32'

make[1]: *** [Makefile:289: all-recursive] Error 1
make[1]: Leaving directory 
'/home/junkes/VE/build/b-erc32/sparc-rtems6/c'

make: *** [Makefile:410: all-recursive] Error 1
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH rtems] i2c: Add non blocking read / write

2021-06-21 Thread Gedare Bloom
it looks ok

On Mon, Jun 21, 2021 at 8:08 AM Christian MAUDERER
 wrote:
>
> Ping.
>
> Am 26.05.21 um 16:39 schrieb Christian Mauderer:
> > This adds the possibility to open an I2C bus with O_NONBLOCK (or set it
> > later via fcntl) to get non-blocking transmissions. This means that if
> > the bus is busy, a read, write or transfer ioctl will return with a
> > EAGAIN errno.
> > ---
> > NOTE: This patch needs
> > https://lists.rtems.org/pipermail/devel/2021-May/067462.html applied too.
> >
> >   cpukit/dev/i2c/i2c-bus.c |  45 ++--
> >   cpukit/include/dev/i2c/i2c.h |  44 ++-
> >   testsuites/libtests/i2c01/init.c | 121 ++-
> >   3 files changed, 203 insertions(+), 7 deletions(-)
> >
> > diff --git a/cpukit/dev/i2c/i2c-bus.c b/cpukit/dev/i2c/i2c-bus.c
> > index 47c4ab..618a817b1a 100644
> > --- a/cpukit/dev/i2c/i2c-bus.c
> > +++ b/cpukit/dev/i2c/i2c-bus.c
> > @@ -31,6 +31,11 @@
> >   #include 
> >   #include 
> >
> > +int i2c_bus_try_obtain(i2c_bus *bus)
> > +{
> > +  return rtems_recursive_mutex_try_lock(&bus->mutex);
> > +}
> > +
> >   void i2c_bus_obtain(i2c_bus *bus)
> >   {
> > rtems_recursive_mutex_lock(&bus->mutex);
> > @@ -41,7 +46,12 @@ void i2c_bus_release(i2c_bus *bus)
> > rtems_recursive_mutex_unlock(&bus->mutex);
> >   }
> >
> > -int i2c_bus_transfer(i2c_bus *bus, i2c_msg *msgs, uint32_t msg_count)
> > +int i2c_bus_do_transfer(
> > +  i2c_bus *bus,
> > +  i2c_msg *msgs,
> > +  uint32_t msg_count,
> > +  uint32_t flags
> > +)
> >   {
> > int err;
> > uint32_t i;
> > @@ -63,13 +73,24 @@ int i2c_bus_transfer(i2c_bus *bus, i2c_msg *msgs, 
> > uint32_t msg_count)
> >   }
> > }
> >
> > -  i2c_bus_obtain(bus);
> > +  if ((flags & I2C_BUS_NOBLOCK) != 0) {
> > +if (i2c_bus_try_obtain(bus) != 0) {
> > +  return -EAGAIN;
> > +}
> > +  } else {
> > +i2c_bus_obtain(bus);
> > +  }
> > err = (*bus->transfer)(bus, msgs, msg_count);
> > i2c_bus_release(bus);
> >
> > return err;
> >   }
> >
> > +int i2c_bus_transfer(i2c_bus *bus, i2c_msg *msgs, uint32_t msg_count)
> > +{
> > +  return i2c_bus_do_transfer(bus, msgs, msg_count, 0);
> > +}
> > +
> >   static ssize_t i2c_bus_read(
> > rtems_libio_t *iop,
> > void *buffer,
> > @@ -84,12 +105,17 @@ static ssize_t i2c_bus_read(
> >   .buf = buffer
> > };
> > int err;
> > +  unsigned flags = 0;
> >
> > if (bus->ten_bit_address) {
> >   msg.flags |= I2C_M_TEN;
> > }
> >
> > -  err = i2c_bus_transfer(bus, &msg, 1);
> > +  if (rtems_libio_iop_is_no_delay(iop)) {
> > +flags |= I2C_BUS_NOBLOCK;
> > +  }
> > +
> > +  err = i2c_bus_do_transfer(bus, &msg, 1, flags);
> > if (err == 0) {
> >   return msg.len;
> > } else {
> > @@ -111,12 +137,17 @@ static ssize_t i2c_bus_write(
> >   .buf = RTEMS_DECONST(void *, buffer)
> > };
> > int err;
> > +  unsigned flags = 0;
> >
> > if (bus->ten_bit_address) {
> >   msg.flags |= I2C_M_TEN;
> > }
> >
> > -  err = i2c_bus_transfer(bus, &msg, 1);
> > +  if (rtems_libio_iop_is_no_delay(iop)) {
> > +flags |= I2C_BUS_NOBLOCK;
> > +  }
> > +
> > +  err = i2c_bus_do_transfer(bus, &msg, 1, flags);
> > if (err == 0) {
> >   return msg.len;
> > } else {
> > @@ -133,12 +164,16 @@ static int i2c_bus_ioctl(
> > i2c_bus *bus = IMFS_generic_get_context_by_iop(iop);
> > i2c_rdwr_ioctl_data *rdwr;
> > int err;
> > +  unsigned flags = 0;
> >
> > switch (command) {
> >   case I2C_RDWR:
> > rdwr = arg;
> > if (rdwr->nmsgs > 0) {
> > -err = i2c_bus_transfer(bus, rdwr->msgs, rdwr->nmsgs);
> > +if (rtems_libio_iop_is_no_delay(iop)) {
> > +  flags |= I2C_BUS_NOBLOCK;
> > +}
> > +err = i2c_bus_do_transfer(bus, rdwr->msgs, rdwr->nmsgs, flags);
> > } else {
> >   err = 0;
> > }
> > diff --git a/cpukit/include/dev/i2c/i2c.h b/cpukit/include/dev/i2c/i2c.h
> > index ac2c369785..5aa45e390c 100644
> > --- a/cpukit/include/dev/i2c/i2c.h
> > +++ b/cpukit/include/dev/i2c/i2c.h
> > @@ -242,6 +242,16 @@ int i2c_bus_register(
> > const char *bus_path
> >   );
> >
> > +/**
> > + * @brief Try to obtain the bus.
> > + *
> > + * @param[in] bus The bus control.
> > + *
> > + * @retval 0 Successful operation.
> > + * @retval EBUSY if mutex is already locked.
> > + */
> > +int i2c_bus_try_obtain(i2c_bus *bus);
> > +
> >   /**
> >* @brief Obtains the bus.
> >*
> > @@ -259,7 +269,8 @@ void i2c_bus_release(i2c_bus *bus);
> >   /**
> >* @brief Transfers I2C messages.
> >*
> > - * The bus is obtained before the transfer and released afterwards.
> > + * The bus is obtained before the transfer and released afterwards. This 
> > is the
> > + * same like calling @ref i2c_bus_do_transfer with flags set to 0.
> >*
> >* @param[in] bus The bus control.
> >* @param[in] msgs The messages to transfer.
> > @@ -271,6 +282,37 @@ void i2c_bus_release(i2c_bus *bus);
> >*/
> >  

Re: GSoC - Code Formatting and Style Checking for RTEMS score

2021-06-21 Thread Gedare Bloom
On Sun, Jun 20, 2021 at 1:13 AM Ida Delphine  wrote:

> Hello everyone,
> I updated the hooks script. About the modes, we have the default, "strict"
> and "nonstrict" (couldn't think of better names). With the default mode, it
> prints a warning specifying the number of style issues if any and aborts
> the commit. With the strict mode, it goes into more detail showing both the
> formatted and unformatted patch, the number of style issues, and aborts the
> commit. In the non-strict mode, it simply displays the warning with the
> style issues and the commit happens.
>
> The default mode basically happens when you run
>
>> git commit -m "Commit message"
>>
> The best method I could find to pass arguments to a script was via
> environment variables. So the nonstrict mode applies when you run
>
>> STYLEMODE=nonstrict git commit -m "Commit message"
>>
> The strict mode applies when you run
>
>> STYLEMODE=strict git commit -m "Commit message"
>>
>
> What are the possible options to pass arguments? (Maybe, a blog post :))
Reading from a git-config file would be better than environment variables.

It might be better to share screenshots by a link (e.g., a blog post :)) to
avoid hitting the mailing list attachment limits.

Gedare

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

Re: [PATCH rtems-docs] user/bsps/imxrt: Info about ARM PLL frequency

2021-06-21 Thread Gedare Bloom
thanks, that should at least give someone a hint what to do.

On Mon, Jun 21, 2021 at 8:59 AM Christian Mauderer
 wrote:
>
> ---
>  user/bsps/arm/imxrt.rst | 20 
>  1 file changed, 20 insertions(+)
>
> diff --git a/user/bsps/arm/imxrt.rst b/user/bsps/arm/imxrt.rst
> index 8a5ee28..3f8b270 100644
> --- a/user/bsps/arm/imxrt.rst
> +++ b/user/bsps/arm/imxrt.rst
> @@ -123,6 +123,26 @@ with your FDT source names)::
>
>  Make sure that your new C file is compiled and linked into the application.
>
> +PLL Settings
> +
> +
> +The commercial variant of the i.MXRT1052 on the evaluation board allows a 
> clock
> +up to 600MHz for the ARM core. For some industrial variants only up to 528MHz
> +are specified. To make it possible to adapt to these variants the application
> +can overwrite the following constant:
> +
> +.. code-block:: c
> +
> +  #include "fsl_clock_config.h"
> +
> +  const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = {
> +  .loopDivider = 100,
> +  .src = 0,
> +  };
> +
> +With the default configuration of a 24MHz oscillator, the loopDivider has to 
> be
> +88 for the 528MHz.
> +
>  Clock Driver
>  
>
> --
> 2.26.2
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v1] cpukit: Add timespecisnonnegative to Makefile.am

2021-06-21 Thread Ryan Long
---
 cpukit/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 78e33b6..df970e5 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -998,6 +998,7 @@ librtemscpu_a_SOURCES += score/src/timespeclessthan.c
 librtemscpu_a_SOURCES += score/src/timespecsubtract.c
 librtemscpu_a_SOURCES += score/src/timespectoticks.c
 librtemscpu_a_SOURCES += score/src/timespecdivide.c
+librtemscpu_a_SOURCES += score/src/timespecisnonnegative.c
 librtemscpu_a_SOURCES += score/src/timespecdividebyinteger.c
 librtemscpu_a_SOURCES += score/src/timespecgetasnanoseconds.c
 librtemscpu_a_SOURCES += score/src/coretod.c
-- 
1.8.3.1

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


Re: [PATCH v1] cpukit: Add timespecisnonnegative to Makefile.am

2021-06-21 Thread Joel Sherrill
This patch is OK and I'm about to push it.  Using autoconf build on
sparc/leon3,
I got the following test results:

assed:577
Failed:  1
User Input:  6
Expected Fail:   1
Indeterminate:   0
Benchmark:   3
Timeout: 0
Test too long:   0
Invalid: 0
Wrong Version:   0
Wrong Build: 0
Wrong Tools: 0
--
Total: 588
Failures:
 dl06.exe
User Input:
 fileio.exe
 dl10.exe
 termios.exe
 capture.exe
 monitor.exe
 top.exe
Expected Fail:
 psxfenv01.exe
Benchmark:
 linpack.exe
 dhrystone.exe
 whetstone.exe

--joel

On Mon, Jun 21, 2021 at 1:12 PM Ryan Long  wrote:

> ---
>  cpukit/Makefile.am | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
> index 78e33b6..df970e5 100644
> --- a/cpukit/Makefile.am
> +++ b/cpukit/Makefile.am
> @@ -998,6 +998,7 @@ librtemscpu_a_SOURCES += score/src/timespeclessthan.c
>  librtemscpu_a_SOURCES += score/src/timespecsubtract.c
>  librtemscpu_a_SOURCES += score/src/timespectoticks.c
>  librtemscpu_a_SOURCES += score/src/timespecdivide.c
> +librtemscpu_a_SOURCES += score/src/timespecisnonnegative.c
>  librtemscpu_a_SOURCES += score/src/timespecdividebyinteger.c
>  librtemscpu_a_SOURCES += score/src/timespecgetasnanoseconds.c
>  librtemscpu_a_SOURCES += score/src/coretod.c
> --
> 1.8.3.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v1] cpukit: Add timespecisnonnegative to Makefile.am

2021-06-21 Thread Gedare Bloom
ok

On Mon, Jun 21, 2021 at 12:12 PM Ryan Long  wrote:
>
> ---
>  cpukit/Makefile.am | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
> index 78e33b6..df970e5 100644
> --- a/cpukit/Makefile.am
> +++ b/cpukit/Makefile.am
> @@ -998,6 +998,7 @@ librtemscpu_a_SOURCES += score/src/timespeclessthan.c
>  librtemscpu_a_SOURCES += score/src/timespecsubtract.c
>  librtemscpu_a_SOURCES += score/src/timespectoticks.c
>  librtemscpu_a_SOURCES += score/src/timespecdivide.c
> +librtemscpu_a_SOURCES += score/src/timespecisnonnegative.c
>  librtemscpu_a_SOURCES += score/src/timespecdividebyinteger.c
>  librtemscpu_a_SOURCES += score/src/timespecgetasnanoseconds.c
>  librtemscpu_a_SOURCES += score/src/coretod.c
> --
> 1.8.3.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v1] cpukit: Add timespecisnonnegative to Makefile.am

2021-06-21 Thread Joel Sherrill
On Mon, Jun 21, 2021 at 3:10 PM Gedare Bloom  wrote:

> ok
>

This either added the file that was needed to keep autoconf builds working
a bit longer or it didn't fix the autoconf build issue reported.

Now checking if the waf and autoconf test results are the same for
sparc/leon3.

--joel


>
> On Mon, Jun 21, 2021 at 12:12 PM Ryan Long  wrote:
> >
> > ---
> >  cpukit/Makefile.am | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
> > index 78e33b6..df970e5 100644
> > --- a/cpukit/Makefile.am
> > +++ b/cpukit/Makefile.am
> > @@ -998,6 +998,7 @@ librtemscpu_a_SOURCES += score/src/timespeclessthan.c
> >  librtemscpu_a_SOURCES += score/src/timespecsubtract.c
> >  librtemscpu_a_SOURCES += score/src/timespectoticks.c
> >  librtemscpu_a_SOURCES += score/src/timespecdivide.c
> > +librtemscpu_a_SOURCES += score/src/timespecisnonnegative.c
> >  librtemscpu_a_SOURCES += score/src/timespecdividebyinteger.c
> >  librtemscpu_a_SOURCES += score/src/timespecgetasnanoseconds.c
> >  librtemscpu_a_SOURCES += score/src/coretod.c
> > --
> > 1.8.3.1
> >
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: rtems6 master build tests for erc32 fail : undefined reference to `_Timespec_Is_non_negative'

2021-06-21 Thread Joel Sherrill
The autoconf build system is on life support and fading fast but
this one was fixable and a patch was pushed. I tested with
sparc/leon3 and Ryan provided a patch. Try again please.

There are only a couple of issues remaining before the autoconf
build system is removed from the master so it is time to figure
out the waf build system if you haven't already. :)

--joel

On Mon, Jun 21, 2021 at 10:24 AM junkes  wrote:

> Making all-am in fstests
> make[5]: Entering directory
> '/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/testsuites/fstests'
> sparc-rtems6-gcc  -mcpu=cypress -O2 -g -ffunction-sections
> -fdata-sections -Wall -Wmissing-prototypes
> -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs
> -B./../../lib/libbsp/sparc/erc32
> -B/home/junkes/VE/kernel/bsps/sparc/erc32/start -specs bsp_specs -qrtems
> -L./../../cpukit -L/home/junkes/VE/kernel/bsps/sparc/shared/start
> -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar -Wl,--gc-sections
> -o fsimfsconfig01.exe fsimfsconfig01/fsimfsconfig01-init.o
> ./../../lib/libbsp/sparc/erc32/librtemsbsp.a
> ./../../cpukit/librtemscpu.a ./../../cpukit/librtemstest.a
> /home/junkes/VE/rtems/6/lib/gcc/sparc-rtems6/10.3.1/../../../../sparc-rtems6/bin/ld:
>
> ./../../cpukit/librtemscpu.a(utimensat.o): in function
> `rtems_filesystem_utime_update':
> /home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/cpukit/../../../../../../kernel/c/src/../../cpukit/libcsupport/src/utimensat.c:153:
>
> undefined reference to `_Timespec_Is_non_negative'
> /home/junkes/VE/rtems/6/lib/gcc/sparc-rtems6/10.3.1/../../../../sparc-rtems6/bin/ld:
>
> /home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/cpukit/../../../../../../kernel/c/src/../../cpukit/libcsupport/src/utimensat.c:157:
>
> undefined reference to `_Timespec_Is_non_negative'
> collect2: error: ld returned 1 exit status
> make[5]: *** [Makefile:1905: fsimfsconfig01.exe] Error 1
> make[5]: Leaving directory
> '/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/testsuites/fstests'
> make[4]: *** [Makefile:663: fstests] Error 2
> make[4]: Leaving directory
> '/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32/testsuites'
> make[3]: *** [Makefile:1342: testsuites] Error 2
> make[3]: Leaving directory
> '/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32'
> make[2]: *** [Makefile:822: all-recursive] Error 1
> make[2]: Leaving directory
> '/home/junkes/VE/build/b-erc32/sparc-rtems6/c/erc32'
> make[1]: *** [Makefile:289: all-recursive] Error 1
> make[1]: Leaving directory
> '/home/junkes/VE/build/b-erc32/sparc-rtems6/c'
> make: *** [Makefile:410: all-recursive] Error 1
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel