Author Topic: CoIDE / STM32Discovery tutorials  (Read 3032 times)

0 Members and 1 Guest are viewing this topic.

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
CoIDE / STM32Discovery tutorials
« on: March 04, 2014, 12:29:25 am »
I personally find CoIDE much easier to use than the commercial tools, particularly its project wizard.

However, a newbie may find it complex and I thought maybe a quick tutorial is in need.

The goal here is:

1) get a project going quickly;
2) get to compile the discovery board demos.

For simplicity, I will start with the F1 Discovery board.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: CoIDE / STM32Discovery tutorials
« Reply #1 on: March 04, 2014, 12:36:35 am »
This tutorial assumes that you have CoIDE installed and gcc-arm installed and configured in CoIDE. If not, consult the manual / google.

1st: create your own project.

a) run CoIDE and Project -> New Project. You will then specify the location of the project, and then pick your chip (for F1, it is STM32F100RB - it is in your discovery board user manual).
b) you will then face your first decision on the Repository page: User the standard peripheral library or not. I would recommend that you do, at least in the beginning to get things going.

You will need two things at a minimum, CMSIS core and RCC - when you click RCC, CoIDE will click CMSIS for you.

After that, you will need to pick whatever elements of the std periph library you need for your project. For now, we just click them all (other than those few on the bottom that are user-supplied).
c) you are done!

You will notice that you have a minimum, non-platform specific main.c, placed in the project folder for you by CoIDE. The project at this point is complete and you can hit compile and you will not see any error message - of course, the project does exactly nothing at this point.

stlink has also being set up for you  and you can download this do-nothing code onto your discovery board.

Where you go from here is entirely up to you - you have a working project and you just need to load it up with your code.

The whole thing takes maybe 30 seconds, if you are slow.
« Last Edit: March 04, 2014, 11:58:15 am by dannyf »
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: CoIDE / STM32Discovery tutorials
« Reply #2 on: March 04, 2014, 12:55:14 am »
Now, load up the Discovery demo code.

1) download the discovery demo package from st.com.
2) unzip it and you will find a few folders. One is called Libraries - it contains CMSIS core and the std periph functions. CoIDE has done that for you.

We need content from two folders:

a) Project: navigate to Project -> Demo, copy all the files under src (main.c and stm32f10x_it.c) and inc (stm32f10x_conf.h and stm32f10x_it.h) to your project directory.
b) Utilities: it contains two files for the discovery board, stm32vldiscovery.h and stm32vldiscovery.c. Copy them to your project directory.

3) You will need to add those new files to your project. In the left middle of the screen, there is a little tab called "Project", showing your project and its content. Right click on your project name, and select "Add Files". Navigate to your project folder and you will see those files mentioned in step 2. Select them all: use Ctrl-Click.

Now all the files will be visible in the "Project" tab / window.

4) you are almost there, :)
4.1) click on stm32vldiscovery.h, insert, right below [#include "stm32f10x.h"], [#include "stm32f10x_conf.h"];
4.2) click on stm32f10x_conf.h, find __STM32F10x_CONF_H: it shows up on lines 22 and 23. Delete one leading underscore (so you have _STM32F10x_CONF_H).

5) hit compile and you are done. The resulting code can be downloaded into the board and it will run.

Step 4) above actually isn't necessary, if you do two things:
a) in step 3), do NOT copy stm32f10x_conf.h from the Demo folder;
b) in CoIDE, navigate to cmsis_boot->stm32f10x_conf.h, and uncomment those lines so that the stm32f10x_conf.h under cmsis_boot is identical to the stm32f10x_conf.h in the demo folder.

The right way, once you know your way around, is to modify the stm32f10x_conf.h (which configures the std periph library) to suit your project's needs.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: CoIDE / STM32Discovery tutorials
« Reply #3 on: March 04, 2014, 12:56:16 am »
Setting up projects for other chips are pretty much the same.

Similar steps for setting up and compiling discovery demo programs for your boards.
================================
https://dannyelectronics.wordpress.com/
 

Offline gmb42

  • Frequent Contributor
  • **
  • Posts: 302
  • Country: gb
Re: CoIDE / STM32Discovery tutorials
« Reply #4 on: March 04, 2014, 09:40:18 am »
This tutorial assumes that you have CoIDE installed and gcc-avr installed and configured in CoIDE. If not, consult the manual / google.

Did you mean to type gcc-arm?
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: CoIDE / STM32Discovery tutorials
« Reply #5 on: March 04, 2014, 11:57:43 am »
yes. corrected.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf