Stellaris sessions
Posted at 2014-01-03.
Testing the Debian "bare metal" compiler with Stellaris launchpad:
raziel% apt-cache policy gcc-arm-none-eabi
gcc-arm-none-eabi:
Installed: 4.8.2-5+4
Candidate: 4.8.2-5+4
Version table:
*** 4.8.2-5+4 0
500 ftp://ftp.fi.debian.org/debian/ unstable/main amd64 Packages
900 ftp://ftp.fi.debian.org/debian/ jessie/main amd64 Packages
100 /var/lib/dpkg/status
I've checked out the dwelch git repo.
raziel% cd stellaris_launchpad
raziel% git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
Build blinker01...
raziel% cd blinker01
raziel% make
arm-none-eabi-as vectors.s -o vectors.o
arm-none-eabi-gcc -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -c blinker01.c -o blinker01.gcc.thumb.o
arm-none-eabi-ld -o blinker01.gcc.thumb.elf -T memmap vectors.o blinker01.gcc.thumb.o
arm-none-eabi-objdump -D blinker01.gcc.thumb.elf > blinker01.gcc.thumb.list
arm-none-eabi-objcopy blinker01.gcc.thumb.elf blinker01.gcc.thumb.bin -O binary
arm-none-eabi-gcc -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -mcpu=cortex-m3 -march=armv7-m -c blinke
arm-none-eabi-ld -o blinker01.gcc.thumb2.elf -T memmap vectors.o blinker01.gcc.thumb2.o
arm-none-eabi-objdump -D blinker01.gcc.thumb2.elf > blinker01.gcc.thumb2.list
arm-none-eabi-objcopy blinker01.gcc.thumb2.elf blinker01.gcc.thumb2.bin -O binary
raziel% lm4flash blinker01.gcc.thumb2.bin
Found ICDI device with serial: 0E200046
ICDI version: 9270
raziel% cd ..
.. and there is a blinding light at every reset :)
raziel% cd blinker02
raziel% make
arm-none-eabi-as vectors.s -o vectors.o
arm-none-eabi-gcc -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -c blinker02.c -o blinker02.gcc.thumb.o
arm-none-eabi-ld -o blinker02.gcc.thumb.elf -T memmap vectors.o blinker02.gcc.thumb.o
arm-none-eabi-objdump -D blinker02.gcc.thumb.elf > blinker02.gcc.thumb.list
arm-none-eabi-objcopy blinker02.gcc.thumb.elf blinker02.gcc.thumb.bin -O binary
arm-none-eabi-gcc -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -mcpu=cortex-m3 -march=armv7-m -c blinker02.c -o blinker02.gcc.thumb2.o
arm-none-eabi-ld -o blinker02.gcc.thumb2.elf -T memmap vectors.o blinker02.gcc.thumb2.o
arm-none-eabi-objdump -D blinker02.gcc.thumb2.elf > blinker02.gcc.thumb2.list
arm-none-eabi-objcopy blinker02.gcc.thumb2.elf blinker02.gcc.thumb2.bin -O binary
raziel% lm4flash blinker02.gcc.thumb2.bin
Found ICDI device with serial: 0E200046
ICDI version: 9270
raziel% cd ..
Blinker2 shows an occasional short blink. It easily looks like nothing is happening unless you stare at the board.
raziel% cd blinker03
raziel% make
arm-none-eabi-as vectors.s -o vectors.o
arm-none-eabi-gcc -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -c blinker03.c -o blinker03.gcc.thumb.o
blinker03.c: In function 'notmain':
blinker03.c:39:27: warning: unused variable 'nowtime' [-Wunused-variable]
unsigned int lasttime,nowtime;
^
blinker03.c:39:18: warning: unused variable 'lasttime' [-Wunused-variable]
unsigned int lasttime,nowtime;
^
blinker03.c:38:18: warning: unused variable 'rc' [-Wunused-variable]
unsigned int rc;
^
arm-none-eabi-ld -o blinker03.gcc.thumb.elf -T memmap vectors.o blinker03.gcc.thumb.o
arm-none-eabi-objdump -D blinker03.gcc.thumb.elf > blinker03.gcc.thumb.list
arm-none-eabi-objcopy blinker03.gcc.thumb.elf blinker03.gcc.thumb.bin -O binary
arm-none-eabi-gcc -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -mcpu=cortex-m3 -march=armv7-m -c blinker03.c -o blinker03.gcc.thumb2.o
blinker03.c: In function 'notmain':
blinker03.c:39:27: warning: unused variable 'nowtime' [-Wunused-variable]
unsigned int lasttime,nowtime;
^
blinker03.c:39:18: warning: unused variable 'lasttime' [-Wunused-variable]
unsigned int lasttime,nowtime;
^
blinker03.c:38:18: warning: unused variable 'rc' [-Wunused-variable]
unsigned int rc;
^
arm-none-eabi-ld -o blinker03.gcc.thumb2.elf -T memmap vectors.o blinker03.gcc.thumb2.o
arm-none-eabi-objdump -D blinker03.gcc.thumb2.elf > blinker03.gcc.thumb2.list
arm-none-eabi-objcopy blinker03.gcc.thumb2.elf blinker03.gcc.thumb2.bin -O binary
raziel% lm4flash blinker03.gcc.thumb2.bin
Found ICDI device with serial: 0E200046
ICDI version: 9270
raziel% cd ..
Blinker3 actually gives useful warnings :)
raziel% cd float01
raziel% make
arm-none-eabi-as --warn --fatal-warnings -mthumb -mfpu=vfp vectors.s -o vectors.o
arm-none-eabi-gcc -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -c float01.c -o float01.gcc.thumb.o
arm-none-eabi-ld -o float01.gcc.thumb.elf -T memmap vectors.o float01.gcc.thumb.o
arm-none-eabi-objdump -D float01.gcc.thumb.elf > float01.gcc.thumb.list
arm-none-eabi-objcopy float01.gcc.thumb.elf float01.gcc.thumb.bin -O binary
arm-none-eabi-gcc -Wall -O2 -nostdlib -nostartfiles -ffreestanding -mthumb -mcpu=cortex-m3 -march=armv7-m -c float01.c -o float01.gcc.thumb2.o
arm-none-eabi-ld -o float01.gcc.thumb2.elf -T memmap vectors.o float01.gcc.thumb2.o
arm-none-eabi-objdump -D float01.gcc.thumb2.elf > float01.gcc.thumb2.list
arm-none-eabi-objcopy float01.gcc.thumb2.elf float01.gcc.thumb2.bin -O binary
raziel% lm4flash float01.gcc.thumb2.bin
Found ICDI device with serial: 0E200046
ICDI version: 9270
raziel% cd ..
Meanwhile in another terminal:
raziel% ipython
Python 2.7.6 (default, Dec 6 2013, 20:05:37)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import serial
In [2]: x = serial.Serial(port='/dev/ttyACM0', baudrate=115200, timeout=2)
In [3]: x.readlines()
Out[3]: ['87654321 \r\n', '12345678 \r\n', '00030D40 \r\n']
In [4]: hex(200 * 1000)
Out[4]: '0x30d40'
In [5]: quit
The fun()
that calculates the multiply, supposedy in 32b float (I haven't
looked into that yet) is found in vectors.s
along with FPU init and things.
Similar things happen in the svc and uart demos, but the output might be harder
to show here. You can use e.g. screen /dev/ttyACM0 115200
with uart02
to get
input and output (echo). All of the code is worth reading even if the style and
method may not be what you want to use yourself. I believe these are supposed
to be educational. :)