Hardware manual

53
6. Adding Board Support Package (BSP) for BLDC on H8S/2638.
6.1. Introduction.
As was mentioned in section 5.1, the basic aim of PXMC library is/was to create easy to use and
extendable hardware independent code for motion control. At begin of my work with PXMC, the
situation looked quite different from above wishes. There was no separation of the code, no
modularity, and no external debug tool. The code was hard to understand and what is the worst
it was very hard to use. There was and still is a huge lack of a good documentation.
In the following subsections I'll try to present most of my work concerned with PXMC and all
changes which I made myself or with Michal Sojka's help/cooperation.
6.2. Subdirectories structure changes.
This subsection is strongly correlated with point 5.3.1 and the figure nr 5.3.1-1. As we can see on
this picture, that nowadays structure of subdirectories hardly depends on the target board. At
the early begin, it was totally different. All files were put together into one pxmc directory and
when we created some new application/driver, we had to create our new file and then include it
to our project.
Now the situation changed. Whenever we want to create a PXMC support to a new board (BSP
Board Support Package), we just create new folder with the name of the board and then we
create the Makefile.omk with compilation rules for our BSP. In the Makefile.omk we also need
to set two variables at the beginning:
default_CONFIG = CONFIG_PXMC_VARIANT=default_variant
lib_LIBRARIES = pxmcbsp
Where the default_variant defines target board and motor configuration. Now, because BSP can
be compiled for different motors on different variant of board, we can use
CONFIG_PXMC_VARIANT to choose in which variant we are interested. If we want to compile
different than the default version, we can override this default value for example in config.omk
file.
Second line states in above that we just want to compile PXMC board support library. It means
that after we create our new .h and .c files, we only want to get a library as a result. In the case
when we just want to extend the already existed driver for a given board, we only need to add
new functionality in existing files.