May 19, 2015

ARM Cortex Development Overview

New to ARM? Here you can take a look over the actual ARM development scenario and find the cheap way to start learning about this amazing 32 bit powerful microcontroller based in my own experience.


As always I will try to be direct and simple, ARM is so widely used due to some factors, like: low energy consumption (vital for mobile devices), high performance and easily found in the market, allied with a good price compared to any other 32 bit microcontroller.

Due to this characteristics, with the time, ARM was being adopted by the industry, like cellphones manufacturers and so many others. The popularity made the world focus over it, and then things like Linux passed to be supported, as well as its open-source tools and so on. Now, we can find models with dual, quad or even eight cores! and if you still reading this, is because by some way, the ARM convinced you to take a look too.

ARM Model Choice

My choice to start was an ARM Cortex-M3 from STM, model STM32F103C8T6, just because I could find cheap development boards with this model in particular, that could allow me to do from a simple hello world to play with a real time operating system, like FreeRTOS.

The board in particular is this, it's small, simple and has all you need, 3.3v voltage regulator, 8 Mhz crystal and the whole chip pins mapped on 2.54" DIP pin headers, so I could easily access all the chip pins, using wires and a breadboard. I recommend you to start with an ARM Cortex-M3 too, because it's very popular and has a lot of information on internet. The Cortex-M0 is "weak", Cortex-M4 expensive and Cortex-M1 seems to be unpopular. So luckily I did the right choice.

ARM Programmer

The board has a JTAG interface, so you can program it using a professional tool like the Ulink2 or similar, which allows real-time debugging while develop the code with one of the supported IDEs like Keil uVision, which is free and full, just with a 32 Kbytes as the program size limit. 

So to start I need order a programmer/debugger too? no! now the strong point of STM, they ship every ARM Cortex-M3 with an embedded bootloader, then you can program it using a serial connection, through the UART1 peripheral, here you can se how. But, of course, if you wish debug your system, soon or later you will need more than a bootloader.

ARM Development

Like any microcontroller, you can choose to program its registers directly, also known as "bare metal", or use some kind of abstraction layer, like libraries. The "war" between the different IDE's like in the 8/16 bit microcontroller field, is exactly this, if you use the IAR , Makro or CCS you have access to its own libraries which provides simple functions to use the peripherals like USB, ethernet, EEPROM, A/D and so on.

But luckily in the ARM field it's a little better, due the popularity and Linux support, there are many open-source libraries, which provides easy ways to use the ARM peripherals and external chips or modules, like LCD screen, bluetooth, wifi and RTC. 


Furthermore, all the major ARM companies together created the CMSIS (Cortex Microcontroller Software Interface Standard), that consist of a layer, where each manufacturer must provide the CMSIS library, for developers work with their ARM microcontrollers using the same API between them, in other words, a code that runs in the NXP ARM , must runs in the STM or any other CMSIS company ARM microcontroller.

The STM CMSIS library is called "Standard Peripheral Library", and to use it in your project, first you need set the USE_STDPERIPH_DRIVER define on the compiler flags. The content of the CMSIS library is simple, each function basically has a series of direct registers operations (bare metal), so if you want learn how to program using the registers directly, the CMSIS libraries can be a good start point, just get the desired function and look how it's implemented.

The STM CMSIS library comes with documentation and examples, furthermore, they provides the STM32Cube tool, which allows through a graphical user interface, the selection of peripherals to be used and set the function of the configurable pins, then it generates the starting code to start develop your application, but unluckily it not support the STM32 F103 series yet, that was my ARM model choice.


For starters I recommend use and read about CMSIS libraries and Keil MDK, that consist of compiler and IDE called uVision, the full features can be seen here, as said, it's free, just with a 32k of flash/program limit, it's CMSIS compliant, has a package manager, which automatically gets the latest libraries from the manufacturer, plus a simulator and user-friendly interface. FreeRTOS can be used within the 32k limit and you can see how, on this link. And think about a debugger too, I recommend the Ulink2.

0 comentários :

Post a Comment