Re: python dependencies Ubuntu 15.04

2015-08-12 Thread Christian Mauderer
Hello,

just a wild guess: Which python Version is default on Ubuntu?

Most distributions use python2 as default. I know that e.g. Arch uses
python3. Just try a

   python --version

to find out.

Kind regards

Christian Mauderer

Am 12.08.2015 um 10:38 schrieb punit vara:
> sudo apt-get install python-all-dev
> 
> I have done this .Still python error.
> Any help will be appreciated.
> 
> 
> 
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 

-- 
----
embedded brains GmbH
Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


XtratuM BSP

2014-06-18 Thread Christian Mauderer

Hello,

there is still the licensing issue with this BSP discussed in an earlier thread.
So the BSP (most likely) still can not be included into the main repository.

Anyway it seems to be useful to re-post the last version of the BSP with bug
fixes, some of the suggested improvements and further adaptions to the current
git-master. If somehow the licensing issues can be resolved in the near future,
the last state of the BSP should be available on the mailinglist. Also if it
should be used somewhere else outside of the official repository, it is not
necessary to re-fix the same bugs again.

Kind regards,

Christian Mauderer

-- 

embedded brains GmbH
Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/2] bsps/xtratum: New BSP

2014-06-18 Thread Christian Mauderer
Hello,

there is only one Patch. I had a second (temporary) commit on top of
this one while generating the patch. I will take more care into this in
the future. Sorry.

Kind regards,

Christian Mauderer

-- 

embedded brains GmbH
Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] Fix headers and add RTC to altera-cyclone-v BSP.

2014-07-25 Thread Christian Mauderer
Hello,

I have three patches for the altera-cyclone-v BSP.

The first adds some missing header files to the BSP installation. Without these
headers, some other headers from the hwlib directory can't be used.

With the second patch a simple I2C driver is added. The third one adds a driver
for the RTC chip on the evaluation board (a DS1339).

Kind regards,

Christian Mauderer

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


[PATCH 3/3] bsp/altera-cyclone-v: Add RTC driver.

2014-07-25 Thread Christian Mauderer
From: Christian Mauderer 

---
 c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am  |   4 +
 c/src/lib/libbsp/arm/altera-cyclone-v/README   |  15 +-
 .../lib/libbsp/arm/altera-cyclone-v/preinstall.am  |   6 +-
 c/src/lib/libbsp/arm/altera-cyclone-v/rtc/rtc.c| 360 +
 4 files changed, 381 insertions(+), 4 deletions(-)
 create mode 100644 c/src/lib/libbsp/arm/altera-cyclone-v/rtc/rtc.c

diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am 
b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
index 01b0272..939ccc7 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
@@ -200,6 +200,10 @@ libbsp_a_SOURCES += i2c/i2cdrv.c
 libbsp_a_SOURCES += i2c/i2cdrv-config.c
 include_bsp_HEADERS += include/i2cdrv.h
 
+# RTC
+libbsp_a_SOURCES += ../../shared/tod.c
+libbsp_a_SOURCES += rtc/rtc.c
+
 # Cache
 libbsp_a_SOURCES += ../../../libcpu/shared/src/cache_manager.c
 libbsp_a_SOURCES += ../shared/include/arm-cache-l1.h
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/README 
b/c/src/lib/libbsp/arm/altera-cyclone-v/README
index 575b72e..0a5bc05 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/README
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/README
@@ -1,3 +1,16 @@
+Overview
+
 Evaluation board for this BSP: 
 - Cyclone V SoC FPGA Development Kit
