How to avoid code duplication in my new RTEMS port

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jul 26 09:35:01 UTC 2013


Hello R.,

On 2013-07-26 11:07, R. Diez wrote:
> Hi all:
>
> I am the same RTEMS newbie from yesterday, who is still trying to port RTEMS to the Arduino Due. 8-)
>
> I was able to flash a modifed RTEMS hello.exe to the board that just hangs near the beginning, and I can step through the infinite loop with GDB. The next thing I need is a serial port driver, in order to get some sort of serial/debug console up and running.
>
> I was advised in this mailing list to look at the following code:
>
>    http://git.rtems.org/rtems/tree/c/src/lib/libcpu/arm/at91rm9200
>
> That CPU is older than the Cortex-M3 one I need, but it is from Atmel too and it looks alike, it has an ARM Thumb core and the serial port documentation in the datasheets looks very similar. The fun would be to know which UART bits and pieces have changed over the years.
>
> One option would be to start from scratch, painfully copying all #defines for all the UART registers. I might be able to copy code from some other real-time OS or library, which ones would you suggest to steal such #defines from? Should I expect most such licences to be incompatible with RTEMS?

the best case would be if you can use the stuff from

http://git.rtems.org/rtems/tree/c/src/lib/libcpu/arm/at91rm9200

In the past I had some very similar looking modules in different chips that 
turned out to be not similar enough and the bug fixing took more time than 
developing the driver from scratch.

A particularly easy console driver with interrupt support is here:

http://git.rtems.org/rtems/tree/c/src/lib/libbsp/arm/shared/arm-pl050.c

A BSP committed to the RTEMS repository should not depend on external libraries 
for the basic support, e.g. initialization, interrupt controller, clock and 
console driver.  So you can run the test suite without additional stuff.  If 
you want to include external code, then it must have an open source license 
that places no restrictions on application code (e.g. BSD, MIT license).

The sharing of driver code is one of the worst things in RTEMS.  The BSP 
centric directory structure leaded to a lot of copy and paste stuff.

This libcpu directory is from my point of view a disaster.  It only scatters 
things more and the build system support is a nightmare.

For ARM I use c/src/lib/libbsp/arm/shared to place generic files for the BSPs 
developed by me.

In case the files provided by the Atmel Software Framework have a proper 
license, then you can simply copy them to the RTEMS sources (only the necessary 
files).

[...]

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

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list