Study Web

Week 7

ARM Assembly Programming: Getting Ready

COS10004 Computer Systems · Lecture 7.1 ARM Assembly Programming: Getting

Ready

ARM Assembly

Bare-metal programming for Raspberry Pi

ACKNOWLEDGEMENTS

  • This material is based on Baking Pi – Operating Systems Development by Alan Chadwick
  • http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ Raspberry Pi Bare Metal Assembly Programming by Peter Lemon
  • https://github.com/PeterLemon/RaspberryPi
  • http://www.raspberrypi.org/forums/viewtopic.php?f=72&t=98904

MATERIALS

Raspberry Pi Model 2B/3B/3B+/4B

Src: http://www.auseparts.com.au/image//catalog/Raspi3/Raspi%203%20Layout.jpg

R PI HARDWARE FOR LABS

  • At least 2 male-to-female lead wires
  • A breadboard
  • Two LEDs (or one could also work)
  • Two resistors: Any resistors from 330 up to 1K ohms are likely to be fine for standard red/green LEDs

EXTRAS

  • Plastic case
  • cheap on e-bay
  • Heat sinks
  • Power supply
  • don't buy the cheapest – try a phone charger first.
  • microSD card – class 4 or 10, up to 32GB 64GB won’t work on earlier models
  • NOOBS distribution Raspberry Pi OS ‘’Buster” (free at www.raspberrypi.org/tag/noobs/)
  • Needed for lab extensions and OS explorations:
  • USB keyboard
  • A Screen Display with HDMI port or in combination with an HDMI adapter suitable for your screen’s input port (eg HDMI to DVI/VGA
  • This is for screen writing lab in Week 10 and asm programming with operating system (these however are optional labs):
  • Note RPi 4 requires micro HDMI cable

SOFTWARE

  • FASM: Flat Assembler 1.4
  • http://arm.flatassembler.net/
  • Win version (1.43)
  • Linux version (download full package from here, or binary from here.
  • Supports B, B+ ARM1176 (ARM6 CPUs), RPi2 ARM7 and RPi3,3B,3B+ and RPi4 (ARMv8 64 bit) CPUs
  • One-step compile, GUI.
  • No installer (no admin rights needed).

FASMARM

  • Syntax is simpler than traditional ARM ASM
  • no need for.section, _start,.global
  • native support for named constants, macros.
  • no Makefiles
  • BUT
  • some ASM commands not supported.*
  • error messages not always helpful. *Supported commands here: YourDrive:\FASMARM_win32\ARMDOC\InstructionFormatsARM.asm

SUMMARY

  • Bare metal assembly programming starts this week!
  • This will be mostly programming without an Operating System
  • no need to install anything on your Pi!
  • Get your gear!
  • Get ready for some programming fun!