cancel
Showing results for 
Search instead for 
Did you mean: 

Help with setting up a development enviroment.

arnold
Associate II
Posted on July 22, 2012 at 09:07

Does someone now a tutorial where is explained from a to z how to setup a development enviroment for a stm32f4discovery.

i'm constantly running against problems, of not compilling my projects good. 

i realy wan't to use eclipse with CDT. 

but next how do i setup a template project, what should i add where. 

how should a make file look, what files should i at least include etc. etc. 

any help would be very helpfull.

could system_stm32f4xx.c be a default file ?

could this also be for the .....it file.

1 REPLY 1
frankmeyer9
Associate II
Posted on July 23, 2012 at 10:35

I'm not using Eclipse & CDT, but that shouldn't make much of a difference.

And I'm going to start from a F10x project. For other derivate like the F0, L1 and F4, it is basically the same.

First, you need to have Peripheral Driver library from ST, which you have already, I guess.

It consists of the CMSIS part, basically from ARM, and the controller specific part from ST.

In main.c, you will need to include a file stm32fxxx.h, in my case stm32f10x.h.

In your case, it will probably be stm32f40x.h. (Before, you probably need to include stdint.h, where some generally used typedefs and defines reside).

Somewhere at the end of stm32fxxx.h, you are going to find this:

#ifdef USE_STDPERIPH_DRIVER

  #include ''stm32f10x_conf.h''

#endif

Again, this is an example for the stm32f10x.

That means, with defining ''USE_STDPERIPH_DRIVER'' in the build settings, you can choose to use the Peripheral functions, or not. When defining this macro, a header file

stm32fxxx_conf.h'' is pulled in. This file is application specific, and not really part of the library. It includes the header files for all specific peripherals, and defines the assert_failed macro. Feel free to comment/uncomment the includes for the peripherals you use in your project. Some toolchains like Atollic often include all of those, and pull in all the the C files for those peripherals. You might need to add the regarding C files manually to your project.

Another thing you need is the startup code, mostly provided as assembler file.

Most examples assume a function SystemInit(), which is executed before main. It resides in system_stm32f10x.c (and system_stm32f10x.h ). You  will need to add them to your project, too, if your startup code uses it.

For the F4, you might need to change the startup code if you intend to use the FPU - there are already several threads describing this issue.

As mentioned above, this is basically the same for all stm32 variants.

Be aware that toolchains may differ in the startup asm file and the linker script. That becomes more difficult if you want to use the C standard library and IO redirection, for instance.