This page hosts the sample sources from the second part of the course F28HS Hardware/Software Interface, dealing with systems programming on the Raspberry Pi 2. You can find the sample sources for the first half, covered by Lito, on separate pages for C samples and Assembler samples.
A .zip file of all sample sources is available here.
General infrastructure and useful scripts (see Tutorial SysFS ):
Sample sources on Raspberry Pi programming, by week:
- Tutorial 1 (Using Python and LinuxFS for GPIO control):
- Tutorial 2 (Using an LED as output and a button as input device):
- tut_led.c C sample code from Tutorial LED
- tut_led_pin23.c C sample code from Tutorial LED, now controlling an LED wired to pin23
- Tutorial 3:
- tut_button.c C sample code for a button controlled LED
- Tutorial 4: (programming with signals and in-line assembler)
- signal2.c re-defining the signal handler for ctrl-c
- sigint.c using alarm signals and define a signal handler
- itimer11.c C version of an interval-timer
- sample0.c simple inline assembler example
- sample01.c min-max example using inline assembler (with detailed comments)
- sumav1_asm.c sum-of-pair inline assembler example (and sum-over-array)
- sumav3_asm.c sum-over-matrix example with inline assembler versions
- lcd-hello.c C sample code from Tutorial LCD
- lcdBinary.o this binary contains digitalWrite, use it when linking; updated version (check this MD5SUM for the file)
> gcc -w -c -o lcd-hello.o lcd-hello.c > gcc -o lcd-hello lcd-hello.o lcdBinary.o > sudo ./lcd-hello
- itimer21.c C and Assembler samples for an interval-timer (use -DASM to compile for assembler)
- itimer31.c using the RPi2 on-chip timer for a timeout function
- gpio47on.s pure Assembler version of LED on
- gpio13on_annot.s pure Assembler version of LED on
- Traffic_Lights_core_code.c (controlling 3 LEDs and 1 button; see this lab sheet)
- Spec for strcpy (see also man 3 strcpy)
- strcpy in ARM Assembler
- another version of strcpy with auto-increment addressing in ARM Assembler