Programming STM32-Discovery using GNU tools. Startup code

Start up code is run just after microcontroller is reset and is executed before main program. As linker script, startup code usually is implemented as universal code for all same microcontroller type. So usually you don’t need to write one from scratch. Anyway it is good to know what happens there anyway. As we said linker script has to go along with startup code. This means that it will initialize MCU automatically according to data defined in linker. Startup code initializes variables, copies defined variables from Flash to RAM, initializes stack and then gives resources to main program. You will find that startup codes usually are written in assembly language, but this can also be done in C which is easier to read and modify if necessary. First of all… Continue reading

Programming STM32-Discovery using GNU tools. Linker script

Previously we went through setting up a development environment for ARM Cortex-M3 microcontroller. We decided that two equal choices will do same job – either CodeSourcery G++ Lite or Yagarto. Both use same base of GNU tool-set. Developing with GCC tools In order to get a working binary, there is a series tools involved during code development. Several tools are necessary to compile simple applications. These are: compiler, assembler, linker and binary generator. Each of them does it own task in a chain process. When you start compiling your project normally there is a linker invoked, which with correct parameters links libraries, object files. Once executable is generated, then binary image generator creates binary image (.bin or .hex) that can be uploaded to MCU. We won’t go in to details… Continue reading

Setting ARM GCC development environment

As we mentioned before, we are going to stick with free software tools. So we are going to use free and open source GCC compiler to develop programs for ARM Cortex microcontrollers. As we are going to work from windows environment there are couple serious choices that are pretty similar. One is using CodeSourcery Lite edition or Yagarto Gnu ARM toolchain. Both tools work same as they use same GCC compiler and other tools. Both seems to be supported frequently. CodeSourcery claim that they are updating Lite Edition twice a year, while Yagarto is doing this more frequently depending on updates of separate tools. So your choice won’t affect your final rezult. When installed you can easily check if everything works fine by opening command line tool and writing simple… Continue reading

Do we need ARM?

ARM microcontrollers are very successfully positioned microcontrollers in the market. Billions of them are used in all areas where control, data processing in interfacing is needed. ARM microcontrollers has evolved in to high level product that provides high processing power with minimal clock frequency and power usage. Practically all major manufacturers are developing their own line or ARM processors that share same standard core functionality and variations between MCUs starts with peripherals and other external features. ARM microcontrollers are really cheap and powerful that makes them attractive to use in almost all applications. They successfully taking place of smaller microcontrollers like ARM or PIC. Hobbyists also are taking them over. Continue reading