Monthly Archives: April 2014

Software Architectural Style

Representational state transfer (REST)

Representational state transfer (REST) is a software architectural style consisting of a coordinated set of architectural constraints applied to components, connectors, and data elements, within a distributed hypermedia system. REST ignores the details of component implementation and protocol syntax in order to focus on the roles of components, the constraints upon their interaction with other components, and their interpretation of significant data elements.
The term representational state transfer was introduced and defined in 2000 by Roy Fielding in his doctoral dissertation at UC Irvine. REST has been applied to describe desired web architecture, to identify existing problems, to compare alternative solutions, and to ensure that protocol extensions would not violate the core constraints that make the web successful. Fielding used REST to design HTTP 1.1 and Uniform Resource Identifiers (URI). The REST architectural style is also applied to the development of web services as an alternative to other distributed-computing specifications such as SOAP.

Architectural constraints

  • Client–server
  • Stateless
  • Cacheable
  • Layered system
  • Code on demand (optional)
  • Uniform interface

Representational state transfer (REST)

Create, read, update and delete (CRUD)

Create, read, update and delete (CRUD)

Service-oriented architecture (SOA)

Service-oriented architecture (SOA) is a software design and software architecture design pattern based on discrete pieces of software providing application functionality as services to other applications. This is known as service-orientation
A service is a self-contained unit of functionality, such as retrieving an online bank statement. Services can be combined by other software applications to provide the complete functionality of a large software application. SOA makes it easy for computers connected over a network to cooperate. Every computer can run an arbitrary number of services, and each service is built in a way that ensures that the service can exchange information with any other service in the network without human interaction and without the need to make changes to the underlying program itself.

Design concept

SOA is based on the concept of a service. Depending on the taken service design approach, each SOA service is designed to perform one or more activities by implementing one or more service operations. As a result, each service is built as a discrete piece of code. This makes it possible to reuse the code in different ways throughout the application by changing only the way an individual service interoperates with other services that make up the application, versus making code changes to the service itself. SOA design principles are used during software development and integration.
For some, SOA can be seen in a continuum from older concepts of distributed computing and modular programming, through SOA, and on to current practices of mashups, SaaS, and cloud computing (which some see as the offspring of SOA)

Other SOA concepts

Architectures can operate independently of specific technologies and can therefore be implemented using a wide range of technologies, including:

  • SOAP, RPC
  • REST
  • CORBA
  • Web services
  • DDS
  • Java RMI
  • WCF (Microsoft’s implementation of web services now forms a part of WCF)
  • Apache Thrift
  • SORCER

Service-oriented architecture (SOA)

Embedded Implementation of Mutexes and Semaphores

Mutexes and Semaphores Demystified
Programming Embedded Systems in C and C++

ChibiOS/RT

Counting Semaphores, Binary Semaphores and Mutexes explained
Mutual Exclusion guide

System Locks

This is the lowest level mechanism, the system is locked by invoking the chSysLock() API and then unlocked by invoking chSysUnlock(). The implementation is architecture dependent but it is guaranteed to, at least, disable the interrupt sources with hardware priority below or equal the kernel level.

Mutexes

The mutexes are the mechanism intended as the most general solution for Mutual Exclusion.

/**
* @brief Locks the specified mutex.
* @post The mutex is locked and inserted in the per-thread stack of owned
* mutexes.
*
* @param[in] mp pointer to the @p Mutex structure
*
* @api
*/
void chMtxLock(Mutex *mp) {

  chSysLock();

  chMtxLockS(mp);

  chSysUnlock();
}

Raspberry Pi

Rasberry Pi – An ARM GNU/Linux box for $25
Embedded Linux mit dem Raspberry Pi
Raspberry Pi: the modder’s dream machine?
RaspberryPi (Model B) SketchUp Model
RPi Verified Peripherals

raspi-config
Step01 – Bare Metal Programming in C Pt1

Mounting Holes

Mechanical Drawings
Raspberry Pi Mounting Hole Positions and Template
adafruit Mounting Holes
CASEplate Assembly – Pi-Plates

Raspian

Raspbian Jessie Download

Debian

RaspberryPi

  • Can I put Debian on my Raspberry Pi?
  • Should I buy a Raspberry Pi?
  • Raspberry Pi issues

Software Packages

How to add a repository

$ sudo apt-get install python-software-properties
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.        
Statusinformationen werden eingelesen.... Fertig
Die folgenden zusätzlichen Pakete werden installiert:
  lsb-release python-apt python-apt-common python-gnupginterface python-pycurl unattended-upgrades