-- DK-DEV-5CSXC6N/ES-0L
\ No newline at end of file
+- DK-DEV-5CSXC6N/ES-0L
+
+RTC
+---
+The evaluation board contains a DS1339C RTC connected to I2C0. To use it you
+have to set the following options:
+
+  #define CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
+  #define CONFIGURE_BSP_PREREQUISITE_DRIVERS I2C_DRIVER_TABLE_ENTRY
+
+Additional there has to be one free file descriptor to access the i2c. Set the
+CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS accordingly.
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am 
b/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
index c13ef6a..4e3b586 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
@@ -5,14 +5,14 @@ $(srcdir)/preinstall.am: Makefile.am
$(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
 endif
 
+PREINSTALL_DIRS =
+DISTCLEANFILES += $(PREINSTALL_DIRS)
+
 all-am: $(PREINSTALL_FILES)
 
 PREINSTALL_FILES =
 CLEANFILES = $(PREINSTALL_FILES)
 
-PREINSTALL_DIRS =
-DISTCLEANFILES += $(PREINSTALL_DIRS)
-
 all-local: $(TMPINSTALL_FILES)
 
 TMPINSTALL_FILES =
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/rtc/rtc.c 
b/c/src/lib/libbsp/arm/altera-cyclone-v/rtc/rtc.c
new file mode 100644
index 000..3c18d1c
--- /dev/null
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/rtc/rtc.c
@@ -0,0 +1,360 @@
+/*
+ * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+/*
+ * Driver for the DS1339 RTC.
+ *
+ * Please note the following points:
+ * - The day of week is ignored.
+ * - The century bit is interpreted the following way:
+ *   - century not set: TOD_BASE_YEAR .. 1999
+ *   - century set: 2000 .. 2099
+ *   - century not set: 2100 .. (TOD_BASE_YEAR + 200)
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ALTERA_CYCLONE_V_RTC_NUMBER 1
+
+#define DS1339_I2C_ADDRESS 0x68
+#define DS1339_I2C_BUS_DEVICE "/dev/i2c0"
+
+#define DS1339_ADDR_CTRL 0x0E
+#define DS1339_CTRL_EOSC 0x80
+#define DS1339_CTRL_BBSQI 0x20
+#define DS1339_CTRL_RS2 0x10
+#define DS1339_CTRL_RS1 0x08
+#define DS1339_CTRL_INTCN 0x04
+#define DS1339_CTRL_A2IE 0x02
+#define DS1339_CTRL_A1IE 0x01
+
+#define DS1339_CTRL_DEFAULT (0x00)
+
+#define DS1339_ADDR_TIME 0x00
+#define DS1339_ADDR_STATUS 0x0F
+#define DS1339_STATUS_OSF 0x80
+#define DS1339_STATUS_A2F 0x02
+#define DS1339_STATUS_A1F 0x01
+
+#define DS1339_STATUS_CLEAR (0x00)
+
+typedef struct {
+  uint8_t seconds;
+  uint8_t minutes;
+  uint8_t hours;
+#define DS1339_HOURS_12_24_FLAG 0x40
+#define DS1339_HOURS_AM_PM_FLAG_OR_20_HOURS 0x20
+#define DS1339_HOURS_10_HOURS 0x10
+  uint8_t weekday;
+  uint8_t date;
+  uint8_t month;
+#define DS1339_MONTH_CENTURY 0x80
+  uint8_t year;
+} ds1339_time_t;
+
+/* The longest write transmission is writing the time + one address bit */
+#define DS1339_MAX_WRITE_SIZE (sizeof(ds1339_time_t) + 1)
+
+/* Functions for converting the fields */
+static unsigned int get_seconds (ds1339_time_t *time) {
+  uint8_t tens = time->seconds >> 4;
+  uint8_t ones = time->seconds & 0x0F;
+  return tens * 10 + ones;
+}
+
+static unsigned int get_minutes (ds1339_time_t *time) {
+  uint8_t tens = time->minutes >> 4;
+  uint8_t ones = time->minutes & 0x0F;
+  return tens * 10 + ones;
+}
+
+static unsigned int get_hours (ds1339_time_t *time) {
+  uin

[PATCH 1/3] bsp/altera-cyclone-v: Add socal from hwlib.

2014-07-25 Thread Christian Mauderer
From: Christian Mauderer 

Some of the headers from the hwlib need the files from the socal subdirectory.
---
 c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am  | 17 +++-
 .../lib/libbsp/arm/altera-cyclone-v/preinstall.am  | 45 ++
 2 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am 
b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
index 6d7115b..e92e728 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
@@ -10,6 +10,7 @@ ACLOCAL_AMFLAGS = -I ../../../../aclocal
 include $(top_srcdir)/../../../../automake/compile.am
 
 include_bspdir = $(includedir)/bsp
+include_bsp_socaldir = $(includedir)/bsp/socal
 include_libcpudir = $(includedir)/libcpu
 
 dist_project_lib_DATA = bsp_specs
@@ -27,6 +28,8 @@ nodist_include_HEADERS = ../../shared/include/coverhd.h \
 nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
 
 include_bsp_HEADERS =
+include_bsp_socal_HEADERS =
+
 include_bsp_HEADERS += ../../shared/include/utility.h
 include_bsp_HEADERS += ../../shared/include/irq-generic.h
 include_bsp_HEADERS += ../../shared/include/irq-info.h
@@ -71,8 +74,18 @@ include_bsp_HEADERS += hwlib/include/hwlib.h
 #include_bsp_HEADERS += hwlib/include/alt_watchdog.h
 #The following Altera hwlib headers would be problematic with RTEMS:
 #include_bsp_HEADERS += hwlib/include/alt_interrupt.h
-#All header files from hwlib/include/socal are regarded as BSP
-#internal and thus not installed
+
+# Some of the headers from hwlib need the files from socal. Install them.
+include_bsp_socal_HEADERS += hwlib/include/socal/alt_clkmgr.h
+include_bsp_socal_HEADERS += hwlib/include/socal/alt_gpio.h
+include_bsp_socal_HEADERS += hwlib/include/socal/alt_i2c.h
+include_bsp_socal_HEADERS += hwlib/include/socal/alt_l3.h
+include_bsp_socal_HEADERS += hwlib/include/socal/alt_rstmgr.h
+include_bsp_socal_HEADERS += hwlib/include/socal/alt_sdr.h
+include_bsp_socal_HEADERS += hwlib/include/socal/alt_sysmgr.h
+include_bsp_socal_HEADERS += hwlib/include/socal/alt_uart.h
+include_bsp_socal_HEADERS += hwlib/include/socal/hps.h
+include_bsp_socal_HEADERS += hwlib/include/socal/socal.h
 
 include_libcpu_HEADERS = ../../../libcpu/arm/shared/include/arm-cp15.h
 
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am 
b/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
index 3f83665..8873d31 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/preinstall.am
@@ -33,6 +33,11 @@ $(PROJECT_INCLUDE)/bsp/$(dirstamp):
@: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
 PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
 
+$(PROJECT_INCLUDE)/bsp/socal/$(dirstamp):
+   @$(MKDIR_P) $(PROJECT_INCLUDE)/bsp/socal
+   @: > $(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+
 $(PROJECT_INCLUDE)/libcpu/$(dirstamp):
@$(MKDIR_P) $(PROJECT_INCLUDE)/libcpu
@: > $(PROJECT_INCLUDE)/libcpu/$(dirstamp)
@@ -174,6 +179,46 @@ $(PROJECT_INCLUDE)/bsp/hwlib.h: hwlib/include/hwlib.h 
$(PROJECT_INCLUDE)/bsp/$(d
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/hwlib.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/hwlib.h
 
+$(PROJECT_INCLUDE)/bsp/socal/alt_clkmgr.h: hwlib/include/socal/alt_clkmgr.h 
$(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/socal/alt_clkmgr.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/socal/alt_clkmgr.h
+
+$(PROJECT_INCLUDE)/bsp/socal/alt_gpio.h: hwlib/include/socal/alt_gpio.h 
$(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/socal/alt_gpio.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/socal/alt_gpio.h
+
+$(PROJECT_INCLUDE)/bsp/socal/alt_i2c.h: hwlib/include/socal/alt_i2c.h 
$(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/socal/alt_i2c.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/socal/alt_i2c.h
+
+$(PROJECT_INCLUDE)/bsp/socal/alt_l3.h: hwlib/include/socal/alt_l3.h 
$(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/socal/alt_l3.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/socal/alt_l3.h
+
+$(PROJECT_INCLUDE)/bsp/socal/alt_rstmgr.h: hwlib/include/socal/alt_rstmgr.h 
$(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/socal/alt_rstmgr.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/socal/alt_rstmgr.h
+
+$(PROJECT_INCLUDE)/bsp/socal/alt_sdr.h: hwlib/include/socal/alt_sdr.h 
$(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/socal/alt_sdr.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/socal/alt_sdr.h
+
+$(PROJECT_INCLUDE)/bsp/socal/alt_sysmgr.h: hwlib/include/socal/alt_sysmgr.h 
$(PROJECT_INCLUDE)/bsp/socal/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/socal/alt_sysmgr.h
+PREINSTAL

Re: [PATCH] Fix headers and add RTC to altera-cyclone-v BSP.

2014-07-28 Thread Christian Mauderer
Hello,

just that there is no confusion about it: The second patch contains some
large headers from the Altera hwlib. Therefore it is bigger than the
maximum mail size for the list and has to be reviewed by a list
administrator. Therefore it can need some additional time to turn up on
the list.

Kind regards,

Christian Mauderer

Am 25.07.2014 11:49, schrieb Christian Mauderer:
> Hello,
> 
> I have three patches for the altera-cyclone-v BSP.
> 
> The first adds some missing header files to the BSP installation. Without 
> these
> headers, some other headers from the hwlib directory can't be used.
> 
> With the second patch a simple I2C driver is added. The third one adds a 
> driver
> for the RTC chip on the evaluation board (a DS1339).
> 
> Kind regards,
> 
> Christian Mauderer
> 
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 

-- 
----
embedded brains GmbH
Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] Fix headers and add RTC to altera-cyclone-v BSP.

2014-07-28 Thread Christian Mauderer


Am 28.07.2014 10:17, schrieb Chris Johns:
> On 28/07/2014 5:17 pm, Christian Mauderer wrote:
>>
>> just that there is no confusion about it: The second patch contains some
>> large headers from the Altera hwlib. Therefore it is bigger than the
>> maximum mail size for the list and has to be reviewed by a list
>> administrator. Therefore it can need some additional time to turn up on
>> the list.
>>
> 
> What is the license for these header files ?
> 
> Are you able to post the license or is there a public reference to the
> code ?
> 
The license is the same like for the headers that are already included
in this BSP in the hwlib directory. Altera uses a BSD-style license for
the files from hwlib. It is written directly in the head of the headers
and sources.

> Did you obtain these files from an installed Altera tool or package with
> an EUL you accepted or via a login to Altera's website ?
> 
The hwlib is packed with the Altera "SoC Embedded Design Suite Web
Edition". It is available here:
http://dl.altera.com/soceds/?edition=subscription

You have to register to get access to the installer. The complete pack
has a number of different licenses for the different parts of the
development environment. But the heads of the source files clearly state
a BSD-style license for the hwlib part.

> Please understand we cannot accept the code unless it is public or the
> project has an accepted agreement from Altera we can include it.
> 
Of course I understand that. It would be difficult to use RTEMS if you
had to search every file for incompatible licenses.

Kind regards

Christian Mauderer

-- 

embedded brains GmbH
Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] Fix headers and add RTC to altera-cyclone-v BSP.

2014-07-29 Thread Christian Mauderer
Hello,

thanks for clarifying the licensing issues with the hwlib Chris.

After that problem is resolved, you can find the resubmission of the second
patch as an answer to this mail.

Please don't hesitate to make any comments to this or one of the other two
patches.

Kind regards

Christian Mauderer

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


[PATCH rtems-libbsd 2/3] builder.py: Add case for plain text files.

2020-09-17 Thread Christian Mauderer
Update #4082
---
 builder.py | 8 
 1 file changed, 8 insertions(+)

diff --git a/builder.py b/builder.py
index f5fe2afc..0eda461f 100755
--- a/builder.py
+++ b/builder.py
@@ -202,6 +202,9 @@ def revertFixLocalIncludes(data):
 data = re.sub('#include ]*)>', '#include "\\1"', data)
 return data
 
+def assertNothing(path):
+pass
+
 def assertHeaderFile(path):
 if path[-2] != '.' or path[-1] != 'h':
 print("*** " + path + " does not end in .h")
@@ -690,6 +693,11 @@ class Module(object):
reverseConverter, buildSystemComposer)]
 return files
 
+def addPlainTextFile(self, files):
+self.files += self.addFiles(files,
+FreeBSDPathComposer(), Converter(),
+Converter(), assertNothing)
+
 def addKernelSpaceHeaderFiles(self, files):
 self.files += self.addFiles(files,
 FreeBSDPathComposer(), 
FromFreeBSDToRTEMSHeaderConverter(),
-- 
2.26.2

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


[PATCH rtems-libbsd 3/3] Import FreeBSD license files.

2020-09-17 Thread Christian Mauderer
Fix #4082
---
 freebsd/COPYRIGHT | 126 ++
 freebsd/contrib/expat/COPYING |  21 +
 freebsd/contrib/libpcap/LICENSE   |  19 
 freebsd/contrib/libxo/LICENSE |  23 +
 freebsd/contrib/tcpdump/LICENSE   |  19 
 freebsd/contrib/wpa/COPYING   |  22 +
 freebsd/crypto/openssl/LICENSE| 125 +
 freebsd/sys/contrib/libsodium/LICENSE |  18 
 freebsd/sys/dev/e1000/LICENSE |  31 +++
 libbsd.py |  45 +
 10 files changed, 449 insertions(+)
 create mode 100644 freebsd/COPYRIGHT
 create mode 100644 freebsd/contrib/expat/COPYING
 create mode 100644 freebsd/contrib/libpcap/LICENSE
 create mode 100644 freebsd/contrib/libxo/LICENSE
 create mode 100644 freebsd/contrib/tcpdump/LICENSE
 create mode 100644 freebsd/contrib/wpa/COPYING
 create mode 100644 freebsd/crypto/openssl/LICENSE
 create mode 100644 freebsd/sys/contrib/libsodium/LICENSE
 create mode 100644 freebsd/sys/dev/e1000/LICENSE

diff --git a/freebsd/COPYRIGHT b/freebsd/COPYRIGHT
new file mode 100644
index ..4a40a9f3
--- /dev/null
+++ b/freebsd/COPYRIGHT
@@ -0,0 +1,126 @@
+# $FreeBSD$
+#  @(#)COPYRIGHT   8.2 (Berkeley) 3/21/94
+
+The compilation of software known as FreeBSD is distributed under the
+following terms:
+
+Copyright (c) 1992-2020 The FreeBSD Project.
+
+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.
+
+The 4.4BSD and 4.4BSD-Lite software is distributed under the following
+terms:
+
+All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
+Releases is copyrighted by The Regents of the University of California.
+
+Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
+   The Regents of the University of California.  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.
+3. All advertising materials mentioning features or use of this software
+   must display the following acknowledgement:
+This product includes software developed by the University of
+California, Berkeley and its contributors.
+4. Neither the name of the University nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+The Institute of Electrical and Electronics Engineers and the American
+National Standards Committee X3, on Information Processing Systems have
+given us permission to reprint portions of their documentation.
+
+In the following statement, the phrase ``this text'' refers to portions
+of 

License files missing on 5-freebsd-12 branch

2020-09-17 Thread Christian Mauderer
Hello,

Chris pinged me that I missed to add these patches to the 5-freebsd-12
branch. It would be good if we would add the license files to the
release branch too. This will allow users to easily find the correct
licenses.

Best regards

Christian


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


Re: [PATCH rtems-libbsd 1/3] Add helper script to find licenses.

2020-09-17 Thread Christian Mauderer
On 17/09/2020 23:35, Chris Johns wrote:
> On 17/9/20 10:51 pm, Joel Sherrill wrote:
>> I think I'm ok on all three of these patches but some 
>> comments on the shell script. I can see where this is a
>> tedious but important check. And it can be improved easily.
>>
>> Since this smells like something Chris would poke me f
>> or and call a "Joel script" :)
> 
> Haha ...
> 
> This patch is only for the 5-freesd-12 branch and a script is fine. The script
> has made think for the master and 6-freebsd-12 branches libbsd.py should be
> taught to handle licenses so these are copied across as part of the import.
> 
> Chris
> 

Hello Chris and Joel,

I agree that this script is an ugly one. It has been hacked together
when I needed to import the license files and I didn't wanted to throw
it out of the window because I thought it might could be useful to find
some more missing license files in the future.

Please note that this script is already on master since quite a long
time and that I only cherry-picked the commits for the 5-freebsd-12
branch (and adapted the import patch to import the right version). So
thanks for the suggestions Joel but shouldn't these changes then be an
extra patch? Chris: You mentioned that libbsd.py should be taught to
handle licenses. Do you plan anything into that direction? In that case
touching the script wouldn't be really useful.

Best regards

Christian
-- 

embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: How to use lvgl on pc386 BSP.

2020-09-19 Thread Christian Mauderer
Hello Karel,

I wasn't aware that there is a framebuffer driver in the PC BSP. Maybe
an alternative to using the BSP framebuffer driver could be to just port
the FreeBSD framebuffer driver for PC and use that one? That might could
be less work than fixing the PC BSPs driver.

If you want to continue to use the BSPs driver, I can try to have a more
detailled look at it. But like I said: I would expect that the FreeBSD
driver is simpler to use.

Best regards

Christian

On 19/09/2020 00:30, Karel Gardas wrote:
> On 9/18/20 11:51 PM, Karel Gardas wrote:
>> Whole demo output looks:
>>
>> i386: isr=0 irr=1
>> i386: isr=0 irr=1
>> FB_VESA_RM frame buffer -- driver initializing..
>>
>>
>> RTEMS LVGL HELLO WORLD
>>
>> nexus0: 
>> pcib0 pcibus 0
>> pci0:  on pcib0
>> pci0:  at device 0.0 (no driver attached)
>> pci0:  at device 1.0 (no driver attached)
>> pci0:  at device 1.1 (no driver attached)
>> pci0:  at device 1.3 (no driver attached)
>> pci0:  at device 2.0 (no driver attached)
>> pci0:  at device 3.0 (no driver attached)
>> cpu0
>> FB_VESA_RM open device
>> The framebuffer device was opened successfully.
>> FB_VESA_RM ioctl called, cmd=4602
>> fbxres 1024, fbyres 768
>> fbbpp 32
>> FB_VESA_RM ioctl called, cmd=4600
>> fbxres 1024, fbyres 768
>> fbbpp 32
>> 1024x768, 32bpp
>> 3145728 screen size.
>> Error: failed to map framebuffer device to memory: Not supported
>>
>>
> 
> ^ that was form Qemu, from my testing hw box it looks as follows. Sorry
> for the dead Reaktek. Also it looks like VBE bios is kind of limited
> since EDID recommended resolution is monitors native: 2560x1440, but
> BIOS does not support it hence offers 1920x1440 as most close.
> 
> i386: isr=0 irr=1
> FB_VESA_RM frame buffer -- driver initializing..
> 
> RTEMS LVGL HELLO WORLD
> 
> nexus0: 
> pcib0 pcibus 0
> pci0:  on pcib0
> pci0:  at device 0.0 (no driver attached)
> pcib1:  at device 1.0 on pci0
> pci1:  on pcib1
> pci1:  at device 5.0 (no driver attached)
> pci1:  at device 5.1 (no driver attached)
> pcib2:  irq 10 at device 10.0 on pci0
> pci2:  on pcib2
> re0:  port
> 0xd800-0xd8ff mem 0xfdfff000-0xfdff,0xfdff8000-0xfdffbfff irq 10 at
> device 0.0 on pci2
> re0: Chip rev. 0x2c00
> re0: MAC rev. 0x0020
> re0: PHY write failed
> re0: PHY write failed
> re0: PHY read failed
> re0: attaching PHYs failed
> device_attach: re0 attach returned 6
> pci0:  at device 17.0 (no driver attached)
> pci0:  at device 18.0 (no driver attached)
> pci0:  at device 18.2 (no driver attached)
> pci0:  at device 19.0 (no driver attached)
> pci0:  at device 19.2 (no driver attached)
> pci0:  at device 20.2 (no driver attached)
> pci0:  at device 20.3 (no driver attached)
> pcib3:  at device 20.4 on pci0
> pci3:  on pcib3
> re0: 
> port 0xe800-0xe8ff mem 0xfebffc00-0xfebffcff irq 3 at device 5.0 on pci3
> re0: Chip rev. 0x0400
> re0: MAC rev. 0x
> miibus0:  on re0
> rgephy0:  PHY 1 on miibus0
> rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX,
> 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master,
> 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1w
> info: re0: Using defaults for TSO: 65518/35/2048
> info: re0: Ethernet address: 00:0e:2e:7b:da:0b
> pci0:  at device 20.5 (no driver attached)
> pci0:  at device 22.0 (no driver attached)
> pci0:  at device 22.2 (no driver attached)
> pci0:  at device 24.0 (no driver attached)
> pci0:  at device 24.1 (no driver attached)
> pci0:  at device 24.2 (no driver attached)
> pci0:  at device 24.3 (no driver attached)
> pci0: > at device 24.4 (no driver attached)
> cpu0
> TheFB_VESA_RM ioctl called, cmd=4602
> fbxres 1920, fbyres 1440
> fbbpp 32
> FB_VESA_RM ioctl called, cmd=4600
> fbxres 1920, fbyres 1440
> fbbpp 32
>  framebuffer device was opened successfully.
> 1920x1440, 32bpp
> 11059200 screen size.
> Error: failed to map framebuffer device to memory: Not supported
> 
> *** FATAL ***
> fatal source: 9 (RTEMS_FATAL_SOURCE_EXCEPTION)
> --
> Exception 13 caught at PC  by thread 167837697
> --
> Processor execution context at time of the fault was  :
> --
>  EAX = 0EBX = 0 ECX = 3662e4EDX = 0
>  ESI = 0EDI = 3662bcEBP = ffESP = 3af0a8
> --
> Error code pushed by processor itself (if not 0) = 0
> --
> Call Stack Trace of EIP:
> 0xef7eef7e 0x
> *** FATAL ***
> fatal source: 9 (RTEMS_FATAL_SOURCE_EXCEPTION)
> --
> Exception 13 caught at PC 2ae863 by thread 167837697
> --
> Processor execution context at time of the fault was  :
> --
>  EAX = bEBX =   ECX =

Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-09-19 Thread Christian Mauderer
Hello Niteesh,

sorry for adding another delay: I think the new build system needs a bit
of time to settle. As soon as there are some more PASS in the table that
Sebastian created [1] (especially for beagle) we should try to get these
patches merged. Before that I would like to avoid big changes because it
might get hard to distinguish new bugs from build system bugs.

Best regards

Christian

[1] https://devel.rtems.org/wiki/Release/6/Waf%20BSP%20Checklist

On 16/09/2020 19:05, Niteesh G. S. wrote:
> Hello,
> 
> Sorry for the delay, I was a bit occupied with my university work.
> Now since the new build system is merged I would like to get my
> GSoC work merged too.
> 
> The goal of this series patches is to implement the OFW API into RTEMS
> and modify libBSD to use this RTEMS API instead of its own.
> 
> Thanks,
> Niteesh.
> 
> On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu  > wrote:
> 
> RTEMS OFW is a FDT only implementation of the OpenFirmWare
> interface. This API is created to be compatible with FreeBSD
> OpenFirmWare interface. The main intention is to make
> porting of FreeBSD drivers to RTEMS easier.
> 
> Most functions implemented have an direct one-one mapping
> with the original OFW API and some extra auxiliary functions
> were implemented to make working with device trees easier in
> RTEMS.
> 
> Update #3784
> ---
>  bsps/include/ofw/ofw.h        | 548 +++
>  bsps/include/ofw/ofw_compat.h |  74 
>  bsps/shared/ofw/ofw.c         | 682 ++
>  spec/build/bsps/obj.yml       |   5 +
>  4 files changed, 1309 insertions(+)
>  create mode 100644 bsps/include/ofw/ofw.h
>  create mode 100644 bsps/include/ofw/ofw_compat.h
>  create mode 100644 bsps/shared/ofw/ofw.c
> 
> diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
> new file mode 100644
> index 00..411010be89
> --- /dev/null
> +++ b/bsps/include/ofw/ofw.h
> @@ -0,0 +1,548 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/**
> + * @file
> + *
> + * @ingroup ofw
> + *
> + * RTEMS FDT implementation of OpenFirmWare Interface.
> + *
> + * RTEMS OFW is a FDT only implementation of the OpenFirmWare
> interface.
> + * This API is created to be compatible with FreeBSD OpenFirmWare
> interface.
> + * The main intention is to make porting of FreeBSD drivers to
> RTEMS easier.
> + */
> +
> +/*
> + * Copyright (C) 2020 Niteesh Babu G S  >
> + *
> + * 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.
> + */
> +
> +#ifndef _OFW_H
> +#define _OFW_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * Represents a node in the device tree. The offset from fdtp to
> node is used
> + * instead of fdt offset to make sure this is compatible with OF
> interface in
> + * FreeBSD.
> + */
> +typedef uint32_t  phandle_t;
> +/**
> + * Represents the effective phandle of the node.
> + */
> +typedef uint32_t  ihandle_t;
> +/**
> + * Represents the data type of the buffer.
> + */
> +typedef uint32_t  pcell_t;
> +
> +/**
> + * @struct rtems_ofw_memory_area
> + *
> + * This is used to represent elements(FDT properties) that define
> + * region of

Re: License files missing on 5-freebsd-12 branch

2020-09-28 Thread Christian Mauderer
On 17/09/2020 23:37, Chris Johns wrote:
> On 17/9/20 10:57 pm, Joel Sherrill wrote:
>> On Thu, Sep 17, 2020 at 4:33 AM Christian Mauderer
>> > <mailto:christian.maude...@embedded-brains.de>> wrote:
>>
>> Hello,
>>
>> Chris pinged me that I missed to add these patches to the 5-freebsd-12
>> branch. It would be good if we would add the license files to the
>> release branch too. This will allow users to easily find the correct
>> licenses.
>>
>>
>> +1  
> 
> OK to push.
> 
> Thanks
> Chris
> 

Sorry for the delay. I didn't manage to do these before my vacation and
then I forgot them during vacation. I just pushed them.

Best regards

Christian

-- 

embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: License files missing on 5-freebsd-12 branch

2020-09-29 Thread Christian Mauderer
On 29/09/2020 03:35, Chris Johns wrote:
> On 28/9/20 9:45 pm, Christian Mauderer wrote:
>> Sorry for the delay. I didn't manage to do these before my vacation and
>> then I forgot them during vacation. I just pushed them.
> 
> No problem and thank you. I hope you had a relaxing vacation?
> 
> Chris
> 

Like every vacation, it was too short. Otherwise: Yes, it was relaxing.

Best regards

Christian

-- 

embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Legacy networking stack removal

2020-10-07 Thread Christian Mauderer
 hardware.

Maybe the next time someone has a funded project into the direction of
lwIP we should try to create a package repo so it can be build without a
lot of effort.

> 
> Unfortunately, this is a case where the RTEMS core developers are too
> nice. We don't want to leave users wanting. Many projects would have
> killed the old stack before now.  And I think it is long overdue for us. :)

Do you ask us to be a bit less nice to users? I'll have to create a link
so that I can reference this statement the next time we discuss a change
that could break something for users ;-)

Best regards

Christian

> 
> I am thinking 4-6 weeks after the transition from autoconf to waf, the
> stack should come out. With any luck, this will be in December.  Moving
> to waf is an ideal time to clean cruft and being just after the 5
> release, we left things in for that last release if that's what the
> outcome is.
> 
> --joel
> 
> 
> 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.
> 
> 
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 

-- 

embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH rtems-libbsd] wpa: Fix multiple definition of `hmac_md5`

2020-10-09 Thread Christian Mauderer
hmac_md5 is defined in dhcpcd and in wpa supplicant.
---
 freebsd/contrib/wpa/src/crypto/md5.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/freebsd/contrib/wpa/src/crypto/md5.h 
b/freebsd/contrib/wpa/src/crypto/md5.h
index 33f8426c..48afb955 100644
--- a/freebsd/contrib/wpa/src/crypto/md5.h
+++ b/freebsd/contrib/wpa/src/crypto/md5.h
@@ -11,6 +11,10 @@
 
 #define MD5_MAC_LEN 16
 
+#ifdef __rtems__
+#define hmac_md5_vectorwpa_hmac_md5_vector
+#define hmac_md5   wpa_hmac_md5
+#endif /* __rtems__ */
 int hmac_md5_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac);
 int hmac_md5(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
-- 
2.28.0

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


Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-11-02 Thread Christian Mauderer
Hello Niteesh,

On 02/11/2020 18:06, Niteesh G. S. wrote:
> ping.

Yes, of course you are right that it would be time to integrate it. The
nasty part why I haven't started to do something into that direction is
that we currently still have the old build system and the new in
parallel. But I think we should start to integrate your code anyway.

Please correct me if I'm wrong: Currently there are two parts:

1. Adding the OFW interface.

2. Using in in BBB.

Is that correct?

I think the first one should be not too hard. There are already some
parts that use only the new build system. Wouldn't be a problem to do
that with OFW too. So to all participating at the discussion: Is there
any blocker left why we wouldn't integrate an updated version of the
patches?

The second part is a bit harder. BBB is one of the BSPs that are quite
entry friendly and therefore it should currently build with old and new
build system till the old system is removed.

Best regards

Christian

> 
> On Thu, Sep 24, 2020 at 9:00 AM Niteesh G. S.  <mailto:niteesh...@gmail.com>> wrote:
> 
> Hello,
> 
> On Sat, Sep 19, 2020 at 4:13 PM Christian Mauderer
> mailto:o...@c-mauderer.de>> wrote:
> 
> Hello Niteesh,
> 
> sorry for adding another delay: I think the new build system
> needs a bit
> of time to settle. As soon as there are some more PASS in the
> table that
> Sebastian created [1] (especially for beagle) we should try to
> get these
> patches merged. Before that I would like to avoid big changes
> because it
> might get hard to distinguish new bugs from build system bugs.
> 
> 
> No problem. Currently, I have my university exams going on and also I am
> waiting for my logic analyzer. As soon as it arrives I'll start
> verifying the previous
> drivers and finish refactoring the other ones.
> 
> Thanks,
> Niteesh.
> 
>  
> 
> 
> Best regards
> 
> Christian
> 
> [1] https://devel.rtems.org/wiki/Release/6/Waf%20BSP%20Checklist
> 
> On 16/09/2020 19:05, Niteesh G. S. wrote:
> > Hello,
> >
> > Sorry for the delay, I was a bit occupied with my university work.
> > Now since the new build system is merged I would like to get my
> > GSoC work merged too.
> >
> > The goal of this series patches is to implement the OFW API
> into RTEMS
> > and modify libBSD to use this RTEMS API instead of its own.
> >
> > Thanks,
> > Niteesh.
> >
> > On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu
> mailto:niteesh...@gmail.com>
> > <mailto:niteesh...@gmail.com <mailto:niteesh...@gmail.com>>>
> wrote:
> >
> >     RTEMS OFW is a FDT only implementation of the OpenFirmWare
> >     interface. This API is created to be compatible with FreeBSD
> >     OpenFirmWare interface. The main intention is to make
> >     porting of FreeBSD drivers to RTEMS easier.
> >
> >     Most functions implemented have an direct one-one mapping
> >     with the original OFW API and some extra auxiliary functions
> >     were implemented to make working with device trees easier in
> >     RTEMS.
> >
> >     Update #3784
> >     ---
> >      bsps/include/ofw/ofw.h        | 548
> +++
> >      bsps/include/ofw/ofw_compat.h |  74 
> >      bsps/shared/ofw/ofw.c         | 682
> ++
> >      spec/build/bsps/obj.yml       |   5 +
> >      4 files changed, 1309 insertions(+)
> >      create mode 100644 bsps/include/ofw/ofw.h
> >      create mode 100644 bsps/include/ofw/ofw_compat.h
> >      create mode 100644 bsps/shared/ofw/ofw.c
> >
> >     diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
> >     new file mode 100644
> >     index 00..411010be89
> >     --- /dev/null
> >     +++ b/bsps/include/ofw/ofw.h
> >     @@ -0,0 +1,548 @@
> >     +/* SPDX-License-Identifier: BSD-2-Clause */
> >     +
> >     +/**
> >     + * @file
> >     + *
> >     + * @ingroup ofw
> >     + *
> >     + * RTEMS FDT implementation of OpenFirmWare Interface.
>

Re: [PATCH v1 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-11-02 Thread Christian Mauderer
Hello Niteesh,

On 03/11/2020 03:42, Niteesh G. S. wrote:
> Hello Christian,
> 
> On Tue, Nov 3, 2020 at 12:43 AM Christian Mauderer  <mailto:o...@c-mauderer.de>> wrote:
> 
> Hello Niteesh,
> 
> On 02/11/2020 18:06, Niteesh G. S. wrote:
> > ping.
> 
> Yes, of course you are right that it would be time to integrate it. The
> nasty part why I haven't started to do something into that direction is
> that we currently still have the old build system and the new in
> parallel. But I think we should start to integrate your code anyway.
> 
> Please correct me if I'm wrong: Currently there are two parts:
> 
> 1. Adding the OFW interface.
> 
> 2. Using in in BBB.
> 
> Is that correct?
> 
> There is also the FreeBSD structures to makeporting of drivers easy.
> I guess merging this after a thorough inspection should also not be
> an issue.
> 

Do the patches for the OFW interface and the FreeBSD structures still
work on a current RTEMS master?

Best regards

Christian

> 
> I think the first one should be not too hard. There are already some
> parts that use only the new build system. Wouldn't be a problem to do
> that with OFW too. So to all participating at the discussion: Is there
> any blocker left why we wouldn't integrate an updated version of the
> patches?
> 
>  
> The only blocker seen during the development was the license issue.
> But that is now resolved since we figured out that all the referenced
> code comes under the BSD 2 license.
>  
> 
> The second part is a bit harder. BBB is one of the BSPs that are quite
> entry friendly and therefore it should currently build with old and new
> build system till the old system is removed.
> 
>  
> OK. I'll wait until the old system gets removed, I still have some work left
> to do on the drivers.
> 
> Thanks,
> Niteesh
> 
> Best regards
> 
> Christian
> 
> >
> > On Thu, Sep 24, 2020 at 9:00 AM Niteesh G. S.
> mailto:niteesh...@gmail.com>
> > <mailto:niteesh...@gmail.com <mailto:niteesh...@gmail.com>>> wrote:
> >
> >     Hello,
> >
> >     On Sat, Sep 19, 2020 at 4:13 PM Christian Mauderer
> >     mailto:o...@c-mauderer.de>
> <mailto:o...@c-mauderer.de <mailto:o...@c-mauderer.de>>> wrote:
> >
> >         Hello Niteesh,
> >
> >         sorry for adding another delay: I think the new build system
> >         needs a bit
> >         of time to settle. As soon as there are some more PASS in the
> >         table that
> >         Sebastian created [1] (especially for beagle) we should try to
> >         get these
> >         patches merged. Before that I would like to avoid big changes
> >         because it
> >         might get hard to distinguish new bugs from build system bugs.
> >
> >
> >     No problem. Currently, I have my university exams going on and
> also I am
> >     waiting for my logic analyzer. As soon as it arrives I'll start
> >     verifying the previous
> >     drivers and finish refactoring the other ones.
> >
> >     Thanks,
> >     Niteesh.
> >
> >      
> >
> >
> >         Best regards
> >
> >         Christian
> >
> >         [1]
> https://devel.rtems.org/wiki/Release/6/Waf%20BSP%20Checklist
> >
> >         On 16/09/2020 19:05, Niteesh G. S. wrote:
> >         > Hello,
> >         >
> >         > Sorry for the delay, I was a bit occupied with my
> university work.
> >         > Now since the new build system is merged I would like to
> get my
> >         > GSoC work merged too.
> >         >
> >         > The goal of this series patches is to implement the OFW API
> >         into RTEMS
> >         > and modify libBSD to use this RTEMS API instead of its own.
> >         >
> >         > Thanks,
> >         > Niteesh.
> >         >
> >         > On Wed, Sep 16, 2020 at 10:33 PM G S Niteesh Babu
> >         mailto:niteesh...@gmail.com>
> <mailto:niteesh...@gmail.com <mailto:niteesh...@gmail.com>>
> >         > <mailto:niteesh...@gmail.com
> <mailto:niteesh...@gmail.com> <mailto:niteesh...@gmail.com
> <mailto:niteesh...@gmail.c

Re: 80 or 79 characters limit?

2020-11-05 Thread Christian Mauderer
Hello Joel and Sebastian,

On 05/11/2020 16:44, Joel Sherrill wrote:
> 
> 
> On Thu, Nov 5, 2020, 9:26 AM Sebastian Huber
>  > wrote:
> 
> Hello,
> 
> I review currently the Coding Conventions. Should the 80 characters
> limit be really a 79 characters limit with the \n as the invisible 80th
> character?
> 
> 
> Yes. 
> 
> As old as this makes me feel, I remember printers which did an automatic
> linefeed and then the newline one if you hit column 80. So it really is
> 79 unfortunately.

I don't think printers with an automatic linefeed are a common use case
for reading the RTEMS source code nowadays. So that maybe isn't the best
reason for using 79 characters.

I would suggest to use the same convention that most coding styles use
which seems to be 80 characters:

  https://en.wikipedia.org/wiki/Characters_per_line#In_programming

At least if there are no more recent examples for tools or editors where
79 is a benefit. 80 seems just feels a bit more natural.

By the way: If we count '\n': Should we count a tab '\t' as a single
character, as 2, as 4 or as 8 ones? What about the few Unicode
characters that slipped in over the years?

Best regards

Christian

> 
> 
> -- 
> embedded brains GmbH
> 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
> PGP: Public key available on request.
> 
> embedded brains GmbH
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
> 
> ___
> devel mailing list
> devel@rtems.org 
> http://lists.rtems.org/mailman/listinfo/devel
> 
> 
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: 80 or 79 characters limit?

2020-11-05 Thread Christian Mauderer
Hello Joel,

On 05/11/2020 20:15, Joel Sherrill wrote:
> 
> 
> On Thu, Nov 5, 2020, 1:12 PM Christian Mauderer  <mailto:o...@c-mauderer.de>> wrote:
> 
> Hello Joel and Sebastian,
> 
> On 05/11/2020 16:44, Joel Sherrill wrote:
> >
> >
> > On Thu, Nov 5, 2020, 9:26 AM Sebastian Huber
> >  <mailto:sebastian.hu...@embedded-brains.de>
> > <mailto:sebastian.hu...@embedded-brains.de
> <mailto:sebastian.hu...@embedded-brains.de>>> wrote:
> >
> >     Hello,
> >
> >     I review currently the Coding Conventions. Should the 80
> characters
> >     limit be really a 79 characters limit with the \n as the
> invisible 80th
> >     character?
> >
> >
> > Yes. 
> >
> > As old as this makes me feel, I remember printers which did an
> automatic
> > linefeed and then the newline one if you hit column 80. So it
> really is
> > 79 unfortunately.
> 
> I don't think printers with an automatic linefeed are a common use case
> for reading the RTEMS source code nowadays. So that maybe isn't the best
> reason for using 79 characters.
> 
> 
> +1
> 
> 
> I would suggest to use the same convention that most coding styles use
> which seems to be 80 characters:
> 
>   https://en.wikipedia.org/wiki/Characters_per_line#In_programming
> 
> At least if there are no more recent examples for tools or editors where
> 79 is a benefit. 80 seems just feels a bit more natural.
> 
> 
> By the way: If we count '\n': Should we count a tab '\t' as a single
> character, as 2, as 4 or as 8 ones?
> 
> 
> We shouldn't have tabs in code we own.

Good point.

> 
> What about the few Unicode
> characters that slipped in over the years?
> 
> 
> We also shouldn't have unicode characters randomly floating around. They
> tend to pop up in my experience when people copy from word processors
> and get fancy quotes. Those cases should be eliminated

Last time I stumbled across a tool that didn't like unicode characters I
found about 75 lines in RTEMS with unicode characters. I have been to
lazy to fix them back then. Mostly because some of them would have
needed some thought about what there should have been (I assume it has
been a microsecond in some cases, but still not sure). Attached you can
find a patch that should replaces most of them without much thought
about the content. If you think it's useful, I can polish it up a bit.

Best regards

Christian

> 
> 
> Best regards
> 
> Christian
> 
> >
> >
> >     --
> >     embedded brains GmbH
> >     Sebastian HUBER
> >     Dornierstr. 4
> >     82178 Puchheim
> >     Germany
> >     email: sebastian.hu...@embedded-brains.de
> <mailto:sebastian.hu...@embedded-brains.de>
> >     <mailto:sebastian.hu...@embedded-brains.de
> <mailto:sebastian.hu...@embedded-brains.de>>
> >     Phone: +49-89-18 94 741 - 16
> >     Fax:   +49-89-18 94 741 - 08
> >     PGP: Public key available on request.
> >
> >     embedded brains GmbH
> >     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 <mailto:devel@rtems.org>
> <mailto:devel@rtems.org <mailto:devel@rtems.org>>
> >     http://lists.rtems.org/mailman/listinfo/devel
> >
> >
> > ___
> > devel mailing list
> > devel@rtems.org <mailto:devel@rtems.org>
> > http://lists.rtems.org/mailman/listinfo/devel
> >
> 
>From 0c216e723e10acbf1f4c9f28044e19ff408d8fab Mon Sep 17 00:00:00 2001
From: Christian Mauderer 
Date: Thu, 1 Oct 2020 23:15:33 +0200
Subject: [PATCH] Remove special chars.

---
 bsps/arm/atsam/contrib/libraries/libboard/include/gmii.h  | 2 +-
 .../contrib/libraries/libboard/source/board_memories.c| 8 
 bsps/arm/atsam/contrib/libraries/libchip/source/aes.c | 2 +-
 bsps/arm/atsam/contrib/libraries/libchip/source/sdramc.c  | 2 +-
 bsps/arm/lm3s69xx/console/console-config.c| 2 +-
 bsps/arm/lm3s69xx/console/uart.c

Re: 80 or 79 characters limit?

2020-11-05 Thread Christian Mauderer
On 05/11/2020 21:28, Gedare Bloom wrote:
> On Thu, Nov 5, 2020 at 1:14 PM Joel Sherrill  wrote:
>>
>> I tried at one point to figure out how to script the changes when I ran into 
>> them.
>> But it was easier to fix them by hand. If you have a simple script, it would 
>> be good
>> to have a home for it. We could grow it then.

Sorry, I didn't use a script either. I just wanted to try a tool on a
larger code base and blindly removed everything that has been a problem
for it.

>>
>> Not accepting unicode should be checked for patches and should be in
>> Coding Conventions.
>>
>> I think you made a couple of bad mapping choices.

See above: The target was not to have a good choice but just to get rid
of them. Never intended to create a real patch from it. But like I said:
I'll polish it a bit and send patches.

>>
>> - "(r)" for the registered symbol (circle R)
>> -  "u" for the micro Greek letter in usec and us (which is strange for usec)

For me "s" is a quite common short for seconds. And u is quite common
for replacing a micro if there is no special micro character. Most
likely in English there is a higher chance to mis-read it as an "us"
like the one in "tell us something" and therefore the short form is
considered strange ;-)

>>
>> Some I have no idea about.
>>
>> + aes.c - absolutely no idea
>> + rtl22xx/console/uart.c - maybe an x
>> + powerpc/include/mpc83xx/mpc83xx.h - maybe an x
>>
>> I think a patch series doing copyright symbols, (r), and u for micro
>> as individual changes would eliminate a lot and not be controversial.
>> That should leave the remaining for a second pass.
>>
>> One patch per character change is safer to review.
> "per kind of character"
> 
> feel free to send all the (C) together, etc.

OK.

> 
> I think the AES one is pTq, math notation for a vector product using 
> transpose.
> 
> I used https://www.branah.com/unicode-converter and put the UTF-8 we
> have in our repo in the box, and that gives some idea what it should
> be in the top unicode box. i.e., put "¡°T¡±" in the UTF-8 box and see
> what pops out on top

That's a nice tool. Thanks for the hint.

Best regards

Christian

> 
>>
>> --joel
>>
>>
>> On Thu, Nov 5, 2020 at 1:34 PM Christian Mauderer  wrote:
>>>
>>> Hello Joel,
>>>
>>> On 05/11/2020 20:15, Joel Sherrill wrote:
>>>>
>>>>
>>>> On Thu, Nov 5, 2020, 1:12 PM Christian Mauderer >>> <mailto:o...@c-mauderer.de>> wrote:
>>>>
>>>> Hello Joel and Sebastian,
>>>>
>>>> On 05/11/2020 16:44, Joel Sherrill wrote:
>>>> >
>>>> >
>>>> > On Thu, Nov 5, 2020, 9:26 AM Sebastian Huber
>>>> > >>> <mailto:sebastian.hu...@embedded-brains.de>
>>>> > <mailto:sebastian.hu...@embedded-brains.de
>>>> <mailto:sebastian.hu...@embedded-brains.de>>> wrote:
>>>> >
>>>> > Hello,
>>>> >
>>>> > I review currently the Coding Conventions. Should the 80
>>>> characters
>>>> > limit be really a 79 characters limit with the \n as the
>>>> invisible 80th
>>>> > character?
>>>> >
>>>> >
>>>> > Yes.
>>>> >
>>>> > As old as this makes me feel, I remember printers which did an
>>>> automatic
>>>> > linefeed and then the newline one if you hit column 80. So it
>>>> really is
>>>> > 79 unfortunately.
>>>>
>>>> I don't think printers with an automatic linefeed are a common use case
>>>> for reading the RTEMS source code nowadays. So that maybe isn't the 
>>>> best
>>>> reason for using 79 characters.
>>>>
>>>>
>>>> +1
>>>>
>>>>
>>>> I would suggest to use the same convention that most coding styles use
>>>> which seems to be 80 characters:
>>>>
>>>>   https://en.wikipedia.org/wiki/Characters_per_line#In_programming
>>>>
>>>> At least if there are no more recent examples for tools or editors 
>>>> where
>>>> 79 is a benefit. 80 seems just feels a bit more natural.
>>>>
>>>>
>>>> 

[PATCH] if_ffec: Fix cache handling on tx.

2020-11-06 Thread Christian Mauderer
With the previous fix, it could happen that the end of the packet hasn't
been flushed. For example assume the following addresses:

ds_addr: 0x81c804A
ds_len: 0x57

In that case the data ends at 0x81c80a1. But due to the rounding the
area from 0x81c8040 to 0x81c80a0 would have been flushed.

This fix now first calculates the start and end address, aligns these
addresses and then recalculates the len that has to be flushed.
---
 freebsd/sys/dev/ffec/if_ffec.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/freebsd/sys/dev/ffec/if_ffec.c b/freebsd/sys/dev/ffec/if_ffec.c
index e8287ed2..47c0f770 100644
--- a/freebsd/sys/dev/ffec/if_ffec.c
+++ b/freebsd/sys/dev/ffec/if_ffec.c
@@ -714,15 +714,16 @@ ffec_encap(struct ifnet *ifp, struct ffec_softc *sc, 
struct mbuf *m0,
tx_desc->buf_paddr = segs[i].ds_addr;
tx_desc->flags2 = flags2;
 #ifdef __rtems__
-   uintptr_t addr_flush = (uintptr_t)segs[i].ds_addr;
+   uintptr_t first_flush = (uintptr_t)segs[i].ds_addr;
size_t len_flush = segs[i].ds_len;
 #ifdef CPU_CACHE_LINE_BYTES
+   uintptr_t last_flush = first_flush + len_flush;
/* mbufs should be cache line aligned. So we can just round. */
-   addr_flush = addr_flush & ~(CPU_CACHE_LINE_BYTES - 1);
-   len_flush = (len_flush + (CPU_CACHE_LINE_BYTES - 1)) &
-   ~(CPU_CACHE_LINE_BYTES - 1);
+   first_flush = rounddown2(first_flush, CPU_CACHE_LINE_BYTES);
+   last_flush = roundup2(last_flush, CPU_CACHE_LINE_BYTES);
+   len_flush = last_flush - first_flush;
 #endif
-   rtems_cache_flush_multiple_data_lines((void*)addr_flush,
+   rtems_cache_flush_multiple_data_lines((void*)first_flush,
len_flush);
 #endif /* __rtems__ */
 
-- 
2.26.2

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


[PATCH rtems 5/8] bsp/rtl22xx: Fix non-ASCII character

2020-11-08 Thread Christian Mauderer
From: Christian Mauderer 

---
 bsps/arm/rtl22xx/console/uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsps/arm/rtl22xx/console/uart.c b/bsps/arm/rtl22xx/console/uart.c
index 2952e74508..c4ddd18b2c 100644
--- a/bsps/arm/rtl22xx/console/uart.c
+++ b/bsps/arm/rtl22xx/console/uart.c
@@ -262,7 +262,7 @@ static int _BSP_get_char(void)
 BSP_polling_getchar_function_type BSP_poll_char = _BSP_get_char;
 
 /*
- * init USART 0��8 bit, 1 Stop,No checkout, BPS115200
+ * init USART 0: 8 bit, 1 Stop,No checkout, BPS115200
  */
 void UART0_Ini(void)
 {
-- 
2.29.2

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

[PATCH rtems 8/8] jffs2: Replace non-ASCII copyright character

2020-11-08 Thread Christian Mauderer
From: Christian Mauderer 

---
 cpukit/libfs/src/jffs2/include/linux/jffs2.h | 4 ++--
 cpukit/libfs/src/jffs2/src/acl.h | 2 +-
 cpukit/libfs/src/jffs2/src/build.c   | 4 ++--
 cpukit/libfs/src/jffs2/src/compr.c   | 8 
 cpukit/libfs/src/jffs2/src/compr.h   | 4 ++--
 cpukit/libfs/src/jffs2/src/compr_rtime.c | 4 ++--
 cpukit/libfs/src/jffs2/src/compr_rubin.c | 4 ++--
 cpukit/libfs/src/jffs2/src/compr_zlib.c  | 4 ++--
 cpukit/libfs/src/jffs2/src/debug.c   | 4 ++--
 cpukit/libfs/src/jffs2/src/debug.h   | 4 ++--
 cpukit/libfs/src/jffs2/src/dir-rtems.c   | 8 
 cpukit/libfs/src/jffs2/src/erase.c   | 4 ++--
 cpukit/libfs/src/jffs2/src/fs-rtems.c| 8 
 cpukit/libfs/src/jffs2/src/gc.c  | 4 ++--
 cpukit/libfs/src/jffs2/src/jffs2_fs_i.h  | 4 ++--
 cpukit/libfs/src/jffs2/src/jffs2_fs_sb.h | 4 ++--
 cpukit/libfs/src/jffs2/src/nodelist.c| 2 +-
 cpukit/libfs/src/jffs2/src/nodelist.h| 2 +-
 cpukit/libfs/src/jffs2/src/nodemgmt.c| 2 +-
 cpukit/libfs/src/jffs2/src/os-rtems.h| 4 ++--
 cpukit/libfs/src/jffs2/src/read.c| 2 +-
 cpukit/libfs/src/jffs2/src/readinode.c   | 2 +-
 cpukit/libfs/src/jffs2/src/scan.c| 2 +-
 cpukit/libfs/src/jffs2/src/summary.h | 2 +-
 cpukit/libfs/src/jffs2/src/write.c   | 2 +-
 cpukit/libfs/src/jffs2/src/xattr.h   | 2 +-
 26 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/cpukit/libfs/src/jffs2/include/linux/jffs2.h 
b/cpukit/libfs/src/jffs2/include/linux/jffs2.h
index a18b719f49..202cb46b8d 100644
--- a/cpukit/libfs/src/jffs2/include/linux/jffs2.h
+++ b/cpukit/libfs/src/jffs2/include/linux/jffs2.h
@@ -1,8 +1,8 @@
 /*
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
- * Copyright © 2001-2007 Red Hat, Inc.
- * Copyright © 2004-2010 David Woodhouse 
+ * Copyright (c) 2001-2007 Red Hat, Inc.
+ * Copyright (c) 2004-2010 David Woodhouse 
  *
  * Created by David Woodhouse 
  *
diff --git a/cpukit/libfs/src/jffs2/src/acl.h b/cpukit/libfs/src/jffs2/src/acl.h
index 2e2b5745c3..1114691c70 100644
--- a/cpukit/libfs/src/jffs2/src/acl.h
+++ b/cpukit/libfs/src/jffs2/src/acl.h
@@ -1,7 +1,7 @@
 /*
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
- * Copyright © 2006  NEC Corporation
+ * Copyright (c) 2006  NEC Corporation
  *
  * Created by KaiGai Kohei 
  *
diff --git a/cpukit/libfs/src/jffs2/src/build.c 
b/cpukit/libfs/src/jffs2/src/build.c
index d35bc83bbb..ce9e258404 100644
--- a/cpukit/libfs/src/jffs2/src/build.c
+++ b/cpukit/libfs/src/jffs2/src/build.c
@@ -3,8 +3,8 @@
 /*
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
- * Copyright © 2001-2007 Red Hat, Inc.
- * Copyright © 2004-2010 David Woodhouse 
+ * Copyright (c) 2001-2007 Red Hat, Inc.
+ * Copyright (c) 2004-2010 David Woodhouse 
  *
  * Created by David Woodhouse 
  *
diff --git a/cpukit/libfs/src/jffs2/src/compr.c 
b/cpukit/libfs/src/jffs2/src/compr.c
index a9e821a6a1..e9d5667116 100644
--- a/cpukit/libfs/src/jffs2/src/compr.c
+++ b/cpukit/libfs/src/jffs2/src/compr.c
@@ -3,11 +3,11 @@
 /*
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
- * Copyright © 2001-2007 Red Hat, Inc.
- * Copyright © 2004-2010 David Woodhouse 
- * Copyright © 2004 Ferenc Havasi ,
+ * Copyright (c) 2001-2007 Red Hat, Inc.
+ * Copyright (c) 2004-2010 David Woodhouse 
+ * Copyright (c) 2004 Ferenc Havasi ,
  * University of Szeged, Hungary
- * Copyright © 2013 embedded brains GmbH 
+ * Copyright (c) 2013 embedded brains GmbH 
  *
  * Created by Arjan van de Ven 
  *
diff --git a/cpukit/libfs/src/jffs2/src/compr.h 
b/cpukit/libfs/src/jffs2/src/compr.h
index e6226e7258..cdf2c5c85a 100644
--- a/cpukit/libfs/src/jffs2/src/compr.h
+++ b/cpukit/libfs/src/jffs2/src/compr.h
@@ -1,9 +1,9 @@
 /*
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
- * Copyright © 2004   Ferenc Havasi ,
+ * Copyright (c) 2004   Ferenc Havasi ,
  *   University of Szeged, Hungary
- * Copyright © 2004-2010 David Woodhouse 
+ * Copyright (c) 2004-2010 David Woodhouse 
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
diff --git a/cpukit/libfs/src/jffs2/src/compr_rtime.c 
b/cpukit/libfs/src/jffs2/src/compr_rtime.c
index c8313ed234..c434c0b74f 100644
--- a/cpukit/libfs/src/jffs2/src/compr_rtime.c
+++ b/cpukit/libfs/src/jffs2/src/compr_rtime.c
@@ -3,8 +3,8 @@
 /*
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
- * Copyright © 2001-2007 Red Hat, Inc.
- * Copyright © 2004-2010 David Woodhouse 
+ * Copyright (c) 2001-2007 Red Hat, Inc.
+ * Copyright (c) 2004-2010 David Woodhouse 
  *
  * Created by Arjan van de Ven 
  *
diff --git a/cpukit/libfs/src/jffs2/src/compr_rubin.c 
b/cpukit/libfs/src/jffs2/src/compr_rubin.c
index 91a1f354f5..d47f293eaa 100644
--- a/cpukit/libfs/src/jffs2/src/compr_rubin.c
+++ b/cpukit/libfs/src/jffs2/src/compr_rubin.c
@@ -3,8 +3,8 @@
 /*

Re: [PATCH rtems 0/8] Replace non ASCII-Characters in source files

2020-11-08 Thread Christian Mauderer
PS: In case the patches make problems due to some odd mail encoding: I
also pushed them as a branch here:

https://gitlab.com/c-mauderer/rtems/-/tree/cm/20201107_replace_non-ASCII


On 07/11/2020 14:23, Christian Mauderer wrote:
> Hello,
> 
> this patch set is a follow up of the discussion in this mail thread:
> 
> https://lists.rtems.org/pipermail/devel/2020-November/063092.html
> 
> It replaces a lot of non-ASCII characters that slipped into our code
> base over the years. Note that I'm not sure whether the last three
> patches are a good idea. They touch imported code and especially the
> jffs2 stuff might get updated from upstream sources. So maybe keeping
> the non-ASCII stuff there might is a better choice.
> 
> Best regards
> 
> Christian
> 
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems 4/8] bsp/mpc83xx: Fix non-ASCII characters

2020-11-08 Thread Christian Mauderer
From: Christian Mauderer 

---
 bsps/powerpc/include/mpc83xx/mpc83xx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsps/powerpc/include/mpc83xx/mpc83xx.h 
b/bsps/powerpc/include/mpc83xx/mpc83xx.h
index f48a5ce675..9613abd365 100644
--- a/bsps/powerpc/include/mpc83xx/mpc83xx.h
+++ b/bsps/powerpc/include/mpc83xx/mpc83xx.h
@@ -668,7 +668,7 @@ typedef struct m83xxUSB_DRRegisters_ {
   volatile uint32_t cdpr1; /* 0x3_1140 Crypto-channel 1 current descriptor 
pointer register R 0x___ 14.6.1.3/14-90 */
   volatile uint32_t */
 0x3_1180--0x3_11BF
-  DBn /*   volatile; uint32_t ff1, */ /* 0x3_1148 Crypto-channel 1 fetch FIFO 
address register W 0x___ 14.6.1.4/14-90 Crypto-channel 1 
descriptor buffers [0�7] R 0x___ 14.6.1.5/14-91 */
+  DBn /*   volatile; uint32_t ff1, */ /* 0x3_1148 Crypto-channel 1 fetch FIFO 
address register W 0x___ 14.6.1.4/14-90 Crypto-channel 1 
descriptor buffers [0..7] R 0x___ 14.6.1.5/14-91 */
   /* Channel 2-4: FIXME: same layout as channel 1*/
   /* Data Encryption Standard Execution Unit (DEU) */
   volatile uint32_t deumr; /* 0x3_2000 DEU mode register R/W 
0x___ 14.5.2.1/14-35 */
-- 
2.29.2

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

[PATCH rtems 1/8] bsps: Replace non-ASCII copyright character

2020-11-08 Thread Christian Mauderer
From: Christian Mauderer 

---
 bsps/arm/lm3s69xx/console/console-config.c | 2 +-
 bsps/arm/lm3s69xx/console/uart.c   | 2 +-
 bsps/arm/lm3s69xx/i2c/ssi.c| 2 +-
 bsps/arm/lm3s69xx/include/bsp/io.h | 2 +-
 bsps/arm/lm3s69xx/include/bsp/irq.h| 2 +-
 bsps/arm/lm3s69xx/include/bsp/lm3s69xx.h   | 2 +-
 bsps/arm/lm3s69xx/include/bsp/ssi.h| 2 +-
 bsps/arm/lm3s69xx/include/bsp/syscon.h | 2 +-
 bsps/arm/lm3s69xx/start/bspstart.c | 2 +-
 bsps/arm/lm3s69xx/start/io.c   | 2 +-
 bsps/arm/lm3s69xx/start/syscon.c   | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/bsps/arm/lm3s69xx/console/console-config.c 
b/bsps/arm/lm3s69xx/console/console-config.c
index b702f0cd66..bce7a624aa 100644
--- a/bsps/arm/lm3s69xx/console/console-config.c
+++ b/bsps/arm/lm3s69xx/console/console-config.c
@@ -1,5 +1,5 @@
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * Copyright (c) 2011 Sebastian Huber.  All rights reserved.
  *
diff --git a/bsps/arm/lm3s69xx/console/uart.c b/bsps/arm/lm3s69xx/console/uart.c
index 67a85f4e96..f9e55dd362 100644
--- a/bsps/arm/lm3s69xx/console/uart.c
+++ b/bsps/arm/lm3s69xx/console/uart.c
@@ -1,5 +1,5 @@
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * Copyright (c) 2011 Sebastian Huber.  All rights reserved.
  *
diff --git a/bsps/arm/lm3s69xx/i2c/ssi.c b/bsps/arm/lm3s69xx/i2c/ssi.c
index 9469c611f0..3b4e8fca9c 100644
--- a/bsps/arm/lm3s69xx/i2c/ssi.c
+++ b/bsps/arm/lm3s69xx/i2c/ssi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
diff --git a/bsps/arm/lm3s69xx/include/bsp/io.h 
b/bsps/arm/lm3s69xx/include/bsp/io.h
index 3e3846e1c6..6dea463a56 100644
--- a/bsps/arm/lm3s69xx/include/bsp/io.h
+++ b/bsps/arm/lm3s69xx/include/bsp/io.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
diff --git a/bsps/arm/lm3s69xx/include/bsp/irq.h 
b/bsps/arm/lm3s69xx/include/bsp/irq.h
index dd49728881..ca7a462f7f 100644
--- a/bsps/arm/lm3s69xx/include/bsp/irq.h
+++ b/bsps/arm/lm3s69xx/include/bsp/irq.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * Copyright (c) 2011 Sebastian Huber.  All rights reserved.
  *
diff --git a/bsps/arm/lm3s69xx/include/bsp/lm3s69xx.h 
b/bsps/arm/lm3s69xx/include/bsp/lm3s69xx.h
index 623b6ca45e..0a4a80760d 100644
--- a/bsps/arm/lm3s69xx/include/bsp/lm3s69xx.h
+++ b/bsps/arm/lm3s69xx/include/bsp/lm3s69xx.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * Copyright (c) 2011 Sebastian Huber.  All rights reserved.
  *
diff --git a/bsps/arm/lm3s69xx/include/bsp/ssi.h 
b/bsps/arm/lm3s69xx/include/bsp/ssi.h
index 66d5302655..7463a19825 100644
--- a/bsps/arm/lm3s69xx/include/bsp/ssi.h
+++ b/bsps/arm/lm3s69xx/include/bsp/ssi.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
diff --git a/bsps/arm/lm3s69xx/include/bsp/syscon.h 
b/bsps/arm/lm3s69xx/include/bsp/syscon.h
index 2904138f4d..67ff69c50e 100644
--- a/bsps/arm/lm3s69xx/include/bsp/syscon.h
+++ b/bsps/arm/lm3s69xx/include/bsp/syscon.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
diff --git a/bsps/arm/lm3s69xx/start/bspstart.c 
b/bsps/arm/lm3s69xx/start/bspstart.c
index da3029e58c..ea73b1e1c2 100644
--- a/bsps/arm/lm3s69xx/start/bspstart.c
+++ b/bsps/arm/lm3s69xx/start/bspstart.c
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
diff --git a/bsps/arm/lm3s69xx/start/io.c b/bsps/arm/lm3s69xx/start/io.c
index b476e7b6dd..0f41f137dd 100644
--- a/bsps/arm/lm3s69xx/start/io.c
+++ b/bsps/arm/lm3s69xx/start/io.c
@@ -1,5 +1,5 @@
 /*
- * Copyright � 2013 Eugeniy Meshcheryakov 
+ * Copyright (c) 2013 Eugeniy Meshcheryakov 
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
diff --git a/bsps/arm/lm3s69xx/start/syscon.c b/bsps/arm/lm3s69xx/start/syscon.c
index 1f5a1a3596..60064c3102 100644
--- a/bsps/arm/lm3s69xx/start

[PATCH rtems 2/8] bsps: Replace non-ASCII trademark symbol

2020-11-08 Thread Christian Mauderer
From: Christian Mauderer 

---
 bsps/arm/atsam/contrib/libraries/libboard/include/gmii.h | 2 +-
 bsps/arm/lm3s69xx/start/bspstart.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bsps/arm/atsam/contrib/libraries/libboard/include/gmii.h 
b/bsps/arm/atsam/contrib/libraries/libboard/include/gmii.h
index e346143452..e9dc31e1e4 100644
--- a/bsps/arm/atsam/contrib/libraries/libboard/include/gmii.h
+++ b/bsps/arm/atsam/contrib/libraries/libboard/include/gmii.h
@@ -52,7 +52,7 @@
 #define GMII_ECR 0x18  // Expanded Control Register
 #define GMII_ICSR0x1B  // Interrupt Control/Status Register
 #define GMII_FC  0x1C  // Function Control
-#define GMII_LCSR0x1D  // LinkMD� Control/Status Register
+#define GMII_LCSR0x1D  // LinkMD(R) Control/Status Register
 #define GMII_PC1R0x1E  // PHY Control 1 Register
 #define GMII_PC2R0x1F  // PHY Control 2 Register
 
diff --git a/bsps/arm/lm3s69xx/start/bspstart.c 
b/bsps/arm/lm3s69xx/start/bspstart.c
index ea73b1e1c2..43b7b826bf 100644
--- a/bsps/arm/lm3s69xx/start/bspstart.c
+++ b/bsps/arm/lm3s69xx/start/bspstart.c
@@ -39,7 +39,7 @@ static void init_main_osc(void)
   syscon->rcc2 = rcc2;
 
   /*
-   As per a note in Stellaris� LM4F120H5QR Microcontroller Data
+   As per a note in Stellaris(R) LM4F120H5QR Microcontroller Data
Sheet on page 219: "When transitioning the system clock
configuration to use the MOSC as the fundamental clock source, the
MOSCDIS bit must be set prior to reselecting the MOSC or an
-- 
2.29.2

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

[PATCH rtems 0/8] Replace non ASCII-Characters in source files

2020-11-08 Thread Christian Mauderer
Hello,

this patch set is a follow up of the discussion in this mail thread:

https://lists.rtems.org/pipermail/devel/2020-November/063092.html

It replaces a lot of non-ASCII characters that slipped into our code
base over the years. Note that I'm not sure whether the last three
patches are a good idea. They touch imported code and especially the
jffs2 stuff might get updated from upstream sources. So maybe keeping
the non-ASCII stuff there might is a better choice.

Best regards

Christian


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


[PATCH rtems 7/8] bsp/atsam: Replace non-ASCII characters

2020-11-08 Thread Christian Mauderer
From: Christian Mauderer 

Note that this replacement is pure guess. It has been done using a
unicode converter tool that spit out the pTq. That is most likely a math
notation for some vector operation.
---
 bsps/arm/atsam/contrib/libraries/libchip/source/aes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsps/arm/atsam/contrib/libraries/libchip/source/aes.c 
b/bsps/arm/atsam/contrib/libraries/libchip/source/aes.c
index 010e7cf8d1..27f543218f 100644
--- a/bsps/arm/atsam/contrib/libraries/libchip/source/aes.c
+++ b/bsps/arm/atsam/contrib/libraries/libchip/source/aes.c
@@ -249,7 +249,7 @@ void AES_SetGcmHash(uint32_t *hash)
 
 /**
  * \brief Get The four 32-bit Tag which contain the final 128-bit GCM
- * Authentication tag ��T�� when GCM processing is complete.
+ * Authentication tag pTq when GCM processing is complete.
  * \param tag point to the word of the tag.
  */
 void AES_GetGcmTag(uint32_t *tag)
-- 
2.29.2

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

[PATCH rtems 6/8] bsp/atsam: Remove non-ASCII chars for microseconds

2020-11-08 Thread Christian Mauderer
From: Christian Mauderer 

---
 .../contrib/libraries/libboard/source/board_memories.c | 10 ++
 .../atsam/contrib/libraries/libchip/source/sdramc.c|  4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/bsps/arm/atsam/contrib/libraries/libboard/source/board_memories.c 
b/bsps/arm/atsam/contrib/libraries/libboard/source/board_memories.c
index e2f04caa8c..354196ab95 100644
--- a/bsps/arm/atsam/contrib/libraries/libboard/source/board_memories.c
+++ b/bsps/arm/atsam/contrib/libraries/libboard/source/board_memories.c
@@ -196,7 +196,8 @@ void BOARD_ConfigureSdram(void)
SDRAMC->SDRAMC_MDR = BOARD_Sdram_Config.sdramc_mdr;
 #endif /* __rtems__ */
 
-   /* 4. A minimum pause of 200 ��s is provided to precede any signal 
toggle.*/
+   /* 4. A minimum pause of 200 microseconds is provided to precede any
+   signal toggle.*/
for (i = 0; i < 10; i++);
 
/* 5. (1)A NOP command is issued to the SDRAM devices. The application 
must
@@ -277,10 +278,11 @@ void BOARD_ConfigureSdram(void)
 
/* 11. Write the refresh rate into the count field in the SDRAMC Refresh
Timer register. (Refresh rate = delay between refresh cycles).
-   The SDRAM device requires a refresh every 15.625 ��s or 7.81 ��s.
+   The SDRAM device requires a refresh every 15.625 or 7.81 microseconds.
With a 100 MHz frequency, the Refresh Timer Counter Register must be set
-   with the value 1562(15.625 ��s x 100 MHz) or 781(7.81 ��s x 100 MHz). */
-   // For IS42S16100E, 2048 refresh cycle every 32ms, every 15.625 ��s
+   with the value 1562(15.625 us x 100 MHz) or 781(7.81 us x 100 MHz). */
+   /* For IS42S16100E, 2048 refresh cycle every 32ms, every 15.625
+   microseconds. */
/* ((32 x 10(^-3))/2048) x150 x (10^6) */
 #ifndef __rtems__
SDRAMC->SDRAMC_TR = 1562;
diff --git a/bsps/arm/atsam/contrib/libraries/libchip/source/sdramc.c 
b/bsps/arm/atsam/contrib/libraries/libchip/source/sdramc.c
index ab5f2d8ec8..aca4a4448e 100644
--- a/bsps/arm/atsam/contrib/libraries/libchip/source/sdramc.c
+++ b/bsps/arm/atsam/contrib/libraries/libchip/source/sdramc.c
@@ -128,8 +128,8 @@ extern void SDRAMC_Configure(SSdramc_Memory *pMemory,
SDRAMC->SDRAMC_MDR = SDRAMC_MDR_MD_SDRAM;
 
/* Step 4 */
-   /* A minimum pause of 200 ��s is provided to precede any signal toggle.
-  (6 core cycles per iteration) */
+   /* A minimum pause of 200 microseconds is provided to precede any signal
+  toggle. (6 core cycles per iteration) */
for (dw = 0; dw < ((dwClockFrequency / 100) * 200 / 6); dw++);
 
/* Step 5. */
-- 
2.29.2

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

[PATCH rtems 3/8] bsps: Replace non-ASCII bullet points

2020-11-08 Thread Christian Mauderer
From: Christian Mauderer 

---
 bsps/shared/grlib/can/occan.c | 4 ++--
 bsps/shared/grlib/spw/grspw.c | 8 
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bsps/shared/grlib/can/occan.c b/bsps/shared/grlib/can/occan.c
index 59b4f234f6..84402b8809 100644
--- a/bsps/shared/grlib/can/occan.c
+++ b/bsps/shared/grlib/can/occan.c
@@ -855,8 +855,8 @@ static int pelican_start(occan_priv *priv){
 #endif
 
/* core already in reset mode,
-*  � Exit reset mode 
-*  � Enter Single/Dual mode filtering.
+*  * Exit reset mode
+*  * Enter Single/Dual mode filtering.
 */
WRITE_REG(priv, &priv->regs->mode, (priv->single_mode << 3));
 
diff --git a/bsps/shared/grlib/spw/grspw.c b/bsps/shared/grlib/spw/grspw.c
index 2e1e8e90e9..1b50cc642f 100644
--- a/bsps/shared/grlib/spw/grspw.c
+++ b/bsps/shared/grlib/spw/grspw.c
@@ -1475,10 +1475,10 @@ static rtems_device_driver grspw_control(
 
/* Get timeout from userspace
 *  timeout:
-*   �  -1 = Default timeout
-*   �  less than -1 = forever
-*   �  0   = no wait, proceed if link is up
-*   �  positive = specifies number of system clock 
ticks that 
+*   *  -1 = Default timeout
+*   *  less than -1 = forever
+*   *  0   = no wait, proceed if link is up
+*   *  positive = specifies number of system clock 
ticks that
 *   startup will wait for link to 
enter ready mode.
 */
timeout = (int)ioarg->buffer;
-- 
2.29.2

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

Re: [PATCH rtems 8/8] jffs2: Replace non-ASCII copyright character

2020-11-08 Thread Christian Mauderer

On 09/11/2020 07:58, Sebastian Huber wrote:

On 07/11/2020 14:23, Christian Mauderer wrote:

diff --git a/cpukit/libfs/src/jffs2/include/linux/jffs2.h 
b/cpukit/libfs/src/jffs2/include/linux/jffs2.h

index a18b719f49..202cb46b8d 100644
--- a/cpukit/libfs/src/jffs2/include/linux/jffs2.h
+++ b/cpukit/libfs/src/jffs2/include/linux/jffs2.h
@@ -1,8 +1,8 @@
  /*
   * JFFS2 -- Journalling Flash File System, Version 2.
   *
- * Copyright © 2001-2007 Red Hat, Inc.
- * Copyright © 2004-2010 David Woodhouse
+ * Copyright (c) 2001-2007 Red Hat, Inc.
+ * Copyright (c) 2004-2010 David Woodhouse

This code is imported from Linux. Do we really have to change this?



Hello Sebastian,

like already stated in the introduction mail: I'm not really sure about 
this one and about patch 6 and 7 myself because they touch imported 
code. So no problem if we don't add the last three ones.


Best regards

Christian

--

embedded brains GmbH
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
PGP: Public key available on request.

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

[PATCH] bsp/atsam: Fix XDMAD status

2020-11-09 Thread Christian Mauderer
In "bsp/atsam: Simplify XDMAD_Handler()" (5f813694f68cee) the interrupt
callback has been made unconditional. That allowed to avoid some special
deadlock situations in error cases. But it removed part of the XDMAD
status handling.

This patch adds the ability to update the XDMAD status from the
callback if that is necessary for the driver.

Fixes #4172
---
 .../contrib/libraries/libchip/source/xdmad.c  | 60 ++-
 .../arm/atsam/include/libchip/include/xdmad.h |  4 ++
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c 
b/bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c
index 13b227036e..161cf0bee4 100644
--- a/bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c
+++ b/bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c
@@ -132,9 +132,66 @@ static uint32_t XDMAD_AllocateXdmacChannel(sXdmad *pXdmad,
return XDMAD_ALLOC_FAILED;
 }
 
+/*
+ * Update the internal xdmad state. Returns true if further processing in the
+ * callback is recommended.
+ *
+ * In an earlier version of the API this has been done by the interrupt handler
+ * directly. But in some cases the application might want to process some of 
the
+ * other interrupts too. Therefore the user callback should now decide itself
+ * whether this is necessary or not.
+ */
+bool XDMAD_UpdateStatusFromCallback(sXdmad *pXdmad,
+   uint32_t Channel,
+   uint32_t status)
+{
+   Xdmac *pXdmac;
+   uint32_t xdmaGlobalChStatus;
+   bool bExec;
+
+   bExec = false;
+   pXdmac = pXdmad->pXdmacs;
+   xdmaGlobalChStatus = XDMAC_GetGlobalChStatus(pXdmac);
+
+   if ((xdmaGlobalChStatus & (XDMAC_GS_ST0 << Channel)) == 0) {
+   uint32_t xdmaChannelIntMask;
+   sXdmadChannel *pCh;
+
+   pCh = &pXdmad->XdmaChannels[Channel];
+
+   xdmaChannelIntMask = XDMAC_GetChannelItMask(pXdmac, Channel);
+   status &= xdmaChannelIntMask;
+
+   if (status & XDMAC_CIS_BIS) {
+   if ((xdmaChannelIntMask & XDMAC_CIM_LIM) == 0) {
+   pCh->state = XDMAD_STATE_DONE;
+   bExec = true;
+   }
+   }
+
+   if (status & XDMAC_CIS_LIS) {
+   pCh->state = XDMAD_STATE_DONE;
+   bExec = true;
+   }
+
+   if (status & XDMAC_CIS_DIS) {
+   pCh->state = XDMAD_STATE_DONE;
+   bExec = true;
+   }
+   } else {
+   /* Block end interrupt for LLI dma mode */
+   if (XDMAC_GetChannelIsr(pXdmac, Channel) & XDMAC_CIS_BIS) {
+   bExec = true;
+   }
+   }
+
+   return bExec;
+}
+
 void XDMAD_DoNothingCallback(uint32_t Channel, void *pArg, uint32_t status)
 {
-   /* Do nothing */
+   /* Do nothing except status update */
+   XDMAD_UpdateStatusFromCallback((sXdmad *)pArg, Channel, status);
 }
 
 /*
@@ -157,6 +214,7 @@ static void XDMAD_SysInitialize(void)
 
for (j = 0; j < pXdmad->numChannels; j ++) {
pXdmad->XdmaChannels[j].fCallback = XDMAD_DoNothingCallback;
+   pXdmad->XdmaChannels[j].pArg = (void *)pXdmad;
}
 
sc = rtems_interrupt_handler_install(
diff --git a/bsps/arm/atsam/include/libchip/include/xdmad.h 
b/bsps/arm/atsam/include/libchip/include/xdmad.h
index 97e24c880b..cba3d052ab 100644
--- a/bsps/arm/atsam/include/libchip/include/xdmad.h
+++ b/bsps/arm/atsam/include/libchip/include/xdmad.h
@@ -241,6 +241,10 @@ extern eXdmadRC XDMAD_StartTransfer(sXdmad *pXdmad, 
uint32_t dwChannel);
 
 extern void XDMAD_DoNothingCallback(uint32_t Channel, void *pArg, uint32_t 
status);
 
+extern bool XDMAD_UpdateStatusFromCallback(sXdmad *pXdmad,
+   uint32_t Channel,
+   uint32_t status);
+
 extern eXdmadRC XDMAD_SetCallback(sXdmad *pXdmad,
   uint32_t 
dwChannel,
   
XdmadTransferCallback fCallback,
-- 
2.26.2

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


Re: [PATCH] bsp/atsam: Fix XDMAD status

2020-11-09 Thread Christian Mauderer
I would like to apply this patch to master (ticket #4173) and to the 5 
branch (ticket #4172). It would be great if someone could have a look 
and acknowledge it.


On 09/11/2020 09:16, Christian Mauderer wrote:

In "bsp/atsam: Simplify XDMAD_Handler()" (5f813694f68cee) the interrupt
callback has been made unconditional. That allowed to avoid some special
deadlock situations in error cases. But it removed part of the XDMAD
status handling.

This patch adds the ability to update the XDMAD status from the
callback if that is necessary for the driver.

Fixes #4172
---
  .../contrib/libraries/libchip/source/xdmad.c  | 60 ++-
  .../arm/atsam/include/libchip/include/xdmad.h |  4 ++
  2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c 
b/bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c
index 13b227036e..161cf0bee4 100644
--- a/bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c
+++ b/bsps/arm/atsam/contrib/libraries/libchip/source/xdmad.c
@@ -132,9 +132,66 @@ static uint32_t XDMAD_AllocateXdmacChannel(sXdmad *pXdmad,
return XDMAD_ALLOC_FAILED;
  }
  
+/*

+ * Update the internal xdmad state. Returns true if further processing in the
+ * callback is recommended.
+ *
+ * In an earlier version of the API this has been done by the interrupt handler
+ * directly. But in some cases the application might want to process some of 
the
+ * other interrupts too. Therefore the user callback should now decide itself
+ * whether this is necessary or not.
+ */
+bool XDMAD_UpdateStatusFromCallback(sXdmad *pXdmad,
+   uint32_t Channel,
+   uint32_t status)
+{
+   Xdmac *pXdmac;
+   uint32_t xdmaGlobalChStatus;
+   bool bExec;
+
+   bExec = false;
+   pXdmac = pXdmad->pXdmacs;
+   xdmaGlobalChStatus = XDMAC_GetGlobalChStatus(pXdmac);
+
+   if ((xdmaGlobalChStatus & (XDMAC_GS_ST0 << Channel)) == 0) {
+   uint32_t xdmaChannelIntMask;
+   sXdmadChannel *pCh;
+
+   pCh = &pXdmad->XdmaChannels[Channel];
+
+   xdmaChannelIntMask = XDMAC_GetChannelItMask(pXdmac, Channel);
+   status &= xdmaChannelIntMask;
+
+   if (status & XDMAC_CIS_BIS) {
+   if ((xdmaChannelIntMask & XDMAC_CIM_LIM) == 0) {
+   pCh->state = XDMAD_STATE_DONE;
+   bExec = true;
+   }
+   }
+
+   if (status & XDMAC_CIS_LIS) {
+   pCh->state = XDMAD_STATE_DONE;
+   bExec = true;
+   }
+
+   if (status & XDMAC_CIS_DIS) {
+   pCh->state = XDMAD_STATE_DONE;
+   bExec = true;
+   }
+   } else {
+   /* Block end interrupt for LLI dma mode */
+   if (XDMAC_GetChannelIsr(pXdmac, Channel) & XDMAC_CIS_BIS) {
+   bExec = true;
+   }
+   }
+
+   return bExec;
+}
+
  void XDMAD_DoNothingCallback(uint32_t Channel, void *pArg, uint32_t status)
  {
-   /* Do nothing */
+   /* Do nothing except status update */
+   XDMAD_UpdateStatusFromCallback((sXdmad *)pArg, Channel, status);
  }
  
  /*

@@ -157,6 +214,7 @@ static void XDMAD_SysInitialize(void)
  
  	for (j = 0; j < pXdmad->numChannels; j ++) {

pXdmad->XdmaChannels[j].fCallback = XDMAD_DoNothingCallback;
+   pXdmad->XdmaChannels[j].pArg = (void *)pXdmad;
}
  
  	sc = rtems_interrupt_handler_install(

diff --git a/bsps/arm/atsam/include/libchip/include/xdmad.h 
b/bsps/arm/atsam/include/libchip/include/xdmad.h
index 97e24c880b..cba3d052ab 100644
--- a/bsps/arm/atsam/include/libchip/include/xdmad.h
+++ b/bsps/arm/atsam/include/libchip/include/xdmad.h
@@ -241,6 +241,10 @@ extern eXdmadRC XDMAD_StartTransfer(sXdmad *pXdmad, 
uint32_t dwChannel);
  
  extern void XDMAD_DoNothingCallback(uint32_t Channel, void *pArg, uint32_t status);
  
+extern bool XDMAD_UpdateStatusFromCallback(sXdmad *pXdmad,

+   uint32_t Channel,
+   uint32_t status);
+
  extern eXdmadRC XDMAD_SetCallback(sXdmad *pXdmad,
   uint32_t 
dwChannel,
   
XdmadTransferCallback fCallback,



--
----
embedded brains GmbH
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
PGP: Public key available on request.

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

Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-09 Thread Christian Mauderer
Hello Niteesh,

I've seen the patches. I have to run a test at least on one BSP with and
one without a FDT to make sure they don't break test runs.

Best regards

Christian

On 09/11/2020 04:45, Niteesh G. S. wrote:
> Hello,
> 
> Pinging again incase this patch missed your attention.
> 
> Thanks,
> Niteesh.
> 
> On Tue, Nov 3, 2020 at 11:49 PM G S Niteesh Babu  > wrote:
> 
> Added a basic test for the implemented RTEMS OFW
> API.
> ---
>  spec/build/testsuites/libtests/grp.yml   |   2 +
>  spec/build/testsuites/libtests/ofw01.yml |  21 +++
>  testsuites/libtests/ofw01/init.c         | 187 +++
>  testsuites/libtests/ofw01/ofw01.doc      |  29 
>  testsuites/libtests/ofw01/ofw01.scn      |   2 +
>  testsuites/libtests/ofw01/some.c         |  72 +
>  testsuites/libtests/ofw01/some.dts       |  76 +
>  testsuites/libtests/ofw01/some.h         |  15 ++
>  8 files changed, 404 insertions(+)
>  create mode 100644 spec/build/testsuites/libtests/ofw01.yml
>  create mode 100644 testsuites/libtests/ofw01/init.c
>  create mode 100644 testsuites/libtests/ofw01/ofw01.doc
>  create mode 100644 testsuites/libtests/ofw01/ofw01.scn
>  create mode 100644 testsuites/libtests/ofw01/some.c
>  create mode 100644 testsuites/libtests/ofw01/some.dts
>  create mode 100644 testsuites/libtests/ofw01/some.h
> 
> diff --git a/spec/build/testsuites/libtests/grp.yml
> b/spec/build/testsuites/libtests/grp.yml
> index b9ca014b0d..1aa136854a 100644
> --- a/spec/build/testsuites/libtests/grp.yml
> +++ b/spec/build/testsuites/libtests/grp.yml
> @@ -316,6 +316,8 @@ links:
>    uid: write
>  - role: build-dependency
>    uid: writev
> +- role: build-dependency
> +  uid: ofw01
>  type: build
>  use-after:
>  - rtemstest
> diff --git a/spec/build/testsuites/libtests/ofw01.yml
> b/spec/build/testsuites/libtests/ofw01.yml
> new file mode 100644
> index 00..8517c58bad
> --- /dev/null
> +++ b/spec/build/testsuites/libtests/ofw01.yml
> @@ -0,0 +1,21 @@
> +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
> +build-type: test-program
> +cflags: []
> +copyrights:
> +- Copyright (C) 2020 Niteesh G S
> +cppflags: []
> +cxxflags: []
> +enabled-by: true
> +features: c cprogram
> +includes: []
> +ldflags:
> +- -Wl,--wrap=bsp_fdt_get
> +links: []
> +source:
> +- testsuites/libtests/ofw01/init.c
> +- testsuites/libtests/ofw01/some.c
> +stlib: []
> +target: testsuites/libtests/ofw01.exe
> +type: build
> +use-after: []
> +use-before: []
> diff --git a/testsuites/libtests/ofw01/init.c
> b/testsuites/libtests/ofw01/init.c
> new file mode 100644
> index 00..82ee5eb11f
> --- /dev/null
> +++ b/testsuites/libtests/ofw01/init.c
> @@ -0,0 +1,187 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/*
> + * Copyright (C) <2020> Niteesh G S  >
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer
> in the
> + *    documentation and/or other materials provided with the
> distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> CONTRIBUTORS "AS IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
> CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
> OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
> ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "some.h"
> +
> +#define BUF_SIZE 100
> +
> +const char rtems_test_name[] = "OFW 01";
> +
>

Re: [PATCH] bsp/atsam: Fix XDMAD status

2020-11-10 Thread Christian Mauderer

On 10/11/2020 06:34, Chris Johns wrote:

On 9/11/20 7:20 pm, Christian Mauderer wrote:

I would like to apply this patch to master (ticket #4173) and to the 5 branch
(ticket #4172). It would be great if someone could have a look and acknowledge 
it.


OK for 5.

Chris



Thanks. I'll give it another day and then commit it.

Best regards

Christian

--

embedded brains GmbH
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
PGP: Public key available on request.

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

Re: [PATCH v2 1/2] bsps/shared/ofw: Implement RTEMS OFW interface

2020-11-16 Thread Christian Mauderer
Hello,

sorry for the long delay. I tested it on xilinx-zynq-a9-qemu (which
doesn't have a FDT) and the test seems to run fine. So I'm OK with the
patches. If no one objects in the next two days, I'll commit them.

Best regards

Christian

On 03/11/2020 19:18, G S Niteesh Babu wrote:
> RTEMS OFW is a FDT only implementation of the OpenFirmWare
> interface. This API is created to be compatible with FreeBSD
> OpenFirmWare interface. The main intention is to make
> porting of FreeBSD drivers to RTEMS easier.
> 
> Most functions implemented have an direct one-one mapping
> with the original OFW API and some extra auxiliary functions
> were implemented to make working with device trees easier in
> RTEMS.
> 
> Update #3784
> ---
>  bsps/include/ofw/ofw.h| 548 +++
>  bsps/include/ofw/ofw_compat.h |  74 
>  bsps/shared/ofw/ofw.c | 682 ++
>  spec/build/bsps/obj.yml   |   5 +
>  4 files changed, 1309 insertions(+)
>  create mode 100644 bsps/include/ofw/ofw.h
>  create mode 100644 bsps/include/ofw/ofw_compat.h
>  create mode 100644 bsps/shared/ofw/ofw.c
> 
> diff --git a/bsps/include/ofw/ofw.h b/bsps/include/ofw/ofw.h
> new file mode 100644
> index 00..4c402671a4
> --- /dev/null
> +++ b/bsps/include/ofw/ofw.h
> @@ -0,0 +1,548 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/**
> + * @file
> + *
> + * @ingroup ofw
> + *
> + * RTEMS FDT implementation of OpenFirmWare Interface.
> + *
> + * RTEMS OFW is a FDT only implementation of the OpenFirmWare interface.
> + * This API is created to be compatible with FreeBSD OpenFirmWare interface.
> + * The main intention is to make porting of FreeBSD drivers to RTEMS easier.
> + */
> +
> +/*
> + * Copyright (C) 2020 Niteesh Babu G S 
> + *
> + * 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.
> + */
> +
> +#ifndef _OFW_H
> +#define _OFW_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include 
> +#include 
> +#include 
> +
> +/**
> + * Represents a node in the device tree. The offset from fdtp to node is used
> + * instead of fdt offset to make sure this is compatible with OF interface in
> + * FreeBSD.
> + */
> +typedef uint32_t  phandle_t;
> +/**
> + * Represents the effective phandle of the node.
> + */
> +typedef uint32_t  ihandle_t;
> +/**
> + * Represents the data type of the buffer.
> + */
> +typedef uint32_t  pcell_t;
> +
> +/**
> + * @struct rtems_ofw_memory_area
> + *
> + * This is used to represent elements(FDT properties) that define
> + * region of memory address.
> + */
> +typedef struct {
> +  /** The start address of the memory region. */
> +  uint32_t start;
> +  /** The size of the memory region. */
> +  uint32_t size;
> +} rtems_ofw_memory_area;
> +
> +/**
> + * @struct rtems_ofw_ranges
> + *
> + * This is used to represent the ranges property in the device tree.
> + */
> +typedef struct {
> +  /** The physical address within the child bus address space */
> +  uint32_t child_bus;
> +  /** The physical address within the parent bus address space */
> +  uint32_t parent_bus;
> +  /** The size of the range in the child’s address space */
> +  uint32_t size;
> +} rtems_ofw_ranges;
> +
> +/**
> + * @brief Gets the node that is next to @a node.
> + *
> + * @param[in] node Node offset
> + *
> + * @retval Peer node offset Successful operation.
> + * @retval 0 No peer node or invalid node handle
> + */
> +phandle_t rtems_ofw_peer(
> +  phandle_t   node
> +);
> +
> +/**
> + * @brief Gets the node that is the child of @a node.
> + *
> + * @param[in] node Node offset
> + *
> + * @retval child node offset Successful operation.
> + * @retval 0 No child node or invalid node handle

[PATCH rtems 1/9] Add License file for BSD-3-Clause

2020-11-17 Thread Christian Mauderer
We have some files with a SPDX identifier for this license. Therefore
the license should be here too.
---
 LICENSE.BSD-3-Clause | 27 +++
 1 file changed, 27 insertions(+)
 create mode 100644 LICENSE.BSD-3-Clause

diff --git a/LICENSE.BSD-3-Clause b/LICENSE.BSD-3-Clause
new file mode 100644
index 00..09d01c1ff5
--- /dev/null
+++ b/LICENSE.BSD-3-Clause
@@ -0,0 +1,27 @@
+https://spdx.org/licenses/BSD-3-Clause
+
+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.
+3. Neither the name of the copyright holder nor the names of its
+   contributors may be used to endorse or promote products derived
+   from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- 
2.26.2

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


[PATCH rtems 2/9] imx: Move imx_iomux to arm/shared

2020-11-17 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imx/headers.am   |  2 -
 bsps/arm/imx/include/bsp.h|  3 +-
 bsps/arm/shared/headers.am|  6 +++
 .../include/arm/freescale/imx/imx_iomuxreg.h  |  0
 .../include/arm/freescale/imx/imx_iomuxvar.h  |  0
 bsps/arm/shared/include/bsp/imx-iomux.h   | 49 +++
 .../{imx/start => shared/pins}/imx_iomux.c|  0
 c/src/lib/libbsp/arm/imx/Makefile.am  |  2 +-
 spec/build/bsps/arm/imx/bspimx.yml| 10 ++--
 9 files changed, 63 insertions(+), 9 deletions(-)
 create mode 100644 bsps/arm/shared/headers.am
 rename bsps/arm/{imx => shared}/include/arm/freescale/imx/imx_iomuxreg.h (100%)
 rename bsps/arm/{imx => shared}/include/arm/freescale/imx/imx_iomuxvar.h (100%)
 create mode 100644 bsps/arm/shared/include/bsp/imx-iomux.h
 rename bsps/arm/{imx/start => shared/pins}/imx_iomux.c (100%)

diff --git a/bsps/arm/imx/headers.am b/bsps/arm/imx/headers.am
index 9863f34300..e7a2418dea 100644
--- a/bsps/arm/imx/headers.am
+++ b/bsps/arm/imx/headers.am
@@ -11,8 +11,6 @@ include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_ecspireg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_gpcreg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_i2creg.h
-include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_iomuxreg.h
-include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_iomuxvar.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_srcreg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_uartreg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_wdogreg.h
diff --git a/bsps/arm/imx/include/bsp.h b/bsps/arm/imx/include/bsp.h
index 99b7a0d1d7..c7e33985a9 100644
--- a/bsps/arm/imx/include/bsp.h
+++ b/bsps/arm/imx/include/bsp.h
@@ -42,6 +42,7 @@
 #include 
 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
@@ -59,8 +60,6 @@ extern uintptr_t imx_gic_dist_base;
 
 void *imx_get_reg_of_node(const void *fdt, int node);
 
-int imx_iomux_configure_pins(const void *fdt, uint32_t phandle);
-
 rtems_vector_number imx_get_irq_of_node(
   const void *fdt,
   int node,
diff --git a/bsps/arm/shared/headers.am b/bsps/arm/shared/headers.am
new file mode 100644
index 00..4fd7238f81
--- /dev/null
+++ b/bsps/arm/shared/headers.am
@@ -0,0 +1,6 @@
+## This file was generated by "./boostrap -H".
+
+include_arm_freescale_imxdir = $(includedir)/arm/freescale/imx
+include_arm_freescale_imx_HEADERS =
+include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
+include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
diff --git a/bsps/arm/imx/include/arm/freescale/imx/imx_iomuxreg.h 
b/bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
similarity index 100%
rename from bsps/arm/imx/include/arm/freescale/imx/imx_iomuxreg.h
rename to bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
diff --git a/bsps/arm/imx/include/arm/freescale/imx/imx_iomuxvar.h 
b/bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
similarity index 100%
rename from bsps/arm/imx/include/arm/freescale/imx/imx_iomuxvar.h
rename to bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
diff --git a/bsps/arm/shared/include/bsp/imx-iomux.h 
b/bsps/arm/shared/include/bsp/imx-iomux.h
new file mode 100644
index 00..60421807c0
--- /dev/null
+++ b/bsps/arm/shared/include/bsp/imx-iomux.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSBSPsARM
+ *
+ * @brief Functions for imx iomux.
+ */
+
+/*
+ * Copyright (C) 2020 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, INDI

[PATCHES] Add imxrt BSP

2020-11-17 Thread Christian Mauderer
Hello,

the following patches add a BSP for IMXRT1050-EVKB. In case the import
patch is too big: I pushed the patches here too:

https://gitlab.com/c-mauderer/rtems/-/tree/cm/20201117_imxrt

Best regards

Christian


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


[PATCH rtems 4/9] cpu/armv7m: Add _ARMV7M_MPU_set_region function

2020-11-17 Thread Christian Mauderer
Make the MPU function defined in the STM32H7 BSP available for all
ARMV7M BSPs.

Update #4180
---
 bsps/arm/stm32h7/start/bspstarthooks.c| 48 +++
 .../cpu/arm/include/rtems/score/armv7m.h  | 37 ++
 2 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/bsps/arm/stm32h7/start/bspstarthooks.c 
b/bsps/arm/stm32h7/start/bspstarthooks.c
index 565bd6876a..97745f0ee8 100644
--- a/bsps/arm/stm32h7/start/bspstarthooks.c
+++ b/bsps/arm/stm32h7/start/bspstarthooks.c
@@ -83,42 +83,6 @@ static void init_peripheral_clocks(void)
   }
 }
 
-static uint32_t get_region_size(uintptr_t size)
-{
-  if ((size & (size - 1)) == 0) {
-return ARMV7M_MPU_RASR_SIZE(30 - __builtin_clz(size));
-  } else {
-return ARMV7M_MPU_RASR_SIZE(31 - __builtin_clz(size));
-  }
-}
-
-static void set_region(
-  volatile ARMV7M_MPU *mpu,
-  uint32_t region,
-  uint32_t rasr,
-  const void *begin,
-  const void *end
-)
-{
-  uintptr_t size;
-  uint32_t rbar;
-
-  RTEMS_OBFUSCATE_VARIABLE(begin);
-  RTEMS_OBFUSCATE_VARIABLE(end);
-  size = (uintptr_t) end - (uintptr_t) begin;
-
-  if ( size > 0 ) {
-rbar = (uintptr_t) begin | region | ARMV7M_MPU_RBAR_VALID;
-rasr |= get_region_size(size);
-  } else {
-rbar = region;
-rasr = 0;
-  }
-
-  mpu->rbar = rbar;
-  mpu->rasr = rasr;
-}
-
 static void init_mpu(void)
 {
   volatile ARMV7M_MPU *mpu;
@@ -136,7 +100,7 @@ static void init_mpu(void)
 mpu->rasr = 0;
   }
 
-  set_region(
+  _ARMV7M_MPU_set_region(
 mpu,
 0,
 ARMV7M_MPU_RASR_XN
@@ -146,7 +110,7 @@ static void init_mpu(void)
 stm32h7_memory_sram_axi_begin,
 stm32h7_memory_sram_axi_end
   );
-  set_region(
+  _ARMV7M_MPU_set_region(
 mpu,
 1,
 ARMV7M_MPU_RASR_XN
@@ -156,7 +120,7 @@ static void init_mpu(void)
 stm32h7_memory_sdram_1_begin,
 stm32h7_memory_sdram_1_end
   );
-  set_region(
+  _ARMV7M_MPU_set_region(
 mpu,
 2,
 ARMV7M_MPU_RASR_AP(0x5)
@@ -165,7 +129,7 @@ static void init_mpu(void)
 bsp_section_start_begin,
 bsp_section_text_end
   );
-  set_region(
+  _ARMV7M_MPU_set_region(
 mpu,
 3,
 ARMV7M_MPU_RASR_XN
@@ -175,7 +139,7 @@ static void init_mpu(void)
 bsp_section_rodata_begin,
 bsp_section_rodata_end
   );
-  set_region(
+  _ARMV7M_MPU_set_region(
 mpu,
 4,
 ARMV7M_MPU_RASR_XN
@@ -185,7 +149,7 @@ static void init_mpu(void)
 bsp_section_nocache_begin,
 bsp_section_nocachenoload_end
   );
-  set_region(
+  _ARMV7M_MPU_set_region(
 mpu,
 region - 1,
 ARMV7M_MPU_RASR_XN | ARMV7M_MPU_RASR_ENABLE,
diff --git a/cpukit/score/cpu/arm/include/rtems/score/armv7m.h 
b/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
index c701e1037c..cb126a49ba 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
@@ -611,6 +611,43 @@ void _ARMV7M_Supervisor_call( void );
 
 void _ARMV7M_Clock_handler( void );
 
+static inline uint32_t _ARMV7M_MPU_get_region_size(uintptr_t size)
+{
+  if ((size & (size - 1)) == 0) {
+return ARMV7M_MPU_RASR_SIZE(30 - __builtin_clz(size));
+  } else {
+return ARMV7M_MPU_RASR_SIZE(31 - __builtin_clz(size));
+  }
+}
+
+static inline void _ARMV7M_MPU_set_region(
+  volatile ARMV7M_MPU *mpu,
+  uint32_t region,
+  uint32_t rasr,
+  const void *begin,
+  const void *end
+)
+{
+  uintptr_t size;
+  uint32_t rbar;
+
+  RTEMS_OBFUSCATE_VARIABLE(begin);
+  RTEMS_OBFUSCATE_VARIABLE(end);
+  size = (uintptr_t) end - (uintptr_t) begin;
+
+  if ( size > 0 ) {
+rbar = (uintptr_t) begin | region | ARMV7M_MPU_RBAR_VALID;
+rasr |= _ARMV7M_MPU_get_region_size(size);
+  } else {
+rbar = region;
+rasr = 0;
+  }
+
+  mpu->rbar = rbar;
+  mpu->rasr = rasr;
+}
+
+
 #endif /* ASM */
 
 #endif /* ARM_MULTILIB_ARCH_V7M */
-- 
2.26.2

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


[PATCH rtems 3/9] bsps/imx: Move imx-gpio to arm/shared

2020-11-17 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imx/headers.am | 5 -
 bsps/arm/shared/headers.am  | 5 +
 bsps/arm/{imx => shared}/include/bsp/imx-gpio.h | 0
 bsps/arm/{imx/gpio => shared/pins}/imx-gpio.c   | 0
 c/src/lib/libbsp/arm/imx/Makefile.am| 2 +-
 spec/build/bsps/arm/imx/bspimx.yml  | 4 ++--
 6 files changed, 8 insertions(+), 8 deletions(-)
 rename bsps/arm/{imx => shared}/include/bsp/imx-gpio.h (100%)
 rename bsps/arm/{imx/gpio => shared/pins}/imx-gpio.c (100%)

diff --git a/bsps/arm/imx/headers.am b/bsps/arm/imx/headers.am
index e7a2418dea..4db8035c38 100644
--- a/bsps/arm/imx/headers.am
+++ b/bsps/arm/imx/headers.am
@@ -17,9 +17,4 @@ include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/
 
 include_bspdir = $(includedir)/bsp
 include_bsp_HEADERS =
-include_bsp_HEADERS += ../../../../../../bsps/arm/imx/include/bsp/imx-gpio.h
 include_bsp_HEADERS += ../../../../../../bsps/arm/imx/include/bsp/irq.h
-
-include_dev_clockdir = $(includedir)/dev/clock
-include_dev_clock_HEADERS =
-include_dev_clock_HEADERS += 
../../../../../../bsps/include/dev/clock/arm-generic-timer.h
diff --git a/bsps/arm/shared/headers.am b/bsps/arm/shared/headers.am
index 4fd7238f81..34474400ec 100644
--- a/bsps/arm/shared/headers.am
+++ b/bsps/arm/shared/headers.am
@@ -4,3 +4,8 @@ include_arm_freescale_imxdir = $(includedir)/arm/freescale/imx
 include_arm_freescale_imx_HEADERS =
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
+
+include_bspdir = $(includedir)/bsp
+include_bsp_HEADERS =
+include_bsp_HEADERS += ../../../../../../bsps/arm/shared/include/bsp/imx-gpio.h
+include_bsp_HEADERS += 
../../../../../../bsps/arm/shared/include/bsp/imx-iomux.h
diff --git a/bsps/arm/imx/include/bsp/imx-gpio.h 
b/bsps/arm/shared/include/bsp/imx-gpio.h
similarity index 100%
rename from bsps/arm/imx/include/bsp/imx-gpio.h
rename to bsps/arm/shared/include/bsp/imx-gpio.h
diff --git a/bsps/arm/imx/gpio/imx-gpio.c b/bsps/arm/shared/pins/imx-gpio.c
similarity index 100%
rename from bsps/arm/imx/gpio/imx-gpio.c
rename to bsps/arm/shared/pins/imx-gpio.c
diff --git a/c/src/lib/libbsp/arm/imx/Makefile.am 
b/c/src/lib/libbsp/arm/imx/Makefile.am
index 80871a286c..c9537a773d 100644
--- a/c/src/lib/libbsp/arm/imx/Makefile.am
+++ b/c/src/lib/libbsp/arm/imx/Makefile.am
@@ -66,7 +66,7 @@ librtemsbsp_a_SOURCES += 
../../../../../../bsps/arm/shared/cache/cache-cp15.c
 librtemsbsp_a_SOURCES += 
../../../../../../bsps/arm/shared/cache/cache-v7ar-disable-data.S
 
 # GPIO
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/imx/gpio/imx-gpio.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/pins/imx-gpio.c
 
 # I2C
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/imx/i2c/imx-i2c.c
diff --git a/spec/build/bsps/arm/imx/bspimx.yml 
b/spec/build/bsps/arm/imx/bspimx.yml
index 442c631b3a..6b3cfdbb2e 100644
--- a/spec/build/bsps/arm/imx/bspimx.yml
+++ b/spec/build/bsps/arm/imx/bspimx.yml
@@ -28,7 +28,7 @@ install:
   - bsps/arm/imx/include/arm/freescale/imx/imx_wdogreg.h
 - destination: ${BSP_INCLUDEDIR}/bsp
   source:
-  - bsps/arm/imx/include/bsp/imx-gpio.h
+  - bsps/arm/shared/include/bsp/imx-gpio.h
   - bsps/arm/imx/include/bsp/irq.h
   - bsps/arm/shared/include/bsp/imx-iomux.h
 - destination: ${BSP_INCLUDEDIR}/dev/clock
@@ -83,7 +83,7 @@ links:
   uid: ../../bspopts
 source:
 - bsps/arm/imx/console/console-config.c
-- bsps/arm/imx/gpio/imx-gpio.c
+- bsps/arm/shared/pins/imx-gpio.c
 - bsps/arm/imx/i2c/imx-i2c.c
 - bsps/arm/imx/spi/imx-ecspi.c
 - bsps/arm/imx/start/bspreset.c
-- 
2.26.2

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


[PATCH rtems 7/9] bsp/imxrt: Fix warnings for imported files

2020-11-17 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imxrt/include/fsl_common.h   | 295 ++
 bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h |   2 +
 .../imxrt/nxp/boards/evkbimxrt1050/pin_mux.c  |   4 +
 .../nxp/devices/MIMXRT1052/drivers/fsl_dcp.c  |   4 +
 .../devices/MIMXRT1052/drivers/fsl_spdif.c|   2 +
 5 files changed, 307 insertions(+)

diff --git a/bsps/arm/imxrt/include/fsl_common.h 
b/bsps/arm/imxrt/include/fsl_common.h
index 358f973b9e..76f943ebba 100644
--- a/bsps/arm/imxrt/include/fsl_common.h
+++ b/bsps/arm/imxrt/include/fsl_common.h
@@ -663,6 +663,301 @@ void DefaultISR(void);
 */
 void SDK_DelayAtLeastUs(uint32_t delay_us, uint32_t coreClock_Hz);
 
+#ifdef __rtems__
+/* Prototypes for IRQHandlers */
+void FLEXIO_CommonIRQHandler(void);
+void FLEXIO_DriverIRQHandler(void);
+void FLEXIO0_DriverIRQHandler(void);
+void FLEXIO1_DriverIRQHandler(void);
+void UART2_FLEXIO_DriverIRQHandler(void);
+void FLEXIO2_DriverIRQHandler(void);
+void FLEXIO3_DriverIRQHandler(void);
+void CAN0_DriverIRQHandler(void);
+void CAN1_DriverIRQHandler(void);
+void CAN2_DriverIRQHandler(void);
+void CAN3_DriverIRQHandler(void);
+void CAN4_DriverIRQHandler(void);
+void DMA_FLEXCAN0_INT_DriverIRQHandler(void);
+void DMA_FLEXCAN1_INT_DriverIRQHandler(void);
+void DMA_FLEXCAN2_INT_DriverIRQHandler(void);
+void ADMA_FLEXCAN0_INT_DriverIRQHandler(void);
+void ADMA_FLEXCAN1_INT_DriverIRQHandler(void);
+void ADMA_FLEXCAN2_INT_DriverIRQHandler(void);
+void USDHC0_DriverIRQHandler(void);
+void USDHC1_DriverIRQHandler(void);
+void USDHC2_DriverIRQHandler(void);
+void LPUART0_LPUART1_RX_DriverIRQHandler(void);
+void LPUART0_LPUART1_TX_DriverIRQHandler(void);
+void LPUART0_LPUART1_DriverIRQHandler(void);
+void LPUART0_TX_DriverIRQHandler(void);
+void LPUART0_RX_DriverIRQHandler(void);
+void LPUART0_DriverIRQHandler(void);
+void LPUART1_TX_DriverIRQHandler(void);
+void LPUART1_RX_DriverIRQHandler(void);
+void LPUART1_DriverIRQHandler(void);
+void LPUART2_TX_DriverIRQHandler(void);
+void LPUART2_RX_DriverIRQHandler(void);
+void LPUART2_DriverIRQHandler(void);
+void LPUART3_TX_DriverIRQHandler(void);
+void LPUART3_RX_DriverIRQHandler(void);
+void LPUART3_DriverIRQHandler(void);
+void LPUART4_TX_DriverIRQHandler(void);
+void LPUART4_RX_DriverIRQHandler(void);
+void LPUART4_DriverIRQHandler(void);
+void LPUART5_TX_DriverIRQHandler(void);
+void LPUART5_RX_DriverIRQHandler(void);
+void LPUART5_DriverIRQHandler(void);
+void LPUART6_TX_DriverIRQHandler(void);
+void LPUART6_RX_DriverIRQHandler(void);
+void LPUART6_DriverIRQHandler(void);
+void LPUART7_TX_DriverIRQHandler(void);
+void LPUART7_RX_DriverIRQHandler(void);
+void LPUART7_DriverIRQHandler(void);
+void LPUART8_TX_DriverIRQHandler(void);
+void LPUART8_RX_DriverIRQHandler(void);
+void LPUART8_DriverIRQHandler(void);
+void M4_0_LPUART_DriverIRQHandler(void);
+void M4_1_LPUART_DriverIRQHandler(void);
+void M4_LPUART_DriverIRQHandler(void);
+void DMA_UART0_INT_DriverIRQHandler(void);
+void DMA_UART1_INT_DriverIRQHandler(void);
+void DMA_UART2_INT_DriverIRQHandler(void);
+void DMA_UART3_INT_DriverIRQHandler(void);
+void DMA_UART4_INT_DriverIRQHandler(void);
+void ADMA_UART0_INT_DriverIRQHandler(void);
+void ADMA_UART1_INT_DriverIRQHandler(void);
+void ADMA_UART2_INT_DriverIRQHandler(void);
+void ADMA_UART3_INT_DriverIRQHandler(void);
+void DMA0_04_DriverIRQHandler(void);
+void DMA0_15_DriverIRQHandler(void);
+void DMA0_26_DriverIRQHandler(void);
+void DMA0_37_DriverIRQHandler(void);
+void DMA1_04_DriverIRQHandler(void);
+void DMA1_15_DriverIRQHandler(void);
+void DMA1_26_DriverIRQHandler(void);
+void DMA1_37_DriverIRQHandler(void);
+void DMA1_04_DriverIRQHandler(void);
+void DMA1_15_DriverIRQHandler(void);
+void DMA1_26_DriverIRQHandler(void);
+void DMA1_37_DriverIRQHandler(void);
+void DMA0_08_DriverIRQHandler(void);
+void DMA0_19_DriverIRQHandler(void);
+void DMA0_210_DriverIRQHandler(void);
+void DMA0_311_DriverIRQHandler(void);
+void DMA0_412_DriverIRQHandler(void);
+void DMA0_513_DriverIRQHandler(void);
+void DMA0_614_DriverIRQHandler(void);
+void DMA0_715_DriverIRQHandler(void);
+void DMA1_08_DriverIRQHandler(void);
+void DMA1_19_DriverIRQHandler(void);
+void DMA1_210_DriverIRQHandler(void);
+void DMA1_311_DriverIRQHandler(void);
+void DMA1_412_DriverIRQHandler(void);
+void DMA1_513_DriverIRQHandler(void);
+void DMA1_614_DriverIRQHandler(void);
+void DMA1_715_DriverIRQHandler(void);
+void DMA0_DMA16_DriverIRQHandler(void);
+void DMA1_DMA17_DriverIRQHandler(void);
+void DMA2_DMA18_DriverIRQHandler(void);
+void DMA3_DMA19_DriverIRQHandler(void);
+void DMA4_DMA20_DriverIRQHandler(void);
+void DMA5_DMA21_DriverIRQHandler(void);
+void DMA6_DMA22_DriverIRQHandler(void);
+void DMA7_DMA23_DriverIRQHandler(void);
+void DMA8_DMA24_DriverIRQHandler(void);
+void DMA9_DMA25_DriverIRQHandler(void);
+void DMA10_DMA26_DriverIRQHandler(void);
+void DMA11_DMA27_DriverIRQHandler(void);
+void DMA12_DMA28_DriverIRQHandler(void);
+void DMA13_DMA29_DriverIRQHandler(void);
+void DMA14_DMA30_Driver

[PATCH rtems 5/9] shell: Add i2c and spi commands

2020-11-17 Thread Christian Mauderer
This adds some commands that are usefull for debugging simple serial
interfaces.

Even if they are a complete re-implementation, the i2c* commands use a
simmilar call like the Linux i2c tools.
---
 cpukit/Makefile.am|   4 +
 cpukit/include/rtems/shellconfig.h|  28 +
 cpukit/libmisc/shell/main_i2cdetect.c | 107 ++
 cpukit/libmisc/shell/main_i2cget.c| 145 
 cpukit/libmisc/shell/main_i2cset.c| 124 
 cpukit/libmisc/shell/main_spi.c   | 157 ++
 spec/build/cpukit/objshell.yml|   4 +
 7 files changed, 569 insertions(+)
 create mode 100644 cpukit/libmisc/shell/main_i2cdetect.c
 create mode 100644 cpukit/libmisc/shell/main_i2cget.c
 create mode 100644 cpukit/libmisc/shell/main_i2cset.c
 create mode 100644 cpukit/libmisc/shell/main_spi.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 4e370ae639..2adfcf933f 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1495,6 +1495,10 @@ librtemscpu_a_SOURCES += libmisc/shell/login_prompt.c
 librtemscpu_a_SOURCES += libmisc/shell/login_check.c
 librtemscpu_a_SOURCES += libmisc/shell/fdisk.c
 librtemscpu_a_SOURCES += libmisc/shell/main_rtc.c
+librtemscpu_a_SOURCES += libmisc/shell/main_spi.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cdetect.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cset.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cget.c
 librtemscpu_a_SOURCES += libmisc/shell/dd-args.c
 librtemscpu_a_SOURCES += libmisc/shell/main_dd.c
 librtemscpu_a_SOURCES += libmisc/shell/dd-conv.c
diff --git a/cpukit/include/rtems/shellconfig.h 
b/cpukit/include/rtems/shellconfig.h
index 3e87d472d6..c5fcf4a45e 100644
--- a/cpukit/include/rtems/shellconfig.h
+++ b/cpukit/include/rtems/shellconfig.h
@@ -78,6 +78,10 @@ extern rtems_shell_cmd_t rtems_shell_DF_Command;
 extern rtems_shell_cmd_t rtems_shell_MD5_Command;
 
 extern rtems_shell_cmd_t rtems_shell_RTC_Command;
+extern rtems_shell_cmd_t rtems_shell_SPI_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CDETECT_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CGET_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CSET_Command;
 
 extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command;
 extern rtems_shell_cmd_t rtems_shell_CPUINFO_Command;
@@ -521,6 +525,30 @@ extern rtems_shell_alias_t * const 
rtems_shell_Initial_aliases[];
   &rtems_shell_RTC_Command,
 #endif
 
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_SPI)) \
+|| defined(CONFIGURE_SHELL_COMMAND_SPI)
+  &rtems_shell_SPI_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CDETECT)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CDETECT)
+  &rtems_shell_I2CDETECT_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CGET)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CGET)
+  &rtems_shell_I2CGET_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CSET)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CSET)
+  &rtems_shell_I2CSET_Command,
+#endif
+
 /*
  *  System related commands
  */
diff --git a/cpukit/libmisc/shell/main_i2cdetect.c 
b/cpukit/libmisc/shell/main_i2cdetect.c
new file mode 100644
index 00..e953b4eaef
--- /dev/null
+++ b/cpukit/libmisc/shell/main_i2cdetect.c
@@ -0,0 +1,107 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 embedded brains GmbH.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ 

[PATCH rtems 8/9] bsp/imxrt: Adapt imported files

2020-11-17 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imxrt/include/fsl_device_registers.h | 57 ++-
 bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h |  6 ++
 ..._nor_config.h => fsl_flexspi_nor_config.h} |  0
 bsps/arm/imxrt/include/fsl_lpuart.h   |  4 ++
 bsps/arm/imxrt/include/fsl_pin_mux.h  |  4 ++
 .../nxp/boards/evkbimxrt1050/clock_config.c   | 12 
 .../imxrt/nxp/boards/evkbimxrt1050/pin_mux.c  |  6 ++
 .../devices/MIMXRT1052/drivers/fsl_lpuart.c   | 17 ++
 8 files changed, 80 insertions(+), 26 deletions(-)
 rename bsps/arm/imxrt/include/{evkbimxrt1050_flexspi_nor_config.h => 
fsl_flexspi_nor_config.h} (100%)

diff --git a/bsps/arm/imxrt/include/fsl_device_registers.h 
b/bsps/arm/imxrt/include/fsl_device_registers.h
index 54caf43ca6..00c3fc7036 100644
--- a/bsps/arm/imxrt/include/fsl_device_registers.h
+++ b/bsps/arm/imxrt/include/fsl_device_registers.h
@@ -1,36 +1,41 @@
-/*
- * Copyright 2014-2016 Freescale Semiconductor, Inc.
- * Copyright 2016-2018 NXP
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
  *
- * SPDX-License-Identifier: BSD-3-Clause
+ * @ingroup RTEMSBSPsARMimxrt
  *
+ * @brief Helper file for including registers for SDK drivers.
  */
 
-#ifndef __FSL_DEVICE_REGISTERS_H__
-#define __FSL_DEVICE_REGISTERS_H__
-
 /*
- * Include the cpu specific register header files.
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
  *
- * The CPU macro should be declared in the project or makefile.
+ * 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.
  */
-#if (defined(CPU_MIMXRT1052CVJ5B) || defined(CPU_MIMXRT1052CVL5B) || 
defined(CPU_MIMXRT1052DVJ6B) || \
-defined(CPU_MIMXRT1052DVL6B))
-
-#define MIMXRT1052_SERIES
-
-/* CMSIS-style register definitions */
-#include "MIMXRT1052.h"
-/* CPU specific feature definitions */
-#include "MIMXRT1052_features.h"
 
-#else
-#error "No valid CPU defined!"
-#endif
+#ifndef FSL_DEVICE_REGISTERS_H
+#define FSL_DEVICE_REGISTERS_H
 
-#endif /* __FSL_DEVICE_REGISTERS_H__ */
+#include 
 
-/***
- * EOF
- 
**/
+#endif /* FSL_DEVICE_REGISTERS_H */
diff --git a/bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h 
b/bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h
index 7b256f6670..56995eca55 100644
--- a/bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h
+++ b/bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h
@@ -9,7 +9,9 @@
 #define __FLEXSPI_NOR_BOOT_H__
 
 #include 
+#ifndef __rtems__
 #include "board.h"
+#endif /* __rtems__ */
 
 /*! @name Driver version */
 /*@{*/
@@ -85,6 +87,7 @@ typedef struct _ivt_ {
 #define FLASH_BASE ((uint32_t)__FLASH_BASE)   
 #endif
 
+#ifndef __rtems__
 #if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE)
 #define DCD_ADDRESS dcd_data
 #else
@@ -94,6 +97,7 @@ typedef struct _ivt_ {
 #define BOOT_DATA_ADDRESS &boot_data
 #define CSF_ADDRESS   0
 #define IVT_RSVD (uint32_t)(0x)
+#endif /* __rtems__ */
 
 /* 
  *  Boot Data 
@@ -114,11 +118,13 @@ typedef struct _boot_data_ {
 #endif /* __rtems__ */
 #define PLUGIN_FLAG   (uint32_t)0
 
+#ifndef __rtems__
 /* External Variables */
 const BOOT_DATA_T boot_data;
 #if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE)
 extern const uint8_t dcd_data[];
 #endif
+#endif /* __rtems__ */
 
 #endif /* __FLEXSPI_NOR_BOOT_H__ */
 
diff --git a/bsps/arm/imxrt/include/evkbimxrt1050_flexspi_nor_config.h 
b/bsps/arm/imxrt/include/fsl_flexspi_nor_config.h
similarity index 100%
rename from bsps/arm/imxrt/include/evkbimxrt1050_flexspi_nor

[PATCH rtems-libbsd 2/2] if_ffec: Fix cache handling on tx

2020-11-17 Thread Christian Mauderer
With the previous fix, it could happen that the end of the packet hasn't
been flushed. For example assume the following addresses:

ds_addr: 0x81c804A
ds_len: 0x57

In that case the data ends at 0x81c80a1. But due to the rounding the
area from 0x81c8040 to 0x81c80a0 would have been flushed.

This fix now first calculates the start and end address, aligns these
addresses and then recalculates the len that has to be flushed.

Update #4180
---
 freebsd/sys/dev/ffec/if_ffec.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/freebsd/sys/dev/ffec/if_ffec.c b/freebsd/sys/dev/ffec/if_ffec.c
index e8287ed2..47c0f770 100644
--- a/freebsd/sys/dev/ffec/if_ffec.c
+++ b/freebsd/sys/dev/ffec/if_ffec.c
@@ -714,15 +714,16 @@ ffec_encap(struct ifnet *ifp, struct ffec_softc *sc, 
struct mbuf *m0,
tx_desc->buf_paddr = segs[i].ds_addr;
tx_desc->flags2 = flags2;
 #ifdef __rtems__
-   uintptr_t addr_flush = (uintptr_t)segs[i].ds_addr;
+   uintptr_t first_flush = (uintptr_t)segs[i].ds_addr;
size_t len_flush = segs[i].ds_len;
 #ifdef CPU_CACHE_LINE_BYTES
+   uintptr_t last_flush = first_flush + len_flush;
/* mbufs should be cache line aligned. So we can just round. */
-   addr_flush = addr_flush & ~(CPU_CACHE_LINE_BYTES - 1);
-   len_flush = (len_flush + (CPU_CACHE_LINE_BYTES - 1)) &
-   ~(CPU_CACHE_LINE_BYTES - 1);
+   first_flush = rounddown2(first_flush, CPU_CACHE_LINE_BYTES);
+   last_flush = roundup2(last_flush, CPU_CACHE_LINE_BYTES);
+   len_flush = last_flush - first_flush;
 #endif
-   rtems_cache_flush_multiple_data_lines((void*)addr_flush,
+   rtems_cache_flush_multiple_data_lines((void*)first_flush,
len_flush);
 #endif /* __rtems__ */
 
-- 
2.26.2

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


[PATCH rtems-libbsd 1/2] imxrt: Add support

2020-11-17 Thread Christian Mauderer
Update #4180
---
 rtemsbsd/include/bsp/nexus-devices.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 18b4c012..630572a8 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -143,6 +143,14 @@ RTEMS_BSD_DRIVER_MMC;
 
 SYSINIT_DRIVER_REFERENCE(ofw_regulator_bus, simplebus);
 
+#elif defined(LIBBSP_ARM_IMXRT_BSP_H)
+
+RTEMS_BSD_DEFINE_NEXUS_DEVICE(ofwbus, 0, 0, NULL);
+SYSINIT_DRIVER_REFERENCE(simplebus, ofwbus);
+
+SYSINIT_DRIVER_REFERENCE(ffec, simplebus);
+SYSINIT_DRIVER_REFERENCE(ksz8091rnb, miibus);
+
 #elif defined(LIBBSP_ARM_LPC24XX_BSP_H)
 
 RTEMS_BSD_DEFINE_NEXUS_DEVICE(ohci, 0, 0, NULL);
-- 
2.26.2

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


[PATCH rtems-docs 2/2] user/bsps: Fix list in bsps-arm

2020-11-17 Thread Christian Mauderer
Seems that some filenames haven't been added correctly.
---
 user/bsps/bsps-arm.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/user/bsps/bsps-arm.rst b/user/bsps/bsps-arm.rst
index a63dd5f..f8a1d60 100644
--- a/user/bsps/bsps-arm.rst
+++ b/user/bsps/bsps-arm.rst
@@ -9,6 +9,7 @@ arm (ARM)
 .. include:: arm/altera-cyclone-v.rst
 .. include:: arm/atsam.rst
 .. include:: arm/beagle.rst
+.. include:: arm/bsp-stm32h7.rst
 .. include:: arm/csb336.rst
 .. include:: arm/csb337.rst
 .. include:: arm/edb7312.rst
@@ -17,8 +18,7 @@ arm (ARM)
 .. include:: arm/imxrt.rst
 .. include:: arm/lm3s69xx.rst
 .. include:: arm/lpc176x.rst
-.. include:: arm/imx.rst
-.. include:: arm/lpc32xx.rst
+.. include:: arm/lpc24xx.rst
 .. include:: arm/raspberrypi.rst
 .. include:: arm/realview-pbx-a9.rst
 .. include:: arm/rtl22xx.rst
-- 
2.26.2

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


[PATCH rtems-docs 1/2] user/bsps: Add imxrt

2020-11-17 Thread Christian Mauderer
Update #4180
---
 user/bsps/arm/imxrt.rst | 174 
 user/bsps/bsps-arm.rst  |   1 +
 2 files changed, 175 insertions(+)
 create mode 100644 user/bsps/arm/imxrt.rst

diff --git a/user/bsps/arm/imxrt.rst b/user/bsps/arm/imxrt.rst
new file mode 100644
index 000..41c6bff
--- /dev/null
+++ b/user/bsps/arm/imxrt.rst
@@ -0,0 +1,174 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2020 embedded brains GmbH
+.. Copyright (C) 2020 Christian Mauderer
+
+imxrt (NXP i.MXRT)
+==
+
+This BSP offers only one variant, the `imxrt1052`. This variant supports the
+i.MXRT 1052 processor on a IMXRT1050-EVKB (tested with rev A1). You can also
+configure it to work with custom boards.
+
+Build Configuration Options
+---
+
+Please see the documentation of the `IMXRT_*` and `BSP_*` configuration options
+for that. You can generate a default set of options with::
+
+  ./waf bsp_defaults --rtems-bsps=arm/imxrt1052 > config.ini
+
+Boot Process
+
+
+There are two possible boot processes supported:
+
+1) The ROM code loads a configuration from HyperFlash (connected to FlexSPI),
+   does some initialization (based on device configuration data (DCD)) and then
+   starts the application. This is the default case. `linkcmds.flexspi` is used
+   for this case.
+
+2) Some custom bootloader does the basic initialization, loads the application
+   to SDRAM and starts it from there. Select the `linkcmds.sdram` for this.
+
+For programming the HyperFlash in case 1, you can use the on board debugger
+integrated into the IMXRT1050-EVKB. You can generate a flash image out of a
+compiled RTEMS application with for example::
+
+  arm-rtems6-objcopy -O binary 
build/arm/imxrt1052/testsuites/samples/hello.exe hello.bin
+
+Then just copy the generated binary to the mass storage provided by the
+debugger. Wait a bit till the mass storage vanishes and re-appears. After that,
+reset the board and the newly programmed application will start.
+
+For debugging: Create a special application with a `while(true)` loop at end of
+`bsp_start_hook_1`. Load that application into flash. Then remove the loop
+again, build your BSP for SDRAM and use a debugger to load the application into
+SDRAM after the BSP started from flash did the basic initialization.
+
+Flash Image
+---
+
+For booting from a HyperFlash (or other storage connected to FlexSPI), the ROM
+code of the i.MXRT first reads some special flash header information from a
+fixed location of the connected flash device. This consists of the Image vector
+table (IVT), Boot data and Device configuration data (DCD).
+
+In RTEMS, these flash headers are generated using some C-structures. If you use
+a board other then the IMXRT1050-EVKB, they have to be adapted. To do that
+re-define the following variables in your application (you only need the ones
+that need different values):
+
+.. code-block:: c
+
+  #include 
+  const uint8_t imxrt_dcd_data[] =
+  { /* Your DCD data here */ };
+  const ivt imxrt_image_vector_table =
+  { /* Your IVT here */ };
+  const BOOT_DATA_T imxrt_boot_data =
+  { /* Your boot data here */ };
+  const flexspi_nor_config_t imxrt_flexspi_config =
+  { /* Your FlexSPI config here */ };
+
+You can find the default definitions in `bsps/arm/imxrt/start/flash-*.c`. Take 
a
+look at the `i.MX RT1050 Processor Reference Manual, Rev. 4, 12/2019` chapter
+`9.7 Program image` for details about the contents.
+
+FDT
+---
+
+The BSP used a FDT based initialization. The FDT is linked into the 
application.
+You can find the default FDT used in the BSP in
+`bsps/arm/imxrt/dts/imxrt1050-evkb.dts`. To use your own FDT compile it and
+convert it into a C file with (replace `YOUR.dts` and simmilar with your FDT
+source names)::
+
+  sh> export BSP_DIR="${RTEMS_SRC_DIR}/bsps/arm/imxrt/"
+  sh> arm-rtems6-cpp -P -x assembler-with-cpp \
+  -I "${BSP_DIR}/include/" \
+  -include "YOUR.dts" /dev/null | \
+  dtc -@ -O dtb -o "YOUR.dtb" -b 0 -p 1024
+  sh> rtems-bin2c -C -N imxrt_dtb "YOUR.dtb" "YOUR.c"
+
+Make sure that your new c file is compiled and linked into the application.
+
+Clock Driver
+
+
+The clock driver uses the generic `ARMv7-M Clock`.
+
+IOMUX
+-
+
+The i.MXRT IOMUXC is initialized based on the FDT. For that, the `pinctrl-0`
+fields of all devices with a status of `ok` or `okay` will be parsed.
+
+Console Driver
+--
+
+LPUART drivers are registered based on the FDT. The special `rtems,path`
+attribute defines where the device file for the console is created.
+
+The `stdout-path` in the `chosen` node determines which LPUART is used for the
+console.
+
+I2C Driver
+--
+
+I2C drivers are registered based on the FDT. The special `rtems,path` attribute
+defines where the device file for the I2C bus is created.
+
+Limitations:
+
+* Onl

Re: [PATCH rtems 1/9] Add License file for BSD-3-Clause

2020-11-17 Thread Christian Mauderer
On 17/11/2020 18:29, Gedare Bloom wrote:
> this is ok, would have preferred it separately ;)

Hello Gedare,

yes, sorry. I shouldn't have hidden it in the patch set. I haven't
checked thoroughly enough before sending. I'll send it as a separate
patch tomorrow so that everyone is aware of it. Same is true for the i2c
and spi commands.

Best regards

Christian

> 
> On Tue, Nov 17, 2020 at 4:05 AM Christian Mauderer
>  wrote:
>>
>> We have some files with a SPDX identifier for this license. Therefore
>> the license should be here too.
>> ---
>>  LICENSE.BSD-3-Clause | 27 +++
>>  1 file changed, 27 insertions(+)
>>  create mode 100644 LICENSE.BSD-3-Clause
>>
>> diff --git a/LICENSE.BSD-3-Clause b/LICENSE.BSD-3-Clause
>> new file mode 100644
>> index 00..09d01c1ff5
>> --- /dev/null
>> +++ b/LICENSE.BSD-3-Clause
>> @@ -0,0 +1,27 @@
>> +https://spdx.org/licenses/BSD-3-Clause
>> +
>> +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.
>> +3. Neither the name of the copyright holder nor the names of its
>> +   contributors may be used to endorse or promote products derived
>> +   from this software without specific prior written permission.
>> +
>> +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
>> +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
>> +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
>> +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>> +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
>> +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
>> +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
>> +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
>> +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
>> +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>> --
>> 2.26.2
>>
>> ___
>> devel mailing list
>> devel@rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] Add License file for BSD-3-Clause

2020-11-17 Thread Christian Mauderer
We have some files with a SPDX identifier for this license. Therefore
the license should be here too.
---

Note: This is a resubmission of the patch. Previously I submitted it together
with the patches that add a new imxrt BSP:

https://lists.rtems.org/pipermail/devel/2020-November/063273.html

I only noted that it would have been better separate after Gedare said it.

 LICENSE.BSD-3-Clause | 27 +++
 1 file changed, 27 insertions(+)
 create mode 100644 LICENSE.BSD-3-Clause

diff --git a/LICENSE.BSD-3-Clause b/LICENSE.BSD-3-Clause
new file mode 100644
index 00..09d01c1ff5
--- /dev/null
+++ b/LICENSE.BSD-3-Clause
@@ -0,0 +1,27 @@
+https://spdx.org/licenses/BSD-3-Clause
+
+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.
+3. Neither the name of the copyright holder nor the names of its
+   contributors may be used to endorse or promote products derived
+   from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- 
2.26.2

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


[PATCH] shell: Add i2c and spi commands

2020-11-17 Thread Christian Mauderer
This adds some commands that are usefull for debugging simple serial
interfaces.

Even if they are a complete re-implementation, the i2c* commands use a
simmilar call like the Linux i2c tools.
---

Note: This is a resubmission of the patch. Previously I submitted it together
with the patches that add a new imxrt BSP:

https://lists.rtems.org/pipermail/devel/2020-November/063273.html

I only noted that it would have been better separate after Gedare said it.

 cpukit/Makefile.am|   4 +
 cpukit/include/rtems/shellconfig.h|  28 +
 cpukit/libmisc/shell/main_i2cdetect.c | 107 ++
 cpukit/libmisc/shell/main_i2cget.c| 145 
 cpukit/libmisc/shell/main_i2cset.c| 124 
 cpukit/libmisc/shell/main_spi.c   | 157 ++
 spec/build/cpukit/objshell.yml|   4 +
 7 files changed, 569 insertions(+)
 create mode 100644 cpukit/libmisc/shell/main_i2cdetect.c
 create mode 100644 cpukit/libmisc/shell/main_i2cget.c
 create mode 100644 cpukit/libmisc/shell/main_i2cset.c
 create mode 100644 cpukit/libmisc/shell/main_spi.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 4e370ae639..2adfcf933f 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1495,6 +1495,10 @@ librtemscpu_a_SOURCES += libmisc/shell/login_prompt.c
 librtemscpu_a_SOURCES += libmisc/shell/login_check.c
 librtemscpu_a_SOURCES += libmisc/shell/fdisk.c
 librtemscpu_a_SOURCES += libmisc/shell/main_rtc.c
+librtemscpu_a_SOURCES += libmisc/shell/main_spi.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cdetect.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cset.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cget.c
 librtemscpu_a_SOURCES += libmisc/shell/dd-args.c
 librtemscpu_a_SOURCES += libmisc/shell/main_dd.c
 librtemscpu_a_SOURCES += libmisc/shell/dd-conv.c
diff --git a/cpukit/include/rtems/shellconfig.h 
b/cpukit/include/rtems/shellconfig.h
index 3e87d472d6..c5fcf4a45e 100644
--- a/cpukit/include/rtems/shellconfig.h
+++ b/cpukit/include/rtems/shellconfig.h
@@ -78,6 +78,10 @@ extern rtems_shell_cmd_t rtems_shell_DF_Command;
 extern rtems_shell_cmd_t rtems_shell_MD5_Command;
 
 extern rtems_shell_cmd_t rtems_shell_RTC_Command;
+extern rtems_shell_cmd_t rtems_shell_SPI_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CDETECT_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CGET_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CSET_Command;
 
 extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command;
 extern rtems_shell_cmd_t rtems_shell_CPUINFO_Command;
@@ -521,6 +525,30 @@ extern rtems_shell_alias_t * const 
rtems_shell_Initial_aliases[];
   &rtems_shell_RTC_Command,
 #endif
 
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_SPI)) \
+|| defined(CONFIGURE_SHELL_COMMAND_SPI)
+  &rtems_shell_SPI_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CDETECT)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CDETECT)
+  &rtems_shell_I2CDETECT_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CGET)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CGET)
+  &rtems_shell_I2CGET_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CSET)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CSET)
+  &rtems_shell_I2CSET_Command,
+#endif
+
 /*
  *  System related commands
  */
