text based board.h generator

This forum is about you. Feel free to discuss anything is related to embedded and electronics, your awesome projects, your ideas, your announcements, not necessarily related to ChibiOS but to embedded in general. This forum is NOT for support.
User avatar
Posts: 291
Joined: Fri May 25, 2012 10:23 am
Location: toulouse, france
Has thanked: 25 times
Been thanked: 36 times

text based board.h generator

Postby alex31 » Sun Jun 10, 2018 7:49 pm


It’s been a while since a board.h generator has not been announced :-)

I know the word probably does not need so many board.h generator, but I will nevertheless briefly expose the one that I use.

This one has be written to fulfil 2 goals :

1/ made easy frequent change in static configuration (teaching practical work)
2/ keep off graphical tool and reference manual

So, instead of generating board.h from STM32CubeMX description, it use as a source a dumb text format. It still need STM32CubeMX to be installed to use the xml description files of the MCU.

There is 2 modes of operation : board.h generation and query mode : to list alternate function and associated pins, associated dma streams and channels.

STM32CubeMX is a good tool to begin a new design, but when you want to change few pins during development, I feel it’s easier to just use a command line tool, and modify a text file.

I just show an example of pin description :

Code: Select all

PA04    VBAT_MEAS               ADC      ADC1_IN4
PA08    XB_ASSO                 INPUT    FLOATING 
PA09    USB_VBUS                INPUT    PULLDOWN 
PA10    SD_DETECT               INPUT    PULLUP 
PA11    OTG_FS_DM               OTG      AF:USB_OTG_FS_DM 
PA12    OTG_FS_DP               OTG      AF:USB_OTG_FS_DP 
PB03    SPI1_SCK                SPI     AF:SPI1_SCK
PB04    SPI1_MISO               SPI     AF:SPI1_MISO
PB05    SPI1_MOSI               SPI     AF:SPI1_MOSI
PB06    USART1_TX               UART    AF:USART1_TX
PB07    USART1_RX               UART    AF:USART1_RX
PB08    I2C1_SCL                I2C     AF:I2C1_SCL
PB09    I2C1_SDA                I2C     AF:I2C1_SDA
PB10    I2C2_SCL                I2C     AF:I2C2_SCL
PB11    I2C2_SDA                I2C     AF:I2C2_SDA
PB12    LED1                    LED

So, no need to open documentation to retrieve alternate function number, and the script check that the function can be attributed on the pin.

The tool is used in teaching class and by developers here at ENAC, so it will be maintained in the foreseeable future.

What can be painfull is the installation since it’ written in perl language : windows user will need to install a perl interpretor since there is no by default, linux and osx user are more lucky.

The full documentation is here :
boardgen.pl doc

script can be found there :
boardgen.pl script

a real board.cfg example :


Return to “User Projects”

Who is online

Users browsing this forum: No registered users and 1 guest