Re: RTEMS Source Builder OpenBSD support.

2015-06-22 Thread Karel Gardas

On 06/22/15 02:24 AM, Chris Johns wrote:

On 22/06/2015 4:37 am, Karel Gardas wrote:


attach is git patch which provides basic OpenBSD support to the RTEMS
source builder.


Thanks. I pushed it then reverted it when I notice it has a GPL license.
I have changed the solaris license and pushed that.

I hope this is not an issue. The RSB is all BSD licensed except asciidoc
and I would like to move to REST which would remove this dependence.



No, problem, but in my copy which I pulled yesterday, there are more 
GPLs. For example openbsd.py was copied from netbsd.py since both are 
most closed IMHO. So GPLed code in my copy is:


solaris.py (you have changed that already)
netbsd.py
freebsd.py

Of course I'm free to license my changes under BSD license, please 
relicense for me. Thanks!



../rtemstoolkit/elftoolchain/libelf/elf.c:36: error: 'LIBELF_CLASS'
undeclared here (not in a function)


positive thing is that upstream version of elftoolchain project already
supports OpenBSD and I've tested the libelf is buildable on it, so it's
perhaps "just" of the matter of updating to what upstream provides?


I will have to take a look and see. It has been a while since I did this
and I cannot remember what I changed to get this to work. It will have
to be later this week as I have dead lines this week.


No rush at all! I also do have deadlines this and next week.


To reacap current status: iconv is not used in newlib due to issue with
big5 encoding (configure complains about it). GDB is build w/o python
since linking against libpython on OpenBSD fails for so far to me
unknown reason.


Can you build a native gdb for OpenBSD with Python ?



Will try once I got to it.

Thanks,
Karel

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


Re: RTEMS Source Builder newlib/iconv issues on OpenBSD/Solaris

2015-06-22 Thread Karel Gardas

On 06/22/15 01:29 AM, Gedare Bloom wrote:

The general question is what's better and how to solve this issue? Just a
note in builder doc for both platforms? Or custom patch to newlib to check
for ggrep/gsed and when available to use them? Or just disabling iconv
completely in platform .py file of the source builder itself? Or hacking
source builder to support building GNU sed/grep on problematic platform,
installing in RTEMS bin and use that and this way make newlib happy?


Probably start with a note. The last option you gave is probably the
most suitable, to have RSB able to build the required dependency
packages from source.


After sending this email I've found hopefully even easier option. We may 
require gnu tools installed, in fact we already did it, so we may just 
link GNU sed/grep to RTEMS tools bin which is first in PATH and be done 
with it. Hopefully such linking is more easier than building the package...



Whether to patch newlib or not should be
consulted to the newlib mailing list.


Indeed, and this is too far for me at least in the current situation.

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


Re: administration tickets was Re: 4.11 Release Description Help Needed

2015-06-22 Thread Sebastian Huber



On 09/06/15 21:14, Sebastian Huber wrote:

- Joel Sherrill  schrieb:

>
>
>On 6/9/2015 1:45 PM, Sebastian Huber wrote:

> >
> >- Sebastian Huber  schrieb:

> >>
> >>
> >>On 03/06/15 12:59, Joel Sherrill wrote:

> >>>On June 3, 2015 4:34:31 AM EDT, Sebastian 
Huber   wrote:

> >Hi,
> >
> >I added some points. What is a bit confusing is that the documentation
> >is not up to date, e.g.
> >
> 
>https://docs.rtems.org/doc-current/share/rtems/html/bsp_howto/Clock-Driver.html#Clock-Driver
> >
> >still reflects the old clock driver API.

> >>>Is it fixed in the source and just needs regenerating on the server? Or is 
there writing to do?
> >>>

> >>
> >>I fixed this in the sources some time ago.  It seems that the automatic
> >>updated doesn't work.

> >
> >The documentation is still not up to date.
> >

>
>There are three tickets for administration work to be done.
>
>2200 - IRC logs/bot on new servers
>2199 - Automated Document Build on new servers
>2198 - Automate Doxygen Build on new servers
>
>I pinged all of them and added you. CC'ed Chris to remind him also.

I was about to edit the release notes.  I think we should generate the 4.11 
texinfo documentation first and make it available via the web site.  Then we 
can add links to this version instead of the development snapshot which may be 
quite misleading after the release.  We should also review it to make sure it 
is up to date.


The texinfo documentation snapshot is still out dated.  For proper 
release notes it would be nice to have the links to the 4.11 
documentation available.


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
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 2/2] Raspberry Pi implementation for the RTEMS GPIO API.

2015-06-22 Thread Andre Marques
Test cases can be found in https://github.com/asuol/RTEMS_rpi_testing
---
 c/src/lib/libbsp/arm/raspberrypi/Makefile.am   |   7 +-
 .../raspberrypi/gpio/gpio-interfaces-pi1-rev2.c| 135 +
 c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c   | 334 +
 .../libbsp/arm/raspberrypi/include/raspberrypi.h   |  79 -
 .../lib/libbsp/arm/raspberrypi/include/rpi-gpio.h  |  76 +
 c/src/lib/libbsp/arm/raspberrypi/irq/irq.c | 105 ++-
 c/src/lib/libbsp/arm/raspberrypi/preinstall.am |   4 +
 7 files changed, 722 insertions(+), 18 deletions(-)
 create mode 100644 
c/src/lib/libbsp/arm/raspberrypi/gpio/gpio-interfaces-pi1-rev2.c
 create mode 100644 c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c
 create mode 100644 c/src/lib/libbsp/arm/raspberrypi/include/rpi-gpio.h

diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am 
b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
index c6133df..36a6f56 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
@@ -44,6 +44,7 @@ include_bsp_HEADERS += include/irq.h
 include_bsp_HEADERS += include/mmu.h
 include_bsp_HEADERS += include/usart.h
 include_bsp_HEADERS += include/raspberrypi.h
+include_bsp_HEADERS += include/rpi-gpio.h
 
 include_libcpu_HEADERS = ../../../libcpu/arm/shared/include/cache_.h \
 ../../../libcpu/arm/shared/include/arm-cp15.h
@@ -79,7 +80,6 @@ libbsp_a_SOURCES += ../../shared/bspclean.c
 libbsp_a_SOURCES += ../../shared/bspgetworkarea.c
 libbsp_a_SOURCES += ../../shared/bsplibc.c
 libbsp_a_SOURCES += ../../shared/bsppost.c
-libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
 libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
 libbsp_a_SOURCES += ../../shared/cpucounterread.c
 libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
@@ -88,6 +88,7 @@ libbsp_a_SOURCES += ../../shared/sbrk.c
 libbsp_a_SOURCES += ../../shared/src/stackalloc.c
 libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
 libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
+libbsp_a_SOURCES += ../../shared/gpio.c
 
 # Startup
 libbsp_a_SOURCES += ../../shared/bspreset_loop.c
@@ -117,6 +118,10 @@ libbsp_a_SOURCES += clock/clockdrv.c 
../../../shared/clockdrv_shell.h
 # Timer
 libbsp_a_SOURCES += misc/timer.c
 
+# GPIO
+
+libbsp_a_SOURCES += gpio/rpi-gpio.c
+
 # RTC
 
 # SSP
