Electronic – STM32 ARM header files for use with Eclipse and GCC

armcompilerembedded

I'm a mechatronics (mechanical and electrical) engineering student and want to learn how to program ARM microprocessors. I've used Atmel ATMegas previously. I'm using a mac and being a student I don't want to use expensive software so I've installed eclipse, Yagarto and openocd as per this blog post. What I want to know though, is where do I get header files for individual chips, as I want to program in C not assembly?.

I'm planning on using STM32 chips as these and NXP's LPC chips seem to be the most popular and STM32 chips seem to be more advanced. I've found that there are some header files when they are part of development boards such as for the STM32F103RBT6 when part of STM32-H103 from Olimex but I can't seem to find header files for other chips in the same family.

A secondary question is, are there any tutorials for C programming of STM32 chips or Cortex-M based chips? I can't seem to find any tutorials that go through the basics such as blinking an LED.

Best Answer

A good book that introduces Cortex-M3 based microcontrollers is "The definitve guide to the ARM Cortex-M3, Second Edition" written by Joseph Yiu. It contains both hardware and software explanations.

There's a software interface standard for Cortex-M processors that is called CMSIS (Cortex Microcontroller Interface Software). You can download standard pheripherals librairies from the microcontroller's manufacturer website which contains the CMSIS header files and source files.

You will also need a startup code to initialize your microcontroller before executing the main loop. It is usually provided by the IDE but I don't know if there's Eclipse packages that can do the job for you.