Vorgeschlagene Pakete:
  lsb python-apt-dbg python-gtk2 python-vte python-apt-doc libcurl4-gnutls-dev python-pycurl-dbg bsd-mailx mail-transport-agent
Die folgenden NEUEN Pakete werden installiert:
  lsb-release python-apt python-apt-common python-gnupginterface python-pycurl python-software-properties unattended-upgrades
0 aktualisiert, 7 neu installiert, 0 zu entfernen und 15 nicht aktualisiert.
Es müssen 689 kB an Archiven heruntergeladen werden.
Nach dieser Operation werden 2'516 kB Plattenplatz zusätzlich benutzt.
Möchten Sie fortfahren [J/n]? j

GNU ARM Embedded Toolchain

$ sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded

$ grep -r ppa /etc/apt/sources.list.d
/etc/apt/sources.list.d/terry_guo-gcc-arm-embedded-wheezy.list:deb http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu wheezy main
/etc/apt/sources.list.d/terry_guo-gcc-arm-embedded-wheezy.list:deb-src http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu wheezy main

$ sudo vi /etc/apt/sources.list.d/terry_guo-gcc-arm-embedded-wheezy.list
deb http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu trusty main
deb-src http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu trusty main

$ sudo apt-get update
$ sudo apt-get install gcc-arm-none-eabi=4-8-2014q2-0trusty10
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.        
Statusinformationen werden eingelesen.... Fertig
Einige Pakete konnten nicht installiert werden. Das kann bedeuten, dass
Sie eine unmögliche Situation angefordert haben oder, wenn Sie die
Unstable-Distribution verwenden, dass einige erforderliche Pakete noch
nicht erstellt wurden oder Incoming noch nicht verlassen haben.
Die folgenden Informationen helfen Ihnen vielleicht, die Situation zu lösen:

Die folgenden Pakete haben unerfüllte Abhängigkeiten:
 gcc-arm-none-eabi : Hängt ab von: libmpfr4 (>= 3.1.2) aber 3.1.0-5 soll installiert werden
E: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.

How to Downgrade a Package via apt-get?
“mpfr4” package in Ubuntu
libmpfr4 3.1.2-1 (armhf binary) in ubuntu trusty
libmpfr4 3.1.2-1 (armhf binary) in ubuntu utopic

$ sudo dpkg -i Downloads/libmpfr4_3.1.2-1_armhf.deb 
(Reading database ... 73631 files and directories currently installed.)
Preparing to replace libmpfr4:armhf 3.1.0-5 (using .../libmpfr4_3.1.2-1_armhf.deb) ...
Unpacking replacement libmpfr4:armhf ...
Setting up libmpfr4:armhf (3.1.2-1) ...
Fehl http://ppa.launchpad.net wheezy/main Sources                                                                                
  404  Not Found
Fehl http://ppa.launchpad.net wheezy/main armhf Packages                                                                            
  404  Not Found
Ign http://ppa.launchpad.net wheezy/main Translation-de_CH                                                                          
Ign http://ppa.launchpad.net wheezy/main Translation-de                                                                             
W: Fehlschlag beim Holen von http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/dists/wheezy/main/source/Sources  404  Not Found
W: Fehlschlag beim Holen von http://ppa.launchpad.net/terry.guo/gcc-arm-embedded/ubuntu/dists/wheezy/main/binary-armhf/Packages  404  Not Found
E: Einige Indexdateien konnten nicht heruntergeladen werden. Sie wurden ignoriert oder alte an ihrer Stelle benutzt.
Holen: 1 http://ppa.launchpad.net trusty Release.gpg [316 B]                                                 
Holen: 2 http://ppa.launchpad.net trusty Release [14.0 kB]                                                                          
Holen: 3 http://ppa.launchpad.net trusty/main Sources [927 B]                                                                                                                  
Holen: 4 http://ppa.launchpad.net trusty/main armhf Packages [601 B]                                                                 
Ign http://ppa.launchpad.net trusty/main Translation-de_CH                                          
Ign http://ppa.launchpad.net trusty/main Translation-de                     
Ign http://ppa.launchpad.net trusty/main Translation-en
$ sudo apt-get install \
apt-src gawk gzip perl autoconf m4 \
automake libtool libncurses5-dev \
gettext gperf dejagnu expect tcl \
autogen guile-1.6 flex flip bison \
tofrodos libgmp3-dev libmpfr-dev debhelper 
/bin/bash ./libtool --tag=CC   --mode=link arm-linux-gnueabihf-gcc -Wall -fomit-frame-pointer -g -O2  -L/home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib -L/home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib  -o cloog cloog.o libcloog.la -lgmp -lppl_c -lppl -lgmpxx -lstdc++
libtool: link: arm-linux-gnueabihf-gcc -Wall -fomit-frame-pointer -g -O2 -o cloog cloog.o  -L/home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib ./.libs/libcloog.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libppl_c.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libpwl.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libppl.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libgmpxx.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libgmp.a -lstdc++
/usr/bin/ld: /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libppl.a(MIP_Problem.o): undefined reference to symbol 'sqrt@@GLIBC_2.4'
//lib/arm-linux-gnueabihf/libm.so.6: error adding symbols: DSO missing from command line
collect2: ld returned 1 exit status
Makefile:504: recipe for target 'cloog' failed
make[1]: *** [cloog] Error 1
make[1]: Leaving directory '/home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/cloog'
Makefile:674: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
arm-linux-gnueabihf-gcc -Wall -fomit-frame-pointer -g -O2 -o cloog cloog.o  -L/home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib ./.libs/libcloog.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libppl_c.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libpwl.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libppl.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libgmpxx.a /home/pi/Downloads/gcc-arm-none-eabi-4_7-2014q2-20140408/build-native/host-libs/usr/lib/libgmp.a -lstdc++ -lm

Very strange linker behavior

Making pdf in doc
make[3]: Entering directory '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/build-native/binutils/bfd/doc'
TEXINPUTS="/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/src/binutils/bfd/../texinfo:$TEXINPUTS" \
MAKEINFO='makeinfo --split-size=5000000 --split-size=5000000   -I /home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/src/binutils/bfd/doc' \
`if test -f /home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/src/binutils/bfd/../texinfo/util/texi2dvi; then echo /home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/src/binutils/bfd/../texinfo/util/texi2dvi; else echo texi2dvi; fi` --pdf --batch -o bfd.pdf `test -f 'bfd.texinfo' || echo '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/src/binutils/bfd/doc/'`bfd.texinfo
You don't have a working TeX binary installed, but the texi2dvi script
can't proceed without it. If you want to use this script, you have to
install some kind of TeX, for example TeX Live Debian packages. You can do
that with this command:
       apt-get install texlive
Makefile:444: recipe for target 'bfd.pdf' failed
make[3]: *** [bfd.pdf] Error 1
make[3]: Leaving directory '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/build-native/binutils/bfd/doc'
Making pdf in po
make[3]: Entering directory '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/build-native/binutils/bfd/po'
make[3]: Nothing to be done for 'pdf'.
make[3]: Leaving directory '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/build-native/binutils/bfd/po'
make[3]: Entering directory '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/build-native/binutils/bfd'
make[3]: Nothing to be done for 'pdf-am'.
make[3]: Leaving directory '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/build-native/binutils/bfd'
Makefile:1618: recipe for target 'pdf-recursive' failed
make[2]: *** [pdf-recursive] Error 1
make[2]: Leaving directory '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/build-native/binutils/bfd'
Makefile:2646: recipe for target 'pdf-bfd' failed
make[1]: *** [pdf-bfd] Error 1
make[1]: Leaving directory '/home/pi/Downloads/gcc-arm-none-eabi-4_8-2014q2-20140609/build-native/binutils'
Makefile:1374: recipe for target 'do-install-pdf' failed
make: *** [do-install-pdf] Error 2

Raspberry PI and FreeBSD

Progress on Raspberry Pi

UART

Raspberry Pi and Arduino via GPIO UART
RPi Serial Connection
Raspberry Pi GPIO How-To
How to use GPIOs on raspberry pi (Simple I/O, PWM and UART)

Kernel Debugging

Preparing Raspberry PI for JTAG Debugging

Embedded Pi

Embest: Schematic for Embedded Pi
Schematic for Embedded Pi

Using a Raspberry Pi as a JTAG Dongle
How to program the Embedded Pi with Raspberry Pi
How to program the Embedded Pi with Raspberry Pi
Getting Started with the Embedded Pi and Raspbian
The Embedded Pi: good hardware but how to use?
Getting Started with the Embedded Pi and Raspbian
Add ADC Functionality to RPi with EPi
Wikipedia: Bit-Banging
OpenOCD FT2232H based JTAG Adapter(s) with UART
Inexpensive Ethernet JTAG Adapter with Raspberry Pi and OpenOCD
stm32flash – Open source cross platform flash program for the STM32 bootloader