diff --git a/c/src/lib/libbsp/arm/raspberrypi/gpio/gpio-interfaces-pi1-rev2.c 
b/c/src/lib/libbsp/arm/raspberrypi/gpio/gpio-interfaces-pi1-rev2.c
new file mode 100644
index 000..5699636
--- /dev/null
+++ b/c/src/lib/libbsp/arm/raspberrypi/gpio/gpio-interfaces-pi1-rev2.c
@@ -0,0 +1,135 @@
+/**
+ * @file gpio-interfaces.c
+ *
+ * @ingroup raspberrypi_gpio
+ *
+ * @brief Raspberry PI GPIO interface definitions.
+ */
+
+/*
+ *  Copyright (c) 2015 Andre Marques 
+ *
+ *  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.
+ */
+
+rtems_gpio_pin_conf arm_tdi = {
+ pin_number: 4,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[5]
+};
+
+rtems_gpio_pin_conf arm_trst = {
+ pin_number: 22,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[4]
+};
+
+rtems_gpio_pin_conf arm_tdo = {
+ pin_number: 24,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[4]
+};
+
+rtems_gpio_pin_conf arm_tck = {
+ pin_number: 25,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[4]
+};
+
+rtems_gpio_pin_conf arm_tms = {
+ pin_number: 27,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[4]
+};
+
+rtems_gpio_pin_conf spi_miso = {
+ pin_number: 7,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[0]
+};
+
+rtems_gpio_pin_conf spi_mosi = {
+ pin_number: 8,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[0]
+};
+
+rtems_gpio_pin_conf spi_sclk = {
+ pin_number: 9,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[0]
+};
+
+rtems_gpio_pin_conf spi_ce_0 = {
+ pin_number: 10,
+ function: BSP_SPECIFIC,
+ pull_mode: NO_PULL_RESISTOR,
+ interrupt: NULL,
+ output_enabled: FALSE,
+ logic_invert: FALSE,
+ bsp_specific: &alt_func_def[0]
+};
+
+rtems_gpio_pin_conf spi_ce_1 = {
+ pin_number: 11,
+ function: BSP_SPECIFIC,
+ pull_mode

[PATCH 1/2] RTEMS GPIO API definition and implementation.

2015-06-22 Thread Andre Marques
---
 c/src/lib/libbsp/Makefile.am   |3 +-
 c/src/lib/libbsp/preinstall.am |4 +
 c/src/lib/libbsp/shared/gpio.c | 1083 
 c/src/lib/libbsp/shared/include/gpio.h |  610 ++
 4 files changed, 1699 insertions(+), 1 deletion(-)
 create mode 100644 c/src/lib/libbsp/shared/gpio.c
 create mode 100644 c/src/lib/libbsp/shared/include/gpio.h

diff --git a/c/src/lib/libbsp/Makefile.am b/c/src/lib/libbsp/Makefile.am
index 3cab4d7..a039a98 100644
--- a/c/src/lib/libbsp/Makefile.am
+++ b/c/src/lib/libbsp/Makefile.am
@@ -9,7 +9,7 @@ EXTRA_DIST = MERGE.PROCEDURE bsp.am
 EXTRA_DIST += shared/bootcard.c shared/bspclean.c \
 shared/bsplibc.c shared/bsppost.c shared/console-polled.c \
 shared/console.c shared/gnatinstallhandler.c shared/sbrk.c \
-shared/tod.c
+shared/tod.c shared/gpio.c
 EXTRA_DIST += shared/vmeUniverse/vmeUniverse.c \
 shared/vmeUniverse/vmeUniverse.h \
 shared/vmeUniverse/vmeUniverseDMA.h \
@@ -35,6 +35,7 @@ include_bsp_HEADERS =
 include_bsp_HEADERS += shared/include/default-initial-extension.h
 include_bsp_HEADERS += shared/include/fatal.h
 include_bsp_HEADERS += shared/include/console-termios.h
+include_bsp_HEADERS += shared/include/gpio.h
 
 include $(srcdir)/preinstall.am
 include $(top_srcdir)/automake/subdirs.am
diff --git a/c/src/lib/libbsp/preinstall.am b/c/src/lib/libbsp/preinstall.am
index 651f136..bbcb7c5 100644
--- a/c/src/lib/libbsp/preinstall.am
+++ b/c/src/lib/libbsp/preinstall.am
@@ -30,3 +30,7 @@ $(PROJECT_INCLUDE)/bsp/console-termios.h: 
shared/include/console-termios.h $(PRO
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/console-termios.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/console-termios.h
 
+$(PROJECT_INCLUDE)/bsp/gpio.h: shared/include/gpio.h 
$(PROJECT_INCLUDE)/bsp/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/gpio.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/gpio.h
+
diff --git a/c/src/lib/libbsp/shared/gpio.c b/c/src/lib/libbsp/shared/gpio.c
new file mode 100644
index 000..12cdb29
--- /dev/null
+++ b/c/src/lib/libbsp/shared/gpio.c
@@ -0,0 +1,1083 @@
+/**
+ * @file gpio.c
+ *
+ * @ingroup rtems_gpio
+ *
+ * @brief RTEMS GPIO API implementation.
+ */
+
+/*
+ *  Copyright (c) 2014-2015 Andre Marques 
+ *
+ *  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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/**
+ * @brief GPIO API mutex atributes.
+ */
+#define MUTEX_ATRIBUTES \
+  ( RTEMS_LOCAL \
+| RTEMS_PRIORITY\
+| RTEMS_BINARY_SEMAPHORE\
+| RTEMS_INHERIT_PRIORITY\
+| RTEMS_NO_PRIORITY_CEILING \
+)
+
+#define AQUIRE_LOCK(m) assert( rtems_semaphore_obtain(m,\
+  RTEMS_WAIT,   \
+  RTEMS_NO_TIMEOUT  \
+  ) == RTEMS_SUCCESSFUL )
+
+#define RELEASE_LOCK(m) assert( rtems_semaphore_release(m) == RTEMS_SUCCESSFUL 
)
+
+/*Encapsulates relevant data for a GPIO interrupt handler. */
+typedef struct _gpio_handler_list
+{
+  struct _gpio_handler_list *next_isr;
+
+  /* User-defined ISR routine. */
+  rtems_gpio_irq_state (*handler) (void *arg);
+
+  /* User-defined arguments for the ISR routine. */
+  void *arg;
+} gpio_handler_list;
+
+/* Encapsulates relevant data about a GPIO pin. */
+typedef struct
+{
+  uint32_t bank_number;
+  uint32_t pin_number;
+
+  rtems_gpio_function pin_function;
+
+  /* Type of event which will trigger an interrupt. */
+  rtems_gpio_interrupt enabled_interrupt;
+
+  /* Id of the task that will be calling the user-defined ISR handlers
+   * for this pin. */
+  rtems_id task_id;
+
+  /* ISR shared flag. */
+  rtems_gpio_handler_flag handler_flag;
+
+  /* Linked list of interrupt handlers. */
+  gpio_handler_list *handler_list;
+
+  /* GPIO input (pull resistor) pin mode. */
+  rtems_gpio_pull_mode resistor_mode;
+
+  /* If true inverts digital in/out logic. */
+  int logic_invert;
+
+  /* Switch-deboucing information. */
+  int debouncing_tick_count;
+  rtems_interval last_isr_tick;
+} gpio_pin;
+
+static gpio_pin** gpio_pin_state;
+static Atomic_Flag init_flag = ATOMIC_INITIALIZER_FLAG;
+static uint32_t gpio_count;
+static uint32_t bank_count;
+static uint32_t pins_per_bank;
+static uint32_t odd_bank_pins;
+static uint32_t* interrupt_counter;
+static rtems_id* bank_lock;
+
+#define BANK_NUMBER(pin_number) pin_number / pins_per_bank
+#define PIN_NUMBER(pin_number) pin_number % pins_per_bank
+
+static int debounce_switch(gpio_pin* gpio)
+{
+  rtems_interval time;
+
+  time = rtems_clock_get_ticks_since_boot();
+
+  /* If not enough time has elapsed since last interrupt. */

Re: RTEMS Source Builder OpenBSD support.

2015-06-22 Thread Chris Johns
On 22/06/2015 6:27 pm, Karel Gardas wrote:
> On 06/22/15 02:24 AM, Chris Johns wrote:
>> On 22/06/2015 4:37 am, Karel Gardas wrote:
>>>
>>> attach is git patch which provides basic OpenBSD support to the RTEMS
>>> source builder.
>>
>> Thanks. I pushed it then reverted it when I notice it has a GPL license.
>> I have changed the solaris license and pushed that.
>>
>> I hope this is not an issue. The RSB is all BSD licensed except asciidoc
>> and I would like to move to REST which would remove this dependence.
>>
> 
> No, problem, but in my copy which I pulled yesterday, there are more
> GPLs. For example openbsd.py was copied from netbsd.py since both are
> most closed IMHO. So GPLed code in my copy is:
> 
> solaris.py (you have changed that already)
> netbsd.py
> freebsd.py

I fixed solaris and missed netbsd. Thanks.

> 
> Of course I'm free to license my changes under BSD license, please
> relicense for me. Thanks!
> 

Excellent. I will do this. Again thanks.

>>> ../rtemstoolkit/elftoolchain/libelf/elf.c:36: error: 'LIBELF_CLASS'
>>> undeclared here (not in a function)
>>>
>>>
>>> positive thing is that upstream version of elftoolchain project already
>>> supports OpenBSD and I've tested the libelf is buildable on it, so it's
>>> perhaps "just" of the matter of updating to what upstream provides?
>>
>> I will have to take a look and see. It has been a while since I did this
>> and I cannot remember what I changed to get this to work. It will have
>> to be later this week as I have dead lines this week.
> 
> No rush at all! I also do have deadlines this and next week.
> 

Great.

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


Re: RTEMS Source Builder newlib/iconv issues on OpenBSD/Solaris

2015-06-22 Thread Chris Johns
On 22/06/2015 6:30 am, Karel Gardas wrote:
> 
> Hello,
> 
> on both Solaris 11 and OpenBSD 5.7 I do have an issue with source
> builder which fails on newlib compilation. This shows as:
> 
> checking for sparc-rtems4.11-ar... sparc-rtems4.11-ar
> checking for sparc-rtems4.11-ranlib... sparc-rtems4.11-ranlib
> checking for sparc-rtems4.11-readelf... sparc-rtems4.11-readelf
> checking whether to enable maintainer-specific portions of Makefiles... no
> checking for a sed that does not truncate output...
> /tmp/rtems-sparc-toolchain/bin//sed
> checking how to print strings... print -r
> checking for gawk... (cached) gawk
> configure: error: big5 is not supported - see
> ../../../gcc-4.9.2/newlib/libc/iconv/encoding.aliases file for the list
> of available encodings
> gmake[1]: *** [configure-target-newlib] Error 1
> gmake[1]: Leaving directory
> `/export/home/karel/vcs/rtems-source-builder/rtems/build/sparc-rtems4.11-gcc-4.9.2-newlib-2.2.0.20150423-i386-pc-solaris2-1/build'
> 
> gmake: *** [all] Error 2
> 
> 
> the problem is in newlib's configure file which strictly requires GNU
> sed/grep combo. The problem is the configure file itself invokes just
> "sed" and "grep". So there are two solutions to this issue:
> 
> Either:
> 
> - disable iconv as I did for OpenBSD in provided patch in source builder
> platform file
> 
> or
> 
> - put GNU sed and grep (perhaps grep is enough, but I would need to
> retest) into PATH in front of original system's grep/sed. This makes
> newlib configure happy.
> 
> The general question is what's better and how to solve this issue? 

We should solve the problem. I build on FreeBSD without GNU sed so I am
interested why OpenBSD would break this way.


> Just
> a note in builder doc for both platforms? Or custom patch to newlib to
> check for ggrep/gsed and when available to use them? Or just disabling
> iconv completely in platform .py file of the source builder itself? Or
> hacking source builder to support building GNU sed/grep on problematic
> platform, installing in RTEMS bin and use that and this way make newlib
> happy?
> 
> Any idea/preference welcome here.
> 

I trip over a few of these things from time to time. MIPS is currently
broken on FreeBSD because of a GNU sed issue.

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


Re: RTEMS Source Builder newlib/iconv issues on OpenBSD/Solaris

2015-06-22 Thread Karel Gardas

On 06/22/15 02:35 PM, Chris Johns wrote:

On 22/06/2015 6:30 am, Karel Gardas wrote:


Hello,

on both Solaris 11 and OpenBSD 5.7 I do have an issue with source
builder which fails on newlib compilation. This shows as:

checking for sparc-rtems4.11-ar... sparc-rtems4.11-ar
checking for sparc-rtems4.11-ranlib... sparc-rtems4.11-ranlib
checking for sparc-rtems4.11-readelf... sparc-rtems4.11-readelf
checking whether to enable maintainer-specific portions of Makefiles... no
checking for a sed that does not truncate output...
/tmp/rtems-sparc-toolchain/bin//sed
checking how to print strings... print -r
checking for gawk... (cached) gawk
configure: error: big5 is not supported - see
../../../gcc-4.9.2/newlib/libc/iconv/encoding.aliases file for the list
of available encodings
gmake[1]: *** [configure-target-newlib] Error 1
gmake[1]: Leaving directory
`/export/home/karel/vcs/rtems-source-builder/rtems/build/sparc-rtems4.11-gcc-4.9.2-newlib-2.2.0.20150423-i386-pc-solaris2-1/build'

gmake: *** [all] Error 2


the problem is in newlib's configure file which strictly requires GNU
sed/grep combo. The problem is the configure file itself invokes just
"sed" and "grep". So there are two solutions to this issue:

Either:

- disable iconv as I did for OpenBSD in provided patch in source builder
platform file

or

- put GNU sed and grep (perhaps grep is enough, but I would need to
retest) into PATH in front of original system's grep/sed. This makes
newlib configure happy.

The general question is what's better and how to solve this issue?


We should solve the problem. I build on FreeBSD without GNU sed so I am
interested why OpenBSD would break this way.


My guess is that the issue is in this code:

iconv_encodings=`echo "${iconv_encodings}" | sed -e 's/,/ /g' -e 
's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
  iconv_to_encodings=`echo "${iconv_to_encodings}" | sed -e 's/,/ /g' 
-e 's/-/_/g' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
  iconv_from_encodings=`echo "${iconv_from_encodings}" | sed -e 's/,/ 
/g' -e 's/-/_/g' -e 
'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`


  available_encodings=`cat "${srcdir}/libc/iconv/encoding.aliases" 
| sed -e '/^#.*/d'`



iconv_encodings1="${iconv_encodings}"
  iconv_encodings=""
  for encoding in ${iconv_encodings1}; do
  result=`echo "${available_encodings}" | grep -e "\(^\| 
\)${encoding}\( \|\$\)"`

  if test $? != "0"; then
  as_fn_error $? "${encoding} is not supported - see 
${srcdir}/libc/iconv/encoding.aliases file for the list of available 
encodings" "$LINENO" 5

  fi
  encoding1=`echo "${result}" | sed -e 's/\(^[^ ]*\).*$/\1/'`
  iconv_encodings="${iconv_encodings} ${encoding1}"
  done


both sed and grep are used there. Honestly I'm still not able to debug 
that since for me source builder is black box which needs to run from 
the start to end and I'm not probably not allowed to hack some debugging 
messages there to see if the grep or sed is actually the culprit here.


Anyway, "sed -e" rings the bell here since I've already seen quite some 
issue with it on Solaris 11 in GHC project, E.g. 
https://phabricator.haskell.org/D740 -- but this is just a tip of the 
iceberg.


Hence my "solution" to use GNU sed/grep solely for this...

BTW: I'm talking about Solaris 11 since symptomps are the same on 
Solaris 11 and on OpenBSD... Debugging may actually reveals different 
reason...


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


Re: [PATCH 1/2] RTEMS GPIO API definition and implementation.

2015-06-22 Thread Gedare Bloom
(


On Mon, Jun 22, 2015 at 8:01 AM, Andre Marques
 wrote:
> ---
>  c/src/lib/libbsp/Makefile.am   |3 +-
>  c/src/lib/libbsp/preinstall.am |4 +
>  c/src/lib/libbsp/shared/gpio.c | 1083 
> 
>  c/src/lib/libbsp/shared/include/gpio.h |  610 ++
>  4 files changed, 1699 insertions(+), 1 deletion(-)
>  create mode 100644 c/src/lib/libbsp/shared/gpio.c
>  create mode 100644 c/src/lib/libbsp/shared/include/gpio.h
>
> diff --git a/c/src/lib/libbsp/Makefile.am b/c/src/lib/libbsp/Makefile.am
> index 3cab4d7..a039a98 100644
> --- a/c/src/lib/libbsp/Makefile.am
> +++ b/c/src/lib/libbsp/Makefile.am
> @@ -9,7 +9,7 @@ EXTRA_DIST = MERGE.PROCEDURE bsp.am
>  EXTRA_DIST += shared/bootcard.c shared/bspclean.c \
>  shared/bsplibc.c shared/bsppost.c shared/console-polled.c \
>  shared/console.c shared/gnatinstallhandler.c shared/sbrk.c \
> -shared/tod.c
> +shared/tod.c shared/gpio.c
>  EXTRA_DIST += shared/vmeUniverse/vmeUniverse.c \
>  shared/vmeUniverse/vmeUniverse.h \
>  shared/vmeUniverse/vmeUniverseDMA.h \
> @@ -35,6 +35,7 @@ include_bsp_HEADERS =
>  include_bsp_HEADERS += shared/include/default-initial-extension.h
>  include_bsp_HEADERS += shared/include/fatal.h
>  include_bsp_HEADERS += shared/include/console-termios.h
> +include_bsp_HEADERS += shared/include/gpio.h
>
>  include $(srcdir)/preinstall.am
>  include $(top_srcdir)/automake/subdirs.am
> diff --git a/c/src/lib/libbsp/preinstall.am b/c/src/lib/libbsp/preinstall.am
> index 651f136..bbcb7c5 100644
> --- a/c/src/lib/libbsp/preinstall.am
> +++ b/c/src/lib/libbsp/preinstall.am
> @@ -30,3 +30,7 @@ $(PROJECT_INCLUDE)/bsp/console-termios.h: 
> shared/include/console-termios.h $(PRO
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/console-termios.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/console-termios.h
>
> +$(PROJECT_INCLUDE)/bsp/gpio.h: shared/include/gpio.h 
> $(PROJECT_INCLUDE)/bsp/$(dirstamp)
> +   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/gpio.h
> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/gpio.h
> +
> diff --git a/c/src/lib/libbsp/shared/gpio.c b/c/src/lib/libbsp/shared/gpio.c
> new file mode 100644
> index 000..12cdb29
> --- /dev/null
> +++ b/c/src/lib/libbsp/shared/gpio.c
> @@ -0,0 +1,1083 @@
> +/**
> + * @file gpio.c
> + *
> + * @ingroup rtems_gpio
> + *
> + * @brief RTEMS GPIO API implementation.
> + */
> +
> +/*
> + *  Copyright (c) 2014-2015 Andre Marques 
> + *
> + *  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.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +/**
> + * @brief GPIO API mutex atributes.
spelling: attributes

> + */
> +#define MUTEX_ATRIBUTES \
here too.

> +  ( RTEMS_LOCAL \
> +| RTEMS_PRIORITY\
> +| RTEMS_BINARY_SEMAPHORE\
> +| RTEMS_INHERIT_PRIORITY\
> +| RTEMS_NO_PRIORITY_CEILING \
> +)
> +
> +#define AQUIRE_LOCK(m) assert( rtems_semaphore_obtain(m,\
spelling: ACQUIRE

> +  RTEMS_WAIT,   \
> +  RTEMS_NO_TIMEOUT  \
> +  ) == RTEMS_SUCCESSFUL )
> +
> +#define RELEASE_LOCK(m) assert( rtems_semaphore_release(m) == 
> RTEMS_SUCCESSFUL )
> +
> +/*Encapsulates relevant data for a GPIO interrupt handler. */
Add Doxygen for all of these structs

