Skip to content

Instantly share code, notes, and snippets.

@apparentlymart
Created July 20, 2014 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apparentlymart/19f221e191bd591dd704 to your computer and use it in GitHub Desktop.
Save apparentlymart/19f221e191bd591dd704 to your computer and use it in GitHub Desktop.
mbed LPC1768 pyLLVM GPIO
/* Boot stub. Must be linked first to be at the beginning of the program ROM. */
/* Main program must provide an entry point function called "main". */
.cpu cortex-m3
.thumb
.word 0x10008000 /* stack top address */
.word _start /* 1 Reset */
.word hang /* 2 NMI */
.word hang /* 3 HardFault */
.word hang /* 4 MemManage */
.word hang /* 5 BusFault */
.word hang /* 6 UsageFault */
.word hang /* 7 RESERVED */
.word hang /* 8 RESERVED */
.word hang /* 9 RESERVED*/
.word hang /* 10 RESERVED */
.word hang /* 11 SVCall */
.word hang /* 12 Debug Monitor */
.word hang /* 13 RESERVED */
.word hang /* 14 PendSV */
.word hang /* 15 SysTick */
.word hang /* 16 External Interrupt(0) */
.word hang /* 17 External Interrupt(1) */
.word hang /* 18 External Interrupt(2) */
.word hang /* 19 ... */
.thumb_func
hang: b .
.thumb_func
.globl _start
_start:
bl main
bl hang
.end
/* GCC Linker Script */
MEMORY
{
rom(RX) : ORIGIN = 0x00000000, LENGTH = 0x40000
ram(WAIL) : ORIGIN = 0x10000000, LENGTH = 30K
}
SECTIONS
{
.text : { *(.text*) } > rom
.bss : { *(.bss*) } > ram
}
all: blink.bin
blink.ll: genblink.py
python genblink.py >blink.ll
blink.bc: blink.ll
opt-3.4 blink.ll -o blink.bc
blink.s: blink.bc
llc-3.4 -march=thumb blink.bc -o blink.s
%.o: %.s
arm-none-eabi-as $< -o $@
blink.elf: boot.o blink.o
arm-none-eabi-ld -T linker boot.o blink.o -o blink.elf
blink.bin: blink.elf
arm-none-eabi-objcopy blink.elf blink.bin -O binary
clean:
rm -f blink.ll blink.s blink.o boot.o blink.elf blink.bin blink.bc
upload: blink.bin
cp blink.bin /media/MBED/blink.bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment