1.6 Linux Board Porting Series - Module 6 - Building U-boot in CCS

Welcome to module 6 of the Linux Board Porting On-line Series. This is the second in a series of three modules which are centered around debugging U-boot from source code using JTAG in Code Composer Studio. In this module, I'm going to show you how to set up a Code Composer Studio project to rebuild U-boot. Now that Code Composer Studio's installed, let's go ahead and launch it. And I have also installed the SDK at the home user directory.
I'm going to take the default workspace. Go ahead and let Code Composer boot up. Now, the first time you open a new workspace, you'll get this welcome to Code Composer Studio screen. I'm just going to exit out of that.
And then let's create a new project. So File, New, and then Project.... Here, I'm going to expand the C, C++, and choose Make File Project with Existing Code. Browse to Home, User. Here's the SDK.
And so TI SDK directory. Then under there, we go to board support and locate the U-boot source code directory. Just select the directory and press OK. We're also going to select the Cross GCC tools, in order for those to be used to index the project.
Once that's been created. You can see here all of that code for U-boot has been imported into the project. I'm going to Right-click on the project there and go down to Properties. We're going to need to update our path variable so that the Code Composer Studio is able to locate our cross-compile tools. So go to Environment, and here where there's the path variable, this is where we're going to have to put in the location of our cross-build tools.
I always forget the exact location in terms of typing it in. So here, I'm going to go to a terminal, change into the SDK directory, and then under linux-devkit and bin, you see here these are the cross-compiler tools. If I do PWD, or Print Working Directory, I can then do Control+Shift+C, and that will copy the entire path for me.
Going back to Code Composer Studio, I'll just double-click here on the path variable and use Control+V to insert what I just copied out of the terminal, and then put a colon in to separate it from the next item. Press OK here, and OK here. And now the Code Composer Studio path variable has been updated so that it can find the cross-compile tools.
The next thing that we need to do is put in Make File, or Make Rules, or I should say Make Targets. So we go to Show View, Make, and Make Target. And here, we select our U-boot project. And this little bullseye with the plus sign will allow us to do a new make target.
The first make target we need is am335x_evm_config. This is going to be the configuration step that will tell U-boot that we're building for the am335x platform. Even though I'm using a BeagleBone Black, it's actually the am335x_evm_config that is used for BeagleBone White, BeagleBone Black, the am335x starter kit, and of course, the am335x EVM.
Now, under the rules for the build command, we need to insert additional arch, which stands for architecture equals arm. And then CROSS_COMPILE=, and you might recall when we were at the terminal before, this was the prepended bit before the GCC. It's arm-arago-linux-gnueabi. And then don't forget the final dash.
I'm going to put in a second target. The second target is going to be u-boot-bin. This is the binary that we're building. So in order to build U-boot, you need two steps. The first one is the configure step, then the second one is the actual build step.
And as before, we're going to put the same environment variables in, the arch and cross-compile. Now that we have that, I can go ahead and expand this. Our new targets are going to be at the very end here. So you can either double-click this, or I'll just select it and then hit the little hammer, which will do the build. going to make this small.
Notice, here's our build console. So if I expand that, we've got a successful configuration. This is showing the command that was executed at the terminal and the feedback, all of which is correct or what would be expected. Next, I'll go back to the Make Targets and select the u-boot.bin.
Go ahead and tell it to build. Now, this takes a little bit longer than the configuration. If I expand the console, you can see it building. And I'm going to pause, again, so that you don't have to wait for the entire U-boot to build. After a few minutes, hopefully you'll get to this point where you see a successful build of u-boot.bin, the U-boot binary.
Now finally, we're going to need a rule to build the SPL. So here we'll do a new Make Target, and put in spl/u-boot-spl.bin. By the way, if you have u-boot.bin highlighted when you press the Add New, you'll notice that it starts off with a copy so you don't have to fill in the Build command again. Now that we have that, we can also build the SPL.
If you wanted, you could additionally put in a clean rule, but we don't need to do a clean operation for this lab, so I'm just going to skip that. And here we see it building the SPL. This concludes module 6 of the Linux Board Porting Online Series. This is the second in a series of three lab exercises where we are setting up debugging, JTAG based debugging, for U-boot. In the seventh module, which is the final module of the U-boot series, we will actually be using JTAG to debug U-boot in Code Composer Studio.

Module 4 - Linux/U-boot Source Code Structure: Overview of the layered organization of the source code files for both Linux and U-boot, focusing on those files which are most pertinent to a typical board porting effort.

Module 5 - Installing Code Composer Studio: This first lab exercise of the series is a recording of the presenter installing Code Composer Studio. In particular, installation of the proper JTAG drivers and a valid CCS license are required to debug U-boot. This is the first of three lab exercises centered around debugging U-boot using JTAG.

Module 6 - Building U-boot in CCS: This lab exercise shows the user how to set up a makefile-based project in Code Composer Studio in order to rebuild u-boot from source code.

Module 7 - Debugging U-boot with JTAG in CCS: This module is a recording of the presenter using Code Composer Studio and an xds560 emulator to debug U-boot on the Beaglebone Black platform.

Module 8 - Installing SDK and Building Kernel with Debug Symbols: This module is a recording of the presenter installing the Sitara Software Development Kit (SDK) and rebuilding the Linux Kernel with Debugging Symbols. It is the first of three modules demonstrating the debugging of the Linux Kernel in Code Composer Studio using JTAG.

Module 9 - Booting Linux from MMC/SD Card and TFTP: This module is a recording of the presenter using the SDK utility to build a bootable MMC/SD card for the AM335x starter kit and modifying the card to load the Linux Kernel from a TFTP server.

Module 10 - Debugging Linux Kernel with JTAG in CCS: This module is a recording of the presenter configuring JTAG debugging of the Linux Kernel using Code Composer Studio. It is the final in a ten-part series.