pyVision
A Machine Learning and Signal Processing toolbox

Download .zip Download.tar.gz View on GitHub


User Defined Library in MBED

This article describes on how to add a user defined library in MBED

Adding User Defined Library to MBED

Following files need to be changed to add support for new libraries in mbed

we will be defining a new library called kfactory

  • build.py - main build file
  • libraries.py - files containing info on various libraries and build paths
  • path.py - files containing path definitions for various libraries

Adding the paths for kfactory source and build diretory in the path.py file

 #kfactory libraries
KFACTORY=join(LIB_DIR,"kfactory")
KFACTORY_LIBRARIES=join(BUILD_DIR,"kfactory");

This configures the build directory for kfactory library

Defining the source,build directories and dependent libraries in library configuration file libraries.py

    {
        "id": "kfactory",
        "source_dir": KFACTORY,
        "build_dir": KFACTORY_LIBRARIES,
        "dependencies": [MBED_LIBRARIES,RTOS_LIBRARIES],
    },

This adds the library dependencies for kfactory library

Adding the new library in build command line parser in the file build.py

    parser.add_option("-k", "--kfactory",
                      action="store_true",
                      dest="kfactory",
                      default=False,
                      help="Compile the kfactory library")

This add a new command line argument -k for compilation of kfactory library

Now place the library source files in mbed/libraries/kfactory subdirectory

To trigger the build run the command

$ python build.py -t GCC_ARK -m NUCLEO_F334R8 -k

the -k option has been added for compiling the new library

blog comments powered by Disqus