Page 1 of 3
board config
Posted: Tue Feb 12, 2013 3:20 am
by tdwebste
Examining the stm32f3_discovery board I see pin names like GPIOA_SPI1_SCK
#define GPIOA_SPI1_SCK 5
in board.h
This pin name does not appear outside board.h
I assume these names are arbitrary.
Was this board.h file generated or hand crafted?
Re: board config
Posted: Tue Feb 12, 2013 7:33 am
by Tectu
The board file for the STM32F3 Discovery board was generated using the eclipse plugin. I'm not sure if the plugin is yet available for public or if only Giovanni has access to use it.
The macros defined in the board.h file are just there so you can create a nicer and more readable application code. For example, you can then write something like:
instead of:
In case of SPI pins you can use them for example in the SPI configuration structure instead of the actual numbers of the pins.
This is really just for esthetics and has nothing to do with the actual functionallity of the board.
~ Tectu
Re: board config
Posted: Tue Feb 12, 2013 9:11 am
by Giovanni
Hi,
Named pins are used on-board, see the STM32F3-Discovery schematic, unused pins have a generic name.
Giovanni
Re: board config
Posted: Fri Feb 15, 2013 12:26 am
by gentijo
Giovanni,
Is there some documentation that you can point us to on the best way to do
pin configuration management. I am hand editing the board.h file to enable
/ disable pins for my code but not all the pins are defined in board.h. i.e.
For my STM32F4 discovery board, there was a board.h but the I2C pins were
not defined, so I found another STM32F4 board.h where they were defined
and copying them into my file.. I get the feeling I am reinventing the wheel
and there is some other process that I could use to do configuration management.
I gave the Eclipse Config Wizard a try, it generated a board.chcfg file and I added
in the template .ftl files. When I choose the "Generate files from Configuration data"
it builds the board.c & board.h, but it have just generic pin information. I get
the feeling that there is a specific editor for board.chcfg that will allow you
to select a pins function vs editing the raw data in the xml editor.
How do you do pin configuration management ?
-John Gentilin
Re: board config
Posted: Fri Feb 15, 2013 7:10 am
by Tectu
I can tell you how I do it:
When the board I have to write board files for is similar to an existing once (eg. same MCU), I copy and then modify it afterwards. I open the schematics of the board, locate pin A0, look what's going on there, decide what's the best, safest state, write it down in the board.h file. Then I continue with pin A1 and so on.
Also note that you can give the pins an initial value in your board.c file.
~ Tectu
Re: board config
Posted: Fri Feb 15, 2013 9:05 am
by Giovanni
Hi,
If you want to use the configuration tool I suggest to copy the board.chcfg file of a similar board into ./boards/<yourboard>/cfg then edit the file using the Eclipse XML editor (in visual mode) setting up all the pins you need. Make sure you have the XML editor installed in Eclipse, it is installed by default in ChibiStudio if you are using that.
Note that if you don't assign a pin a name a generic name will be generated, so give them names.
Like Tectu suggested, the board schematic is your best friend here. The Reference Manual can help too.
Giovanni
Re: board config
Posted: Fri Oct 11, 2013 7:28 pm
by Anubirux
Hello,
I have some problems with this board config tool also. I didn't want to start new topic and I hope its ok to write here

So I tried generate board files but I only have files with *.c.ftl like. I tried to use cfg files just from demos.
What em I doing wrong ?
Greetings
Edit:
Maybe this helps, I'm using the latest ChibiStudio.
Re: board config
Posted: Fri Oct 11, 2013 7:45 pm
by Giovanni
Hi,
I just tried, got the .c and .h files. What procedure are you using?
I did the following:
1) Select the .chcfg file.
2) Press the generate button in the toolbar (it only appears if the chcfg file is selected).
3) Files appeared in the upper directory.
Giovanni
Re: board config
Posted: Fri Oct 11, 2013 7:49 pm
by Anubirux
Files appear in "C:\ChibiStudio\eclipse\configuration\org.eclipse.osgi\bundles\323\2\.cp\resources\gencfg\processors\boards\stm32f3xx\templates".
Here is also console copy:
Code: Select all
Starting session
> Processing board.c.ftl
> Processing board.h.ftl
> Processing board.mk.ftl
Finished
Re: board config
Posted: Sat Oct 12, 2013 8:18 am
by Anubirux
Everything is fine, it generates files perfectly. I though that it didnt overwrite old board files but it does. I was definitely too tired yesterday.
Anyway thanks for help
