Robotomia.Lesson one. Installation of the SoCoX development tools for ARM microcontrollers on Windows. Connecting the GCC compiler. First project.
At introductory article we chose the C programming language and the Developer’s Toolkit for Microcontrollers with ARM Cortex M0/3/4 core, SooCox, for our training course.
This kit is completely free and has open source code.
The package consists of the following main parts :
– CooCox CoIDE is a highly integrated visual development environment for microcontrollers with ARM Cortex M0/3/4 core.
– CooCox CoSmart – A tool for easy configuration of microcontroller ports.
– CooCox CoOS is a real time multitasking operating system.
– CooCox Colink / CoLinkEx is a toolkit for hardware debugging of programs.
– CooCox CoFlash – utilities for programming Flash memory of a microcontroller. Can work both from the graphical interface and from the command line.
At the beginning it looks like it will take you a whole day to install it, but luckily it’s much easier as everything you need can be downloaded from one place. Follow the link from the vendor of our board to the CoCentre download page: www.brc-electronics.nl/cocenter-installation
There is a detailed description of how to start the installation, here is a link to run it www.coocox.org/Tools/CoCenter-1.4.7.exe
Basically the process comes down to selecting the path where the files will be located. In the last window you will be asked if you want the program to start immediately after installation. If you agree, the center will start and you will find an icon to click on at the bottom right of the screen. If not, you can start it from the desktop.
After that, you will see a window of about the following kind on the screen :
Click on all the Download links and the components are automatically downloaded. I tried installing the center on two different operating systems. Windows XP and Windows 7 64 bit version. The screen shot for the 64 bit version is shown here. You can see that the USB driver file has no size, it looks like it is not found or does not exist yet. We will have to look into it. Anyway, I still can’t get it on my Windows 7 notebook and this seems to be the reason why I cannot launch the debugger on the 64-bit version. This is very unfortunate. Next I will describe how the example install works on my desktop with Windows XP.
As the component is downloaded, the Install caption will appear as in the picture above. Once everything is downloaded, click on Install from the top down. The installation process does not seem to cause any problems. Now, the last step is to download and install the C compiler itself, because it is not included in the package. When working with the environment, you can use different versions of compilers, but the developer recommends GCC stable version 4.6. You can download it here launchpad.net/gcc-arm-embedded/+download I advise you to download the latest version of gcc-arm-none-eabi-4_6-2012q4-20121016.exe (md5). It won’t be hard to install, just don’t forget to remember the path you are installing in and put a checkmark in the last window to write paths to needed variables.
There we go, that’s great. The only thing left is to write the path to the folder where our environment will look for the compiler. I copied it to the path suggested by the compiler and it is c:\Program Files\GNU Tools ARM Embedded\4.6 2012q4\bin.
Now run our CooCox development environment, you can do it directly from CoCenter by clicking on the Run button there. After that choose the path shown on the picture below, where the executable files of the compiler are located, in my case it is c:\Program Files\GNU Tools ARM Embedded\4.6 2012q4\bin. In my case it is c:\Program Files\GNU Tools ARM Embedded\4.6 2012q4\arm-none-eabi\bin. One more thing, before you install the language selection window, my advice – choose English, because to read Russian in an alternative encoding is not for the faint-hearted.
Now, finally, everything is ready to write the first program. To do this, you need to create a new project. Press Project -> New Project, choose the project file name and the path where you want to put it. This will open a window to select the microcontroller – choose the one our board is based on – NXP manufacturer, LPC17xx series, LPC1769 microcontroller, click on Finsh.
And then, in step 3, we get a lazy box. Here we can choose which pre-made modules and libraries we want to use in our project. Great. Of course, we need the standard libraries. Check the box next to "C library". What else will we use? Well, I2C, for example. Many of the sensors in our set are connected to the board through this two-wire interface. Check the box for I2C and the clever environment adds more checkboxes, without which this interface will not run. Let’s see what else we are offered to add :
1. CMSIS core – system library
2. Common Header – description of common library functions
3. CLKPWR – control of power supply and clock frequency connection to peripheral modules. The point is that in modern microcontrollers you can disable unused modules to save power consumption.
4. PINSEL – microcontroller pin setting. Most of the pins on the microcontroller are universal and different functions can be connected to them. In this microcontroller many pins can be assigned to one of four functions.
The result is this :
Wonderful. It seems to be all business, nothing superfluous. Let’s add another library "GPIO" which is responsible for setting up the I/O ports which can also be differently configured in this microcontroller.
Well, that’s all we need and now let’s try to write something. To do this, in the window "Project" find the inscription main.c and double-click on it. Now we have the text of our main program. Our work is almost done, so we’ll write something really short just to see if our compiler works. Let’s modify the code like this.
Save the project by clicking on the floppy disk icon and try to compile the project either by clicking on the appropriate icon or by pressing the "F7" key.
Oh, my gosh, it all works. Project compiled without errors.
You can try to practice programming or you can try to connect ready-made examples, but note that not all of them work correctly for some reason and we will meet in the next lesson. At last we will connect the circuit board to the computer and learn how to write the program into it. And we’ll write something simple, but really work in hardware. Instead of "Hello Word", the Embedders will flash their LEDs, which we have plenty of on our board.
I am looking forward to your questions and clarifications. See you soon.