> +typedef struct _gpio_handler_list
> +{
> +  struct _gpio_handler_list *next_isr;
Consider using an RTEMS chain (doubly-linked list) here. It would save
on some list-manipulation code, and force you to use readable
functions that already exist in the rtems namespace. If you want one
list per pin, you can embed an rtems_chain_control in each gpio_pin.

> +
> +  /* User-defined ISR routine. */
> +  rtems_gpio_irq_state (*handler) (void *arg);
> +
> +  /* User-defined arguments for the ISR routine. */
> +  void *arg;
> +} gpio_handler_list;
> +
> +/* Encapsulates relevant data about a GPIO pin. */
> +typedef struct
> +{
> +  uint32_t bank_number;
> +  uint32_t pin_number;
> +
> +  rtems_gpio_function pin_function;
> +
> +  /* Type of event which will trigger an interrupt. */
> +  rtems_gpio_interrupt enabled_interrupt;
enabled_interrupt brings to mind isr enable/disable, if this field is
more than a bool, then a more descriptive name should be used.

> +
> +  /* Id of the task that will be calling the user-defined ISR handlers
> +   * for this pin. */
> +  rtems_id task_id;
perhaps 'handler_task_id' can help readability

> +
> +  /* ISR shared flag. */
> +  rtems_gpio_handler_flag handler_flag;
> +
> +  /* Linked list of interrupt handlers. */
> +  gpio_handler_list *handler_list;
> +
> +  /

Re: [PATCH 2/2] Raspberry Pi implementation for the RTEMS GPIO API.

2015-06-22 Thread Gedare Bloom
On Mon, Jun 22, 2015 at 8:01 AM, Andre Marques
 wrote:
> Test cases can be found in https://github.com/asuol/RTEMS_rpi_testing
> ---
>  c/src/lib/libbsp/arm/raspberrypi/Makefile.am   |   7 +-
>  .../raspberrypi/gpio/gpio-interfaces-pi1-rev2.c| 135 +
>  c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c   | 334 
> +
>  .../libbsp/arm/raspberrypi/include/raspberrypi.h   |  79 -
>  .../lib/libbsp/arm/raspberrypi/include/rpi-gpio.h  |  76 +
>  c/src/lib/libbsp/arm/raspberrypi/irq/irq.c | 105 ++-
>  c/src/lib/libbsp/arm/raspberrypi/preinstall.am |   4 +
>  7 files changed, 722 insertions(+), 18 deletions(-)
>  create mode 100644 
> c/src/lib/libbsp/arm/raspberrypi/gpio/gpio-interfaces-pi1-rev2.c
>  create mode 100644 c/src/lib/libbsp/arm/raspberrypi/gpio/rpi-gpio.c
>  create mode 100644 c/src/lib/libbsp/arm/raspberrypi/include/rpi-gpio.h
>
> diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am 
> b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
> index c6133df..36a6f56 100644
> --- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
> +++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am
> @@ -44,6 +44,7 @@ include_bsp_HEADERS += include/irq.h
>  include_bsp_HEADERS += include/mmu.h
>  include_bsp_HEADERS += include/usart.h
>  include_bsp_HEADERS += include/raspberrypi.h
> +include_bsp_HEADERS += include/rpi-gpio.h
>
>  include_libcpu_HEADERS = ../../../libcpu/arm/shared/include/cache_.h \
>  ../../../libcpu/arm/shared/include/arm-cp15.h
> @@ -79,7 +80,6 @@ libbsp_a_SOURCES += ../../shared/bspclean.c
>  libbsp_a_SOURCES += ../../shared/bspgetworkarea.c
>  libbsp_a_SOURCES += ../../shared/bsplibc.c
>  libbsp_a_SOURCES += ../../shared/bsppost.c
> -libbsp_a_SOURCES += ../../shared/bsppredriverhook.c
>  libbsp_a_SOURCES += ../../shared/bsppretaskinghook.c
>  libbsp_a_SOURCES += ../../shared/cpucounterread.c
>  libbsp_a_SOURCES += ../../shared/cpucounterdiff.c
> @@ -88,6 +88,7 @@ libbsp_a_SOURCES += ../../shared/sbrk.c
>  libbsp_a_SOURCES += ../../shared/src/stackalloc.c
>  libbsp_a_SOURCES += ../shared/startup/bsp-start-memcpy.S
>  libbsp_a_SOURCES += ../shared/arm-cp15-set-ttb-entries.c
> +libbsp_a_SOURCES += ../../shared/gpio.c
>
>  # Startup
>  libbsp_a_SOURCES += ../../shared/bspreset_loop.c
> @@ -117,6 +118,10 @@ libbsp_a_SOURCES += clock/clockdrv.c 
> ../../../shared/clockdrv_shell.h
>  # Timer
>  libbsp_a_SOURCES += misc/timer.c
>
> +# GPIO
> +
> +libbsp_a_SOURCES += gpio/rpi-gpio.c
> +
>  # RTC
>
>  # SSP
> diff --git a/c/src/lib/libbsp/arm/raspberrypi/gpio/gpio-interfaces-pi1-rev2.c 
> b/c/src/lib/libbsp/arm/raspberrypi/gpio/gpio-interfaces-pi1-rev2.c
> new file mode 100644
> index 000..5699636
> --- /dev/null
> +++ b/c/src/lib/libbsp/arm/raspberrypi/gpio/gpio-interfaces-pi1-rev2.c
> @@ -0,0 +1,135 @@
> +/**
> + * @file gpio-interfaces.c
> + *
> + * @ingroup raspberrypi_gpio
> + *
> + * @brief Raspberry PI GPIO interface definitions.
> + */
> +
> +/*
> + *  Copyright (c) 2015 Andre Marques 
> + *
> + *  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.
> + */
> +
> +rtems_gpio_pin_conf arm_tdi = {
> + pin_number: 4,
> + function: BSP_SPECIFIC,
> + pull_mode: NO_PULL_RESISTOR,
> + interrupt: NULL,
> + output_enabled: FALSE,
> + logic_invert: FALSE,
> + bsp_specific: &alt_func_def[5]
> +};
These can be made const, and : initializers should not be used as they
are non-standard, you can use . instead for designated initializers.

> +
> +rtems_gpio_pin_conf arm_trst = {
> + pin_number: 22,
> + function: BSP_SPECIFIC,
> + pull_mode: NO_PULL_RESISTOR,
> + interrupt: NULL,
> + output_enabled: FALSE,
> + logic_invert: FALSE,
> + bsp_specific: &alt_func_def[4]
> +};
> +
> +rtems_gpio_pin_conf arm_tdo = {
> + pin_number: 24,
> + function: BSP_SPECIFIC,
> + pull_mode: NO_PULL_RESISTOR,
> + interrupt: NULL,
> + output_enabled: FALSE,
> + logic_invert: FALSE,
> + bsp_specific: &alt_func_def[4]
> +};
> +
> +rtems_gpio_pin_conf arm_tck = {
> + pin_number: 25,
> + function: BSP_SPECIFIC,
> + pull_mode: NO_PULL_RESISTOR,
> + interrupt: NULL,
> + output_enabled: FALSE,
> + logic_invert: FALSE,
> + bsp_specific: &alt_func_def[4]
> +};
> +
> +rtems_gpio_pin_conf arm_tms = {
> + pin_number: 27,
> + function: BSP_SPECIFIC,
> + pull_mode: NO_PULL_RESISTOR,
> + interrupt: NULL,
> + output_enabled: FALSE,
> + logic_invert: FALSE,
> + bsp_specific: &alt_func_def[4]
> +};
> +
> +rtems_gpio_pin_conf spi_miso = {
> + pin_number: 7,
> + function: BSP_SPECIFIC,
> + pull_mode: NO_PULL_RESISTOR,
> + interrupt: NULL,
> + output_enabled: FALSE,
> + logic_invert: FALSE,
> + bsp_specific: &alt_func_def[0]
> +};
> +
> +rtems_gpio_pin_conf spi_mosi = {
> + pin_number: 8,
> + function: BSP_SPECIFIC,
> + pull_mode: NO_PULL_RESISTOR,
> + interrupt: NULL,
> + output_enabled: FALSE,
> + logic_invert: FALSE,
> + bsp_specific: &alt_func_def[0]
> +};
> +
> +rtems_gpio_pin_conf spi_scl

Re: GSoC 2015: Raspberry Pi 2 Support

2015-06-22 Thread Alan Cudmore
Great news on the Pi 2 cache configuration!
I am looking forward to a patch to try.

Alan


On Sun, Jun 21, 2015 at 3:27 PM, Rohini Kulkarni 
wrote:

> :)
> There is very little code that had to be added.
> I need to clean the code and add conditional call for Pi 2. Then I would
> be ready to submit a patch.
>  On 22 Jun 2015 00:52, "Gedare Bloom"  wrote:
>
>> On Sun, Jun 21, 2015 at 3:04 PM, Rohini Kulkarni 
>> wrote:
>> > I missed mentioning the number of dhrystones in the previous mail.
>> >
>> > Originally it was 1 million.
>> > The new number of dhrystones I executed is 100 million.
>> >
>> The next thing to do is to figure out what changes are contributing to
>> the performance improvement, and then prepare patches. :) Great work
>>
>> > On Mon, Jun 22, 2015 at 12:29 AM, Rohini Kulkarni <
>> krohini1...@gmail.com>
>> > wrote:
>> >>
>> >> Hi all,
>> >>
>> >> I have managed to get a significant performance improvement with some
>> >> changes in configurations.
>> >>
>> >> The measured time was for dhrystones reduced from 12 to "too small to
>> be
>> >> measured "
>> >>
>> >> For dhrystones the time was 0.4.
>> >>
>> >> The number of dhrystones per second increased from approximately 8
>> to
>> >> 250 :)
>> >>
>> >> Thanks!
>> >>
>> >> On Sun, Jun 21, 2015 at 1:32 AM, Rohini Kulkarni <
>> krohini1...@gmail.com>
>> >> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> I have added an SMP related post to my blog to define where exactly in
>> >>> the code I need to work. Some feedback to indicate if I am
>> identifying the
>> >>> work area correctly would be very helpful!
>> >>>
>> >>> Thanks!
>> >>>
>> >>> On 18 Jun 2015 03:37, "Rohini Kulkarni" 
>> wrote:
>> 
>>  Hi all,
>> 
>>  I have updated my blog to reflect my understanding and attempts for
>>  cache performance issue.
>> 
>>  Lately I have been trying around memory attributes for the
>>  mm_config_table. One set of configurations for cacheable memory
>> (inner and
>>  outer levels)ended up reducing performance further ( which I really
>> thought
>>  would improve). So this table set up certainly controls performance.
>> 
>>  The results are not improving after turning on cache. So memory
>> sections
>>  are perhaps not even getting cached.
>>  I get a feeling it has got to do with this mm_config_table.
>> 
>>  Updates from the github code and blog might help in further
>> discussion.
>> 
>>  Link to github code:https://github.com/krohini1593/rtems/tree/rohini
>> 
>>  Link to Blog
>> 
>>  Thanks!
>> 
>>  On Mon, Jun 15, 2015 at 8:29 PM, Alan Cudmore <
>> alan.cudm...@gmail.com>
>>  wrote:
>> >
>> > Hi,
>> > Some of the code examples may give you some clues. Like this one:
>> > https://github.com/mrvn/test/blob/master/smp.cc
>> >
>> > Or this:
>> > https://github.com/PeterLemon/RaspberryPi/tree/master/SMP/SMPINIT
>> >
>> > If you still can't figure it out, you can always join the
>> > raspberrypi.org forums and ask on this thread:
>> > https://www.raspberrypi.org/forums/viewtopic.php?f=72&t=98904
>> >
>> > When it comes to the Pi 2 and SMP, you are our RTEMS expert :)
>> >
>> > Thanks,
>> > Alan
>> >
>> >
>> > On Sat, Jun 13, 2015 at 2:29 PM, Rohini Kulkarni
>> >  wrote:
>> >>
>> >> Hi,
>> >>
>> >> This is regarding Pi 2 SMP support. After powering on, the
>> secondary
>> >> mailboxes read one of their four mailbox registers and wait for a
>> non-zero
>> >> content to be written. This content is to be the physical address
>> of the
>> >> location from where the cores are expected to start execution.
>> >>
>> >> I am stuck at figuring out this address. How should I go about
>> >> understanding this?
>> >>
>> >> Thanks!
>> >>
>> >> On 3 Jun 2015 19:44, "Gedare Bloom"  wrote:
>> >>>
>> >>> On Wed, Jun 3, 2015 at 2:39 AM, Rohini Kulkarni
>> >>>  wrote:
>> >>> > But, I can't say cache configurations have a role here.
>> >>> >
>> >>> > I'll push my code to my github project soon.
>> >>> >
>> >>> > P.S. The Pi2 board I possess seems to have broken down. It just
>> >>> > isn't
>> >>> > turning on. Unable to test further. Will order one immediately.
>> >>> >
>> >>> Ouch. Make sure you put it in a safe space for development, clear
>> of
>> >>> threats like moisture, static shock, and cats.
>> >>>
>> >>> > On 3 Jun 2015 09:03, "Rohini Kulkarni" 
>> >>> > wrote:
>> >>> >>
>> >>> >> Hi,
>> >>> >>
>> >>> >> Alan, your suggestion has resulted in much improvement
>> >>> >>
>> >>> >> arm_control=0x1000
>> >>> >>
>> >>> >> This has simply worked! Looks like the other cores were taking
>> up
>> >>> >> plenty
>> >>> >> of time.
>> >>> >> I was aware from references that the other cores run a WFI, but
>> >>> >> ya, did
>> >>> >> 

[PATCH] altq_subr.c: Disable x86 specific code on RTEMS

2015-06-22 Thread Joel Sherrill
---
 freebsd/sys/contrib/altq/altq/altq_subr.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/freebsd/sys/contrib/altq/altq/altq_subr.c 
b/freebsd/sys/contrib/altq/altq/altq_subr.c
index 3ebd58d..55f0977 100644
--- a/freebsd/sys/contrib/altq/altq/altq_subr.c
+++ b/freebsd/sys/contrib/altq/altq/altq_subr.c
@@ -930,6 +930,9 @@ init_machclk_setup(void)
 #if defined(__NetBSD__) && defined(MULTIPROCESSOR)
machclk_usepcc = 0;
 #endif
+#if defined(__rtems__)
+   machclk_usepcc = 0;
+#else
 #if defined(__amd64__) || defined(__i386__)
/* check if TSC is available */
 #ifdef __FreeBSD__
@@ -940,6 +943,7 @@ init_machclk_setup(void)
 #endif
machclk_usepcc = 0;
 #endif
+#endif
 }
 
 void
@@ -967,6 +971,7 @@ init_machclk(void)
 * if the clock frequency (of Pentium TSC or Alpha PCC) is
 * accessible, just use it.
 */
+#ifndef __rtems__
 #if defined(__amd64__) || defined(__i386__)
 #ifdef __FreeBSD__
machclk_freq = atomic_load_acq_64(&tsc_freq);
@@ -976,7 +981,7 @@ init_machclk(void)
machclk_freq = pentium_mhz * 100;
 #endif
 #endif
-
+#endif
/*
 * if we don't know the clock frequency, measure it.
 */
-- 
1.7.1

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


Re: [PATCH] altq_subr.c: Disable x86 specific code on RTEMS

2015-06-22 Thread Gedare Bloom
On Mon, Jun 22, 2015 at 3:43 PM, Joel Sherrill
 wrote:
> ---
>  freebsd/sys/contrib/altq/altq/altq_subr.c |7 ++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/freebsd/sys/contrib/altq/altq/altq_subr.c 
> b/freebsd/sys/contrib/altq/altq/altq_subr.c
> index 3ebd58d..55f0977 100644
> --- a/freebsd/sys/contrib/altq/altq/altq_subr.c
> +++ b/freebsd/sys/contrib/altq/altq/altq_subr.c
> @@ -930,6 +930,9 @@ init_machclk_setup(void)
>  #if defined(__NetBSD__) && defined(MULTIPROCESSOR)
> machclk_usepcc = 0;
>  #endif
> +#if defined(__rtems__)
> +   machclk_usepcc = 0;
> +#else
>  #if defined(__amd64__) || defined(__i386__)
> /* check if TSC is available */
>  #ifdef __FreeBSD__
> @@ -940,6 +943,7 @@ init_machclk_setup(void)
>  #endif
> machclk_usepcc = 0;
>  #endif
> +#endif
>  }
>
>  void
> @@ -967,6 +971,7 @@ init_machclk(void)
>  * if the clock frequency (of Pentium TSC or Alpha PCC) is
>  * accessible, just use it.
>  */
> +#ifndef __rtems__
>  #if defined(__amd64__) || defined(__i386__)
>  #ifdef __FreeBSD__
> machclk_freq = atomic_load_acq_64(&tsc_freq);
> @@ -976,7 +981,7 @@ init_machclk(void)
> machclk_freq = pentium_mhz * 100;
>  #endif
>  #endif
> -
> +#endif
I think you're supposed to avoid removing lines (even blank ones)