diff --git a/cpukit/libmisc/shell/main_i2cdetect.c 
b/cpukit/libmisc/shell/main_i2cdetect.c
new file mode 100644
index 00..e953b4eaef
--- /dev/null
+++ b/cpukit/libmisc/shell/main_i2cdetect.c
@@ -0,0 +1,107 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 embedded brains GmbH.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERR

Re: [PATCH rtems-docs 1/2] user/bsps: Add imxrt

2020-11-17 Thread Christian Mauderer

Am 17.11.20 um 18:41 schrieb Gedare Bloom:

On Tue, Nov 17, 2020 at 4:09 AM Christian Mauderer
 wrote:


Update #4180
---
  user/bsps/arm/imxrt.rst | 174 
  user/bsps/bsps-arm.rst  |   1 +
  2 files changed, 175 insertions(+)
  create mode 100644 user/bsps/arm/imxrt.rst

diff --git a/user/bsps/arm/imxrt.rst b/user/bsps/arm/imxrt.rst
new file mode 100644
index 000..41c6bff
--- /dev/null
+++ b/user/bsps/arm/imxrt.rst
@@ -0,0 +1,174 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2020 embedded brains GmbH
+.. Copyright (C) 2020 Christian Mauderer
+
+imxrt (NXP i.MXRT)
+==
+
+This BSP offers only one variant, the `imxrt1052`. This variant supports the
+i.MXRT 1052 processor on a IMXRT1050-EVKB (tested with rev A1). You can also
+configure it to work with custom boards.
+
+Build Configuration Options
+---
+
+Please see the documentation of the `IMXRT_*` and `BSP_*` configuration options
+for that. You can generate a default set of options with::

one colon: I think?



That's the start for the literal block below. Restructured Text allows 
three syntax variants for that. From Wikipedia:


::

  some literal text

This may also be used inline at the end of a paragraph, like so::

  some more literal text

.. code:: python

   print("A literal block directive explicitly marked as python code")


+
+  ./waf bsp_defaults --rtems-bsps=arm/imxrt1052 > config.ini
+
+Boot Process
+
+
+There are two possible boot processes supported:
+
+1) The ROM code loads a configuration from HyperFlash (connected to FlexSPI),
+   does some initialization (based on device configuration data (DCD)) and then
+   starts the application. This is the default case. `linkcmds.flexspi` is used
+   for this case.
+
+2) Some custom bootloader does the basic initialization, loads the application
+   to SDRAM and starts it from there. Select the `linkcmds.sdram` for this.
+
+For programming the HyperFlash in case 1, you can use the on board debugger
+integrated into the IMXRT1050-EVKB. You can generate a flash image out of a
+compiled RTEMS application with for example::
+
+  arm-rtems6-objcopy -O binary 
build/arm/imxrt1052/testsuites/samples/hello.exe hello.bin
+
+Then just copy the generated binary to the mass storage provided by the
+debugger. Wait a bit till the mass storage vanishes and re-appears. After that,
+reset the board and the newly programmed application will start.
+
+For debugging: Create a special application with a `while(true)` loop at end of
+`bsp_start_hook_1`. Load that application into flash. Then remove the loop
+again, build your BSP for SDRAM and use a debugger to load the application into
+SDRAM after the BSP started from flash did the basic initialization.
+
+Flash Image
+---
+
+For booting from a HyperFlash (or other storage connected to FlexSPI), the ROM
+code of the i.MXRT first reads some special flash header information from a
+fixed location of the connected flash device. This consists of the Image vector
+table (IVT), Boot data and Device configuration data (DCD).
+
+In RTEMS, these flash headers are generated using some C-structures. If you use
+a board other then the IMXRT1050-EVKB, they have to be adapted. To do that

s/then/than


Thanks.


s/they have/it has
I thought that multiple structures for multiple headers have to be 
adapted. Would it really be correct to use "it" for that?





+re-define the following variables in your application (you only need the ones
+that need different values):
+
+.. code-block:: c
+
+  #include 
+  const uint8_t imxrt_dcd_data[] =
+  { /* Your DCD data here */ };
+  const ivt imxrt_image_vector_table =
+  { /* Your IVT here */ };
+  const BOOT_DATA_T imxrt_boot_data =
+  { /* Your boot data here */ };
+  const flexspi_nor_config_t imxrt_flexspi_config =
+  { /* Your FlexSPI config here */ };
+
+You can find the default definitions in `bsps/arm/imxrt/start/flash-*.c`. Take 
a
+look at the `i.MX RT1050 Processor Reference Manual, Rev. 4, 12/2019` chapter
+`9.7 Program image` for details about the contents.
+
+FDT
+---
+
+The BSP used a FDT based initialization. The FDT is linked into the 
application.
+You can find the default FDT used in the BSP in
+`bsps/arm/imxrt/dts/imxrt1050-evkb.dts`. To use your own FDT compile it and
+convert it into a C file with (replace `YOUR.dts` and simmilar with your FDT
+source names)::
+
+  sh> export BSP_DIR="${RTEMS_SRC_DIR}/bsps/arm/imxrt/"
+  sh> arm-rtems6-cpp -P -x assembler-with-cpp \
+  -I "${BSP_DIR}/include/" \
+  -include "YOUR.dts" /dev/null | \
+  dtc -@ -O dtb -o "YOUR.dtb" -b 0 -p 1024
+  sh> rtems-bin2c -C -N imxrt_dtb "YOUR.dtb" "YOUR.c"
+
+Make sure that your new c file is compiled and linked into the application.
+
+Clock Driver
+
+
+The clock driver uses 

Re: [PATCHES] Add imxrt BSP

2020-11-17 Thread Christian Mauderer

Hello Gedare,

Am 17.11.20 um 18:33 schrieb Gedare Bloom:

Everything except 5 looks good. I or someone else should take a closer
look at that.


Thanks for the review.

I noted that I most likely have to rework the MPU setup a bit. A table 
based approach (similar to the one used for ARMV7_CP15 based BSPs) would 
be better to allow a user to overwrite the table if he has a board with 
a slightly different memory configuration.




On Tue, Nov 17, 2020 at 4:04 AM Christian Mauderer
 wrote:


Hello,

the following patches add a BSP for IMXRT1050-EVKB. In case the import
patch is too big: I pushed the patches here too:

https://gitlab.com/c-mauderer/rtems/-/tree/cm/20201117_imxrt

Best regards

Christian


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


--

embedded brains GmbH
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
PGP: Public key available on request.

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

[PATCH rtems v2 2/7] bsps/imx: Move imx-gpio to arm/shared

2020-11-18 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imx/headers.am | 5 -
 bsps/arm/shared/headers.am  | 5 +
 bsps/arm/{imx => shared}/include/bsp/imx-gpio.h | 0
 bsps/arm/{imx/gpio => shared/pins}/imx-gpio.c   | 0
 c/src/lib/libbsp/arm/imx/Makefile.am| 2 +-
 spec/build/bsps/arm/imx/bspimx.yml  | 4 ++--
 6 files changed, 8 insertions(+), 8 deletions(-)
 rename bsps/arm/{imx => shared}/include/bsp/imx-gpio.h (100%)
 rename bsps/arm/{imx/gpio => shared/pins}/imx-gpio.c (100%)

diff --git a/bsps/arm/imx/headers.am b/bsps/arm/imx/headers.am
index e7a2418dea..4db8035c38 100644
--- a/bsps/arm/imx/headers.am
+++ b/bsps/arm/imx/headers.am
@@ -17,9 +17,4 @@ include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/
 
 include_bspdir = $(includedir)/bsp
 include_bsp_HEADERS =
-include_bsp_HEADERS += ../../../../../../bsps/arm/imx/include/bsp/imx-gpio.h
 include_bsp_HEADERS += ../../../../../../bsps/arm/imx/include/bsp/irq.h
-
-include_dev_clockdir = $(includedir)/dev/clock
-include_dev_clock_HEADERS =
-include_dev_clock_HEADERS += 
../../../../../../bsps/include/dev/clock/arm-generic-timer.h
diff --git a/bsps/arm/shared/headers.am b/bsps/arm/shared/headers.am
index 4fd7238f81..34474400ec 100644
--- a/bsps/arm/shared/headers.am
+++ b/bsps/arm/shared/headers.am
@@ -4,3 +4,8 @@ include_arm_freescale_imxdir = $(includedir)/arm/freescale/imx
 include_arm_freescale_imx_HEADERS =
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
+
+include_bspdir = $(includedir)/bsp
+include_bsp_HEADERS =
+include_bsp_HEADERS += ../../../../../../bsps/arm/shared/include/bsp/imx-gpio.h
+include_bsp_HEADERS += 
../../../../../../bsps/arm/shared/include/bsp/imx-iomux.h
diff --git a/bsps/arm/imx/include/bsp/imx-gpio.h 
b/bsps/arm/shared/include/bsp/imx-gpio.h
similarity index 100%
rename from bsps/arm/imx/include/bsp/imx-gpio.h
rename to bsps/arm/shared/include/bsp/imx-gpio.h
diff --git a/bsps/arm/imx/gpio/imx-gpio.c b/bsps/arm/shared/pins/imx-gpio.c
similarity index 100%
rename from bsps/arm/imx/gpio/imx-gpio.c
rename to bsps/arm/shared/pins/imx-gpio.c
diff --git a/c/src/lib/libbsp/arm/imx/Makefile.am 
b/c/src/lib/libbsp/arm/imx/Makefile.am
index 80871a286c..c9537a773d 100644
--- a/c/src/lib/libbsp/arm/imx/Makefile.am
+++ b/c/src/lib/libbsp/arm/imx/Makefile.am
@@ -66,7 +66,7 @@ librtemsbsp_a_SOURCES += 
../../../../../../bsps/arm/shared/cache/cache-cp15.c
 librtemsbsp_a_SOURCES += 
../../../../../../bsps/arm/shared/cache/cache-v7ar-disable-data.S
 
 # GPIO
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/imx/gpio/imx-gpio.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/pins/imx-gpio.c
 
 # I2C
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/imx/i2c/imx-i2c.c
diff --git a/spec/build/bsps/arm/imx/bspimx.yml 
b/spec/build/bsps/arm/imx/bspimx.yml
index 442c631b3a..6b3cfdbb2e 100644
--- a/spec/build/bsps/arm/imx/bspimx.yml
+++ b/spec/build/bsps/arm/imx/bspimx.yml
@@ -28,7 +28,7 @@ install:
   - bsps/arm/imx/include/arm/freescale/imx/imx_wdogreg.h
 - destination: ${BSP_INCLUDEDIR}/bsp
   source:
-  - bsps/arm/imx/include/bsp/imx-gpio.h
+  - bsps/arm/shared/include/bsp/imx-gpio.h
   - bsps/arm/imx/include/bsp/irq.h
   - bsps/arm/shared/include/bsp/imx-iomux.h
 - destination: ${BSP_INCLUDEDIR}/dev/clock
@@ -83,7 +83,7 @@ links:
   uid: ../../bspopts
 source:
 - bsps/arm/imx/console/console-config.c
-- bsps/arm/imx/gpio/imx-gpio.c
+- bsps/arm/shared/pins/imx-gpio.c
 - bsps/arm/imx/i2c/imx-i2c.c
 - bsps/arm/imx/spi/imx-ecspi.c
 - bsps/arm/imx/start/bspreset.c
-- 
2.26.2

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


[PATCH rtems v2 3/7] cpu/armv7m: Add table based init for ARMV7M_MPU

2020-11-18 Thread Christian Mauderer
Modify the MPU functions of the stm32h7 BSP to be table based and
available for all ARMV7M BSPs.

Update #4180
---
 bsps/arm/stm32h7/start/bspstarthooks.c| 168 ++
 .../cpu/arm/include/rtems/score/armv7m.h  | 100 +++
 2 files changed, 150 insertions(+), 118 deletions(-)

diff --git a/bsps/arm/stm32h7/start/bspstarthooks.c 
b/bsps/arm/stm32h7/start/bspstarthooks.c
index 565bd6876a..41c510aa4c 100644
--- a/bsps/arm/stm32h7/start/bspstarthooks.c
+++ b/bsps/arm/stm32h7/start/bspstarthooks.c
@@ -35,6 +35,52 @@
 
 #include 
 
+const ARMV7M_MPU_Region_Config
+  stm32h7_start_config_mpu_region [] = {
+{
+  .begin = stm32h7_memory_sram_axi_begin,
+  .end = stm32h7_memory_sram_axi_end,
+  .flags = ARMV7M_MPU_RASR_XN
+| ARMV7M_MPU_RASR_AP(0x3)
+| ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
+| ARMV7M_MPU_RASR_ENABLE,
+}, {
+  .begin = stm32h7_memory_sdram_1_begin,
+  .end = stm32h7_memory_sdram_1_end,
+  .flags = ARMV7M_MPU_RASR_XN
+| ARMV7M_MPU_RASR_AP(0x3)
+| ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
+| ARMV7M_MPU_RASR_ENABLE,
+}, {
+  .begin = bsp_section_start_begin,
+  .end = bsp_section_text_end,
+  .flags = ARMV7M_MPU_RASR_AP(0x5)
+| ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
+| ARMV7M_MPU_RASR_ENABLE,
+}, {
+  .begin = bsp_section_rodata_begin,
+  .end = bsp_section_rodata_end,
+  .flags = ARMV7M_MPU_RASR_XN
+| ARMV7M_MPU_RASR_AP(0x5)
+| ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
+| ARMV7M_MPU_RASR_ENABLE,
+}, {
+  .begin = bsp_section_nocache_begin,
+  .end = bsp_section_nocachenoload_end,
+  .flags = ARMV7M_MPU_RASR_XN
+| ARMV7M_MPU_RASR_AP(0x3)
+| ARMV7M_MPU_RASR_TEX(0x2)
+| ARMV7M_MPU_RASR_ENABLE,
+}, {
+  .begin = stm32h7_memory_null_begin,
+  .end = stm32h7_memory_null_end,
+  .flags = ARMV7M_MPU_RASR_XN | ARMV7M_MPU_RASR_ENABLE,
+}
+  };
+
+const size_t stm32h7_start_config_mpu_region_count =
+  RTEMS_ARRAY_SIZE(stm32h7_start_config_mpu_region);
+
 void HAL_MspInit(void)
 {
   __HAL_RCC_SYSCFG_CLK_ENABLE();
@@ -83,123 +129,6 @@ static void init_peripheral_clocks(void)
   }
 }
 
-static uint32_t get_region_size(uintptr_t size)
-{
-  if ((size & (size - 1)) == 0) {
-return ARMV7M_MPU_RASR_SIZE(30 - __builtin_clz(size));
-  } else {
-return ARMV7M_MPU_RASR_SIZE(31 - __builtin_clz(size));
-  }
-}
-
-static void set_region(
-  volatile ARMV7M_MPU *mpu,
-  uint32_t region,
-  uint32_t rasr,
-  const void *begin,
-  const void *end
-)
-{
-  uintptr_t size;
-  uint32_t rbar;
-
-  RTEMS_OBFUSCATE_VARIABLE(begin);
-  RTEMS_OBFUSCATE_VARIABLE(end);
-  size = (uintptr_t) end - (uintptr_t) begin;
-
-  if ( size > 0 ) {
-rbar = (uintptr_t) begin | region | ARMV7M_MPU_RBAR_VALID;
-rasr |= get_region_size(size);
-  } else {
-rbar = region;
-rasr = 0;
-  }
-
-  mpu->rbar = rbar;
-  mpu->rasr = rasr;
-}
-
-static void init_mpu(void)
-{
-  volatile ARMV7M_MPU *mpu;
-  volatile ARMV7M_SCB *scb;
-  uint32_t region_count;
-  uint32_t region;
-
-  mpu = _ARMV7M_MPU;
-  scb = _ARMV7M_SCB;
-
-  region_count = ARMV7M_MPU_TYPE_DREGION_GET(mpu->type);
-
-  for (region = 0; region < region_count; ++region) {
-mpu->rbar = ARMV7M_MPU_RBAR_VALID | region;
-mpu->rasr = 0;
-  }
-
-  set_region(
-mpu,
-0,
-ARMV7M_MPU_RASR_XN
-  | ARMV7M_MPU_RASR_AP(0x3)
-  | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
-  | ARMV7M_MPU_RASR_ENABLE,
-stm32h7_memory_sram_axi_begin,
-stm32h7_memory_sram_axi_end
-  );
-  set_region(
-mpu,
-1,
-ARMV7M_MPU_RASR_XN
-  | ARMV7M_MPU_RASR_AP(0x3)
-  | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
-  | ARMV7M_MPU_RASR_ENABLE,
-stm32h7_memory_sdram_1_begin,
-stm32h7_memory_sdram_1_end
-  );
-  set_region(
-mpu,
-2,
-ARMV7M_MPU_RASR_AP(0x5)
-  | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
-  | ARMV7M_MPU_RASR_ENABLE,
-bsp_section_start_begin,
-bsp_section_text_end
-  );
-  set_region(
-mpu,
-3,
-ARMV7M_MPU_RASR_XN
-  | ARMV7M_MPU_RASR_AP(0x5)
-  | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
-  | ARMV7M_MPU_RASR_ENABLE,
-bsp_section_rodata_begin,
-bsp_section_rodata_end
-  );
-  set_region(
-mpu,
-4,
-ARMV7M_MPU_RASR_XN
-  | ARMV7M_MPU_RASR_AP(0x3)
-  | ARMV7M_MPU_RASR_TEX(0x2)
-  | ARMV7M_MPU_RASR_ENABLE,
-bsp_section_nocache_begin,
-bsp_section_nocachenoload_end
-  );
-  set_region(
-mpu,
-region - 1,
-ARMV7M_MPU_RASR_XN | ARMV7M_MPU_RASR_ENABLE,
-stm32h7_memory_null_begin,
-stm32h7_memory_null_end
-  );
-
-  mpu->ctrl = ARMV7M_MPU_CTRL_ENABLE | ARMV7M_MPU_CTRL_PRIVDEFENA;
-  scb->shcsr |= ARMV7M_SCB_SHCS

[PATCH rtems v2 1/7] bsps/imx: Move imx_iomux to arm/shared

2020-11-18 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imx/headers.am   |  2 -
 bsps/arm/imx/include/bsp.h|  2 -
 bsps/arm/imx/spi/imx-ecspi.c  |  1 +
 bsps/arm/shared/headers.am|  6 +++
 .../include/arm/freescale/imx/imx_iomuxreg.h  |  0
 .../include/arm/freescale/imx/imx_iomuxvar.h  |  0
 bsps/arm/shared/include/bsp/imx-iomux.h   | 49 +++
 .../{imx/start => shared/pins}/imx_iomux.c|  0
 c/src/lib/libbsp/arm/imx/Makefile.am  |  2 +-
 spec/build/bsps/arm/imx/bspimx.yml| 10 ++--
 10 files changed, 63 insertions(+), 9 deletions(-)
 create mode 100644 bsps/arm/shared/headers.am
 rename bsps/arm/{imx => shared}/include/arm/freescale/imx/imx_iomuxreg.h (100%)
 rename bsps/arm/{imx => shared}/include/arm/freescale/imx/imx_iomuxvar.h (100%)
 create mode 100644 bsps/arm/shared/include/bsp/imx-iomux.h
 rename bsps/arm/{imx/start => shared/pins}/imx_iomux.c (100%)

diff --git a/bsps/arm/imx/headers.am b/bsps/arm/imx/headers.am
index 9863f34300..e7a2418dea 100644
--- a/bsps/arm/imx/headers.am
+++ b/bsps/arm/imx/headers.am
@@ -11,8 +11,6 @@ include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_ecspireg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_gpcreg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_i2creg.h
-include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_iomuxreg.h
-include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_iomuxvar.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_srcreg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_uartreg.h
 include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/imx/include/arm/freescale/imx/imx_wdogreg.h
diff --git a/bsps/arm/imx/include/bsp.h b/bsps/arm/imx/include/bsp.h
index 99b7a0d1d7..8b95a79535 100644
--- a/bsps/arm/imx/include/bsp.h
+++ b/bsps/arm/imx/include/bsp.h
@@ -59,8 +59,6 @@ extern uintptr_t imx_gic_dist_base;
 
 void *imx_get_reg_of_node(const void *fdt, int node);
 
-int imx_iomux_configure_pins(const void *fdt, uint32_t phandle);
-
 rtems_vector_number imx_get_irq_of_node(
   const void *fdt,
   int node,
diff --git a/bsps/arm/imx/spi/imx-ecspi.c b/bsps/arm/imx/spi/imx-ecspi.c
index 26ba812f62..1ffc4d9798 100644
--- a/bsps/arm/imx/spi/imx-ecspi.c
+++ b/bsps/arm/imx/spi/imx-ecspi.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/bsps/arm/shared/headers.am b/bsps/arm/shared/headers.am
new file mode 100644
index 00..4fd7238f81
--- /dev/null
+++ b/bsps/arm/shared/headers.am
@@ -0,0 +1,6 @@
+## This file was generated by "./boostrap -H".
+
+include_arm_freescale_imxdir = $(includedir)/arm/freescale/imx
+include_arm_freescale_imx_HEADERS =
+include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
+include_arm_freescale_imx_HEADERS += 
../../../../../../bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
diff --git a/bsps/arm/imx/include/arm/freescale/imx/imx_iomuxreg.h 
b/bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
similarity index 100%
rename from bsps/arm/imx/include/arm/freescale/imx/imx_iomuxreg.h
rename to bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
diff --git a/bsps/arm/imx/include/arm/freescale/imx/imx_iomuxvar.h 
b/bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
similarity index 100%
rename from bsps/arm/imx/include/arm/freescale/imx/imx_iomuxvar.h
rename to bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
diff --git a/bsps/arm/shared/include/bsp/imx-iomux.h 
b/bsps/arm/shared/include/bsp/imx-iomux.h
new file mode 100644
index 00..60421807c0
--- /dev/null
+++ b/bsps/arm/shared/include/bsp/imx-iomux.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSBSPsARM
+ *
+ * @brief Functions for imx iomux.
+ */
+
+/*
+ * Copyright (C) 2020 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 IMP

[PATCH rtems v2 0/7] Add imxrt BSP

2020-11-18 Thread Christian Mauderer
Hello,

this is a second verson for the imxrt BSP. If no one objects, it will be
the last for this patch set.

I don't re-send the documentation and libbsd parts. For libbsd it will
be the same and for documentation it will be the one with changes like
discussed.

The BSD-3-clause license and console commands are now on the list for
review in separate mails.

The import patch is still the same. It will most likely hit the size
limit for the mailing list again.

Changes in this patch set:

- I replaced the transient event with a semaphore in the SPI driver.
- The MPU initialization is reworked. Now a user could adapt it by
  overwriting the variables in his application.
- I fixed a bug that I introduced in imx.

Best regards

Christian


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


[PATCH rtems v2 5/7] bsp/imxrt: Fix warnings for imported files

2020-11-18 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imxrt/include/fsl_common.h   | 295 ++
 bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h |   2 +
 .../imxrt/nxp/boards/evkbimxrt1050/pin_mux.c  |   4 +
 .../nxp/devices/MIMXRT1052/drivers/fsl_dcp.c  |   4 +
 .../devices/MIMXRT1052/drivers/fsl_spdif.c|   2 +
 5 files changed, 307 insertions(+)

diff --git a/bsps/arm/imxrt/include/fsl_common.h 
b/bsps/arm/imxrt/include/fsl_common.h
index 358f973b9e..76f943ebba 100644
--- a/bsps/arm/imxrt/include/fsl_common.h
+++ b/bsps/arm/imxrt/include/fsl_common.h
@@ -663,6 +663,301 @@ void DefaultISR(void);
 */
 void SDK_DelayAtLeastUs(uint32_t delay_us, uint32_t coreClock_Hz);
 
+#ifdef __rtems__
+/* Prototypes for IRQHandlers */
+void FLEXIO_CommonIRQHandler(void);
+void FLEXIO_DriverIRQHandler(void);
+void FLEXIO0_DriverIRQHandler(void);
+void FLEXIO1_DriverIRQHandler(void);
+void UART2_FLEXIO_DriverIRQHandler(void);
+void FLEXIO2_DriverIRQHandler(void);
+void FLEXIO3_DriverIRQHandler(void);
+void CAN0_DriverIRQHandler(void);
+void CAN1_DriverIRQHandler(void);
+void CAN2_DriverIRQHandler(void);
+void CAN3_DriverIRQHandler(void);
+void CAN4_DriverIRQHandler(void);
+void DMA_FLEXCAN0_INT_DriverIRQHandler(void);
+void DMA_FLEXCAN1_INT_DriverIRQHandler(void);
+void DMA_FLEXCAN2_INT_DriverIRQHandler(void);
+void ADMA_FLEXCAN0_INT_DriverIRQHandler(void);
+void ADMA_FLEXCAN1_INT_DriverIRQHandler(void);
+void ADMA_FLEXCAN2_INT_DriverIRQHandler(void);
+void USDHC0_DriverIRQHandler(void);
+void USDHC1_DriverIRQHandler(void);
+void USDHC2_DriverIRQHandler(void);
+void LPUART0_LPUART1_RX_DriverIRQHandler(void);
+void LPUART0_LPUART1_TX_DriverIRQHandler(void);
+void LPUART0_LPUART1_DriverIRQHandler(void);
+void LPUART0_TX_DriverIRQHandler(void);
+void LPUART0_RX_DriverIRQHandler(void);
+void LPUART0_DriverIRQHandler(void);
+void LPUART1_TX_DriverIRQHandler(void);
+void LPUART1_RX_DriverIRQHandler(void);
+void LPUART1_DriverIRQHandler(void);
+void LPUART2_TX_DriverIRQHandler(void);
+void LPUART2_RX_DriverIRQHandler(void);
+void LPUART2_DriverIRQHandler(void);
+void LPUART3_TX_DriverIRQHandler(void);
+void LPUART3_RX_DriverIRQHandler(void);
+void LPUART3_DriverIRQHandler(void);
+void LPUART4_TX_DriverIRQHandler(void);
+void LPUART4_RX_DriverIRQHandler(void);
+void LPUART4_DriverIRQHandler(void);
+void LPUART5_TX_DriverIRQHandler(void);
+void LPUART5_RX_DriverIRQHandler(void);
+void LPUART5_DriverIRQHandler(void);
+void LPUART6_TX_DriverIRQHandler(void);
+void LPUART6_RX_DriverIRQHandler(void);
+void LPUART6_DriverIRQHandler(void);
+void LPUART7_TX_DriverIRQHandler(void);
+void LPUART7_RX_DriverIRQHandler(void);
+void LPUART7_DriverIRQHandler(void);
+void LPUART8_TX_DriverIRQHandler(void);
+void LPUART8_RX_DriverIRQHandler(void);
+void LPUART8_DriverIRQHandler(void);
+void M4_0_LPUART_DriverIRQHandler(void);
+void M4_1_LPUART_DriverIRQHandler(void);
+void M4_LPUART_DriverIRQHandler(void);
+void DMA_UART0_INT_DriverIRQHandler(void);
+void DMA_UART1_INT_DriverIRQHandler(void);
+void DMA_UART2_INT_DriverIRQHandler(void);
+void DMA_UART3_INT_DriverIRQHandler(void);
+void DMA_UART4_INT_DriverIRQHandler(void);
+void ADMA_UART0_INT_DriverIRQHandler(void);
+void ADMA_UART1_INT_DriverIRQHandler(void);
+void ADMA_UART2_INT_DriverIRQHandler(void);
+void ADMA_UART3_INT_DriverIRQHandler(void);
+void DMA0_04_DriverIRQHandler(void);
+void DMA0_15_DriverIRQHandler(void);
+void DMA0_26_DriverIRQHandler(void);
+void DMA0_37_DriverIRQHandler(void);
+void DMA1_04_DriverIRQHandler(void);
+void DMA1_15_DriverIRQHandler(void);
+void DMA1_26_DriverIRQHandler(void);
+void DMA1_37_DriverIRQHandler(void);
+void DMA1_04_DriverIRQHandler(void);
+void DMA1_15_DriverIRQHandler(void);
+void DMA1_26_DriverIRQHandler(void);
+void DMA1_37_DriverIRQHandler(void);
+void DMA0_08_DriverIRQHandler(void);
+void DMA0_19_DriverIRQHandler(void);
+void DMA0_210_DriverIRQHandler(void);
+void DMA0_311_DriverIRQHandler(void);
+void DMA0_412_DriverIRQHandler(void);
+void DMA0_513_DriverIRQHandler(void);
+void DMA0_614_DriverIRQHandler(void);
+void DMA0_715_DriverIRQHandler(void);
+void DMA1_08_DriverIRQHandler(void);
+void DMA1_19_DriverIRQHandler(void);
+void DMA1_210_DriverIRQHandler(void);
+void DMA1_311_DriverIRQHandler(void);
+void DMA1_412_DriverIRQHandler(void);
+void DMA1_513_DriverIRQHandler(void);
+void DMA1_614_DriverIRQHandler(void);
+void DMA1_715_DriverIRQHandler(void);
+void DMA0_DMA16_DriverIRQHandler(void);
+void DMA1_DMA17_DriverIRQHandler(void);
+void DMA2_DMA18_DriverIRQHandler(void);
+void DMA3_DMA19_DriverIRQHandler(void);
+void DMA4_DMA20_DriverIRQHandler(void);
+void DMA5_DMA21_DriverIRQHandler(void);
+void DMA6_DMA22_DriverIRQHandler(void);
+void DMA7_DMA23_DriverIRQHandler(void);
+void DMA8_DMA24_DriverIRQHandler(void);
+void DMA9_DMA25_DriverIRQHandler(void);
+void DMA10_DMA26_DriverIRQHandler(void);
+void DMA11_DMA27_DriverIRQHandler(void);
+void DMA12_DMA28_DriverIRQHandler(void);
+void DMA13_DMA29_DriverIRQHandler(void);
+void DMA14_DMA30_Driver

[PATCH rtems v2 6/7] bsp/imxrt: Adapt imported files

2020-11-18 Thread Christian Mauderer
Update #4180
---
 bsps/arm/imxrt/include/fsl_device_registers.h | 57 ++-
 bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h |  6 ++
 ..._nor_config.h => fsl_flexspi_nor_config.h} |  0
 bsps/arm/imxrt/include/fsl_lpuart.h   |  4 ++
 bsps/arm/imxrt/include/fsl_pin_mux.h  |  4 ++
 .../nxp/boards/evkbimxrt1050/clock_config.c   | 12 
 .../imxrt/nxp/boards/evkbimxrt1050/pin_mux.c  |  6 ++
 .../devices/MIMXRT1052/drivers/fsl_lpuart.c   | 17 ++
 8 files changed, 80 insertions(+), 26 deletions(-)
 rename bsps/arm/imxrt/include/{evkbimxrt1050_flexspi_nor_config.h => 
fsl_flexspi_nor_config.h} (100%)

diff --git a/bsps/arm/imxrt/include/fsl_device_registers.h 
b/bsps/arm/imxrt/include/fsl_device_registers.h
index 54caf43ca6..00c3fc7036 100644
--- a/bsps/arm/imxrt/include/fsl_device_registers.h
+++ b/bsps/arm/imxrt/include/fsl_device_registers.h
@@ -1,36 +1,41 @@
-/*
- * Copyright 2014-2016 Freescale Semiconductor, Inc.
- * Copyright 2016-2018 NXP
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
  *
- * SPDX-License-Identifier: BSD-3-Clause
+ * @ingroup RTEMSBSPsARMimxrt
  *
+ * @brief Helper file for including registers for SDK drivers.
  */
 
-#ifndef __FSL_DEVICE_REGISTERS_H__
-#define __FSL_DEVICE_REGISTERS_H__
-
 /*
- * Include the cpu specific register header files.
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
  *
- * The CPU macro should be declared in the project or makefile.
+ * 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.
  */
-#if (defined(CPU_MIMXRT1052CVJ5B) || defined(CPU_MIMXRT1052CVL5B) || 
defined(CPU_MIMXRT1052DVJ6B) || \
-defined(CPU_MIMXRT1052DVL6B))
-
-#define MIMXRT1052_SERIES
-
-/* CMSIS-style register definitions */
-#include "MIMXRT1052.h"
-/* CPU specific feature definitions */
-#include "MIMXRT1052_features.h"
 
-#else
-#error "No valid CPU defined!"
-#endif
+#ifndef FSL_DEVICE_REGISTERS_H
+#define FSL_DEVICE_REGISTERS_H
 
-#endif /* __FSL_DEVICE_REGISTERS_H__ */
+#include 
 
-/***
- * EOF
- 
**/
+#endif /* FSL_DEVICE_REGISTERS_H */
diff --git a/bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h 
b/bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h
index 7b256f6670..56995eca55 100644
--- a/bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h
+++ b/bsps/arm/imxrt/include/fsl_flexspi_nor_boot.h
@@ -9,7 +9,9 @@
 #define __FLEXSPI_NOR_BOOT_H__
 
 #include 
+#ifndef __rtems__
 #include "board.h"
+#endif /* __rtems__ */
 
 /*! @name Driver version */
 /*@{*/
@@ -85,6 +87,7 @@ typedef struct _ivt_ {
 #define FLASH_BASE ((uint32_t)__FLASH_BASE)   
 #endif
 
+#ifndef __rtems__
 #if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE)
 #define DCD_ADDRESS dcd_data
 #else
@@ -94,6 +97,7 @@ typedef struct _ivt_ {
 #define BOOT_DATA_ADDRESS &boot_data
 #define CSF_ADDRESS   0
 #define IVT_RSVD (uint32_t)(0x)
+#endif /* __rtems__ */
 
 /* 
  *  Boot Data 
@@ -114,11 +118,13 @@ typedef struct _boot_data_ {
 #endif /* __rtems__ */
 #define PLUGIN_FLAG   (uint32_t)0
 
+#ifndef __rtems__
 /* External Variables */
 const BOOT_DATA_T boot_data;
 #if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (1 == XIP_BOOT_HEADER_DCD_ENABLE)
 extern const uint8_t dcd_data[];
 #endif
+#endif /* __rtems__ */
 
 #endif /* __FLEXSPI_NOR_BOOT_H__ */
 
diff --git a/bsps/arm/imxrt/include/evkbimxrt1050_flexspi_nor_config.h 
b/bsps/arm/imxrt/include/fsl_flexspi_nor_config.h
similarity index 100%
rename from bsps/arm/imxrt/include/evkbimxrt1050_flexspi_nor

Re: [PATCH] Add License file for BSD-3-Clause

2020-11-18 Thread Christian Mauderer

Thanks. I pushed it.

Am 18.11.20 um 17:17 schrieb Gedare Bloom:

Looks good, push it

On Wed, Nov 18, 2020 at 12:37 AM Christian Mauderer
 wrote:


We have some files with a SPDX identifier for this license. Therefore
the license should be here too.
---

Note: This is a resubmission of the patch. Previously I submitted it together
with the patches that add a new imxrt BSP:

https://lists.rtems.org/pipermail/devel/2020-November/063273.html

I only noted that it would have been better separate after Gedare said it.

  LICENSE.BSD-3-Clause | 27 +++
  1 file changed, 27 insertions(+)
  create mode 100644 LICENSE.BSD-3-Clause

diff --git a/LICENSE.BSD-3-Clause b/LICENSE.BSD-3-Clause
new file mode 100644
index 00..09d01c1ff5
--- /dev/null
+++ b/LICENSE.BSD-3-Clause
@@ -0,0 +1,27 @@
+https://spdx.org/licenses/BSD-3-Clause
+
+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.
+3. Neither the name of the copyright holder nor the names of its
+   contributors may be used to endorse or promote products derived
+   from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
2.26.2

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


--

embedded brains GmbH
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
PGP: Public key available on request.

embedded brains GmbH
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 v2 3/7] cpu/armv7m: Add table based init for ARMV7M_MPU

2020-11-18 Thread Christian Mauderer

Am 19.11.20 um 08:19 schrieb Sebastian Huber:

On 18/11/2020 15:45, Christian Mauderer wrote:


+/**
+ * Higher level region configuration.
+ *
+ * Allows to configure with begin and end which is more convenient for
+ * calculating the sizes from linker command file. Note that you 
still have to

+ * follow the following rules:
+ *
+ * - Begin address has to be aligned to 0x20 (lower 5 bits set to 0)
+ * - Sizes can only be a value of 2^x with a minimum of 32 Byte. If 
you have an

+ *   end address that is not aligned, the region will get bigger.
+ * - Later regions have higher priority.
+ */
+typedef struct {
+  const void *begin;
+  const void *end;
+  uint32_t flags;


uint32_t rasr;

I guess the flags are actually a value stored directly to the RASR?


+} ARMV7M_MPU_Region_Config;


ARMV7M_MPU_Region_config


+
  typedef struct {
    uint32_t dhcsr;
    uint32_t dcrsr;
@@ -611,6 +632,85 @@ void _ARMV7M_Supervisor_call( void );
  void _ARMV7M_Clock_handler( void );
+static inline uint32_t _ARMV7M_MPU_get_region_size(uintptr_t size)


_ARMV7M_MPU_Get_region_size


+{
+  if ((size & (size - 1)) == 0) {
+    return ARMV7M_MPU_RASR_SIZE(30 - __builtin_clz(size));
+  } else {
+    return ARMV7M_MPU_RASR_SIZE(31 - __builtin_clz(size));
+  }
+}
+
+static inline void _ARMV7M_MPU_set_region(


_ARMV7M_MPU_Set_region


+  volatile ARMV7M_MPU *mpu,
+  uint32_t region,
+  uint32_t rasr,
+  const void *begin,
+  const void *end
+)
+{
+  uintptr_t size;
+  uint32_t rbar;
+
+  RTEMS_OBFUSCATE_VARIABLE(begin);
+  RTEMS_OBFUSCATE_VARIABLE(end);
+  size = (uintptr_t) end - (uintptr_t) begin;
+
+  if ( size > 0 ) {
+    rbar = (uintptr_t) begin | region | ARMV7M_MPU_RBAR_VALID;
+    rasr |= _ARMV7M_MPU_get_region_size(size);
+  } else {
+    rbar = region;
+    rasr = 0;
+  }
+
+  mpu->rbar = rbar;
+  mpu->rasr = rasr;
+}
+
+static inline void _ARMV7M_MPU_disable_region(


_ARMV7M_MPU_Disable_region


+  volatile ARMV7M_MPU *mpu,
+  uint32_t region
+)
+{
+  mpu->rbar = ARMV7M_MPU_RBAR_VALID | region;
+  mpu->rasr = 0;
+}
+
+static inline void _ARMV7M_MPU_setup_from_config_and_enable(
+  const ARMV7M_MPU_Region_Config *cfg,
+  size_t cfg_count
+)


_ARMV7M_MPU_Setup

The config is implicit in the parameter. You don't necessarily enable a 
configured region. It depends on the user provided RASR value.



+{
+  volatile ARMV7M_MPU *mpu;
+  volatile ARMV7M_SCB *scb;
+  uint32_t region_count;
+  uint32_t region;
+
+  mpu = _ARMV7M_MPU;
+  scb = _ARMV7M_SCB;
+
+  region_count = ARMV7M_MPU_TYPE_DREGION_GET(mpu->type);
+
+  if (cfg_count > region_count) {
+    rtems_panic("invalid MPU config");
+  }


I think rtems_panic() is too heavy weight at this point. It uses 
printk(). Maybe just use _Assert(). I think we need some light weight 
general purpose fatal error which could just use the return address to 
identify the error location.



+
+  for (region = 0; region < region_count; ++region) {


for (region = cfg_count; region < region_count; ++region)

Only disable not configured regions?


I think I maybe have to disable the MPU first if I do that. Otherwise it 
is possible that there is (for example) a region 0 that prevents access 
to all memory and a high region (lets say 5) that allows access to 
program memory. As soon as I clear the high one but not the low one, the 
system will crash because it can't access the memory any more.


But most likely a similar situation can be constructed with cleaning all 
regions. I'll take a look at disabling MPU before setting it up.





+    _ARMV7M_MPU_disable_region(mpu, region);
+  }
+
+  for (region = 0; region < cfg_count; ++region) {
+    _ARMV7M_MPU_set_region(mpu, region, cfg->flags, cfg->begin, 
cfg->end);

+  }
+
+  mpu->ctrl = ARMV7M_MPU_CTRL_ENABLE | ARMV7M_MPU_CTRL_PRIVDEFENA;
+  scb->shcsr |= ARMV7M_SCB_SHCSR_MEMFAULTENA;
+
+  _ARM_Data_synchronization_barrier();
+  _ARM_Instruction_synchronization_barrier();
+}




--
----
embedded brains GmbH
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
PGP: Public key available on request.

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

[PATCH rtems v3 0/7] Add imxrt BSP

2020-11-19 Thread Christian Mauderer
Hello,

again an updated version. There haven't been relevant changes beneath
patch 3 (some follow up ones in 7) so I'm only sending patch 3.

Changes:

- renames like suggested by Sebastian
- the MPU is now disabled, set up and re-enabled
- every MPU region is only set up once due to that
- I moved the constants for STM32H7 into a separate file to enable the
  main advantage of that initialization: Allowing the user to provide
  a different configuration in his application.

Best regards

Christian


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


[PATCH rtems v3 3/7] cpu/armv7m: Add table based init for ARMV7M_MPU

2020-11-19 Thread Christian Mauderer
Modify the MPU functions of the stm32h7 BSP to be table based and
available for all ARMV7M BSPs.

Update #4180
---
 bsps/arm/stm32h7/include/stm32h7/mpu-config.h |  44 +++
 bsps/arm/stm32h7/start/bspstarthooks.c| 120 +-
 bsps/arm/stm32h7/start/mpu-config.c   |  75 +++
 .../cpu/arm/include/rtems/score/armv7m.h  | 102 +++
 spec/build/bsps/arm/stm32h7/bspstm32h7.yml|   2 +
 5 files changed, 225 insertions(+), 118 deletions(-)
 create mode 100644 bsps/arm/stm32h7/include/stm32h7/mpu-config.h
 create mode 100644 bsps/arm/stm32h7/start/mpu-config.c

diff --git a/bsps/arm/stm32h7/include/stm32h7/mpu-config.h 
b/bsps/arm/stm32h7/include/stm32h7/mpu-config.h
new file mode 100644
index 00..274532
--- /dev/null
+++ b/bsps/arm/stm32h7/include/stm32h7/mpu-config.h
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#ifndef LIBBSP_ARM_STM32H7_STM32H7_MPU_CONFIG_H
+#define LIBBSP_ARM_STM32H7_STM32H7_MPU_CONFIG_H
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+extern const ARMV7M_MPU_Region_config stm32h7_config_mpu_region[];
+extern const size_t stm32h7_config_mpu_region_count;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_ARM_STM32H7_STM32H7_MPU_CONFIG_H */
diff --git a/bsps/arm/stm32h7/start/bspstarthooks.c 
b/bsps/arm/stm32h7/start/bspstarthooks.c
index 565bd6876a..dcd4b0bef2 100644
--- a/bsps/arm/stm32h7/start/bspstarthooks.c
+++ b/bsps/arm/stm32h7/start/bspstarthooks.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -83,123 +84,6 @@ static void init_peripheral_clocks(void)
   }
 }
 
