Sat Sep 7 17:12:45 EDT 2013

Trying out Tivaware

With arm-none-eabi-* binaries[1] in the path, things seem to work out
of the box:

$ cd tivaware/examples/boards/ek-tm4c123gxl/freertos_demo
$ make
$ file gcc/freertos_demo.axf 
gcc/freertos_demo.axf: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped

Let's see if there's a simpler example: blinky.c in:
$ cd tivaware/examples/boards/ek-tm4c123gxl/blinky

It has a very simple main file.  Where is the chip startup?  Ah, in
startup_gcc.c - check linker flag "--entry ResetISR".

using blinky.ld, gnu ld links:
- blinky.o
- startup_gcc.o
- libm.a
- libc.a
- libgcc.a

( Makefile finds libc.a ... using
  arm-none-eabi-gcc print-file-name=libc.a )

The output .axf is just an ELF.

The startup_gcc.c file seems to have the "viral" clause license..
From what I read this is probably not a problem in practice.

Startup does:
  - ISR vector setup (different than ARMv5 ?)
  - RAM data,bss setup
  - Float unit setup
  - main()

Let's try to upload it.
$ openocd --version
Open On-Chip Debugger 0.8.0-dev-00120-gc93d28d-dirty (2013-08-18-00:30)

# M-x gdb
~/tm4c/gdb -i=mi /opt/xc/tivaware/examples/boards/ek-tm4c123gxl/blinky/gcc/blinky.axf

After fixing some gdb/emacs problems that required updates, it does
seem that the "load" command worked as the led is blinking:

mon reset
mon halt

Though there are some problems:

- first time around, "load" didn't work
- can't write to PC?

p $pc
$5 = (void (*)()) 0x28f <main+35>
set $pc = 0
p $pc
$6 = (void (*)()) 0x1 <g_pfnVectors+1>

[1] https://launchpad.net/gcc-arm-embedded