Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 2.7 KB

README.md

File metadata and controls

63 lines (43 loc) · 2.7 KB

qr-asm

Generate a QR code from scratch with only ARM assembly.


QR code to my GitHub profile.

A byte mode QR code of https://github.com/barrettotte using Q error correction level.
See qrcode.pbm for the raw image file.

Why?

At first, I learned how QR codes worked with an ugly python implementation; See docs/python. Midway through the python implementation, I started to learn ARM assembly. But, I had no idea what to build to practice my knowledge.

So, this project turned into a giant coding challenge just to see if I could do it. In a world where C exists, you should obviously never use assembly for this type of project/application.

Usage

Usage: qrcode msg err_lvl

valid error levels: L=1, M=0, Q=3, H=2

My primary test - ./bin/qrcode "https://github.com/barrettotte" 3

Quick build and test - make && make test

Limitations

I constrained the QR code generation a lot. I just wanted to encode a url, not build a whole library.

  • Byte mode encoding only
  • QR version 4 and below (up to 80 characters with v4-L)
  • Mask evaluation not implemented, hardcoded to mask 0 (I think masks only effect scan efficiency)
  • Instead of implementing an entire image file format, I used the PBM file format to create my QR code image.

Additionally, I'm still a novice with assembly so there is probably a ton of unoptimized code. I also didn't use all the features of the ARM assembler/architecture. I wanted to write this so a year from now a dummy like me could understand what I wrote.

Debugging with GDB

I'm still new to GDB, but this worked for me.

  • make && make qemu
  • make debug

For sanity checking this ugly thing, see my notes in docs/3Q-test.md

References