Archive for janvier, 2009
Since I’ve been placed in the « Low-Level team » at Novariant, I’ve learn a lot of stuff regarding embedded system. Being in SONIA also helped to developed this interest in embedded and robotic stuff… but the requirements in SONIA are not really the same as those I encounter at work.
At work, the timing requirements are extremely important if you want to get the best precision in the industrie. Knowing that, and planning to start my career in the embedded computing world, I decided to take the course « LOG550 – DĂ©veloppement de systĂ¨me temps rĂ©els » which means that I will learn how to program on a microcontroller. Unfortunately, this courses is not in my standard program at university (not offered to GTI student), BUT, since I already worked for a company in the embedded field and that I was in theproject it was easy to get a derogation for it.
The development board used in LOG550 is anfrom and the microcontroller is the . Since I like embedded stuff, I bought the kit. Instead of only being able to touch to this hardware at school, I can now « PLAY » with it at home.
Well, having the kit is one thing but programming it is something else and for that I must have a good IDE. Unfortunately,is selling their things with an IDE that is made for Windows… I though that every embedded programmers would be smart enought to not use Windows and I can’t understand why Studio is Windows only… But well there is better replacement anyway and Eclipse is one of them.
So here is how I setuped everything to make it work with my. (The steps can easily be adapted for any platform because Eclipse is multiplatform and toolchain also)
- The starter kit
- The Microcontroller
- A serial to USB adapter (only if your computer doesn’t have a serial port)
Now lets start with the software installation. The first thing you need is the AVR MacPack » basicly it contains a special gcc for avr. For users of linux, check your package manager for it and for the unfortunate … there is WinAVR. Look here if you want more information on the toolchains.toolchain so you’ll be able to compile stuff for the microcontroller. I’m using a so the toolchain is in the «
Ok, now that we have our toolchains installed, lets move on Eclipse installation. I suggest you to download the bundle for C/C++ « Eclipse IDE for C/C++ Developers » to get a clean IDE. I’ve download the latest, which is called Ganymede at the moment. Now you need to install the plugin, like any other plugins you use the update manager to do it.
Update Site (Eclipse 3.4)
Go to the Software update dialog (Help > Software Updates…)
Then select the Available Software tab. Click on the ‘Add Site… button o the right hand side and enter the URL of the update site:
Then click on OK. TheEclipse update site is now shown in the list of update sites. Select the « Eclipse Plugin » and press the Install… button in the top right corner.
From the plugin’s wiki
You’re done ! Eclipse is installed and setuped with the little guide and adapted it to my needs, basicly you change the toolchain, the and the frequency. I have a 16MHz crystal so I changed it to 16000000.Plugin. Now you have to create a C project to begin… I followed this
There is still some little settings to make everything work. We will go to the properties of your new project and create a new programmer configuration.
Properties of your projectÂ –>–> AVRDude and select the Programmer tab. Now click on New… enter a name, select your programmer hardware (mine is an Atmel version 2.x Firmware) and if you have to use a USB to serial adapter give a path to it in the « Override default port (-P) » field. For me this window look like that:
I did not use the internal crystal of theso I had to change the Fuse Bits for it. Properties of your projectÂ –> –> AVRDude and select the Fuses tab and select Direct hex values. Now, make sure your is hooked to your computer and that the is in place and also that everything is powered. Then click on the third icon (the one that look likes an ) on the list like below.
This will read the current fuses bit from theand populate the empty fields. Now we have to modify them so we can tell the to use an external crystal. For this click on the first icon on the list to start the editor. The only parameter I had to change is « SUT_CKSEL ».
You should get something looking like this.
Now, for some reasons my configuration was not generating the HEX need for theand plugin. To fix this, go to the properties of your project –> C/C++ Build –> Settings –> Additionals Tools in Toolchain and make sure that « Generate HEX file for Flash memory » is checked.
Also, take a look at the other configurations there. By preference I changed «Compiler –> Languages Standard » and set it to « ISO C99 + GNU Extensions » it adds « -std=gnu99″ to the compilation (with this you can now use a variable declaration in your for loop header). I also point the directories to the include folder of the Toolchain to make it easier to see the different « .h » files inside eclipse.
I hope I did not forget something, if I did, simply drop me a comment.