Saturday, December 12, 2009

Cortex-M3 + CodeSourcery startup...

This .pdf documents how to write a minimal C program to run on the LM3S811EVB qemu target:

http://www.bravegnu.org/gnu-eprog-handout.pdf

Install CodeSourcery and have fun! I'm going to look into elaborating on this over the weekend. Maybe even blink an LED on my LPC13xx board...

---

Compiling CMSIS w/CodeSourcery w/o IDE...

This is for the LPC13XX target. This also works with Luminary Micro's stuff as long as you change the relevant LPC13xx's to LM3's.

- Get the CodeSourcery tarball for Linux and extract it.
- Set path to [extraction dir]/bin:$PATH to get the toolchain in path

- Get the CMSIS library from onarm.com and extract it
- create a flat cmsis directory outside of that tree
- copy CMSIS_V1P30/CM3/CoreSupport/core_cm3.* to it
- then CMSIS_V1P30/CM3/DeviceSupport/NXP/LPC13xx/startup/gcc/*
- finally CMSIS_V1P30/CM3/Example/Sourcery\ G++Lite/LPC13xx/*

Then make a start.c with an empty _start() function.

To build: arm-none-eabi-gcc -mcpu=cortex-m3 -msoft-float -mthumb -fno-common -Wl,-cref,'-Map=map.txt',-S,'-TLPC13xx.ld' *.c startup_LPC13xx.s

And to de-ELF it so you can write it to flash: arm-none-eabi-objcopy a.out -O binary a.bin

Now to actually build and run code. The next step is to build the LM3 version and run it under qemu's L3MS811 EVB emulation... and not have it crash.

No comments: