How do I compile and link the sample code to get the binary?
I am working with TI Stellaris LM3S1968. This MCU has an ARM Cortex-M3.
I set up a virtual machine on my Windows 7 laptop and there I installed GNU Tools for ARM Embedded Processors . Then I installed Stellaris Flash Programmer, GUI and command line . I also installed Stellaris FTDI Drivers .
Finally, I downloaded and extracted the EK-LM3S1968 firmware development package .
There are some examples in the extracted folder. One of them is close. If I go to / StellarisWare / board / ek-lm3s1968 / blinky / gcc / there is a file called blinky.bin. Using Stellaris Flash Programmer, I can connect it to my computer and run it and it will work. I tried this with various examples and they all worked.
Now my goal would be to compile the example code provided at / StellarisWare / board / ek -lm3s1968 / blinky / and execute it. However, I was out of luck as I am not very good at C or microcontroller programming.
I copied the LM3S1968 libraries from StellarisWare folder to the compiler include folder. Then I followed some examples I found on the internet, but I was not successful. This is what I 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 I run this .bin file it does nothing, the LED stays on.
I think this is because there is a startup_gcc.c file that launches the MCU before starting the program. But I don't know how to do it.
There are many files for different IDEs, but they are not free, so I want to use the GNU tools.
I tried searching here on StackOverflow and Googling but I couldn't find an answer.
source to share