-static uint32_t get_region_size(uintptr_t size)
-{
-  if ((size & (size - 1)) == 0) {
-return ARMV7M_MPU_RASR_SIZE(30 - __builtin_clz(size));
-  } else {
-return ARMV7M_MPU_RASR_SIZE(31 - __builtin_clz(size));
-  }
-}
-
-static void set_region(
-  volatile ARMV7M_MPU *mpu,
-  uint32_t region,
-  uint32_t rasr,
-  const void *begin,
-  const void *end
-)
-{
-  uintptr_t size;
-  uint32_t rbar;
-
-  RTEMS_OBFUSCATE_VARIABLE(begin);
-  RTEMS_OBFUSCATE_VARIABLE(end);
-  size = (uintptr_t) end - (uintptr_t) begin;
-
-  if ( size > 0 ) {
-rbar = (uintptr_t) begin | region | ARMV7M_MPU_RBAR_VALID;
-rasr |= get_region_size(size);
-  } else {
-rbar = region;
-rasr = 0;
-  }
-
-  mpu->rbar = rbar;
-  mpu->rasr = rasr;
-}
-
-static void init_mpu(void)
-{
-  volatile ARMV7M_MPU *mpu;
-  volatile ARMV7M_SCB *scb;
-  uint32_t region_count;
-  uint32_t region;
-
-  mpu = _ARMV7M_MPU;
-  scb = _ARMV7M_SCB;
-
-  region_count = ARMV7M_MPU_TYPE_DREGION_GET(mpu->type);
-
-  for (region = 0; region < region_count; ++region) {
-mpu->rbar = ARMV7M_MPU_RBAR_VALID | region;
-mpu->rasr = 0;
-  }
-
-  set_region(
-mpu,
-0,
-ARMV7M_MPU_RASR_XN
-  | ARMV7M_MPU_RASR_AP(0x3)
-  | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
-  | ARMV7M_MPU_RASR_ENABLE,
-stm32h7_memory_sram_axi_begin,
-stm32h7_memory_sram_axi_end
-  );
-  set_region(
-mpu,
-1,
-ARMV7M_MPU_RASR_XN
-  | ARMV7M_MPU_RASR_AP(0x3)
-  | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
-  | ARMV7M_MPU_RASR_ENABLE,
-stm32h7_memory_sdram_1_begin,
-stm32h7_memory_sdram_1_end
-  );
-  set_region(
-mpu,
-2,
-ARMV7M_MPU_RASR_AP(0x5)
-  | ARMV7M_MPU_RASR_TEX(0x1) | ARMV7M_MPU_RASR_C | ARMV7M_MPU_RASR_B
-  | ARMV7M_MPU_RASR_ENABLE,
-bsp_section_start_begin,
-bsp_section_text_end
-  );
-  set_re

Re: [PATCH rtems v3 3/7] cpu/armv7m: Add table based init for ARMV7M_MPU

2020-11-19 Thread Christian Mauderer

Am 19.11.20 um 10:14 schrieb Sebastian Huber:

On 19/11/2020 09:51, Christian Mauderer wrote:


+  _Assert(cfg_count > region_count);


  _Assert(cfg_count <= region_count)

With this change it is fine to check in.



Stupid mistake. Sorry. I'll fix it before check in.

I'll give the other patches one more day for review.

Best regards

Christian
--

embedded brains GmbH
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
PGP: Public key available on request.

embedded brains GmbH
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 v3 3/7] cpu/armv7m: Add table based init for ARMV7M_MPU

2020-11-19 Thread Christian Mauderer

Am 19.11.20 um 10:15 schrieb Sebastian Huber:


On 19/11/2020 09:51, Christian Mauderer wrote:

+  mpu = _ARMV7M_MPU;
+  scb = _ARMV7M_SCB;
+
+  scb->shcsr &= ~ARMV7M_SCB_SHCSR_MEMFAULTENA;
I think it is not necessary to touch the shcsr. Disabling the MPU should 
be enough.


OK. I'll try it on the imxrt.


+  mpu->ctrl = 0;
+
+  _ARM_Data_synchronization_barrier();
+  _ARM_Instruction_synchronization_barrier();




--

embedded brains GmbH
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
PGP: Public key available on request.

embedded brains GmbH
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 v3 3/7] cpu/armv7m: Add table based init for ARMV7M_MPU

2020-11-19 Thread Christian Mauderer

Am 19.11.20 um 10:22 schrieb Christian Mauderer:

Am 19.11.20 um 10:15 schrieb Sebastian Huber:


On 19/11/2020 09:51, Christian Mauderer wrote:

+  mpu = _ARMV7M_MPU;
+  scb = _ARMV7M_SCB;
+
+  scb->shcsr &= ~ARMV7M_SCB_SHCSR_MEMFAULTENA;
I think it is not necessary to touch the shcsr. Disabling the MPU 
should be enough.


OK. I'll try it on the imxrt.


Seems to be no problem to remove that line. I'll do that before pushing.




+  mpu->ctrl = 0;
+
+  _ARM_Data_synchronization_barrier();
+  _ARM_Instruction_synchronization_barrier();






--

embedded brains GmbH
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
PGP: Public key available on request.

embedded brains GmbH
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 v3 3/7] cpu/armv7m: Add table based init for ARMV7M_MPU

2020-11-19 Thread Christian Mauderer
On 19/11/2020 21:14, Gedare Bloom wrote:
> On Thu, Nov 19, 2020 at 1:13 PM Gedare Bloom  wrote:
>>
>> Hi Sebastian, Christian:
>>
>> I saw the req
> Oops, gmail shortcuts cut me off.
> 
> I saw the request to change the names, but I think the _ARMV7M_MPU_yyy
> is correct, because MPU is the capitalized first "word" of the
> subgroup there. It is consistent with the naming of other
> _ARMV7M_Xxx_yyy routines.

But there is for example

_ARMV7M_NVIC_Is_enabled
_ARMV7M_NVIC_Set_enable
_ARMV7M_DWT_Enable_CYCCNT
ARMV7M_MPU_Access_permissions

and some others in the same file. So I would lean towards what Sebastian
suggested. Otherwise the new functions wouldn't fit the scheme of the
existing ones.

> 
>>
>> On Thu, Nov 19, 2020 at 3:17 AM Christian Mauderer
>>  wrote:
>>>
>>> Am 19.11.20 um 10:22 schrieb Christian Mauderer:
>>>> Am 19.11.20 um 10:15 schrieb Sebastian Huber:
>>>>>
>>>>> On 19/11/2020 09:51, Christian Mauderer wrote:
>>>>>> +  mpu = _ARMV7M_MPU;
>>>>>> +  scb = _ARMV7M_SCB;
>>>>>> +
>>>>>> +  scb->shcsr &= ~ARMV7M_SCB_SHCSR_MEMFAULTENA;
>>>>> I think it is not necessary to touch the shcsr. Disabling the MPU
>>>>> should be enough.
>>>>
>>>> OK. I'll try it on the imxrt.
>>>
>>> Seems to be no problem to remove that line. I'll do that before pushing.
>>>
>>>>
>>>>>> +  mpu->ctrl = 0;
>>>>>> +
>>>>>> +  _ARM_Data_synchronization_barrier();
>>>>>> +  _ARM_Instruction_synchronization_barrier();
>>>>>
>>>>
>>>
>>> --
>>> 
>>> embedded brains GmbH
>>> 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
>>> PGP: Public key available on request.
>>>
>>> embedded brains GmbH
>>> Registergericht: Amtsgericht München
>>> Registernummer: HRB 157899
>>> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
>>> Unsere Datenschutzerklärung finden Sie hier:
>>> https://embedded-brains.de/datenschutzerklaerung/
>>> ___
>>> devel mailing list
>>> devel@rtems.org
>>> http://lists.rtems.org/mailman/listinfo/devel
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH rtems v3 0/7] Add imxrt BSP

2020-11-20 Thread Christian Mauderer

Thanks for the reviews. I pushed the patches with changes like discussed.

Best regards

Christian

Am 19.11.20 um 09:51 schrieb Christian Mauderer:

Hello,

again an updated version. There haven't been relevant changes beneath
patch 3 (some follow up ones in 7) so I'm only sending patch 3.

Changes:

- renames like suggested by Sebastian
- the MPU is now disabled, set up and re-enabled
- every MPU region is only set up once due to that
- I moved the constants for STM32H7 into a separate file to enable the
   main advantage of that initialization: Allowing the user to provide
   a different configuration in his application.

Best regards

Christian




--

embedded brains GmbH
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
PGP: Public key available on request.

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

Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-20 Thread Christian Mauderer
x65, 0x72, 0x72, 0x75,
+  0x70, 0x74, 0x73, 0x00, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x00,
+};
+
+const size_t some_bin_size = sizeof(some_bin);
diff --git a/testsuites/libtests/ofw01/some.dts 
b/testsuites/libtests/ofw01/some.dts
new file mode 100644
index 00..6ed8aeb069
--- /dev/null
+++ b/testsuites/libtests/ofw01/some.dts
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2020 Niteesh G S .  All rights reserved.
+ * Copyright (c) 2015 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+/dts-v1/;
+
+/ {
+   compatible = "a,b";
+   #address-cells = <1>;
+   #size-cells = <2>;
+   model = "c";
+
+   d {
+   e = "f";
+   g;
+
+   h@0 {
+   };
+
+   h@1 {
+   w = <123>;
+   };
+   };
+
+   aliases {
+   k = "/m@1248";
+   };
+
+   l: m@1248 {
+   n = <0xdeadbeef 0x12345678>;
+
+   o {
+   p;
+   };
+
+   q {
+   r = "s";
+   };
+   };
+
+   t {
+   u = <&l>;
+   };
+
+   a {
+   compatible = "a";
+   reg = <0x1234 0x10>;
+   ranges = <0x1000 0x8000 0x400 0x2000 0xF000 0x1000>;
+   interrupts = <0x1>;
+
+   b {
+   reg = <0x1234 0x10 0x2468 0x10>;
+   };
+   };
+
+   c {
+   ranges;
+   interrupts = <0x1 0x2 0x3>;
+
+   q {
+   reg = <0x4800 0x200>;
+   status = "okay";
+   };
+   };
+};
diff --git a/testsuites/libtests/ofw01/some.h b/testsuites/libtests/ofw01/some.h
new file mode 100644
index 00..e2e0135e68
--- /dev/null
+++ b/testsuites/libtests/ofw01/some.h
@@ -0,0 +1,15 @@
+/*
+ *  Extern declarations for C structure representing binary file some.bin
+ *
+ *  WARNING: Automatically generated -- do not edit!
+ */
+
+#ifndef __some_h
+#define __some_h
+
+#include 
+
+extern const unsigned char some_bin[];
+extern const size_t some_bin_size;
+
+#endif



--

embedded brains GmbH
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
PGP: Public key available on request.

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

Re: [PATCH v2 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-11-22 Thread Christian Mauderer

Hello Niteesh,

Am 20.11.20 um 20:18 schrieb Niteesh G. S.:
On Fri, Nov 20, 2020 at 2:50 PM Christian Mauderer 
<mailto:christian.maude...@embedded-brains.de>> wrote:


On a last test before I wanted to push it, I found a problem
(sorry). On
BSPs that rely on a FDT the test doesn't work:

No problem :).

You wrap bsp_fdt_get and return another FDT. So as soon as one
driver of
the BSP needs the original FDT, that driver won't work any more.

I think I remember that problem from the Beagle too. Didn't you have a
version where you have enabled the wrapper later? If not: I added a
suggestion below.

Really sorry since it has been a couple of months now I don't exactly
remember what all I tried.


No problem. It's partial my fault that it needed that much time.




Am 03.11.20 um 19:18 schrieb G S Niteesh Babu:
 > Added a basic test for the implemented RTEMS OFW
 > API.
 > ---
 >   spec/build/testsuites/libtests/grp.yml   |   2 +
 >   spec/build/testsuites/libtests/ofw01.yml |  21 +++
 >   testsuites/libtests/ofw01/init.c         | 187
+++
 >   testsuites/libtests/ofw01/ofw01.doc      |  29 
 >   testsuites/libtests/ofw01/ofw01.scn      |   2 +
 >   testsuites/libtests/ofw01/some.c         |  72 +
 >   testsuites/libtests/ofw01/some.dts       |  76 +
 >   testsuites/libtests/ofw01/some.h         |  15 ++
 >   8 files changed, 404 insertions(+)
 >   create mode 100644 spec/build/testsuites/libtests/ofw01.yml
 >   create mode 100644 testsuites/libtests/ofw01/init.c
 >   create mode 100644 testsuites/libtests/ofw01/ofw01.doc
 >   create mode 100644 testsuites/libtests/ofw01/ofw01.scn
 >   create mode 100644 testsuites/libtests/ofw01/some.c
 >   create mode 100644 testsuites/libtests/ofw01/some.dts
 >   create mode 100644 testsuites/libtests/ofw01/some.h
 >
 > diff --git a/spec/build/testsuites/libtests/grp.yml
b/spec/build/testsuites/libtests/grp.yml
 > index b9ca014b0d..1aa136854a 100644
 > --- a/spec/build/testsuites/libtests/grp.yml
 > +++ b/spec/build/testsuites/libtests/grp.yml
 > @@ -316,6 +316,8 @@ links:
 >     uid: write
 >   - role: build-dependency
 >     uid: writev
 > +- role: build-dependency
 > +  uid: ofw01
 >   type: build
 >   use-after:
 >   - rtemstest
 > diff --git a/spec/build/testsuites/libtests/ofw01.yml
b/spec/build/testsuites/libtests/ofw01.yml
 > new file mode 100644
 > index 00..8517c58bad
 > --- /dev/null
 > +++ b/spec/build/testsuites/libtests/ofw01.yml
 > @@ -0,0 +1,21 @@
 > +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 > +build-type: test-program
 > +cflags: []
 > +copyrights:
 > +- Copyright (C) 2020 Niteesh G S
 > +cppflags: []
 > +cxxflags: []
 > +enabled-by: true
 > +features: c cprogram
 > +includes: []
 > +ldflags:
 > +- -Wl,--wrap=bsp_fdt_get
 > +links: []
 > +source:
 > +- testsuites/libtests/ofw01/init.c
 > +- testsuites/libtests/ofw01/some.c
 > +stlib: []
 > +target: testsuites/libtests/ofw01.exe
 > +type: build
 > +use-after: []
 > +use-before: []
 > diff --git a/testsuites/libtests/ofw01/init.c
b/testsuites/libtests/ofw01/init.c
 > new file mode 100644
 > index 00..82ee5eb11f
 > --- /dev/null
 > +++ b/testsuites/libtests/ofw01/init.c
 > @@ -0,0 +1,187 @@
 > +/* SPDX-License-Identifier: BSD-2-Clause */
 > +
 > +/*
 > + * Copyright (C) <2020> Niteesh G S mailto:niteesh...@gmail.com>>
 > + *
 > + * 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 DIRE

Re: [PATCH] shell: Add i2c and spi commands

2020-11-26 Thread Christian MAUDERER
Anyone against this patch? Otherwise I would like to push it somewhen in 
the near future.


Best regards

Christian

Am 18.11.20 um 08:36 schrieb Christian Mauderer:

This adds some commands that are usefull for debugging simple serial
interfaces.

Even if they are a complete re-implementation, the i2c* commands use a
simmilar call like the Linux i2c tools.
---

Note: This is a resubmission of the patch. Previously I submitted it together
with the patches that add a new imxrt BSP:

https://lists.rtems.org/pipermail/devel/2020-November/063273.html

I only noted that it would have been better separate after Gedare said it.

  cpukit/Makefile.am|   4 +
  cpukit/include/rtems/shellconfig.h|  28 +
  cpukit/libmisc/shell/main_i2cdetect.c | 107 ++
  cpukit/libmisc/shell/main_i2cget.c| 145 
  cpukit/libmisc/shell/main_i2cset.c| 124 
  cpukit/libmisc/shell/main_spi.c   | 157 ++
  spec/build/cpukit/objshell.yml|   4 +
  7 files changed, 569 insertions(+)
  create mode 100644 cpukit/libmisc/shell/main_i2cdetect.c
  create mode 100644 cpukit/libmisc/shell/main_i2cget.c
  create mode 100644 cpukit/libmisc/shell/main_i2cset.c
  create mode 100644 cpukit/libmisc/shell/main_spi.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 4e370ae639..2adfcf933f 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1495,6 +1495,10 @@ librtemscpu_a_SOURCES += libmisc/shell/login_prompt.c
  librtemscpu_a_SOURCES += libmisc/shell/login_check.c
  librtemscpu_a_SOURCES += libmisc/shell/fdisk.c
  librtemscpu_a_SOURCES += libmisc/shell/main_rtc.c
+librtemscpu_a_SOURCES += libmisc/shell/main_spi.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cdetect.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cset.c
+librtemscpu_a_SOURCES += libmisc/shell/main_i2cget.c
  librtemscpu_a_SOURCES += libmisc/shell/dd-args.c
  librtemscpu_a_SOURCES += libmisc/shell/main_dd.c
  librtemscpu_a_SOURCES += libmisc/shell/dd-conv.c
diff --git a/cpukit/include/rtems/shellconfig.h 
b/cpukit/include/rtems/shellconfig.h
index 3e87d472d6..c5fcf4a45e 100644
--- a/cpukit/include/rtems/shellconfig.h
+++ b/cpukit/include/rtems/shellconfig.h
@@ -78,6 +78,10 @@ extern rtems_shell_cmd_t rtems_shell_DF_Command;
  extern rtems_shell_cmd_t rtems_shell_MD5_Command;
  
  extern rtems_shell_cmd_t rtems_shell_RTC_Command;

+extern rtems_shell_cmd_t rtems_shell_SPI_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CDETECT_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CGET_Command;
+extern rtems_shell_cmd_t rtems_shell_I2CSET_Command;
  
  extern rtems_shell_cmd_t rtems_shell_SHUTDOWN_Command;

  extern rtems_shell_cmd_t rtems_shell_CPUINFO_Command;
@@ -521,6 +525,30 @@ extern rtems_shell_alias_t * const 
rtems_shell_Initial_aliases[];
&rtems_shell_RTC_Command,
  #endif
  
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \

+  && !defined(CONFIGURE_SHELL_NO_COMMAND_SPI)) \
+|| defined(CONFIGURE_SHELL_COMMAND_SPI)
+  &rtems_shell_SPI_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CDETECT)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CDETECT)
+  &rtems_shell_I2CDETECT_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CGET)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CGET)
+  &rtems_shell_I2CGET_Command,
+#endif
+
+#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) \
+  && !defined(CONFIGURE_SHELL_NO_COMMAND_I2CSET)) \
+|| defined(CONFIGURE_SHELL_COMMAND_I2CSET)
+  &rtems_shell_I2CSET_Command,
+#endif
+
  /*
   *  System related commands
   */
diff --git a/cpukit/libmisc/shell/main_i2cdetect.c 
b/cpukit/libmisc/shell/main_i2cdetect.c
new file mode 100644
index 00..e953b4eaef
--- /dev/null
+++ b/cpukit/libmisc/shell/main_i2cdetect.c
@@ -0,0 +1,107 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 embedded brains GmbH.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL TH

[PATCH rtems-docs] shell: Document i2c and spi commands.

2020-11-30 Thread Christian Mauderer
---
 shell/general_commands.rst | 200 +
 1 file changed, 200 insertions(+)

diff --git a/shell/general_commands.rst b/shell/general_commands.rst
index c74ae45..a6f7e18 100644
--- a/shell/general_commands.rst
+++ b/shell/general_commands.rst
@@ -44,6 +44,14 @@ The RTEMS shell has the following general commands:
 
 - rtc_ - RTC driver configuration
 
+- i2cdetect_ - detect I2C devices
+
+- i2cget_ - get data from an EEPROM like I2C device
+
+- i2cset_ - write data to an EEPROM like I2C device
+
+- spi_ - read and write simple data to an SPI bus
+
 - exit_ - alias for logoff command
 
 Commands
@@ -1179,6 +1187,198 @@ CONFIGURATION:
 
\clearpage
 
+.. _i2cdetect:
+
+i2cdetect - detect I2C devices
+--
+.. index:: i2cdetect
+
+SYNOPSYS:
+.. code-block:: shell
+
+i2cdetect 
+
+.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CDETECT
+.. index:: CONFIGURE_SHELL_COMMAND_I2CDETECT
+
+DESCRIPTION:
+Tries to detect I2C devices connected to the I2C bus. To do that, write
+requests with the length of 0 are used.
+
+WARNING: This might confuse some I2C devices, so please use it only if you
+know what you are doing.
+
+The command supports a ``-h`` option to get usage details.
+
+The command works only with I2C bus drivers that use the Linux-Style API.
+
+EXAMPLES:
+The following is an example where two I2C devices are detected. One on 0x1a
+and one on 0x1f:
+
+.. code-block:: shell
+
+SHLL [/] # i2cdetect /dev/i2c1
+x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
+0x -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+1x  -- -- -- -- -- -- -- -- -- -- 1a -- -- -- -- 1f
+2x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+3x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+4x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+5x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+6x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+7x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+SHLL [/] #
+
+CONFIGURATION:
+This command is included in the default shell command set.  When building a
+custom command set, define ``CONFIGURE_SHELL_COMMAND_I2CDETECT`` to have
+this command included.
+
+This command can be excluded from the shell command set by defining
+``CONFIGURE_SHELL_NO_COMMAND_I2CDETECT`` when all shell commands have been
+configured.
+
+.. raw:: latex
+
+   \clearpage
+
+.. _i2cget:
+
+i2cget - get data from an EEPROM like I2C device
+
+.. index:: i2cget
+
+SYNOPSYS:
+.. code-block:: shell
+
+i2cget[]
+
+.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CGET
+.. index:: CONFIGURE_SHELL_COMMAND_I2CGET
+
+DESCRIPTION:
+Get one or multiple bytes from an EEPROM like I2C device. If you read
+multiple bytes ( given and > 1) the read will be done in one
+single request. An auto incrementing register pointer is assumed.
+
+The command supports a ``-h`` option to get usage details.
+
+The command works only with I2C bus drivers that use the Linux-Style API.
+
+EXAMPLES:
+The following is an example how to read a one byte register at 0xd from the
+I2C device at 0x1f:
+
+.. code-block:: shell
+
+SHLL [/] # i2cget /dev/i2c1 0x1f 0x0d
+0xc7 
+SHLL [/] #
+
+CONFIGURATION:
+This command is included in the default shell command set.  When building a
+custom command set, define ``CONFIGURE_SHELL_COMMAND_I2CGET`` to have this
+command included.
+
+This command can be excluded from the shell command set by defining
+``CONFIGURE_SHELL_NO_COMMAND_I2CGET`` when all shell commands have been
+configured.
+
+.. raw:: latex
+
+   \clearpage
+
+.. _i2cset:
+
+i2cset - write data to an EEPROM like I2C device
+
+.. index:: i2cset
+
+SYNOPSYS:
+.. code-block:: shell
+
+i2cset [ [...]]
+
+.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CSET
+.. index:: CONFIGURE_SHELL_COMMAND_I2CSET
+
+DESCRIPTION:
+Write one or multiple bytes to an EEPROM like I2C device. If you write
+multiple bytes (multiple  given) the write will be done in one 
single
+request. An auto incrementing register pointer is assumed.
+
+The command supports a ``-h`` option to get usage details.
+
+The command works only with I2C bus drivers that use the Linux-Style API.
+
+EXAMPLES:
+The following is an example how to write one byte of 0x00 to the register 
at
+0x11 of the I2C device at 0x1f:
+
+.. code-block:: shell
+
+SHLL [/] # i2cset /dev/i2c1 0x1f 0x11 0x00
+SHLL [/] #
+
+CONFIGURATION:
+This command is included in the default shell command set.  When building a
+custom command set, define ``CONFIGURE_SHELL_COMMAND_I2CSET`` to have this
+command included.
+
+This command can be excluded from the shell command 

Re: [PATCH rtems-docs] shell: Document i2c and spi commands.

2020-11-30 Thread Christian Mauderer

Hello Gedare,

thanks for the review.

On 30/11/2020 18:43, Gedare Bloom wrote:



On Mon, Nov 30, 2020 at 7:14 AM Christian Mauderer 
<mailto:christian.maude...@embedded-brains.de>> wrote:


---
  shell/general_commands.rst | 200 +
  1 file changed, 200 insertions(+)

diff --git a/shell/general_commands.rst b/shell/general_commands.rst
index c74ae45..a6f7e18 100644
--- a/shell/general_commands.rst
+++ b/shell/general_commands.rst
@@ -44,6 +44,14 @@ The RTEMS shell has the following general commands:

  - rtc_ - RTC driver configuration

+- i2cdetect_ - detect I2C devices
+
+- i2cget_ - get data from an EEPROM like I2C device
+
+- i2cset_ - write data to an EEPROM like I2C device
+
+- spi_ - read and write simple data to an SPI bus
+
  - exit_ - alias for logoff command

  Commands
@@ -1179,6 +1187,198 @@ CONFIGURATION:

     \clearpage

+.. _i2cdetect:
+
+i2cdetect - detect I2C devices
+--
+.. index:: i2cdetect
+
+SYNOPSYS:
+    .. code-block:: shell
+
+        i2cdetect 
+
+.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CDETECT
+.. index:: CONFIGURE_SHELL_COMMAND_I2CDETECT
+
+DESCRIPTION:
+    Tries to detect I2C devices connected to the I2C bus. To do
that, write
+    requests with the length of 0 are used.
+
+    WARNING: This might confuse some I2C devices, so please use it
only if you
+    know what you are doing.
+

What happens for devices that don't know how to respond? is it any kind 
of undefined behavior?


That depends on the devices. Basically everything can happen. For example:

- device is just not detected
- I2C bus hangs
- some random undefined behavior

The command uses the same method that is used by the Linux i2cdetect 
command and therefore I added a similar warning:


   https://linux.die.net/man/8/i2cdetect



+    The command supports a ``-h`` option to get usage details.
+
+    The command works only with I2C bus drivers that use the
Linux-Style API.
+
+EXAMPLES:
+    The following is an example where two I2C devices are detected.
One on 0x1a
+    and one on 0x1f:
+
+    .. code-block:: shell
+
+        SHLL [/] # i2cdetect /dev/i2c1
+            x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
+        0x     -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+        1x  -- -- -- -- -- -- -- -- -- -- 1a -- -- -- -- 1f
+        2x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+        3x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+        4x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+        5x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+        6x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+        7x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+        SHLL [/] #
+
+CONFIGURATION:
+    This command is included in the default shell command set. 
When building a


If this is unsafe to use when you don't know what you're doing, then 
maybe it should not be available without explicitly turning it on?  
(Safe Defaults)


I can do that if you want. It's more or less a diagnostic command (just 
like the others here). But note that we have a lot of "unsafe if you 
don't know what you are doing" commands. Like dd, mkrfs, mmove, fdisk, 
and even exit can crash some systems ...


Aren't nearly all shell commands at least a bit unsafe? And we don't 
have a lot of commands that have to be explicitly turned on if 
CONFIGURE_SHELL_COMMANDS_ALL is already set. I found only networking 
commands.




+    custom command set, define
``CONFIGURE_SHELL_COMMAND_I2CDETECT`` to have
+    this command included.
+
+    This command can be excluded from the shell command set by defining
+    ``CONFIGURE_SHELL_NO_COMMAND_I2CDETECT`` when all shell
commands have been
+    configured.
+
+.. raw:: latex
+
+   \clearpage
+
+.. _i2cget:
+
+i2cget - get data from an EEPROM like I2C device
+
+.. index:: i2cget
+
+SYNOPSYS:
+    .. code-block:: shell
+
+        i2cget[]
+
+.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CGET
+.. index:: CONFIGURE_SHELL_COMMAND_I2CGET
+
+DESCRIPTION:
+    Get one or multiple bytes from an EEPROM like I2C device. If
you read
+    multiple bytes ( given and > 1) the read will be done
in one


Default is 1 byte? Please clarify


OK.



+    single request. An auto incrementing register pointer is assumed.
+
+    The command supports a ``-h`` option to get usage details.
+
+    The command works only with I2C bus drivers that use the
Linux-Style API.

[PATCH rtems-docs v2] shell: Document i2c and spi commands.

2020-12-01 Thread Christian Mauderer
---
 shell/general_commands.rst | 215 +
 1 file changed, 215 insertions(+)

diff --git a/shell/general_commands.rst b/shell/general_commands.rst
index c74ae45..5913f54 100644
--- a/shell/general_commands.rst
+++ b/shell/general_commands.rst
@@ -44,6 +44,14 @@ The RTEMS shell has the following general commands:
 
 - rtc_ - RTC driver configuration
 
+- i2cdetect_ - detect I2C devices
+
+- i2cget_ - get data from an EEPROM like I2C device
+
+- i2cset_ - write data to an EEPROM like I2C device
+
+- spi_ - read and write simple data to an SPI bus
+
 - exit_ - alias for logoff command
 
 Commands
@@ -1179,6 +1187,213 @@ CONFIGURATION:
 
\clearpage
 
+.. _i2cdetect:
+
+i2cdetect - detect I2C devices
+--
+.. index:: i2cdetect
+
+SYNOPSYS:
+.. code-block:: shell
+
+i2cdetect 
+
+.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CDETECT
+.. index:: CONFIGURE_SHELL_COMMAND_I2CDETECT
+
+DESCRIPTION:
+Tries to detect I2C devices connected to the I2C bus. To do that, write
+requests with the length of 0 are used.
+
+WARNING: This might confuse some I2C devices, so please use it only if you
+know what you are doing.
+
+The command supports a ``-h`` option to get usage details.
+
+The command works only with I2C bus drivers that use the Linux-Style API.
+
+EXAMPLES:
+The following is an example where two I2C devices are detected. One on 0x1a
+and one on 0x1f:
+
+.. code-block:: shell
+
+SHLL [/] # i2cdetect /dev/i2c1
+x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
+0x -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+1x  -- -- -- -- -- -- -- -- -- -- 1a -- -- -- -- 1f
+2x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+3x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+4x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+5x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+6x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+7x  -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+SHLL [/] #
+
+CONFIGURATION:
+This command is included in the default shell command set.  When building a
+custom command set, define ``CONFIGURE_SHELL_COMMAND_I2CDETECT`` to have
+this command included.
+
+This command can be excluded from the shell command set by defining
+``CONFIGURE_SHELL_NO_COMMAND_I2CDETECT`` when all shell commands have been
+configured.
+
+.. raw:: latex
+
+   \clearpage
+
+.. _i2cget:
+
+i2cget - get data from an EEPROM like I2C device
+
+.. index:: i2cget
+
+SYNOPSYS:
+.. code-block:: shell
+
+i2cget[]
+
+.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CGET
+.. index:: CONFIGURE_SHELL_COMMAND_I2CGET
+
+DESCRIPTION:
+Get one or multiple bytes from an EEPROM like I2C device. If  is
+not given the command defaults to reading one byte. If you read multiple
+bytes ( given and bigger then 1) the read will be done in one
+single request. An auto incrementing register pointer is assumed.
+
+The command supports a ``-h`` option to get usage details.
+
+All numbers can be entered in decimal form (normal digits; e.g. 16),
+hexadecimal form (with 0x prefix; e.g. 0x10) or octal form (with a leading
+zero; e.g. 020).
+
+The command works only with I2C bus drivers that use the Linux-Style API.
+
+EXAMPLES:
+The following is an example how to read a one byte register at 0xd from the
+I2C device at 0x1f:
+
+.. code-block:: shell
+
+SHLL [/] # i2cget /dev/i2c1 0x1f 0x0d
+0xc7 
+SHLL [/] #
+
+CONFIGURATION:
+This command is included in the default shell command set.  When building a
+custom command set, define ``CONFIGURE_SHELL_COMMAND_I2CGET`` to have this
+command included.
+
+This command can be excluded from the shell command set by defining
+``CONFIGURE_SHELL_NO_COMMAND_I2CGET`` when all shell commands have been
+configured.
+
+.. raw:: latex
+
+   \clearpage
+
+.. _i2cset:
+
+i2cset - write data to an EEPROM like I2C device
+
+.. index:: i2cset
+
+SYNOPSYS:
+.. code-block:: shell
+
+i2cset [ [...]]
+
+.. index:: CONFIGURE_SHELL_NO_COMMAND_I2CSET
+.. index:: CONFIGURE_SHELL_COMMAND_I2CSET
+
+DESCRIPTION:
+Write one or multiple bytes to an EEPROM like I2C device. If you write
+multiple bytes (multiple  given) the write will be done in one 
single
+request. An auto incrementing register pointer is assumed.
+
+The command supports a ``-h`` option to get usage details.
+
+All numbers can be entered in decimal form (normal digits; e.g. 16),
+hexadecimal form (with 0x prefix; e.g. 0x10) or octal form (with a leading
+zero; e.g. 020).
+
+The command works only with I2C bus drivers that use the Linux-Style API.
+
+EXAMPLES:
+The following is an example how to write one byte

Re: [PATCH rtems-docs] shell: Document i2c and spi commands.

2020-12-01 Thread Christian MAUDERER

Am 01.12.20 um 13:45 schrieb Peter Dufault:




On Nov 30, 2020, at 18:07 , Gedare Bloom  wrote:

Aren't nearly all shell commands at least a bit unsafe? And we don't
have a lot of commands that have to be explicitly turned on if
CONFIGURE_SHELL_COMMANDS_ALL is already set. I found only networking
commands.

That seems accurate, you can go ahead with the approach you took then. It seems 
to be mostly consistent with the state of practice.




I was surprised at the need to enable each command instead of adding all I2C 
commands with a single enable.  I don't think code overhead is an issue.  If 
you're testing I2C from the shell I'm not sure when it's important to have only 
e.g. i2cget but not i2cset.


It's like with a lot of other commands in RTEMS. You can have all or you 
enable them one by one. I had a look and we have (for example) also no 
group for file commands like rm, mv, cp, ls.


The only group I found (beneath CONFIGURE_SHELL_COMMANDS_ALL) is the 
CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING. I'm not sure whether it would 
be a good idea to start a new group now.


Best regards

Christian



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.


___
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
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems] bsps/imxrt: Split up dts.

2020-12-04 Thread Christian Mauderer
This allows simpler creation of own dts files for custom boards.

Update #4180
---
 bsps/arm/imxrt/dts/imxrt1050-evkb.dts   | 287 +-
 bsps/arm/imxrt/include/imxrt/imxrt1050.dtsi | 309 
 spec/build/bsps/arm/imxrt/bspimxrt.yml  |   1 +
 3 files changed, 312 insertions(+), 285 deletions(-)
 create mode 100644 bsps/arm/imxrt/include/imxrt/imxrt1050.dtsi

diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.dts 
b/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
index 968ca1dbdc..8b2c571bba 100644
--- a/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
+++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
@@ -34,293 +34,10 @@
  * rtems-bin2c -C -N imxrt_dtb "${BSP_DIR}/dts/imxrt1050-evkb.dtb" 
"${BSP_DIR}/dts/imxrt1050-evkb.c"
  */
 
-#include 
-
 /dts-v1/;
 
