ARM assembly
Bibliography: ARM instruction set, ARM architecture.
ARM GNU compiler for Windows downloadable from here. You can compile with arm-elf-gcc command (eg. arm-elf-gcc -o hw hw.c). The compiled executable can be run with the command arm-elf-run (eg. arm-elf-run hw).
First example: main.c and f.s :
#include <stdio.h> int f(int); main() { printf("%d\n",f(4)); }
.file "f.c" .text .align 2 .global f .type f, %function f: @ args = 0, pretend = 0, frame = 0 @ frame_needed = 0, uses_anonymous_args = 0 @ link register save eliminated. add r0, r0, r0 @ lr needed for prologue bx lr .size f, .-f .ident "GCC: (GNU) 4.0.2"
Compilation: arm-elf-gcc -o h main.c f.s
Executing: arm-elf-run h
Practice:
- Function f should have two parameters (r0 and r1), és should return with 2*r0+3*r1. (use add instruction instead of mul)
- Function f should have one parameter (r0), and should return the sum of the interger number between 1 and the given value. For example if the given value is 4, the return value should be 1+2+3+4=10.
- Function f should have tree parameters (r0, r1, r2), and should return with the largest one.
- Function f should have one parameter (r0), and should return the sum of the odd interger number between 1 and the given value. For example if the given value is 8, the return value should be 1+3+5+7=16.
- Function f should have one parameter (r0), and should the Fibonacci number with the specified number.
ARM hack challenge: here (useful utility: arm-elf-objdump)
Raspberry Pi information
Programming info: http://elinux.org/Rpi_Low-level_peripherals
LED circuit: https://www.circuitlab.com/circuit/456ph8/screenshot/540x405/
BC547 tansistor: http://potentiallabs.com/cart/image/cache/data/BC547-500x416.jpg
Python pin turn on/off program: led.py
Project work possibilities
- Solve the 8 queen problem in ARM assembly - and draw the solutions to the console
- Listing the prime numbers using ARM assembly
- Calculating the digits of pi in ARM assembly
- Rapberry PI security camera: show the actual picture, and in case of moving, start the recording
- Raspberry PI NAS
- Any kind of sensor programming with Raspberry PI
- Any agreed custom task