Lab 2: Creating your own board support package (BSP)
A BSP includes a set of device drivers that are specific to the components/silicon used in the board. These are provided by the component vendors / silicon vendors, mostly in the form of .inf and associated .sys/.dll files.
Create a new Board Support Package (BSP) when:
Creating a new hardware design
Replacing a driver or component on an existing hardware design
Whether you're creating a new BSP or modifying an existing BSP, you become the owner. This lets you decide whether to allow updates to install on your boards.
In our lab, we'll create a new BSP based on the Raspberry Pi 2, removing the existing GPIO driver and replacing it with the sample GPIO driver: GPIO KMDF demo.
Create a new BSP working folder
From the IoT Core Shell, create a BSP working folder that you'd like to modify using Add-IoTBSP.
Add-IoTBSP MyRPi2 (or) newbsp MyRPi2
Add packages into the feature manifest
Open the feature manifest file for your new BSP,
In another window, open the Raspberry Pi 2 feature manifest to use as a template.
Add your base packages (BasePackages).
UEFI drivers for the boot partition (RASPBERRYPI.RPi2.BootFirmware.cab)
Drivers required for UpdateOS (SV.PlatExtensions.UpdateOS.cab)
Mandatory device drivers (bcm2836sdhc.cab, dwcUsbOtg.cab, rpiq.cab)
When creating your own BSP, it's typical to require a display driver and a storage driver, and sometimes a network driver.
Copy in the device layout and platform packages (DeviceLayoutPackages, OEMDevicePlatformPackages).
Note that both the OEMDevicePlatform.xml and devicelayout.xml can be packaged into one package, for example, DeviceLayout.MBR4GB. The same package can then be specified as input in both the sections (for example, under
<DeviceLayoutPackages>). To learn more, see Device layout.
Copy in features (Features).
Copy in features you want. Exclude any that don't apply to your project.
For example, copy in each of the drivers except the existing GPIO driver:
<PackageFile Path="$(mspackageroot)\Retail\$(cputype)\$(buildtype)" Name="RASPBERRYPI.RPi2.GPIO.cab"> <FeatureIDs> <FeatureID>RPI2_DRIVERS</FeatureID> </FeatureIDs> </PackageFile>
Note: To make grouping packages easier, you can combine them into one or more Feature IDs. For example, all of the Raspberry Pi 2 optional drivers use the Feature ID: RPI2_DRIVERS.
Add the HelloBlinky driver
<PackageFile Path="%PKGBLD_DIR%" Name="%OEM_NAME%.Drivers.HelloBlinky.cab"> <FeatureIDs> <FeatureID>BLINKY_DRIVER</FeatureID> </FeatureIDs> </PackageFile>
Create a new product folder
Create a new working product folder, adding your BSP name to the end.
newproduct ProductC MyRpi2
This creates the folder:
C:\MyWorkspace\Source-<arch>\Products\ProductC, which is linked to the new BSP.
Update the project's configuration files
Update the product test configuration file using Add-IoTProductFeature
Add-IoTProductFeature ProductC Test BLINKY_DRIVER -OEM (or) addfid ProductC Test BLINKY_DRIVER -OEM
Build and test the image
Build the image
From the IoT Core Shell, create the image:
buildimage ProductC Test
This creates the product binaries at
Start Windows IoT Core Dashboard > Setup a new device > Custom, and browse to your image.
Put the Micro SD card in the device, select it, accept the license terms, and click Install. This replaces the previous image with our new image.
Put the card into the IoT device and start it up.
After a short while, the device should start automatically, and you should see your app.
Check to see if your driver works
- Use the testing procedures in the Hello, Blinky! lab to test your driver.