- Table of contents
- Creating a Custom Baseboard Configuration
Creating a Custom Baseboard Configuration¶
If you have designed a custom baseboard for use with the MitySOM-335x, you will need to customize the Linux kernel (and possibly U-Boot) for your design. This customization will define the pinmux and configure the peripherals and interfaces that are specific to your design. In most cases, we suggest following our example development baseboard design as much as possible to minimize the required software changes.
First, you need to determine which version of the Linux kernel you plan to use. If you are using an older MDK with a 3.7 kernel or older (e.g. 3.2) you will need to update the baseboard file in the kernel. If you are using a newer MDK with a 3.8 kernel or newer (e.g. 4.11) you will need to update the device tree for your custom board.
This page will help guide a user on how to create a customized baseboard file in the kernel which will represent the devices on your physical custom baseboard. If you are using a newer kernel (e.g. 3.8 or newer), please skip to the Device Tree Update section.
Kernel 3.7 or Older: Baseboard file update¶
First Steps¶
This guide will assume that you have a Linux based Operating System (such as Ubuntu 12.04) and basic proficiency in the use of it's command line. This guide will also assume that you have already familiarized yourself with Critical Link's git repository and have checked out the latest version of the Linux Kernel from it.
If you need Linux or more information on where to begin, check out the Getting Started with the AM335x Series guide.
Creating a Template for a Custom Baseboard¶
This guide will assume that the ARM toolchain has already been "sourced".
- Open a terminal window
- Navigate to the Linux Kernel git directory
cd ~/projects/linux-mityarm-335x/
- Navigate to the directory where the baseboard files are
cd arch/arm/mach-omap2/
- Copy the Critical Link Devkit baseboard file for use as a template.
The suggested filename format isbaseboard-<preferred name here>.c
. For this example the name will bebaseboard-mityarm335x-devkit-new.c
cp baseboard-mityarm335x-devkit.c baseboard-mityarm335x-devkit-new.c
- Using a text editor (vim, emacs, nano, etc) open the
Makefile
in the current working directory and add a line for your new baseboard file. Search forCONFIG_BASEBOARD
. . . obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o obj-$(CONFIG_MACH_OMAP_3430SDP) += board-3430sdp.o obj-$(CONFIG_MACH_MITYARM335X) += board-mityarm335x.o obj-$(CONFIG_BASEBOARD_MITYARM335X_DEVKIT) += baseboard-mityarm335x-devkit.o #new baseboard file is below this line obj-$(CONFIG_BASEBOARD_MITYARM335X_DEVKIT_NEW) += baseboard-mityarm335x-devkit-new.o obj-$(CONFIG_BASEBOARD_MITYARM335X_TESTFIXTURE) += baseboard-mityarm335x-testfixture.o obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o . . .
- Using a text editor open the
Kconfig
file in the current working directory and add a configuration option for your new baseboard file. Search forconfig BASEBOARD
. . . config BASEBOARD_MITYARM335X_DEVKIT bool "MityARM-335x Development Kit" help Select this option for the Critical Link MityARM-335x Development Kit baseboard. config BASEBOARD_MITYARM335X_DEVKIT_NEW bool "MityARM-335x Development Kit New" help Select this option for the "NEW" Critical Link MityARM-335x Development Kit baseboard. config BASEBOARD_MITYARM335X_TESTFIXTURE . . .
- Return to the Linux Kernel directory and configure the kernel for the AM335x
cd ../../../ make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- mityarm-335x-devkit_defconfig
- Open Menuconfig and select the new baseboard
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- menuconfig
Navigate to System Type -> TI OMAP2/3/4 Specific Features -> Select baseboard. Among the options you will see your newly created baseboard. Select it and hit Enter. - Save the new configuration and exit Menuconfig.
- Test the new configuration by building the Linux Kernel
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- uImage
- If the build succeeded, save your new configuration so it can be used later on.
cp .config arch/arm/configs/mityarm-335x-devkit-new_defconfig
To use this new config run themake
command with the new filename like belowmake ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- mityarm-335x-devkit-new_defconfig
- Make sure to commit these new files to your git repo
- Review the changes you have made. This is a good habit to get into as you can catch forgotten debug statements, etc.
git diff
- Stage the files you want to commit
git add arch/arm/configs/mityarm-335x-devkit-new_defconfig git add arch/arm/mach-omap2/baseboard-mityarm335x-devkit-new.c git add arch/arm/mach-omap2/Makefile git add arch/arm/mach-omap2/KConfig
- Commit the changes. Make sure to provide a helpful description.
git commit
- The changes are now committed to your local copy of the git repo.
- To look at your commit and others a good tool to use is
gitk
. This will open up a gui showing the log history of commits. The -n option prevents it from loading all 100k commits at once.gitk -n 2000
- Review the changes you have made. This is a good habit to get into as you can catch forgotten debug statements, etc.
Using the New Baseboard File¶
By creating a new baseboard file it allows you to make any form of modifications to this file and have the capability of creating multiple versions of the baseboard for use in your project. This also gives you a template of base functionality that is provided by the mityarm335x baseboard.
For example creating custom pinmuxing.¶
The majority of pins on the 335x can be used for one of several uses. These are defined in the 335x datasheet Table 4-1. Note to map these to the CPU registers, look at the 335x TRM Table 9-10 Control_Module registers starting at address 800h.
A wiki page is provided to help determine which pins are taken and should not be changed. Pin Out
2.6 and 3.2 kernel instructions¶
The devkit baseboard file in the kernel has several pin mux configs defined in this board.
http://support.criticallink.com/gitweb/?p=linux-mityarm-335x.git;a=blob;f=arch/arm/mach-omap2/baseboard-mityarm335x-devkit.c;h=65d594c62a960ea07d447592e1282daf03609280;hb=refs/heads/mityarm-linux-v3.2#l130
Pinmuxes for devices on the SOM are located in the board-mityarm335x.c file. These should not be changed in most cases. Doing so may cause problems with booting the device or accessing devices built into the SOM.
http://support.criticallink.com/gitweb/?p=linux-mityarm-335x.git;a=blob;f=arch/arm/mach-omap2/board-mityarm335x.c;h=038558e1e707ff5fe076940e426b0fe86e8272af;hb=refs/heads/mityarm-linux-v3.2
The pinmux pins are defined in the arch/arm/mach-omap2/mux33xx.c file. Note that TI has not filled in all possible pinmuxes so in the rare case you want to use a pin they haven't defined you might need to modify this file.
http://support.criticallink.com/gitweb/?p=linux-mityarm-335x.git;a=blob;f=arch/arm/mach-omap2/mux33xx.c;h=d45e440952f400580a2a9f7531df6c0387dfaf2c;hb=refs/heads/mityarm-linux-v3.2
Kernel 3.8 or Newer: Device Tree Update¶
For newer kernels, the processor and board configuration does not need to be compiled into the kernel. Instead, the hardware is described in a Device Tree file that configures the hardware interfaces and the processor pinmux. This device tree is then loaded at boot time to configure the kernel. One advantage of this approach is it allows you to reconfigure the hardware without requiring a kernel recompile in most cases.
Before you begin, please make sure you can complete a kernel compile as described in our Linux Kernel (2018 April MDK Release) wiki page. This will ensure that your toolchain and environment is setup correctly before you try to customize it.
Finding the Device Trees¶
- Open a terminal window
- Navigate to the Linux Kernel git directory
cd ~/projects/linux-mityarm-335x/
- Navigate to the device tree directory:
cd arch/arm/boot/dts
- Copy the Critical Link Devkit baseboard file for use as a template.
cp am335x-mitysom-devkit.dts am335x-mitysom-custom.dts
- Use your favorite text editor to add a line for the new custom device tree in the Makefile in the same directory:
... am335x-moxa-uc-8100-me-t.dtb \ am335x-nano.dtb \ am335x-mitysom-devkit.dtb \ am335x-mitysom-custom.dtb \ am335x-mitysom-maker.dtb \ am335x-mitysom-abx.dtb \ am335x-pepper.dtb \ am335x-phycore-rdk.dtb \ ...
Note that this line ends with ".dtb \" not "
.dts \".
After completing these steps, your "custom" dtb will be created when you run the "make dtbs
" step of the kernel build instructions. This dtb file can then be loaded at boot to configure your baseboard.
Editing your Device Tree¶
The kernel's device tree documentation is available in linux-mityarm-335x/Documentation/devicetree
, but this can be overwhelming if you haven't used the device tree before.
For your first pass, please review the devkit device tree to see how the pinmux is defined. Then, make changes based on your board's design. Note that the pinmux registers are added to 800h to match with the pinmux registers from the TRM Table 9-10. So conf_gpmc_ad0 at 800h in the TRM will be 0x000 in the device tree.
Also, most pinmuxes have an _sleep version. This pinmux is used when the system is put into sleep mode to reduce power usage, if you don't plan to use the sleep mode these can be ignored. If your product does require a sleep mode, please contact us to help you ensure your hardware design will work in sleep mode.
If you are using the MitySOM-335x SOM in your design, Critical Link can help you update your device tree. Please feel free to post to our user forums if you have any questions.
Updating the kernel configuration¶
In addition to adding your customized device tree, you also need to ensure that any required drivers are enabled in the kernel config. This can be done manually using the "make menuconfig
" command during the kernel build process. If you are using an interface or IC that is not on our development kit baseboard, you will need to make sure the correct driver is enabled in the kernel config.
If you are using the MitySOM-335x SOM in your design, please contact Critical Link if you need assistance customizing your kernel config for your specific hardware.
Using your new device tree and kernel¶
Once you have your compiled device tree and kernel, you can use our instructions for building a fitimage at the end of our Linux kernel (2018 MDK release) wiki page.
You will need to use a fit image if you want to use the same U-Boot kernel loading interface we use in our MDK. However, note that since we have changed the name of the .dtb
file, you will need to update the file, <MDK path>/sources/fitImage.its
, accordingly.
In fitImage.its
replace
data = /incbin/("arch/arm/boot/dts/am335x-mitysom-devkit.dtb");
with
data = /incbin/("arch/arm/boot/dts/am335x-mitysom-custom.dtb");
Go to top