Sunday, 15 June 2014

c - How do I compile and link the sample code to get a binary? -



c - How do I compile and link the sample code to get a binary? -

i'm working ti stellaris lm3s1968. mcu has arm cortex-m3.

i installed vm on laptop windows 7 on it, , there installed gnu tools arm embedded processors. installed stellaris flash programmer, gui , command line. installed stellaris ftdi drivers.

finally, downloaded , extracted ek-lm3s1968 firmware development package.

in extracted folder, there examples. 1 of them blinky. if go /stellarisware/board/ek-lm3s1968/blinky/gcc/ there's file called blinky.bin. using stellaris flash programmer can hook computer , flash it, , it'll work. tried various examples , worked.

now goal compile sample code provided in /stellarisware/board/ek-lm3s1968/blinky/, , flash it. however, haven't had much luck, i'm not experienced c or programming microcontrollers.

i copied lm3s1968 libraries stellarisware folder compiler's include folder. followed examples found online, not successful. tried:

arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb blinky.c -nostartfile -t blinky.ld -o blinky.o arm-none-eabi-ld -t blinky.ld -o blinky.out blinky.o arm-none-eabi-objcopy -obinary blinky.out blinky.bin

when flash .bin file, doesn't anything, led stays on.

i think it's because there's startup_gcc.c file, handles starting mcu before running program. i'm not sure how bundle it.

there's lot of files different ides, they're non-free, want utilize gnu tools.

i tried searching here in stackoverflow , googling around, unable find answer.

i believe linker discarding startup code. way create sure gets included using keep in linker script. create sure linker not discard startup code. if don't have startup code in section, need first.

c arm linker-scripts

No comments:

Post a Comment