-/ {
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   chosen: chosen {};
-
-   aliases {
-   gpio0 = &gpio1;
-   gpio1 = &gpio2;
-   gpio2 = &gpio3;
-   gpio3 = &gpio4;
-   gpio4 = &gpio5;
-   };
-
-   nvic: interrupt-controller@e000e100  {
-   compatible = "arm,armv7m-nvic";
-   interrupt-controller;
-   #interrupt-cells = <1>;
-   reg = <0xe000e100 0xc00>;
-   };
-
-   systick: timer@e000e010 {
-   compatible = "arm,armv7m-systick";
-   reg = <0xe000e010 0x10>;
-   status = "disabled";
-   };
-
-   soc {
-   compatible = "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
-   interrupt-parent = <&nvic>;
-   ranges;
-
-   aips-bus@4000 {
-   compatible = "fsl,aips-bus", "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
-   reg = <0x4000 0x0010>;
-   ranges;
-
-   gpio5: gpio@400c {
-   compatible = "fsl,imxrt-gpio",
-   "fsl,imx6ul-gpio", "fsl,imx35-gpio";
-   reg = <0x400c 0x4000>;
-   interrupts = <88>, <89>;
-   gpio-controller;
-   #gpio-cells = <2>;
-   interrupt-controller;
-   #interrupt-cells = <2>;
-   };
-   };
-
-   aips-bus@4010 {
-   compatible = "fsl,aips-bus", "simple-bus";
-   #address-cells = <1>;
-   #size-cells = <1>;
-   reg = <0x4010 0x0010>;
-   ranges;
-
-   gpio4: gpio@401c4000 {
-   compatible = "fsl,imxrt-gpio",
-   "fsl,imx6ul-gpio", "fsl,imx35-gpio";
-   reg = <0x401c4000 0x4000>;
-   interrupts = <86>, <87>;
-   gpio-controller;
-   #gpio-cells = <2>;
-   interrupt-controller;
-   #interrupt-cells = <2>;
-   };
-
-   gpio3: gpio@401c {
-   compatible = "fsl,imxrt-gpio",
-   "fsl,imx6ul-gpio", "fsl,imx35-gpio";
-   reg = <0x401c 0x4000>;
-   interrupts = <84>, <85>;
-   gpio-controller;
-   #gpio-cells = <2>;
-   interrupt-controller;
-   #interrupt-cells = <2>;
-   };
-
-   gpio2: gpio@401bc000 {
-   compatible = "fsl,imxrt-gpio",
-   "fsl,imx6ul-gpio", "fsl,imx35-gpio";
-   reg = <0x401bc000 0x4000>;
-   interrupts = <82>, <83>;
-   gpio-controller;
-   #gpio-cells = <2>;
-   interrupt-controller;
-   #interrupt-cells = <2>;
-   };
-
-   gpio1: gpio@401b8000 {
-   compatible = "fsl,imxrt-gpio",
-   "fsl,imx6ul-gpio", "fsl,imx35-gpio";
-   reg = <0x401b8000 0x4000>;
-   interrupts = <80>, <81>, <72>, <73>, <74>,
-   <75>, <76>, <77>, <78>, <79>;
-   gpio-controller;
-   #gpio-cells = <2>;
-   interrupt-controller;
-   #interrupt-cells = <2>;
-  

Re: [PATCH rtems] bsps/imxrt: Split up dts.

2020-12-04 Thread Christian Mauderer

Hello Gedare,

On 04/12/2020 17:04, Gedare Bloom wrote:

seems fine to me.


Thanks.

is this stuff documented somewhere (at least for this 
BSP)?


At the moment it's the only BSP where we have a dts that is written 
purely for RTEMS and linked in that way. Other BSPs either use a Linux 
FDT (which doesn't exist yet in the official kernel for i.MXRT) or have 
some other special sources.


Currently there is only a very short note that the device tree can be 
changed in the BSP. I'll extend it a bit.


Best regards

Christian



On Fri, Dec 4, 2020 at 2:07 AM Christian Mauderer 
<mailto:christian.maude...@embedded-brains.de>> wrote:


This allows simpler creation of own dts files for custom boards.

Update #4180
---
  bsps/arm/imxrt/dts/imxrt1050-evkb.dts       | 287 +-
  bsps/arm/imxrt/include/imxrt/imxrt1050.dtsi | 309 
  spec/build/bsps/arm/imxrt/bspimxrt.yml      |   1 +
  3 files changed, 312 insertions(+), 285 deletions(-)
  create mode 100644 bsps/arm/imxrt/include/imxrt/imxrt1050.dtsi

diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
b/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
index 968ca1dbdc..8b2c571bba 100644
--- a/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
+++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.dts
@@ -34,293 +34,10 @@
   *     rtems-bin2c -C -N imxrt_dtb
"${BSP_DIR}/dts/imxrt1050-evkb.dtb" "${BSP_DIR}/dts/imxrt1050-evkb.c"
   */

-#include 
-
  /dts-v1/;

-/ {
-       #address-cells = <1>;
-       #size-cells = <1>;
-
-       chosen: chosen {};
-
-       aliases {
-               gpio0 = &gpio1;
-               gpio1 = &gpio2;
-               gpio2 = &gpio3;
-               gpio3 = &gpio4;
-               gpio4 = &gpio5;
-       };
-
-       nvic: interrupt-controller@e000e100  {
-               compatible = "arm,armv7m-nvic";
-               interrupt-controller;
-               #interrupt-cells = <1>;
-               reg = <0xe000e100 0xc00>;
-       };
-
-       systick: timer@e000e010 {
-               compatible = "arm,armv7m-systick";
-               reg = <0xe000e010 0x10>;
-               status = "disabled";
-       };
-
-       soc {
-               compatible = "simple-bus";
-               #address-cells = <1>;
-               #size-cells = <1>;
-               interrupt-parent = <&nvic>;
-               ranges;
-
-               aips-bus@4000 {
-                       compatible = "fsl,aips-bus", "simple-bus";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       reg = <0x4000 0x0010>;
-                       ranges;
-
-                       gpio5: gpio@400c {
-                               compatible = "fsl,imxrt-gpio",
-                                   "fsl,imx6ul-gpio", "fsl,imx35-gpio";
-                               reg = <0x400c 0x4000>;
-                               interrupts = <88>, <89>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
-                       };
-               };
-
-               aips-bus@4010 {
-                       compatible = "fsl,aips-bus", "simple-bus";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-                       reg = <0x4010 0x0010>;
-                       ranges;
-
-                       gpio4: gpio@401c4000 {
-                               compatible = "fsl,imxrt-gpio",
-                                   "fsl,imx6ul-gpio", "fsl,imx35-gpio";
-                               reg = <0x401c4000 0x4000>;
-                               interrupts = <86>, <87>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               interrupt-controller;
-                               #interrupt-cells = <2>;
-                       };
-
-                       gpio3: gpio@401c {
-                               compatible = "fsl,imxrt-gpio",
-                                   "fsl,imx6ul-gpio", "fsl,imx35-gpio";
-                               reg = <0x401c0

[PATCH rtems] bsps/arm/imx*: Fix location of shared headers

2020-12-10 Thread Christian Mauderer
When moving the headers from the imx BSP to the shared area, the wrong
directory has been selected. This patch fixes that problem.

Update #4180
---
 .../include/arm/freescale/imx/imx_iomuxreg.h  |  0
 .../include/arm/freescale/imx/imx_iomuxvar.h  |  0
 bsps/arm/{shared => }/include/bsp/imx-gpio.h  |  0
 bsps/arm/{shared => }/include/bsp/imx-iomux.h |  0
 spec/build/bsps/arm/imx/bspimx.yml| 11 +--
 spec/build/bsps/arm/imxrt/bspimxrt.yml| 11 +--
 6 files changed, 10 insertions(+), 12 deletions(-)
 rename bsps/arm/{shared => }/include/arm/freescale/imx/imx_iomuxreg.h (100%)
 rename bsps/arm/{shared => }/include/arm/freescale/imx/imx_iomuxvar.h (100%)
 rename bsps/arm/{shared => }/include/bsp/imx-gpio.h (100%)
 rename bsps/arm/{shared => }/include/bsp/imx-iomux.h (100%)

diff --git a/bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h 
b/bsps/arm/include/arm/freescale/imx/imx_iomuxreg.h
similarity index 100%
rename from bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
rename to bsps/arm/include/arm/freescale/imx/imx_iomuxreg.h
diff --git a/bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h 
b/bsps/arm/include/arm/freescale/imx/imx_iomuxvar.h
similarity index 100%
rename from bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
rename to bsps/arm/include/arm/freescale/imx/imx_iomuxvar.h
diff --git a/bsps/arm/shared/include/bsp/imx-gpio.h 
b/bsps/arm/include/bsp/imx-gpio.h
similarity index 100%
rename from bsps/arm/shared/include/bsp/imx-gpio.h
rename to bsps/arm/include/bsp/imx-gpio.h
diff --git a/bsps/arm/shared/include/bsp/imx-iomux.h 
b/bsps/arm/include/bsp/imx-iomux.h
similarity index 100%
rename from bsps/arm/shared/include/bsp/imx-iomux.h
rename to bsps/arm/include/bsp/imx-iomux.h
diff --git a/spec/build/bsps/arm/imx/bspimx.yml 
b/spec/build/bsps/arm/imx/bspimx.yml
index 5f448682ed..93628f0368 100644
--- a/spec/build/bsps/arm/imx/bspimx.yml
+++ b/spec/build/bsps/arm/imx/bspimx.yml
@@ -8,8 +8,7 @@ copyrights:
 cppflags: []
 enabled-by: true
 family: imx
-includes:
-  - bsps/arm/shared/include
+includes: []
 install:
 - destination: ${BSP_INCLUDEDIR}
   source:
@@ -21,16 +20,16 @@ install:
   - bsps/arm/imx/include/arm/freescale/imx/imx_ecspireg.h
   - bsps/arm/imx/include/arm/freescale/imx/imx_gpcreg.h
   - bsps/arm/imx/include/arm/freescale/imx/imx_i2creg.h
-  - bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
-  - bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
   - bsps/arm/imx/include/arm/freescale/imx/imx_srcreg.h
   - bsps/arm/imx/include/arm/freescale/imx/imx_uartreg.h
   - bsps/arm/imx/include/arm/freescale/imx/imx_wdogreg.h
+  - bsps/arm/include/arm/freescale/imx/imx_iomuxreg.h
+  - bsps/arm/include/arm/freescale/imx/imx_iomuxvar.h
 - destination: ${BSP_INCLUDEDIR}/bsp
   source:
-  - bsps/arm/shared/include/bsp/imx-gpio.h
   - bsps/arm/imx/include/bsp/irq.h
-  - bsps/arm/shared/include/bsp/imx-iomux.h
+  - bsps/arm/include/bsp/imx-gpio.h
+  - bsps/arm/include/bsp/imx-iomux.h
 - destination: ${BSP_INCLUDEDIR}/dev/clock
   source:
   - bsps/include/dev/clock/arm-generic-timer.h
diff --git a/spec/build/bsps/arm/imxrt/bspimxrt.yml 
b/spec/build/bsps/arm/imxrt/bspimxrt.yml
index 67161ba11f..bafd7ef3f9 100644
--- a/spec/build/bsps/arm/imxrt/bspimxrt.yml
+++ b/spec/build/bsps/arm/imxrt/bspimxrt.yml
@@ -8,8 +8,7 @@ copyrights:
 cppflags: []
 enabled-by: true
 family: imxrt
-includes:
-  - bsps/arm/shared/include
+includes: []
 install:
 - destination: ${BSP_INCLUDEDIR}
   source:
@@ -92,14 +91,14 @@ install:
   - bsps/arm/imxrt/include/tm27.h
 - destination: ${BSP_INCLUDEDIR}/arm/freescale/imx
   source:
-  - bsps/arm/shared/include/arm/freescale/imx/imx_iomuxreg.h
-  - bsps/arm/shared/include/arm/freescale/imx/imx_iomuxvar.h
+  - bsps/arm/include/arm/freescale/imx/imx_iomuxreg.h
+  - bsps/arm/include/arm/freescale/imx/imx_iomuxvar.h
 - destination: ${BSP_INCLUDEDIR}/bsp
   source:
   - bsps/arm/imxrt/include/bsp/flash-headers.h
   - bsps/arm/imxrt/include/bsp/irq.h
-  - bsps/arm/shared/include/bsp/imx-gpio.h
-  - bsps/arm/shared/include/bsp/imx-iomux.h
+  - bsps/arm/include/bsp/imx-gpio.h
+  - bsps/arm/include/bsp/imx-iomux.h
 - destination: ${BSP_INCLUDEDIR}/imxrt
   source:
   - bsps/arm/imxrt/include/imxrt/imxrt1050-pinfunc.h
-- 
2.26.2

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


Re: Fwd: [rtems-bsp-builder] 2020-12-11 12:57:21: Profile(s): everything

2020-12-13 Thread Christian Mauderer

Hello Joel,

that patch should most likely fix that problem:

https://lists.rtems.org/pipermail/devel/2020-December/063708.html

I haven't pushed it yet because I just posted it on Thursday and it was 
only one day of review time on Friday. I'll push it on Monday (together 
with some other pending patches).


Best regards

Christian

On 12/12/2020 17:24, Joel Sherrill wrote:
Looks like the failures would mostly be explained by something is broken 
on the imx7 BSP and the SPE PowerPC bsps are still listed in the tier 
files for the tester.


-- Forwarded message -
From: mailto:j...@rtems.org>>
Date: Sat, Dec 12, 2020, 9:49 AM
Subject: [rtems-bsp-builder] 2020-12-11 12:57:21: Profile(s): everything
To: mailto:bu...@rtems.org>>


RTEMS Tools Project - RTEMS Kernel BSP Builder, 6.0.not_released


Host: #1 SMP Tue Aug 25 17:23:54 UTC 2020

command: /home/joel/rtems-cron-6/tools/6/bin/rtems-bsp-builder\
          --rtems=/home/joel/rtems-cron-6/rtems --build-path=/home/joel\
          /rtems-cron-6/build --prefix=/home/joel/rtems-cron-6/tools/6/bsps\
          --log=/home/joel/rtems-cron-6/bsp-builder.log --warnings-\
          report=warnings.log --mail --mail-to=bu...@rtems.org 
 --mail-\

          from=j...@rtems.org  --profiles=everything

Total Time            : 20:51:45.296683 for 1696 completed job(s)
Average BSP Build Time: 0:00:44.283783

Builds
==
  debug
  network
  network-debug
  no-network
  no-posix
  posix
  posix-debug
  posix-profiling
  profiling
  smp
  smp-debug
  smp-network
  smp-network-debug

Failures Report
===
    1 debug arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --enable-rtems-debug
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

    2 network arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --enable-networking
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

    3 network-debug arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --enable-rtems-debug --enable-networking
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

    4 no-network arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --disable-networking
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

    5 no-posix arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --disable-posix
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

    6 posix arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --enable-posix
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

    7 posix-debug arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --enable-rtems-debug --enable-posix
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

    8 posix-profiling arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --enable-posix --enable-profiling
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

    9 profiling arm/imx7 build:
       configure: /home/joel/rtems-cron-6/rtems/configure --target=arm-\
       rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
       cron-6/tools/6/bsps --enable-profiling
      error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
             arm/freescale/imx/imx_iomuxvar.h: No such file or directory

   10 smp arm/imx7 build:
       config

[PATCH rtems] cpu/armv7m: Fix table based init for ARMV7M_MPU

2020-12-14 Thread Christian Mauderer
Somehow the table index has been missing in the latest patch version.
With that, the configuration for the first region has been applied
multiple times.

Update #4180
---
 cpukit/score/cpu/arm/include/rtems/score/armv7m.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cpukit/score/cpu/arm/include/rtems/score/armv7m.h 
b/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
index c1960455ff..8f926e826a 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/armv7m.h
@@ -700,7 +700,13 @@ static inline void _ARMV7M_MPU_Setup(
   _Assert(cfg_count <= region_count);
 
   for (region = 0; region < cfg_count; ++region) {
-_ARMV7M_MPU_Set_region(mpu, region, cfg->rasr, cfg->begin, cfg->end);
+_ARMV7M_MPU_Set_region(
+  mpu,
+  region,
+  cfg[region].rasr,
+  cfg[region].begin,
+  cfg[region].end
+);
   }
 
   for (region = cfg_count; region < region_count; ++region) {
-- 
2.26.2

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


Re: [PATCH rtems] cpu/armv7m: Fix table based init for ARMV7M_MPU

2020-12-14 Thread Christian MAUDERER

Thanks. I pushed them both (together with some other pending patches).

Am 14.12.20 um 12:01 schrieb Sebastian Huber:

On 14/12/2020 11:31, Christian Mauderer wrote:


Somehow the table index has been missing in the latest patch version.
With that, the configuration for the first region has been applied
multiple times.

Update #4180
Please check it in and also the patch which fixes the imx7 header file 
locations.




--

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: Fwd: [rtems-bsp-builder] 2020-12-11 12:57:21: Profile(s): everything

2020-12-14 Thread Christian MAUDERER

Hello Joel,

Am 14.12.20 um 15:23 schrieb Joel Sherrill:



On Sun, Dec 13, 2020 at 3:32 AM Christian Mauderer <mailto:o...@c-mauderer.de>> wrote:


Hello Joel,

that patch should most likely fix that problem:


Great!


https://lists.rtems.org/pipermail/devel/2020-December/063708.html
<https://lists.rtems.org/pipermail/devel/2020-December/063708.html>

I haven't pushed it yet because I just posted it on Thursday and it was
only one day of review time on Friday. I'll push it on Monday (together
with some other pending patches).


OK. I'll start another sweep when this goes in.


Sebastian urged me to push the patch. So it already is in the repo since 
a few hours:


https://git.rtems.org/rtems/commit/?id=9b3def237addd99154817f85c6c1a7ef62e444f1



FWIW I try to do at least one build sweep a month and post reports of
failures when the set of issues changes. It is just easy for something to
slip in. Easy enough to let the computers churn a few days.


Yes, that's great. Sorry that the bug slipped in.

Best regards

Christian



--joel


Best regards

Christian

On 12/12/2020 17:24, Joel Sherrill wrote:
 > Looks like the failures would mostly be explained by something is
broken
 > on the imx7 BSP and the SPE PowerPC bsps are still listed in the
tier
 > files for the tester.
 >
 > -- Forwarded message -
 > From: mailto:j...@rtems.org>
<mailto:j...@rtems.org <mailto:j...@rtems.org>>>
 > Date: Sat, Dec 12, 2020, 9:49 AM
 > Subject: [rtems-bsp-builder] 2020-12-11 12:57:21: Profile(s):
everything
 > To: mailto:bu...@rtems.org>
<mailto:bu...@rtems.org <mailto:bu...@rtems.org>>>
 >
 >
 > RTEMS Tools Project - RTEMS Kernel BSP Builder, 6.0.not_released
 > 
 >
 > Host: #1 SMP Tue Aug 25 17:23:54 UTC 2020
 >
 > command: /home/joel/rtems-cron-6/tools/6/bin/rtems-bsp-builder\
 >           --rtems=/home/joel/rtems-cron-6/rtems
--build-path=/home/joel\
 >           /rtems-cron-6/build
--prefix=/home/joel/rtems-cron-6/tools/6/bsps\
 >           --log=/home/joel/rtems-cron-6/bsp-builder.log --warnings-\
 >           report=warnings.log --mail --mail-to=bu...@rtems.org
<mailto:bu...@rtems.org>
 > <mailto:bu...@rtems.org <mailto:bu...@rtems.org>> --mail-\
 >           from=j...@rtems.org <mailto:j...@rtems.org>
<mailto:j...@rtems.org <mailto:j...@rtems.org>> --profiles=everything
 >
 > Total Time            : 20:51:45.296683 for 1696 completed job(s)
 > Average BSP Build Time: 0:00:44.283783
 >
 > Builds
 > ==
 >   debug
 >   network
 >   network-debug
 >   no-network
 >   no-posix
 >   posix
 >   posix-debug
 >   posix-profiling
 >   profiling
 >   smp
 >   smp-debug
 >   smp-network
 >   smp-network-debug
 >
 > Failures Report
 > ===
 >     1 debug arm/imx7 build:
 >        configure: /home/joel/rtems-cron-6/rtems/configure
--target=arm-\
 >        rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
 >        cron-6/tools/6/bsps --enable-rtems-debug
 >       error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
 >              arm/freescale/imx/imx_iomuxvar.h: No such file or
directory
 >
 >     2 network arm/imx7 build:
 >        configure: /home/joel/rtems-cron-6/rtems/configure
--target=arm-\
 >        rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
 >        cron-6/tools/6/bsps --enable-networking
 >       error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
 >              arm/freescale/imx/imx_iomuxvar.h: No such file or
directory
 >
 >     3 network-debug arm/imx7 build:
 >        configure: /home/joel/rtems-cron-6/rtems/configure
--target=arm-\
 >        rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
 >        cron-6/tools/6/bsps --enable-rtems-debug --enable-networking
 >       error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
 >              arm/freescale/imx/imx_iomuxvar.h: No such file or
directory
 >
 >     4 no-network arm/imx7 build:
 >        configure: /home/joel/rtems-cron-6/rtems/configure
--target=arm-\
 >        rtems6 --enable-rtemsbsp=imx7 --prefix=/home/joel/rtems-\
 >        cron-6/tools/6/bsps --disable-networking
 >       error: bsps/arm/shared/pins/imx_iomux.c:69:10: fatal error:
 >              arm/freescale/imx/imx_iomuxvar.h: No such file or

[PATCH rtems 6/6] bsps/imxrt: Add ioctl to LPSPI to get registers

2020-12-14 Thread Christian Mauderer
This allows an application to get the registers of the LPSPI. That is
usefull for applications that want to use DMA for a very specialized and
highly optimized communication.

Update #4180
---
 bsps/arm/imxrt/include/imxrt/lpspi.h   | 54 ++
 bsps/arm/imxrt/spi/imxrt-lpspi.c   | 20 ++
 spec/build/bsps/arm/imxrt/bspimxrt.yml |  1 +
 3 files changed, 75 insertions(+)
 create mode 100644 bsps/arm/imxrt/include/imxrt/lpspi.h

diff --git a/bsps/arm/imxrt/include/imxrt/lpspi.h 
b/bsps/arm/imxrt/include/imxrt/lpspi.h
new file mode 100644
index 00..8a87f28da9
--- /dev/null
+++ b/bsps/arm/imxrt/include/imxrt/lpspi.h
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#ifndef LIBBSP_ARM_IMXRT_IMXRT_LPSPI_H
+#define LIBBSP_ARM_IMXRT_IMXRT_LPSPI_H
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define IMXRT_LPSPI_IOC_MAGIC 's'
+
+/**
+ * @brief Fetch the raw registers.
+ *
+ * This allows to do some special operations. Note that if you do something
+ * fancy, you should lock the hardware by obtaining the bus with the
+ * SPI_BUS_OBTAIN ioctl first. With that, the normal driver can't be used by
+ * other tasks. Also note that you should leave the registers in a clean state
+ * before releasing the bus again.
+ */
+#define IMXRT_LPSPI_GET_REGISTERS _IOR(IMXRT_LPSPI_IOC_MAGIC, 0, LPSPI_Type *)
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_ARM_IMXRT_IMXRT_LPSPI_H */
diff --git a/bsps/arm/imxrt/spi/imxrt-lpspi.c b/bsps/arm/imxrt/spi/imxrt-lpspi.c
index 6da3ffdecf..06d8f715d9 100644
--- a/bsps/arm/imxrt/spi/imxrt-lpspi.c
+++ b/bsps/arm/imxrt/spi/imxrt-lpspi.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct imxrt_lpspi_bus {
   spi_bus base;
@@ -471,6 +472,24 @@ static clock_ip_name_t imxrt_lpspi_clock_ip(volatile 
LPSPI_Type *regs)
   return kCLOCK_IpInvalid;
 }
 
+static int imxrt_lpspi_ioctl(spi_bus *base, ioctl_command_t command, void *arg)
+{
+  struct imxrt_lpspi_bus *bus;
+  bus = (struct imxrt_lpspi_bus *) base;
+  int err = 0;
+
+  switch (command) {
+case IMXRT_LPSPI_GET_REGISTERS:
+  *(volatile LPSPI_Type**)arg = bus->regs;
+  break;
+default:
+  err = -EINVAL;
+  break;
+  }
+
+  return err;
+}
+
 void imxrt_lpspi_init(void)
 {
   const void *fdt;
@@ -523,6 +542,7 @@ void imxrt_lpspi_init(void)
   bus->base.transfer = imxrt_lpspi_transfer;
   bus->base.destroy = imxrt_lpspi_destroy;
   bus->base.setup = imxrt_lpspi_setup;
+  bus->base.ioctl = imxrt_lpspi_ioctl;
 
   eno = spi_bus_register(&bus->base, bus_path);
   if (eno != 0) {
diff --git a/spec/build/bsps/arm/imxrt/bspimxrt.yml 
b/spec/build/bsps/arm/imxrt/bspimxrt.yml
index be4a4bb566..3044fda998 100644
--- a/spec/build/bsps/arm/imxrt/bspimxrt.yml
+++ b/spec/build/bsps/arm/imxrt/bspimxrt.yml
@@ -103,6 +103,7 @@ install:
   source:
   - bsps/arm/imxrt/include/imxrt/imxrt1050.dtsi
   - bsps/arm/imxrt/include/imxrt/imxrt1050-pinfunc.h
+  - bsps/arm/imxrt/include/imxrt/lpspi.h
   - bsps/arm/imxrt/include/imxrt/memory.h
   - bsps/arm/imxrt/include/imxrt/mpu-config.h
 - destination: ${BSP_LIBDIR}
-- 
2.26.2

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


[PATCH rtems 5/6] cpukit/spi: Allow driver specific ioctl

2020-12-14 Thread Christian Mauderer
This allows a SPI driver to add a hardware specific ioctl.
---
 cpukit/dev/spi/spi-bus.c | 3 +++
 cpukit/include/dev/spi/spi.h | 7 +++
 2 files changed, 10 insertions(+)

diff --git a/cpukit/dev/spi/spi-bus.c b/cpukit/dev/spi/spi-bus.c
index 5308603216..42b70aa6c9 100644
--- a/cpukit/dev/spi/spi-bus.c
+++ b/cpukit/dev/spi/spi-bus.c
@@ -199,6 +199,8 @@ static int spi_bus_ioctl(
   arg,
   IOCPARM_LEN(command) / sizeof(struct spi_ioc_transfer)
 );
+  } else if (bus->ioctl != NULL) {
+err = (*bus->ioctl)(bus, command, arg);
   } else {
 err = -EINVAL;
   }
@@ -300,6 +302,7 @@ static int spi_bus_do_init(
   bus->transfer = spi_bus_transfer_default;
   bus->setup = spi_bus_setup_default;
   bus->destroy = destroy;
+  bus->ioctl = NULL;
   bus->bits_per_word = 8;
 
   return 0;
diff --git a/cpukit/include/dev/spi/spi.h b/cpukit/include/dev/spi/spi.h
index dfe9cf512b..8850b288fe 100644
--- a/cpukit/include/dev/spi/spi.h
+++ b/cpukit/include/dev/spi/spi.h
@@ -141,6 +141,13 @@ struct spi_bus {
* devices.
*/
   uint16_t delay_usecs;
+
+  /**
+   * @brief Driver specific ioctl.
+   *
+   * @param[in] bus The bus control.
+   */
+  int (*ioctl)(spi_bus *bus, ioctl_command_t command, void *arg);
 };
 
 /**
-- 
2.26.2

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


[PATCH rtems 2/6] bsps/shared: Copy fsl-edma from mpc55xx

2020-12-14 Thread Christian Mauderer
This is a preparation for making the driver universal.

Update #4180
---
 bsps/include/fsl/edma.h| 329 +++
 bsps/include/fsl/regs-edma.h   | 710 +
 bsps/shared/dev/dma/fsl-edma.c | 329 +++
 3 files changed, 1368 insertions(+)
 create mode 100644 bsps/include/fsl/edma.h
 create mode 100644 bsps/include/fsl/regs-edma.h
 create mode 100644 bsps/shared/dev/dma/fsl-edma.c

diff --git a/bsps/include/fsl/edma.h b/bsps/include/fsl/edma.h
new file mode 100644
index 00..8b7d65d3b6
--- /dev/null
+++ b/bsps/include/fsl/edma.h
@@ -0,0 +1,329 @@
+/**
+ * @file
+ *
+ * @ingroup RTEMSBSPsPowerPCMPC55XX
+ *
+ * @brief Enhanced Direct Memory Access (eDMA).
+ */
+
+/*
+ * Copyright (c) 2008-2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef LIBCPU_POWERPC_MPC55XX_EDMA_H
+#define LIBCPU_POWERPC_MPC55XX_EDMA_H
+
+#include 
+
+#include 
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#if MPC55XX_CHIP_FAMILY == 551
+  #define EDMA_CHANNEL_COUNT 16U
+#elif MPC55XX_CHIP_FAMILY == 564
+  #define EDMA_CHANNEL_COUNT 16U
+#elif MPC55XX_CHIP_FAMILY == 567
+  #define EDMA_CHANNEL_COUNT 96U
+#else
+  #define EDMA_CHANNEL_COUNT 64U
+#endif
+
+#define EDMA_MODULE_COUNT ((EDMA_CHANNEL_COUNT + 63U) / 64U)
+
+#define EDMA_CHANNELS_PER_MODULE 64U
+
+#if EDMA_MODULE_COUNT == 1
+  #define EDMA_TCD_BY_CHANNEL_INDEX(channel_index) \
+(&EDMA.TCD[(channel_index)])
+#elif EDMA_MODULE_COUNT == 2
+  #define EDMA_TCD_BY_CHANNEL_INDEX(channel_index) \
+((channel_index) < EDMA_CHANNELS_PER_MODULE ? \
+  &EDMA_A.TCD[(channel_index)] \
+: &EDMA_B.TCD[(channel_index) - EDMA_CHANNELS_PER_MODULE])
+#else
+  #error "unsupported module count"
+#endif
+
+/* FIXME: These values are only valid for the MPC5566 and MPC5674F */
+typedef enum {
+  EDMA_EQADC_A_FISR0_CFFF0 = 0,
+  EDMA_EQADC_A_FISR0_RFDF0 = 1,
+  EDMA_EQADC_A_FISR1_CFFF1 = 2,
+  EDMA_EQADC_A_FISR1_RFDF1 = 3,
+  EDMA_EQADC_A_FISR2_CFFF2 = 4,
+  EDMA_EQADC_A_FISR2_RFDF2 = 5,
+  EDMA_EQADC_A_FISR3_CFFF3 = 6,
+  EDMA_EQADC_A_FISR3_RFDF3 = 7,
+  EDMA_EQADC_A_FISR4_CFFF4 = 8,
+  EDMA_EQADC_A_FISR4_RFDF4 = 9,
+  EDMA_EQADC_A_FISR5_CFFF5 = 10,
+  EDMA_EQADC_A_FISR5_RFDF5 = 11,
+  EDMA_DSPI_B_SR_TFFF = 12,
+  EDMA_DSPI_B_SR_RFDF = 13,
+  EDMA_DSPI_C_SR_TFFF = 14,
+  EDMA_DSPI_C_SR_RFDF = 15,
+  EDMA_DSPI_D_SR_TFFF = 16,
+  EDMA_DSPI_D_SR_RFDF = 17,
+  EDMA_ESCI_A_COMBTX = 18,
+  EDMA_ESCI_A_COMBRX = 19,
+  EDMA_EMIOS_GFR_F0 = 20,
+  EDMA_EMIOS_GFR_F1 = 21,
+  EDMA_EMIOS_GFR_F2 = 22,
+  EDMA_EMIOS_GFR_F3 = 23,
+  EDMA_EMIOS_GFR_F4 = 24,
+  EDMA_EMIOS_GFR_F8 = 25,
+  EDMA_EMIOS_GFR_F9 = 26,
+  EDMA_ETPU_CDTRSR_A_DTRS0 = 27,
+  EDMA_ETPU_CDTRSR_A_DTRS1 = 28,
+  EDMA_ETPU_CDTRSR_A_DTRS2 = 29,
+  EDMA_ETPU_CDTRSR_A_DTRS14 = 30,
+  EDMA_ETPU_CDTRSR_A_DTRS15 = 31,
+  EDMA_DSPI_A_SR_TFFF = 32,
+  EDMA_DSPI_A_SR_RFDF = 33,
+  EDMA_ESCI_B_COMBTX = 34,
+  EDMA_ESCI_B_COMBRX = 35,
+  EDMA_EMIOS_GFR_F6 = 36,
+  EDMA_EMIOS_GFR_F7 = 37,
+  EDMA_EMIOS_GFR_F10 = 38,
+  EDMA_EMIOS_GFR_F11 = 39,
+  EDMA_EMIOS_GFR_F16 = 40,
+  EDMA_EMIOS_GFR_F17 = 41,
+  EDMA_EMIOS_GFR_F18 = 42,
+  EDMA_EMIOS_GFR_F19 = 43,
+  EDMA_ETPU_CDTRSR_A_DTRS12 = 44,
+  EDMA_ETPU_CDTRSR_A_DTRS13 = 45,
+  EDMA_ETPU_CDTRSR_A_DTRS28 = 46,
+  EDMA_ETPU_CDTRSR_A_DTRS29 = 47,
+  EDMA_SIU_EISR_EIF0 = 48,
+  EDMA_SIU_EISR_EIF1 = 49,
+  EDMA_SIU_EISR_EIF2 = 50,
+  EDMA_SIU_EISR_EIF3 = 51,
+  EDMA_ETPU_CDTRSR_B_DTRS0 = 52,
+  EDMA_ETPU_CDTRSR_B_DTRS1 = 53,
+  EDMA_ETPU_CDTRSR_B_DTRS2 = 54,
+  EDMA_ETPU_CDTRSR_B_DTRS3 = 55,
+  EDMA_ETPU_CDTRSR_B_DTRS12 = 56,
+  EDMA_ETPU_CDTRSR_B_DTRS13 = 57,
+  EDMA_ETPU_CDTRSR_B_DTRS14 = 58,
+  EDMA_ETPU_CDTRSR_B_DTRS15 = 59,
+  EDMA_ETPU_CDTRSR_B_DTRS28 = 60,
+  EDMA_ETPU_CDTRSR_B_DTRS29 = 61,
+  EDMA_ETPU_CDTRSR_B_DTRS30 = 62,
+  EDMA_ETPU_CDTRSR_B_DTRS31 = 63
+  #if MPC55XX_CHIP_FAMILY == 567
+,
+EDMA_EQADC_B_FISR0_CFFF0 = 64 + 0,
+EDMA_EQADC_B_FISR0_RFDF0 = 64 + 1,
+EDMA_EQADC_B_FISR1_CFFF1 = 64 + 2,
+EDMA_EQADC_B_FISR1_RFDF1 = 64 + 3,
+EDMA_EQADC_B_FISR2_CFFF2 = 64 + 4,
+EDMA_EQADC_B_FISR2_RFDF2 = 64 + 5,
+EDMA_EQADC_B_FISR3_CFFF3 = 64 + 6,
+EDMA_EQADC_B_FISR3_RFDF3 = 64 + 7,
+EDMA_EQADC_B_FISR4_CFFF4 = 64 + 8,
+EDMA_EQADC_B_FISR4_RFDF4 = 64 + 9,
+EDMA_EQADC_B_FISR5_CFFF5 = 64 + 10,
+EDMA_EQADC_B_FISR5_RFDF5 = 64 + 11,
+EDMA_DECFILTER_A_IB = 64 + 12,
+EDMA_DECFILTER_A_OB = 64 + 13,
+EDMA_DECFILTER_B_IB = 64 + 14,
+EDMA_DECFILTER_B_OB = 64 + 15,
+EDMA_DECFILTER_C_IB = 64 + 16,
+EDMA_DECFILTER_C_OB = 64 + 17,
+EDMA_DECFILTER_D_IB = 64 + 18,
+EDMA_DECFILTER_D_OB = 64 + 19,
+EDMA_DECFILTER_E_IB = 64 + 20,
+EDMA_DECFILTER_E_OB = 64 + 21,
+EDMA_DECFILTER_F_IB = 6

[PATCH rtems 3/6] bsps/shared: Adapt fsl-edma driver for imxrt

2020-12-14 Thread Christian Mauderer
Note: The changes have been done with portability in mind. The driver
should (in theory) be able to replace the original one in the MPC BSPs
too. For full compatibility an adaption layer and especially a test
would be necessary. Because both are missing, don't integrate it into
the MPC BSP now.

Update #4180
---
 bsps/arm/imxrt/start/bspstart.c  |   3 +
 bsps/include/fsl/edma.h  | 218 +++--
 bsps/include/fsl/regs-edma.h | 977 +++
 bsps/shared/dev/dma/fsl-edma.c   | 349 +--
 spec/build/bsps/arm/imxrt/bspimxrt.yml   |   2 +
 spec/build/bsps/arm/imxrt/optfsledmaemlm.yml |  16 +
 spec/build/bsps/obj.yml  |   5 +
 7 files changed, 746 insertions(+), 824 deletions(-)
 create mode 100644 spec/build/bsps/arm/imxrt/optfsledmaemlm.yml

diff --git a/bsps/arm/imxrt/start/bspstart.c b/bsps/arm/imxrt/start/bspstart.c
index 884f0aaf92..445af04563 100644
--- a/bsps/arm/imxrt/start/bspstart.c
+++ b/bsps/arm/imxrt/start/bspstart.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -139,3 +140,5 @@ RTEMS_SYSINIT_ITEM(imxrt_lpi2c_init, 
RTEMS_SYSINIT_DEVICE_DRIVERS,
 RTEMS_SYSINIT_ORDER_MIDDLE);
 RTEMS_SYSINIT_ITEM(imxrt_ffec_init, RTEMS_SYSINIT_DEVICE_DRIVERS,
 RTEMS_SYSINIT_ORDER_MIDDLE);
+RTEMS_SYSINIT_ITEM(fsl_edma_init, RTEMS_SYSINIT_DEVICE_DRIVERS,
+RTEMS_SYSINIT_ORDER_FIRST);
diff --git a/bsps/include/fsl/edma.h b/bsps/include/fsl/edma.h
index 8b7d65d3b6..a2727f0c0e 100644
--- a/bsps/include/fsl/edma.h
+++ b/bsps/include/fsl/edma.h
@@ -1,29 +1,40 @@
 /**
  * @file
  *
- * @ingroup RTEMSBSPsPowerPCMPC55XX
+ * @ingroup RTEMSBSPsSharedFslEDMA
  *
- * @brief Enhanced Direct Memory Access (eDMA).
+ * @brief Freescale / NXP Enhanced Direct Memory Access (eDMA).
  */
 
 /*
- * Copyright (c) 2008-2013 embedded brains GmbH.  All rights reserved.
+ * Copyright (C) 2008-2020 embedded brains GmbH (http://www.embedded-brains.de)
  *
- *  embedded brains GmbH
- *  Dornierstr. 4
- *  82178 Puchheim
- *  Germany
- *  
+ * 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.
  *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
+ * 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.
  */
 
-#ifndef LIBCPU_POWERPC_MPC55XX_EDMA_H
-#define LIBCPU_POWERPC_MPC55XX_EDMA_H
+#ifndef LIBBSP_SHARED_FSL_EDMA_H
+#define LIBBSP_SHARED_FSL_EDMA_H
 
-#include 
+#include 
 
 #include 
 #include 
@@ -32,7 +43,9 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#if MPC55XX_CHIP_FAMILY == 551
+#ifdef LIBBSP_ARM_IMXRT_BSP_H
+  #define EDMA_CHANNEL_COUNT 32U
+#elif MPC55XX_CHIP_FAMILY == 551
   #define EDMA_CHANNEL_COUNT 16U
 #elif MPC55XX_CHIP_FAMILY == 564
   #define EDMA_CHANNEL_COUNT 16U
@@ -46,20 +59,27 @@ extern "C" {
 
 #define EDMA_CHANNELS_PER_MODULE 64U
 
-#if EDMA_MODULE_COUNT == 1
-  #define EDMA_TCD_BY_CHANNEL_INDEX(channel_index) \
-(&EDMA.TCD[(channel_index)])
-#elif EDMA_MODULE_COUNT == 2
-  #define EDMA_TCD_BY_CHANNEL_INDEX(channel_index) \
-((channel_index) < EDMA_CHANNELS_PER_MODULE ? \
-  &EDMA_A.TCD[(channel_index)] \
-: &EDMA_B.TCD[(channel_index) - EDMA_CHANNELS_PER_MODULE])
-#else
-  #error "unsupported module count"
+volatile struct fsl_edma_tcd *fsl_edma_tcd_of_channel_index(unsigned index);
+unsigned fsl_edma_channel_index_of_tcd(volatile struct fsl_edma_tcd *edma_tcd);
+
+#ifdef LIBBSP_POWERPC_MPC55XXEVB_BSP_H
+  #error Legacy stuff. Move to compatibility layer.
+  #if EDMA_MODULE_COUNT == 1
+#define EDMA_TCD_BY_CHANNEL_INDEX(channel_index) \
+  (&EDMA.TCD[(channel_index)])
+  #elif EDMA_MODULE_COUNT == 2
+#define EDMA_TCD_BY_CHANNEL_INDEX(channel_index) \
+ 

[PATCH rtems 4/6] bsps/imxrt: Add DMA numbers to dtsi

2020-12-14 Thread Christian Mauderer
Also currently no driver uses these numbers, it is usefull for
applications that want to use the DMA.

Update #4180
---
 bsps/arm/imxrt/dts/imxrt1050-evkb.c | 1037 ++-
 bsps/arm/imxrt/include/imxrt/imxrt1050.dtsi |   45 +
 2 files changed, 604 insertions(+), 478 deletions(-)

diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.c 
b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
index 8815b2c60b..f0b0c16d36 100644
--- a/bsps/arm/imxrt/dts/imxrt1050-evkb.c
+++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
@@ -7,10 +7,10 @@
 #include 
 
 const unsigned char imxrt_dtb[] = {
-  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x24, 0xcb, 0x00, 0x00, 0x00, 0x38, 
-  0x00, 0x00, 0x1e, 0xa8, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11, 
-  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x23, 
-  0x00, 0x00, 0x1e, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x28, 0x96, 0x00, 0x00, 0x00, 0x38, 
+  0x00, 0x00, 0x22, 0x54, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11, 
+  0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x42, 
+  0x00, 0x00, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 
@@ -21,7 +21,7 @@ const unsigned char imxrt_dtb[] = {
   0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2f, 0x75, 
   0x61, 0x72, 0x74, 0x40, 0x34, 0x30, 0x31, 0x38, 0x34, 0x30, 0x30, 0x30, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
-  0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 
+  0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 
   0x00, 0x00, 0x00, 0x01, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x00, 
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x2f, 
   0x2f, 0x73, 0x6f, 0x63, 0x2f, 0x61, 0x69, 0x70, 0x73, 0x2d, 0x62, 0x75, 
@@ -65,7 +65,7 @@ const unsigned char imxrt_dtb[] = {
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x82, 
   0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x27, 
-  0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 
+  0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 
   0x73, 0x6f, 0x63, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 
   0x00, 0x00, 0x00, 0x4d, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2d, 0x62, 
   0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
@@ -84,315 +84,327 @@ const unsigned char imxrt_dtb[] = {
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x7e, 
   0x40, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x01, 
-  0x67, 0x70, 0x69, 0x6f, 0x40, 0x34, 0x30, 0x30, 0x63, 0x30, 0x30, 0x30, 
-  0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x2e, 
-  0x00, 0x00, 0x00, 0x4d, 0x66, 0x73, 0x6c, 0x2c, 0x69, 0x6d, 0x78, 0x72, 
-  0x74, 0x2d, 0x67, 0x70, 0x69, 0x6f, 0x00, 0x66, 0x73, 0x6c, 0x2c, 0x69, 
-  0x6d, 0x78, 0x36, 0x75, 0x6c, 0x2d, 0x67, 0x70, 0x69, 0x6f, 0x00, 0x66, 
-  0x73, 0x6c, 0x2c, 0x69, 0x6d, 0x78, 0x33, 0x35, 0x2d, 0x67, 0x70, 0x69, 
-  0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 
-  0x00, 0x00, 0x00, 0x7e, 0x40, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xa1, 
-  0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x03, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, 0x03, 
-  0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x02, 
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6d, 
-  0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
-  0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x02, 
-  0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x61, 0x69, 0x70, 0x73, 
-  0x2d, 0x62, 0x75, 0x73, 0x40, 0x34, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 
-  0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 
-  0x00, 0x00, 0x00, 0x4d, 0x66, 0x73, 0x6c, 0x2c, 0x61, 0x69, 0x70, 0x73, 
-  0x2d, 0x62, 0x75, 0x73, 0x00, 0x73, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x2d, 
-  0x62, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 
-  0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01, 
-  0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x7e, 
-  0x40, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 

[PATCH rtems 1/6] bsps/imxrt: Use standard names to avoid warnings

2020-12-14 Thread Christian Mauderer
If spi or i2c slaves are "connected" to the spi or i2c bus, the device
tree compiler complains if the busses are not named spi or i2c.

Update #4180
---
 bsps/arm/imxrt/dts/imxrt1050-evkb.c | 193 ++--
 bsps/arm/imxrt/include/imxrt/imxrt1050.dtsi |  16 +-
 2 files changed, 103 insertions(+), 106 deletions(-)

diff --git a/bsps/arm/imxrt/dts/imxrt1050-evkb.c 
b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
index b97337b264..8815b2c60b 100644
--- a/bsps/arm/imxrt/dts/imxrt1050-evkb.c
+++ b/bsps/arm/imxrt/dts/imxrt1050-evkb.c
@@ -7,10 +7,10 @@
 #include 
 
 const unsigned char imxrt_dtb[] = {
-  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x24, 0xeb, 0x00, 0x00, 0x00, 0x38, 
-  0x00, 0x00, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11, 
+  0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x24, 0xcb, 0x00, 0x00, 0x00, 0x38, 
+  0x00, 0x00, 0x1e, 0xa8, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11, 
   0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x23, 
-  0x00, 0x00, 0x1e, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+  0x00, 0x00, 0x1e, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 
@@ -402,8 +402,8 @@ const unsigned char imxrt_dtb[] = {
   0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 
   0x00, 0x00, 0x00, 0x7e, 0x40, 0x30, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 
-  0x00, 0x00, 0x00, 0x01, 0x6c, 0x70, 0x73, 0x70, 0x69, 0x40, 0x34, 0x30, 
-  0x33, 0x39, 0x34, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
+  0x00, 0x00, 0x00, 0x01, 0x73, 0x70, 0x69, 0x40, 0x34, 0x30, 0x33, 0x39, 
+  0x34, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
   0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 
@@ -418,8 +418,8 @@ const unsigned char imxrt_dtb[] = {
   0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
   0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 
   0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x18, 
-  0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x6c, 0x70, 0x73, 0x70, 
-  0x69, 0x40, 0x34, 0x30, 0x33, 0x39, 0x38, 0x30, 0x30, 0x30, 0x00, 0x00, 
+  0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x73, 0x70, 0x69, 0x40, 
+  0x34, 0x30, 0x33, 0x39, 0x38, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
   0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
@@ -434,8 +434,8 @@ const unsigned char imxrt_dtb[] = {
   0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x70, 0x69, 0x32, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x27, 
   0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 
-  0x6c, 0x70, 0x73, 0x70, 0x69, 0x40, 0x34, 0x30, 0x33, 0x39, 0x63, 0x30, 
-  0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
+  0x73, 0x70, 0x69, 0x40, 0x34, 0x30, 0x33, 0x39, 0x63, 0x30, 0x30, 0x30, 
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 
   0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x4d, 
@@ -449,8 +449,8 @@ const unsigned char imxrt_dtb[] = {
   0x00, 0x00, 0x00, 0xc8, 0x2f, 0x64, 0x65, 0x76, 0x2f, 0x73, 0x70, 0x69, 
   0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 
   0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x02, 
-  0x00, 0x00, 0x00, 0x01, 0x6c, 0x70, 0x73, 0x70, 0x69, 0x40, 0x34, 0x30, 
-  0x33, 0x61, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
+  0x00, 0x00, 0x00, 0x01, 0x73, 0x70, 0x69, 0x40, 0x34, 0x30, 0x33, 0x61, 
+  0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
   0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 
   0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 
@@ -464,8 +464,8 @@ const unsigned char imxrt_dtb[] = {
   0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xc8, 0x2f, 0x64, 0x65, 0x76, 
   0x2f, 0x73, 0x70, 0x69, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 
   0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x1b, 
-  0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x6c, 0x70, 0x69, 0x32, 
-  0x

Re: [PATCH v3 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-12-19 Thread Christian Mauderer

Hello Niteesh,

sorry, I somehow forget to check that patch set. I'll do it in the next 
few days.


Best regards

Christian

On 17/12/2020 12:15, Niteesh G. S. wrote:

ping.


On Fri, Dec 4, 2020 at 1:41 PM G S Niteesh Babu > wrote:


This commit adds a basic test that tests all the implemented
RTEMS OFW functions.
---
  spec/build/testsuites/libtests/grp.yml   |   2 +
  spec/build/testsuites/libtests/ofw01.yml |  21 +++
  testsuites/libtests/ofw01/init.c         | 197 +++
  testsuites/libtests/ofw01/ofw01.doc      |  29 
  testsuites/libtests/ofw01/ofw01.scn      |   2 +
  testsuites/libtests/ofw01/some.c         |  72 +
  testsuites/libtests/ofw01/some.dts       |  76 +
  testsuites/libtests/ofw01/some.h         |  15 ++
  8 files changed, 414 insertions(+)
  create mode 100644 spec/build/testsuites/libtests/ofw01.yml
  create mode 100644 testsuites/libtests/ofw01/init.c
  create mode 100644 testsuites/libtests/ofw01/ofw01.doc
  create mode 100644 testsuites/libtests/ofw01/ofw01.scn
  create mode 100644 testsuites/libtests/ofw01/some.c
  create mode 100644 testsuites/libtests/ofw01/some.dts
  create mode 100644 testsuites/libtests/ofw01/some.h

diff --git a/spec/build/testsuites/libtests/grp.yml
b/spec/build/testsuites/libtests/grp.yml
index aff46c9f8f..82c2288e2f 100644
--- a/spec/build/testsuites/libtests/grp.yml
+++ b/spec/build/testsuites/libtests/grp.yml
@@ -316,6 +316,8 @@ links:
    uid: write
  - role: build-dependency
    uid: writev
+- role: build-dependency
+  uid: ofw01
  type: build
  use-after:
  - rtemstest
diff --git a/spec/build/testsuites/libtests/ofw01.yml
b/spec/build/testsuites/libtests/ofw01.yml
new file mode 100644
index 00..8517c58bad
--- /dev/null
+++ b/spec/build/testsuites/libtests/ofw01.yml
@@ -0,0 +1,21 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+build-type: test-program
+cflags: []
+copyrights:
+- Copyright (C) 2020 Niteesh G S
+cppflags: []
+cxxflags: []
+enabled-by: true
+features: c cprogram
+includes: []
+ldflags:
+- -Wl,--wrap=bsp_fdt_get
+links: []
+source:
+- testsuites/libtests/ofw01/init.c
+- testsuites/libtests/ofw01/some.c
+stlib: []
+target: testsuites/libtests/ofw01.exe
+type: build
+use-after: []
+use-before: []
diff --git a/testsuites/libtests/ofw01/init.c
b/testsuites/libtests/ofw01/init.c
new file mode 100644
index 00..105c52c50e
--- /dev/null
+++ b/testsuites/libtests/ofw01/init.c
@@ -0,0 +1,197 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) <2020> Niteesh G S mailto:niteesh...@gmail.com>>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer
in the
+ *    documentation and/or other materials provided with the
distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "some.h"
+
+#define BUF_SIZE 100
+
+const char rtems_test_name[] = "OFW 01";
+static const void *test_bin = NULL;
+
+const void *__wrap_bsp_fdt_get(void);
+const void *__real_bsp_fdt_get(void);
+
+const void *__wrap_bsp_fdt_get(void)
+{
+  if (test_bin != NULL) {
+    return test_bin;
+  }
+
+  return __real_bsp_fdt_get();
+}
+
+static void Init(rtem

Re: [PATCH v3 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-12-22 Thread Christian Mauderer

Hello Niteesh,

On 19/12/2020 16:57, Niteesh G. S. wrote:

Hello Christian,

On Sat, Dec 19, 2020 at 7:11 PM Christian Mauderer <mailto:o...@c-mauderer.de>> wrote:


Hello Niteesh,

sorry, I somehow forget to check that patch set. I'll do it in the next
few days.

No problem, please take your time :).


I have a problem with the patches on a non-fdt-BSP: The test doesn't 
link. I tried it with the xilinx_zynq_a9_qemu BSP.


Basically the bsp_fdt_get() is missing on that BSP. To work arround 
that, it is possible to change the return statement in the 
__wrap_bsp_fdt_get to:



#ifdef BSP_FDT_IS_SUPPORTED
  return __real_bsp_fdt_get();
#else
 return some_bin;
#endif

Note that in the no-fdt-bsp-case, it has to return a valid FDT because 
otherwise the ofw initialization fails.


I tested that modified version on xilinx_zynq_a9_qemu and on BBB and it 
seems to work fine. If you are OK with this modification (and no one 
objects in the next two days) I'll push the patches with this modification.




If you are on vacation, enjoy your vacations :)


Thanks. It wouldn't be reasonable to travel during a pandemic and I 
don't like traveling anyway. Therefore it's a quiet and relaxing 
vacation ;-)


Best regards

Christian



Thanks,
Niteesh.


Best regards

Christian

On 17/12/2020 12:15, Niteesh G. S. wrote:
 > ping.
 >
 >
 > On Fri, Dec 4, 2020 at 1:41 PM G S Niteesh Babu
mailto:niteesh...@gmail.com>
 > <mailto:niteesh...@gmail.com <mailto:niteesh...@gmail.com>>> wrote:
 >
 >     This commit adds a basic test that tests all the implemented
 >     RTEMS OFW functions.
 >     ---
 >       spec/build/testsuites/libtests/grp.yml   |   2 +
 >       spec/build/testsuites/libtests/ofw01.yml |  21 +++
 >       testsuites/libtests/ofw01/init.c         | 197
+++
 >       testsuites/libtests/ofw01/ofw01.doc      |  29 
 >       testsuites/libtests/ofw01/ofw01.scn      |   2 +
 >       testsuites/libtests/ofw01/some.c         |  72 +
 >       testsuites/libtests/ofw01/some.dts       |  76 +
 >       testsuites/libtests/ofw01/some.h         |  15 ++
 >       8 files changed, 414 insertions(+)
 >       create mode 100644 spec/build/testsuites/libtests/ofw01.yml
 >       create mode 100644 testsuites/libtests/ofw01/init.c
 >       create mode 100644 testsuites/libtests/ofw01/ofw01.doc
 >       create mode 100644 testsuites/libtests/ofw01/ofw01.scn
 >       create mode 100644 testsuites/libtests/ofw01/some.c
 >       create mode 100644 testsuites/libtests/ofw01/some.dts
 >       create mode 100644 testsuites/libtests/ofw01/some.h
 >
 >     diff --git a/spec/build/testsuites/libtests/grp.yml
 >     b/spec/build/testsuites/libtests/grp.yml
 >     index aff46c9f8f..82c2288e2f 100644
 >     --- a/spec/build/testsuites/libtests/grp.yml
 >     +++ b/spec/build/testsuites/libtests/grp.yml
 >     @@ -316,6 +316,8 @@ links:
 >         uid: write
 >       - role: build-dependency
 >         uid: writev
 >     +- role: build-dependency
 >     +  uid: ofw01
 >       type: build
 >       use-after:
 >       - rtemstest
 >     diff --git a/spec/build/testsuites/libtests/ofw01.yml
 >     b/spec/build/testsuites/libtests/ofw01.yml
 >     new file mode 100644
 >     index 00..8517c58bad
 >     --- /dev/null
 >     +++ b/spec/build/testsuites/libtests/ofw01.yml
 >     @@ -0,0 +1,21 @@
 >     +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 >     +build-type: test-program
 >     +cflags: []
 >     +copyrights:
 >     +- Copyright (C) 2020 Niteesh G S
 >     +cppflags: []
 >     +cxxflags: []
 >     +enabled-by: true
 >     +features: c cprogram
 >     +includes: []
 >     +ldflags:
 >     +- -Wl,--wrap=bsp_fdt_get
 >     +links: []
 >     +source:
 >     +- testsuites/libtests/ofw01/init.c
 >     +- testsuites/libtests/ofw01/some.c
 >     +stlib: []
 >     +target: testsuites/libtests/ofw01.exe
 >     +type: build
 >     +use-after: []
 >     +use-before: []
 >     diff --git a/testsuites/libtests/ofw01/init.c
 >     b/testsuites/libtests/ofw01/init.c
 >     new file mode 100644
 >     index 00..105c52c50e
 >     --- /dev/null
 >     +++ b/testsuites/libtests/ofw01/init.c
 >     @@ -0,0 +1,197 @@
 >     +/* SPDX-License-Identifier: BSD-2-Clause */
 >     +
 >     +/*
 >     + * Copyright (C) <2020> Niteesh G S mailto:nit

Re: [PATCH v3 2/2] libtests/ofw01: Added a test for RTEMS OFW

2020-12-27 Thread Christian Mauderer

Hello Niteesh,

I pushed the two patches.

Best regards

Christian

On 22/12/2020 19:01, Niteesh G. S. wrote:

Hello Christian,

On Tue, Dec 22, 2020 at 6:33 PM Christian Mauderer <mailto:o...@c-mauderer.de>> wrote:


Hello Niteesh,

On 19/12/2020 16:57, Niteesh G. S. wrote:
 > Hello Christian,
 >
 > On Sat, Dec 19, 2020 at 7:11 PM Christian Mauderer
mailto:o...@c-mauderer.de>
 > <mailto:o...@c-mauderer.de <mailto:o...@c-mauderer.de>>> wrote:
 >
 >     Hello Niteesh,
 >
 >     sorry, I somehow forget to check that patch set. I'll do it
in the next
 >     few days.
 >
 > No problem, please take your time :).

I have a problem with the patches on a non-fdt-BSP: The test doesn't
link. I tried it with the xilinx_zynq_a9_qemu BSP.


Basically the bsp_fdt_get() is missing on that BSP. To work arround
that, it is possible to change the return statement in the
__wrap_bsp_fdt_get to:


      #ifdef BSP_FDT_IS_SUPPORTED
        return __real_bsp_fdt_get();
      #else
       return some_bin;
      #endif

I am sorry for not testing it on a non-fdt-BSP, I totally forgot about 
this part though

you mentioned it in the previous patch.

Note that in the no-fdt-bsp-case, it has to return a valid FDT because
otherwise the ofw initialization fails.

I tested that modified version on xilinx_zynq_a9_qemu and on BBB and it
seems to work fine. If you are OK with this modification (and no one
objects in the next two days) I'll push the patches with this
modification.


Please push if no one objects.

 > If you are on vacation, enjoy your vacations :)

Thanks. It wouldn't be reasonable to travel during a pandemic and I
don't like traveling anyway.

+1

Therefore it's a quiet and relaxing
vacation ;-)


:)


Thanks,
Niteesh.

Best regards

Christian

 >
 > Thanks,
 > Niteesh.
 >
 >
 >     Best regards
 >
 >     Christian
 >
 >     On 17/12/2020 12:15, Niteesh G. S. wrote:
 >      > ping.
 >      >
 >      >
 >      > On Fri, Dec 4, 2020 at 1:41 PM G S Niteesh Babu
 >     mailto:niteesh...@gmail.com>
<mailto:niteesh...@gmail.com <mailto:niteesh...@gmail.com>>
 >      > <mailto:niteesh...@gmail.com <mailto:niteesh...@gmail.com>
<mailto:niteesh...@gmail.com <mailto:niteesh...@gmail.com>>>> wrote:
 >      >
 >      >     This commit adds a basic test that tests all the
implemented
 >      >     RTEMS OFW functions.
 >      >     ---
 >      >       spec/build/testsuites/libtests/grp.yml   |   2 +
 >      >       spec/build/testsuites/libtests/ofw01.yml |  21 +++
 >      >       testsuites/libtests/ofw01/init.c         | 197
 >     +++
 >      >       testsuites/libtests/ofw01/ofw01.doc      |  29 
 >      >       testsuites/libtests/ofw01/ofw01.scn      |   2 +
 >      >       testsuites/libtests/ofw01/some.c         |  72 +
 >      >       testsuites/libtests/ofw01/some.dts       |  76 +
 >      >       testsuites/libtests/ofw01/some.h         |  15 ++
 >      >       8 files changed, 414 insertions(+)
 >      >       create mode 100644
spec/build/testsuites/libtests/ofw01.yml
 >      >       create mode 100644 testsuites/libtests/ofw01/init.c
 >      >       create mode 100644 testsuites/libtests/ofw01/ofw01.doc
 >      >       create mode 100644 testsuites/libtests/ofw01/ofw01.scn
 >      >       create mode 100644 testsuites/libtests/ofw01/some.c
 >      >       create mode 100644 testsuites/libtests/ofw01/some.dts
 >      >       create mode 100644 testsuites/libtests/ofw01/some.h
 >      >
 >      >     diff --git a/spec/build/testsuites/libtests/grp.yml
 >      >     b/spec/build/testsuites/libtests/grp.yml
 >      >     index aff46c9f8f..82c2288e2f 100644
 >      >     --- a/spec/build/testsuites/libtests/grp.yml
 >      >     +++ b/spec/build/testsuites/libtests/grp.yml
 >      >     @@ -316,6 +316,8 @@ links:
 >      >         uid: write
 >      >       - role: build-dependency
 >      >         uid: writev
 >      >     +- role: build-dependency
 >      >     +  uid: ofw01
 >      >       type: build
 >      >       use-after:
 >      >       - rtemstest
 >      >     diff --git a/spec/build/testsuites/libtests/ofw01.yml
 >      >     b/spec/build/testsuites/libtests/ofw01.yml
 >   

[PATCH] bsp/imx: Fix system counter init for imx6

2021-01-18 Thread Christian Mauderer
For i.MX7 U-Boot initializes the system counter. On i.MX6 Barebox is
often used which doesn't initialize the counter. With this patch, we try
to auto-detect whether the counter is initialized or not and do the
initialization ourself if necessary.

Closes #3869
---
 bsps/arm/imx/start/bspstart.c | 61 ++-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/bsps/arm/imx/start/bspstart.c b/bsps/arm/imx/start/bspstart.c
index 9f610d1ff5..238bc2bd28 100644
--- a/bsps/arm/imx/start/bspstart.c
+++ b/bsps/arm/imx/start/bspstart.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -59,6 +60,60 @@ uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t 
icells)
   return intr[1] + MAGIC_IRQ_OFFSET;
 }
 
+static bool imx_is_imx6(const void *fdt)
+{
+  /*
+   * At the moment: Check for some compatible strings that should be there
+   * somewhere in every fdt.
+   *
+   * FIXME: It would be nice if some CPU-ID could be used instead. But I didn't
+   * find one.
+   */
+  int node;
+
+  node = fdt_node_offset_by_compatible(fdt, -1, "fsl,imx6ul");
+  if (node >= 0) {
+return true;
+  }
+
+  node = fdt_node_offset_by_compatible(fdt, -1, "fsl,imx6ull");
+  if (node >= 0) {
+return true;
+  }
+
+  return false;
+}
+
+#define SYSCNT_CNTCR  (0x0)
+#define SYSCNT_CNTCR_ENABLE   (1 << 0)
+#define SYSCNT_CNTCR_HDBG (1 << 1)
+#define SYSCNT_CNTCR_FCREQ(n) (1 << (8 + (n)))
+#define SYSCNT_CNTFID(n)  (0x20 + 4 * (n))
+
+static uint32_t imx_syscnt_enable_and_return_frequency(const void *fdt)
+{
+  uint32_t freq;
+  volatile void *syscnt_base;
+
+  /* That's not in the usual FDTs. Sorry for falling back to a magic value. */
+  if (imx_is_imx6(fdt)) {
+syscnt_base = (void *)0x021dc000;
+  } else {
+syscnt_base = (void *)0x306c;
+  }
+
+  freq = *(uint32_t *)(syscnt_base + SYSCNT_CNTFID(0));
+
+  arm_cp15_set_counter_frequency(freq);
+
+  *(uint32_t *)(syscnt_base + SYSCNT_CNTCR) =
+SYSCNT_CNTCR_ENABLE |
+SYSCNT_CNTCR_HDBG |
+SYSCNT_CNTCR_FCREQ(0);
+
+  return freq;
+}
+
 void arm_generic_timer_get_config(
   uint32_t *frequency,
   uint32_t *irq
@@ -76,7 +131,11 @@ void arm_generic_timer_get_config(
   if (val != NULL && len >= 4) {
 *frequency = fdt32_to_cpu(val[0]);
   } else {
-bsp_fatal(IMX_FATAL_GENERIC_TIMER_FREQUENCY);
+/*
+ * Normally clock-frequency would be provided by the boot loader. If it
+ * didn't add one, we have to initialize the system counter ourself.
+ */
+*frequency = imx_syscnt_enable_and_return_frequency(fdt);
   }
 
   /* FIXME: Figure out how Linux gets a proper IRQ number */
-- 
2.26.2

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


Re: [PATCH] bsp/imx: Fix system counter init for imx6

2021-01-18 Thread Christian MAUDERER

Hello,

I want to backport that patch to RTEMS 5 too because this problem 
occurred multiple times on the mailing list. If that is OK I'll create a 
separate ticket for RTEMS 5 that describes that problem. For RTEMS 6 it 
should finally be the last step to closing the "add i.MX6UL" ticket.


Best regards

Christian

Am 18.01.21 um 10:02 schrieb Christian Mauderer:

For i.MX7 U-Boot initializes the system counter. On i.MX6 Barebox is
often used which doesn't initialize the counter. With this patch, we try
to auto-detect whether the counter is initialized or not and do the
initialization ourself if necessary.

Closes #3869
---
  bsps/arm/imx/start/bspstart.c | 61 ++-
  1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/bsps/arm/imx/start/bspstart.c b/bsps/arm/imx/start/bspstart.c
index 9f610d1ff5..238bc2bd28 100644
--- a/bsps/arm/imx/start/bspstart.c
+++ b/bsps/arm/imx/start/bspstart.c
@@ -19,6 +19,7 @@
  #include 
  #include 
  #include 
+#include 
  
  #include 
  
@@ -59,6 +60,60 @@ uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)

return intr[1] + MAGIC_IRQ_OFFSET;
  }
  
+static bool imx_is_imx6(const void *fdt)

+{
+  /*
+   * At the moment: Check for some compatible strings that should be there
+   * somewhere in every fdt.
+   *
+   * FIXME: It would be nice if some CPU-ID could be used instead. But I didn't
+   * find one.
+   */
+  int node;
+
+  node = fdt_node_offset_by_compatible(fdt, -1, "fsl,imx6ul");
+  if (node >= 0) {
+return true;
+  }
+
+  node = fdt_node_offset_by_compatible(fdt, -1, "fsl,imx6ull");
+  if (node >= 0) {
+return true;
+  }
+
+  return false;
+}
+
+#define SYSCNT_CNTCR  (0x0)
+#define SYSCNT_CNTCR_ENABLE   (1 << 0)
+#define SYSCNT_CNTCR_HDBG (1 << 1)
+#define SYSCNT_CNTCR_FCREQ(n) (1 << (8 + (n)))
+#define SYSCNT_CNTFID(n)  (0x20 + 4 * (n))
+
+static uint32_t imx_syscnt_enable_and_return_frequency(const void *fdt)
+{
+  uint32_t freq;
+  volatile void *syscnt_base;
+
+  /* That's not in the usual FDTs. Sorry for falling back to a magic value. */
+  if (imx_is_imx6(fdt)) {
+syscnt_base = (void *)0x021dc000;
+  } else {
+syscnt_base = (void *)0x306c;
+  }
+
+  freq = *(uint32_t *)(syscnt_base + SYSCNT_CNTFID(0));
+
+  arm_cp15_set_counter_frequency(freq);
+
+  *(uint32_t *)(syscnt_base + SYSCNT_CNTCR) =
+SYSCNT_CNTCR_ENABLE |
+SYSCNT_CNTCR_HDBG |
+SYSCNT_CNTCR_FCREQ(0);
+
+  return freq;
+}
+
  void arm_generic_timer_get_config(
uint32_t *frequency,
uint32_t *irq
@@ -76,7 +131,11 @@ void arm_generic_timer_get_config(
if (val != NULL && len >= 4) {
  *frequency = fdt32_to_cpu(val[0]);
} else {
-bsp_fatal(IMX_FATAL_GENERIC_TIMER_FREQUENCY);
+/*
+ * Normally clock-frequency would be provided by the boot loader. If it
+ * didn't add one, we have to initialize the system counter ourself.
+ */
+*frequency = imx_syscnt_enable_and_return_frequency(fdt);
}
  
/* FIXME: Figure out how Linux gets a proper IRQ number */




--

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] bsp/imx: Fix system counter init for imx6

2021-01-19 Thread Christian MAUDERER

Am 18.01.21 um 22:45 schrieb Chris Johns:

On 18/1/21 8:05 pm, Christian MAUDERER wrote:

I want to backport that patch to RTEMS 5 too because this problem occurred
multiple times on the mailing list. If that is OK I'll create a separate ticket
for RTEMS 5 that describes that problem. For RTEMS 6 it should finally be the
last step to closing the "add i.MX6UL" ticket.


This is OK for RTEMS 5. Please create the ticket and push the change when you
are ready.

Thanks
Chris



Hello Chris,

thanks for the OK for 5. I'll give the patch a few days more review time 
before I push it to master and 5.


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: [rtems commit] bsps/shared: Adapt fsl-edma driver for imxrt

2021-01-22 Thread Christian MAUDERER

Am 22.01.21 um 14:04 schrieb Sebastian Huber:


On 21/01/2021 10:26, Christian Mauderer wrote:

  spec/build/bsps/obj.yml  |   5 +
This is the wrong place for these files. Please add a separate object 
for the driver and link to this object in all BSPs which use the driver.




Sorry. I'll create a commit to fix it soon.

I thought that the commit would be OK after it had been on the list for 
about one month without objections.


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

  1   2   3   4   5   6   7   8   9   10   >