> /*
>  * if we don't know the clock frequency, measure it.
>  */
> --
> 1.7.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] altq_subr.c: Disable x86 specific code on RTEMS

2015-06-22 Thread Gedare Bloom
On Mon, Jun 22, 2015 at 4:36 PM, Gedare Bloom  wrote:
> On Mon, Jun 22, 2015 at 3:43 PM, Joel Sherrill
>  wrote:
>> ---
>>  freebsd/sys/contrib/altq/altq/altq_subr.c |7 ++-
>>  1 files changed, 6 insertions(+), 1 deletions(-)
>>
>> diff --git a/freebsd/sys/contrib/altq/altq/altq_subr.c 
>> b/freebsd/sys/contrib/altq/altq/altq_subr.c
>> index 3ebd58d..55f0977 100644
>> --- a/freebsd/sys/contrib/altq/altq/altq_subr.c
>> +++ b/freebsd/sys/contrib/altq/altq/altq_subr.c
>> @@ -930,6 +930,9 @@ init_machclk_setup(void)
>>  #if defined(__NetBSD__) && defined(MULTIPROCESSOR)
>> machclk_usepcc = 0;
>>  #endif
>> +#if defined(__rtems__)
>> +   machclk_usepcc = 0;
>> +#else
>>  #if defined(__amd64__) || defined(__i386__)
>> /* check if TSC is available */
>>  #ifdef __FreeBSD__
>> @@ -940,6 +943,7 @@ init_machclk_setup(void)
>>  #endif
>> machclk_usepcc = 0;
>>  #endif
>> +#endif
>>  }
>>
>>  void
>> @@ -967,6 +971,7 @@ init_machclk(void)
>>  * if the clock frequency (of Pentium TSC or Alpha PCC) is
>>  * accessible, just use it.
>>  */
>> +#ifndef __rtems__
>>  #if defined(__amd64__) || defined(__i386__)
>>  #ifdef __FreeBSD__
>> machclk_freq = atomic_load_acq_64(&tsc_freq);
>> @@ -976,7 +981,7 @@ init_machclk(void)
>> machclk_freq = pentium_mhz * 100;
>>  #endif
>>  #endif
>> -
>> +#endif
> I think you're supposed to avoid removing lines (even blank ones)
Also demarcate the endif with /* __rtems__ */

