STM32F4-Discovery Board
I received my STM32F4-Discovery evaluation board last week. So I setup the required development environments and did a quick test.
The STM32F4 is an ARM Cortex-M4 processor with DSP and FPU instructions. Since I have not used any ARM MCU before, I decided first to use the recommended tool chain to get myself started.
According to the user manual (UM1467), the following IDEs have native support for STM32F4-Discovery board:
- IAR Embedded Workbench for ARM (EWARM)
- RealView Microcontroller Development Kit (MDK-ARM)
- Atollic TrueSTUDIO for STM32
- Altium TASKING VX-toolset for ARM
And it seems that only the Atollic TrueSTUDIO has a free version (Lite) that does not have any code limitations. So the Atollic IDE is the pretty obvious choice for me.
The IDE is based on the popular open source Eclipse development environment. Having used it extensively with C++ and Java projects, setting up the demo project is pretty straight forward. Atollic TrueSTUDIO also integrates with ST-Link GDB server, which makes debugging within the IDE very easy (see screenshot below)
To upload the compiled code onto the STM32F4 board, we will need the STM32 ST-LINK utility.
Atollic TrueSTUDIO builds the project target into ELF format which cannot be uploaded to the development board directly. So we will need to first convert the target from ELF to Intel HEX. Unfortunately, the lite version does not seem to provide such a conversion utility.
After some searching, I found that Ronetix ARM toolset contains arm-elf-objcopy which can be used for such conversion. The full Ronetix tool chain can be downloaded from here.
To convert the ELF file to HEX, use the command below:
STM32F4-Discovery_FW_V1.0.1\Project\Demonstration\TrueSTUDIO\STM32F4-Discovery_Demo\Debug
arm-elf-objcopy -O ihex RCC.elf RCC.hex
Now we can use the ST-LINK utility to upload the .HEX file onto the STM32F4-Discovery board. Interestingly enough, the converted HEX file is about 17 kB smaller than the pre-compiled project demonstration file in the binary folder. It works without a glitch nevertheless. I suspect that the ST supplied HEX file might have been compiled with more debugging information.
I didn’t get it, you mean I have to change IDE from Atollic to Ronetix or what?
because I downloaded the link file and it only downloads Eclipse??
please give more detail on how to make this convertion( from elf to hex)
thanks
No, you don’t need to use Eclipse, the Ronetix tool kit comes with a utility (arm-elf-objcopy) you can use to convert. Also, I might not be quite clear in my original post… Atollic TrueSTUDIO can upload the code as well, just not in hex format (which means if you will have to rely on the IDE to do your debugging/deployment).
but I have only the above kit(STM32F4-Discovery) and I want to have hex file after I compile my program using any IDE that I can program in c/c++. can you be more clear please about that tool that I have to download..
Thanks
Sure… the tool I used is ronetix-gnutools-arm-elf-4.1.1-linux.tar.bz2 (from http://download.ronetix.info/toolchains/arm/)
and another thing, what and where you mean by saying:
To convert the ELF file to HEX, use the command below:
STM32F4-Discovery_FW_V1.0.1\Project\Demonstration\TrueSTUDIO\STM32F4-Discovery_Demo\Debug
arm-elf-objcopy -O ihex RCC.elf RCC.hex
do you mean in Ronetix or atollic? I think both are using same eclipse?
The .elf file would be the one generated using Atollic TrueStudio.
I’m finding this hard to believe, so I need to verify.
You have a card that plugs into the PC via USB port. That’s how it gets power.
BUT- you say you can’t transfer [compiled] code to the board?
You HAVE to buy the ST-LINK utility hardware device?
Or do you mean – you need to use the ST-LINK software and USB driver at:
http://www.st.com/internet/evalboard/product/219866.jsp
to communicate ?
Hi Alan,
No, it’s not that it couldn’t transfer code, it can. It’s just if you want to use the .hex format, you can’t do it within the IDE.
Hi Wong,
Thanks for the rewiev and good explanation.
But I you don’t have to use Ronetix Toolchain. It is possible with Atollic Toolchain.
Lite Edition is only blocking generating the .hex file via Atollic IDE. It is possible to over command line.
You can use this while in the command line : arm-atollic-eabi-objcopy -O ihex [project].elf [project].hex
And works ;)
http://www.fatihinanc.com/wp-content/uploads/2012/03/objcopy.png
Thanks.
Best Regards.
Thanks M.Fatih for the suggestion.
To get the HEX output by default navigate Project -> C/C++ Build -> Settings -> Tool Settings -> Other -> Output Format then check convert build output and format to intel hex.
Hope this helps.
Aha, thanks for the info.
Hi, Kerry – could you say a bit more about the advantage or purpose of converting the code to Hex format before uploading, or the implications of the alternative?
I’m not sure what you mean by “(which means if you will have to rely on the IDE to do your debugging/deployment).”
Thanks, I’m a complete ARM newbie.
The Hex format is universal and thus you don’t have to rely on a particular environment to upload it on to your MCU.
We have a new community at Arm-HQ. Ask all your arm related questions here. There is even a sub-forum for the Discovery kits:
http://forum.arm-hq.com/index.php?/forum/15-stm-discovery-evaluation-kits/
Can you hepl me to programing for stm32f4!
Thanks a lot
hello from where did u get the stm 32 f4…is it from st.com…if so, i m getting confused with the ordering process..it is getting rejected everytime.please answer my question…