This post will describe how to download and test the ARM GCC, and GNU Make. GCC is a very powerful embedded software development suite. I feel that there is a fairly steep learning curve for becoming proficient with this collection of tools, but from my experience with paid development suites, once you get past the simple cookie cutter project, it can be very difficult, and sometimes impossible to configure your project exactly how you want it due to the level of abstraction introduced by the toolchain vendor. I feel that with the GCC once you’ve got past the learning curve, there is no limit to what you can do with your software projects. Once we get to the Eclipse IDE portion, we will introduce a level of abstraction that can, at times, be quirky and frustrating, but you can, at any moment, go back to the command line to troubleshoot your toolchain.
Download ARM GCC
To start off, head over to launchpad.net and download the zip file of the ARM GCC. Most of the other tutorials say to use the installer, but I prefer the zip file. The advantages of the installer are that it automatically extracts the files in to a folder on your drive, and that the installer can automatically add a path to your path environment variable. However, I prefer to do both of these manually since I will be creating a particular folder tree for the tool chain, and the path never seems to be put in the right spot. Once the ARM GCC zip file is downloaded, extract it. Next, create a folder that will eventually hold the entire toolchain on the C drive. You can name this folder whatever you want. I wanted to name it something short and simple. I named this folder ARMTC. After that, create a folder that will hold the ARM GCC named ARMGCC inside of the ARMTC. In the ARMGCC folder insert the content that was extracted from the ARM GCC zip file. This can be seen in the image below. Now set the path environment variable to point to the bin file which contains the ARM GCC. In Windows 7, right click on computer and click properties. Click the Advanced system settings link. In the System Properties window, click the Environment Variables button located to the bottom of the Advanced tab. On my computer there is a scroll pane for user variables and another below it labeled system variables. In the system variables scroll pane, navigate to the variable named Path. single left click it to select it, and then click the corresponding edit button below its scroll pane. When the Edit System Variable window pops up, add a path to the ARM GCC bin folder to the Variable value text box ensuring that you add a semicolon to separate the path that you’ve just added and the existing paths. The path that I’ve added is shown below. C:\ARMTC\ARMGCC\bin; I’ve noticed that I had to restart my computer for the new path to take effect, so if you are not able to complete the following test, then you might try restarting you computer. Next, test out your ARM GCC by opening a command prompt and typing in the command shown below. arm-none-eabi-gcc -v If your path, and your gcc executable, are set up properly, you should see output similar to mine shown below.
Once ARM GCC is tested, it is time to install make. Start by downloading the zip files (not the setup files) of the binaries and dependencies from here. Once you’ve downloaded them, extract both. Warning: Both zip files extract many, what should be sub folders, so you may want to put the zip files in container folders to keep everything straight, and to keep from having naming conflicts. In the bin folder extracted from the binaries zip file there should be a file, make.exe. Insert the make.exe file in to your ARMGCC bin folder. Next, in the bin folder extracted from the dependencies zip file, there should be files named libintl3.dll and libiconv2.dll. Also insert these files in to your ARMGCC bin folder. My results are shown in the image below. Now test make by opening up your command prompt and typing the command below. make -v Your output will likely look similar to mine below. Some makefiles include GNU commands. This has the advantage of making them compatible across multiple platforms. To make these commands available on your system, download the GNU Core Utils package here. Once you get to the downloads page, scroll near the bottom, and download the binaries zip file. From the extracted bin file, copy the rm.exe, mkdir.exe, touch.exe, and uname.exe files to your ARMGCC bin folder. I started with the commands that were used in the YAGARTO package. Below is what the contents of my ARMGCC bin file looks like at this point.
Build the Example Project
Now let’s give our budding toolchain a real test, and try to compile a real code-base. This will probably be the most ironic part of the tutorial. Olimex provides example code for the STM32-E407 development board, but the only place I’ve found it is packed up in their toolchain that they have put together which is very much the same as the toolchain that we are putting together. However, the point of this tutorial is to learn how to build the toolchain yourself. The Olimex OpenOCD Development Studio (ODS) can be downloaded on this page. Follow the link, then click on the Google Docs download link that says, “Download latest revision.” at the time of this writing they have posted revision K. Another advantage of downloading this version of the toolchain, is that you can refer to it if you are having trouble getting something to work. Once you have downloaded ODS, you then must install it by executing the .exe file that you’ve downloaded. While installing, uncheck the start menu options box as you see fit. I unchecked it, because I didn’t want start menu shortcuts. Also if you don’t have java already installed, then leave the Java checkbox checked, otherwise uncheck it. You will need Java installed to use Eclipse. Next, point the installer to wherever you want the files to be. I just left it to install to the C: drive. Once the files have been extracted, navigate to the OlimexODS folder, and then to the examples directory, and finally to the STM32-E407 directory. Once you are in the STM32-E407 directory, hold shift, and right click within the directory, and select “open a command window here”. Once you have the command window open, enter the command below:
You should then see the output of the source code being compiled. If you see the message:
make: nothing to be done for ‘all’.
The source code has already been compiled, and you should enter the command:
This will delete all of the output files and clear the slate for you to build the source code. Now try entering the make all command once more. You should then see the successful output of the source code being built. The output that I observed is shown in the image below. This concludes this part of the tutorial. Hopefully now you can compile source code using a command window to control the ARM GCC. Next we will set up and use the Eclipse IDE to create a project and compile code.