>
>> /*
>>  * if we don't know the clock frequency, measure it.
>>  */
>> --
>> 1.7.1
>>
>> ___
>> devel mailing list
>> devel@rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] GSoC: Cache configurations Raspberry Pi 2 support

2015-06-22 Thread Rohini Kulkarni
---
 .../arm/raspberrypi/startup/mm_config_table.c  |   18 +++
 c/src/lib/libbsp/arm/shared/mminit.c   |   23

 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c
b/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c
index 8a6d37a..dd1941e 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c
@@ -31,39 +31,39 @@ const arm_cp15_start_section_config
arm_cp15_start_mmu_config_table[] = {
   }, {
 .begin = (uint32_t) bsp_section_fast_data_begin,
 .end = (uint32_t) bsp_section_fast_data_end,
-.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
 .begin = (uint32_t) bsp_section_start_begin,
 .end = (uint32_t) bsp_section_start_end,
-.flags = ARMV7_MMU_CODE_CACHED
+.flags = ARMV7_MMU_CODE_CACHED
   }, {
 .begin = (uint32_t) bsp_section_vector_begin,
 .end = (uint32_t) bsp_section_vector_end,
-.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
 .begin = (uint32_t) bsp_section_text_begin,
 .end = (uint32_t) bsp_section_text_end,
-.flags = ARMV7_MMU_READ_WRITE
+.flags = ARMV7_MMU_READ_WRITE | ARM_MMU_SECT_C | ARM_MMU_SECT_B
   }, {
 .begin = (uint32_t) bsp_section_rodata_begin,
 .end = (uint32_t) bsp_section_rodata_end,
-.flags = ARMV7_MMU_DATA_READ_ONLY_CACHED
+.flags = ARMV7_MMU_DATA_READ_ONLY_CACHED
   }, {
 .begin = (uint32_t) bsp_section_data_begin,
 .end = (uint32_t) bsp_section_data_end,
-.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
 .begin = (uint32_t) bsp_section_bss_begin,
 .end = (uint32_t) bsp_section_bss_end,
-.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
 .begin = (uint32_t) bsp_section_work_begin,
 .end = (uint32_t) bsp_section_work_end,
-.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
 .begin = (uint32_t) bsp_section_stack_begin,
 .end = (uint32_t) bsp_section_stack_end,
-.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+.flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
 .begin = RPI_PERIPHERAL_BASE,
 .end =   RPI_PERIPHERAL_BASE + RPI_PERIPHERAL_SIZE,
diff --git a/c/src/lib/libbsp/arm/shared/mminit.c
b/c/src/lib/libbsp/arm/shared/mminit.c
index acfbfc0..96ca1ec 100644
--- a/c/src/lib/libbsp/arm/shared/mminit.c
+++ b/c/src/lib/libbsp/arm/shared/mminit.c
@@ -13,6 +13,28 @@
 #include 
 #include 

+#if (BSP_IS_RPI2 == 1)
+BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)
+{
+  /* Enable SMP in auxiliary control */
+  uint32_t actlr = arm_cp15_get_auxiliary_control();
+  actlr |= ARM_CORTEX_A9_ACTL_SMP;
+  arm_cp15_set_auxiliary_control(actlr);
+
+  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
+ARM_CP15_CTRL_A,
+ARM_CP15_CTRL_AFE| ARM_CP15_CTRL_Z
+  );
+
+  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
+ctrl,
+(uint32_t *) bsp_translation_table_base,
+ARM_MMU_DEFAULT_CLIENT_DOMAIN,
+&arm_cp15_start_mmu_config_table[0],
+arm_cp15_start_mmu_config_table_size
+  );
+}
+#else
 BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)
 {
   uint32_t ctrl = arm_cp15_get_control();
@@ -27,3 +49,4 @@ BSP_START_TEXT_SECTION void
bsp_memory_management_initialize(void)
 arm_cp15_start_mmu_config_table_size
   );
 }
+#endif
\ No newline at end of file
-- 
1.7.9.5

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

Re: [PATCH 1/2] RTEMS GPIO API definition and implementation.

2015-06-22 Thread André Marques

Hello Gedare,

first of all thanks for the review. Answers bellow.

On 22-06-2015 16:05, Gedare Bloom wrote:

(


On Mon, Jun 22, 2015 at 8:01 AM, Andre Marques
 wrote:

---
  c/src/lib/libbsp/Makefile.am   |3 +-
  c/src/lib/libbsp/preinstall.am |4 +
  c/src/lib/libbsp/shared/gpio.c | 1083 
  c/src/lib/libbsp/shared/include/gpio.h |  610 ++
  4 files changed, 1699 insertions(+), 1 deletion(-)
  create mode 100644 c/src/lib/libbsp/shared/gpio.c
  create mode 100644 c/src/lib/libbsp/shared/include/gpio.h

diff --git a/c/src/lib/libbsp/Makefile.am b/c/src/lib/libbsp/Makefile.am
index 3cab4d7..a039a98 100644
--- a/c/src/lib/libbsp/Makefile.am
+++ b/c/src/lib/libbsp/Makefile.am
@@ -9,7 +9,7 @@ EXTRA_DIST = MERGE.PROCEDURE bsp.am
  EXTRA_DIST += shared/bootcard.c shared/bspclean.c \
  shared/bsplibc.c shared/bsppost.c shared/console-polled.c \
  shared/console.c shared/gnatinstallhandler.c shared/sbrk.c \
-shared/tod.c
+shared/tod.c shared/gpio.c
  EXTRA_DIST += shared/vmeUniverse/vmeUniverse.c \
  shared/vmeUniverse/vmeUniverse.h \
  shared/vmeUniverse/vmeUniverseDMA.h \
@@ -35,6 +35,7 @@ include_bsp_HEADERS =
  include_bsp_HEADERS += shared/include/default-initial-extension.h
  include_bsp_HEADERS += shared/include/fatal.h
  include_bsp_HEADERS += shared/include/console-termios.h
+include_bsp_HEADERS += shared/include/gpio.h

  include $(srcdir)/preinstall.am
  include $(top_srcdir)/automake/subdirs.am
diff --git a/c/src/lib/libbsp/preinstall.am b/c/src/lib/libbsp/preinstall.am
index 651f136..bbcb7c5 100644
--- a/c/src/lib/libbsp/preinstall.am
+++ b/c/src/lib/libbsp/preinstall.am
@@ -30,3 +30,7 @@ $(PROJECT_INCLUDE)/bsp/console-termios.h: 
shared/include/console-termios.h $(PRO
 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/console-termios.h
  PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/console-termios.h

+$(PROJECT_INCLUDE)/bsp/gpio.h: shared/include/gpio.h 
$(PROJECT_INCLUDE)/bsp/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/gpio.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/gpio.h
+
diff --git a/c/src/lib/libbsp/shared/gpio.c b/c/src/lib/libbsp/shared/gpio.c
new file mode 100644
index 000..12cdb29
--- /dev/null
+++ b/c/src/lib/libbsp/shared/gpio.c
@@ -0,0 +1,1083 @@
+/**
+ * @file gpio.c
+ *
+ * @ingroup rtems_gpio
+ *
+ * @brief RTEMS GPIO API implementation.
+ */
+
+/*
+ *  Copyright (c) 2014-2015 Andre Marques 
+ *
+ *  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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/**
+ * @brief GPIO API mutex atributes.

spelling: attributes


+ */
+#define MUTEX_ATRIBUTES \

here too.


+  ( RTEMS_LOCAL \
+| RTEMS_PRIORITY\
+| RTEMS_BINARY_SEMAPHORE\
+| RTEMS_INHERIT_PRIORITY\
+| RTEMS_NO_PRIORITY_CEILING \
+)
+
+#define AQUIRE_LOCK(m) assert( rtems_semaphore_obtain(m,\

spelling: ACQUIRE


+  RTEMS_WAIT,   \
+  RTEMS_NO_TIMEOUT  \
+  ) == RTEMS_SUCCESSFUL )
+
+#define RELEASE_LOCK(m) assert( rtems_semaphore_release(m) == RTEMS_SUCCESSFUL 
)
+
+/*Encapsulates relevant data for a GPIO interrupt handler. */

Add Doxygen for all of these structs


+typedef struct _gpio_handler_list
+{
+  struct _gpio_handler_list *next_isr;

Consider using an RTEMS chain (doubly-linked list) here. It would save
on some list-manipulation code, and force you to use readable
functions that already exist in the rtems namespace. If you want one
list per pin, you can embed an rtems_chain_control in each gpio_pin.


Yes that makes sense. Will check that.


+
+  /* User-defined ISR routine. */
+  rtems_gpio_irq_state (*handler) (void *arg);
+
+  /* User-defined arguments for the ISR routine. */
+  void *arg;
+} gpio_handler_list;
+
+/* Encapsulates relevant data about a GPIO pin. */
+typedef struct
+{
+  uint32_t bank_number;
+  uint32_t pin_number;
+
+  rtems_gpio_function pin_function;
+
+  /* Type of event which will trigger an interrupt. */
+  rtems_gpio_interrupt enabled_interrupt;

enabled_interrupt brings to mind isr enable/disable, if this field is
more than a bool, then a more descriptive name should be used.


Yes this field can have several values, as it reflects the currently 
active interrupt (defined on the rtems_gpio_interrupt enum) on a pin. 
Maybe it can become current_active_interrupt or cur_active_interrupt.



+
+  /* Id of the task that will be calling the user-defined ISR handlers
+   * for this pin. */
+  rtems_id task_id;

perhaps 'handler_task_id' can help readability


agreed.



testing order for rtems-libbsd

2015-06-22 Thread Joel Sherrill

Hi

I have it built now for pc386 but some tests run and others don't.
Any suggestions on the order to run tests in from simplest to
most complex?

--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


qemu invocation for pc386

2015-06-22 Thread Joel Sherrill

Hi

It looks like qemu has changed the command line related to
virtual fat directories.

Has anyone used it recently or have suggestions? I don't seem
to be able to parse the help offered and get it happy.

+ qemu-system-i386 -m 512 -boot a -cpu 486 -fda /home/joel/qemu/pc386_fda 
-drive file=fat:dir:rw:/home/joel/qemu/hd -monitor null -nographic -serial 
stdio --no-reboot
WARNING: Image format was not specified for '/home/joel/qemu/pc386_fda' and 
probing guessed raw.
 Automatically detecting the format is dangerous for raw images, write 
operations on block 0 will be restricted.
 Specify the 'raw' format explicitly to remove the restrictions.
vvfat /home/joel/qemu/hd chs 1024,16,63
WARNING: Image format was not specified for 'json:{"fat-type": 0, "dir": "/home/joel/qemu/hd", "driver": 
"vvfat", "floppy": false, "rw": true}' and probing guessed raw.
 Automatically detecting the format is dangerous for raw images, write 
operations on block 0 will be restricted.
 Specify the 'raw' format explicitly to remove the restrictions.
*** LIBBSD SLEEP 1 TEST ***
nexus0: 
devctl: +nexus0 at   on root0
devctl: !system=IFNET subsystem=lo0 type=ATTACH
test timeouts
slave[2]: 1
slave[1]: 2
slave[0]: 3
test wakeup without waiter
test wakeup one
assertion "slave_counters[2] == 4" failed: file 
"../../testsuite/sleep01/test_main.c", line 183, function: test_wakeup_one

EXECUTIVE SHUTDOWN! Any key to reboot...


--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: testing order for rtems-libbsd

2015-06-22 Thread Sebastian Huber



On 23/06/15 01:56, Joel Sherrill wrote:

Hi

I have it built now for pc386 but some tests run and others don't.
Any suggestions on the order to run tests in from simplest to
most complex?



The ones covered by a "make run_tests" should work (there is a known 
issue with selectpollkqueue01).


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
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] altq_subr.c: Disable x86 specific code on RTEMS

2015-06-22 Thread Sebastian Huber



On 22/06/15 22:37, Gedare Bloom wrote:

On Mon, Jun 22, 2015 at 4:36 PM, Gedare Bloom  wrote:

>On Mon, Jun 22, 2015 at 3:43 PM, Joel Sherrill
>  wrote:

>>---
>>  freebsd/sys/contrib/altq/altq/altq_subr.c |7 ++-
>>  1 files changed, 6 insertions(+), 1 deletions(-)
>>
>>diff --git a/freebsd/sys/contrib/altq/altq/altq_subr.c 
b/freebsd/sys/contrib/altq/altq/altq_subr.c
>>index 3ebd58d..55f0977 100644
>>--- a/freebsd/sys/contrib/altq/altq/altq_subr.c
>>+++ b/freebsd/sys/contrib/altq/altq/altq_subr.c
>>@@ -930,6 +930,9 @@ init_machclk_setup(void)
>>  #if defined(__NetBSD__) && defined(MULTIPROCESSOR)
>> machclk_usepcc = 0;
>>  #endif
>>+#if defined(__rtems__)
>>+   machclk_usepcc = 0;
>>+#else
>>  #if defined(__amd64__) || defined(__i386__)
>> /* check if TSC is available */
>>  #ifdef __FreeBSD__
>>@@ -940,6 +943,7 @@ init_machclk_setup(void)
>>  #endif
>> machclk_usepcc = 0;
>>  #endif
>>+#endif
>>  }
>>
>>  void
>>@@ -967,6 +971,7 @@ init_machclk(void)
>>  * if the clock frequency (of Pentium TSC or Alpha PCC) is
>>  * accessible, just use it.
>>  */
>>+#ifndef __rtems__
>>  #if defined(__amd64__) || defined(__i386__)
>>  #ifdef __FreeBSD__
>> machclk_freq = atomic_load_acq_64(&tsc_freq);
>>@@ -976,7 +981,7 @@ init_machclk(void)
>> machclk_freq = pentium_mhz * 100;
>>  #endif
>>  #endif
>>-
>>+#endif

>I think you're supposed to avoid removing lines (even blank ones)

Also demarcate the endif with /* __rtems__ */



Yes, please.

I was able to update from FreeBSD 8.4, 9.2, 9.3, and 9-stable recently 
and these markers help a lot!


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
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: testing order for rtems-libbsd

2015-06-22 Thread Chris Johns
On 23/06/2015 3:55 pm, Sebastian Huber wrote:
> 
> 
> On 23/06/15 01:56, Joel Sherrill wrote:
>> Hi
>>
>> I have it built now for pc386 but some tests run and others don't.
>> Any suggestions on the order to run tests in from simplest to
>> most complex?
>>
> 
> The ones covered by a "make run_tests" should work (there is a known
> issue with selectpollkqueue01).
> 

On the Zynq some test kill qemu then the init task is deleted. I have
not looked into this yet.

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