Archive

Archive for the ‘Technical Stuffs’ Category

Git – Source Code Management Tool

July 18th, 2010 Jeega No comments

Two year back I realized this,  software, firmware or any type of codes written even by genius is crap without proper code management. Real headache starts just after the coding phase is over.  There are many, many, many problems involved in maintaining the codes. There is possibility, a bug pops up two years after the development phase is over and you have to go back to the codes to debug that. Even for the person who wrote the code, it takes considerable amount of time to re-familiarize it, let alone others.  So some sort of code management tool is essential for a project even when only one person is involved in coding process. Mostly my projects involves only one programmer and that is me.

I used some version control systems before[SVN, Visual Source Safe, etc]. Most of them are Centralized Version Control Systems. But none is suitable for a programmer like me or I can say I am not suitable for such tools. Recently I started using GIT, then I realized I am looking for Distriubed Version Control System and not  Centralized Version Control System. I was not aware of the difference back then. GIT is one of the best and fastest Source Code Management tool I have ever used. Click here to know more about git. I am now using Git for all my projects, even for the documentation projects.

For a newbie, this video should be the starting point. Have fun with Linus Trovalds.

ARM – Embedded Software Development Tools (Part 2)

June 15th, 2010 Jeega No comments

In the last post we’ve seen the purpose of Development Tools. Now we’ll see some of the development tools available for ARM Architecture.

There are wide variety of options available. I have listed only few which I consider worthy.

1. Keil Realview Microcontroller Development Kit
2. IAR Embedded Workbench for ARM
3. GNU Tools for ARM
4. WinARM

One have to consider the following points before choosing a development tool

1. Programming Language – Mostly C is enough, some high-end applications requires C++. It is possible to create a compiler with COBOL, BASIC, FORTRAN. I doubt tools with old programming languages available nowadays. Assembly language is mandatory for application that requires embedded operating system.

2. Level of sophistication – This point is very important for a proprietary development tools. Most expected in proprietary tools and least expected in open source tools. Code navigation,  project management, tool-chain automation and simulation among other things are very important for large projects.

3. Operating System for Development (Host Platform) – Windows or Linux or MacOS. Some tools work in different platforms and some don’t

4. Level of optimization – There are many different ways to compile a code from high level language to machine code. I compilation should result in faster execution speed and smaller memory footprint. In embedded systems where the resources are limited, optimization of code comes into play.

5. Debugging Options – Many debugging methods are available — JTAG, BDM, serial debugging, etc. It is not mandatory. I know some people who don’t use debugging options, i have also seen many broken stuff nearby their workplace. Working without a debugger is definitely pain in the arse.

6. BUDGET – Proprietary / Open Source. May depend on all the above points.

Keil RealView MDK

I am using Keil development tools for 8051 right from my diploma time. I love to work with keil because i know it better and I don’t know/have any other tools to compare it with — so far. It is obvious Keil is my choice for ARM too. Advantage is this tool is from ARM Company. It is better to use ARM’s own Development Tools. Some of the features are

- Supports 4 different optimization levels
- Supports wide variety of devices from different manufacturers
- Supports C,C++ and Assembly programming language
- Supports simulation
- Can automatically creates startup code for different processors and architectures
- Real-time libraries are available to ease the programmers work.
- Debugging the processor with Keil is cool with uLink2 USB-JTAG Adapter
- Comes with RTX Real-time Kernel (no need to worry about OS)

Some of the disadvantages i noticed are

- Only supports ARM7, ARM9 and Cortex M Architecture. hope they’ll add more in future.

click here
to know more about RealView MDK

IAR ARM Workbench

IAR is also a competent IDE. Equally good compared with Keil.

- Supports ARM10, ARM11, SecureCore and Xscale as well.
- Plugins available from different Embedded OS vendors
- IAR J-Trace and J-link Adapters are available for debugging
- 32KB Kickstart Edition is available for free. Best for DIY aspirants.
- Supports C,C++ and Assembly Programming Language.
- Can automatically generate code from IAR visualSTATE. Very useful for non-programmers.

click here to know more about IAR Embedded Workbench for ARM

Both Keil and IAR tools will work only on windows OS. Can make it work on Linux but drivers for debug adapters are hard to find. Have to spend huge amount of money to buy these softwares. Most of the processes like compiling, linking, assembling will be done with just a press of shortcut key.

GNU Tools for ARM

Here we are at open source part. no money required tools. As I already mentioned using open source tools is little difficult. Open source tools lack sophistication like in Proprietary tools, but more powerful. One have to do little manual work to make the tool work. Compilation with just a shortcut key won’t work in such tools.

GNU Tools for ARM is collection of different tools made to work together.

- Can make it work in Windows, Linux and MacOS. Requires cygwin in windows.

Disadvantages are

- Support for limited devices.
- Have to manually write linker scripts for unsupported devices
- Project management, code navigation is tough for larger projects. Can make it easier with Eclipse IDE for C/C++.

Again we have to spend time configuring Eclipse IDE.

click here
to know more about GNU Tools for ARM

WinARM

WinARM is another open source tool built using GNU Tools for ARM. Doesn’t require cygwin.

- Project Management and Code Navigation through Programmers Notepad – Open source code editor.
- Limited support for devices compared to commercial tools.

click here
to know more about WinARM

GNU tools for ARM and winARM requires little expertise in command line and shell scripting. have to dedicate separate post for each. To start with I prefer Keil Evaluation version or IAR 32KB kickstart edition download-able at their websites

ARM – Embedded Software Development Tools (Part 1)

June 5th, 2010 Jeega 2 comments

We all know, for a developer, a processor is of no use without its development tools. I remember in my college days how we, students, used to program the 8085 microprocessor kit. we have to first write the algorithm, convert the algorithm to mnemonic codes and to its opcode. Then we have to key in the HEX machine codes through keypad. That is like rocket science for most of us. Because we were trained that way. Gone are those days. But that method is still used in colleges to train students. What we learned at that stage is raw assembly language programming. Assembly language is effective for small programs and when the complexity of code increases it is hard to manage the code. But I know some peoples still use the assembly program for huge programs. Its not that it is impossible.

Now much more sophisticated tools are available to help programmers. We are going to see some of the development tools available for ARM processors. Development tools means collection of software programs running on host computer. Now most of the tools available are cross development tools. Cross development means generating codes for a platform in some other platform. For example, we are going to install all our programs in Windows OS. Say Windows OS is running on a Pentium Processor. Pentium processor itself is a platform which has its own instruction set. So we are using Pentium platform to generate codes for our ARM processor. Don’t get confused on the jargon “platform”. Platform here means series of processors which use the same instruction set. Its the development tools job to take care of the complex creation and conversion of output file from one platform to another. Purpose of these programs is to create a programmable binary file for the target processor. Some of the programs are

- IDE
- Libraries
- Compiler
- Linker
- Assembler, etc.

One have to clearly understand the purpose of all these programs — to effectively use it.

IDE (Integrated Development Environment)

IDE has the graphical user interface where user enters their code. It is IDE’s task, while building, to pass the source code to compiler/assembler which generates object files, pass the object files to linker which generates programmable binary files. We’ll see the list of IDE’s available for ARM later.
To know more about what IDE in general. click here

Assembler

Every family of processor has its own instruction set. Each instruction is called as mnemonic.   It is the assembler program’s job to do the conversion from mnemonics to machine-code. Because of these variation in instruction sets between different processor, the assembly codes are not portable. Whereas, codes programmed in High level language like C or C++ is portable.

To know more about assemblers. click here

Compiler

Compiler is a program which converts code from one computer language to another computer language. Since writing a complex program in assembly language is hectic, we need to go for higher level languages like C or C++. Say we choose to write codes in C language for our program. It is compilers job to convert the codes from C language to Assembly language.

Lets see an example. consider the following expression

a = 0×10;

This is a simple expression in C which assigns the value 10 to variable ‘a’. I hope the reader knows what ‘a’ is – An integer pointer to a memory location. consider it is initialized with register keyword. ‘register’ keyword makes the pointer to point at any one of the processor register (say R1). We are passing value 10 to that R1 register in processor. Equivalent code in assembly language for ARM processor is

MOV R1, #0×10

Compilers job is not just limited to code conversion. Some compiler directly produce the machine code reducing the requirement of assembler in between. It also gives notification if the code contains syntax and semantic errors. Another main job is code optimization. We’ll see further about compiler later.

To know more about compilers. click here

Libraries

Libraries are codes written by others to reduce the programmers job. Header files are the interfaces to access the libraries. “stdio.h” is a header file for the standard input output library provided by the compiler provider. If you look into the “stdio.h” you will just see the declaration for the functions like “printf(…)” and “scanf(…)”. Mostly source code for libraries are not accessible, it comes in the form of object files which don’t require compilation. It is already compiled and ready to use.

To know more about libraries. click here

Linker

Obviously question will arise  ”Why Linker? Isn’t sufficient to use just Compiler and Assembler to generate code?” Yes, it is possible if you are the sole programmer of your project and if you resolved not to use other peoples help in your program. At some point of time, for projects, programming without the help of others code is not possible.  Often the programmers tend to use his own codes from previous projects. For that, modularization of the codes is very essential. We all know modularization means dividing a task into smaller reusable tasks. Instead of typing all the required codes in single ‘main.c’ file, we can identify the reusable codes and move it to into different files like ‘timer.c’, ‘spi.c’, ‘uart.c’, ‘adc.c’, etc.

As we mentioned before compiler and assembler generates the machine-code from source code. But in the situation where many modules interact, the compiler and assembler generates the object file suitable for the linker. compiler will generate ‘main.obj’, ‘timer.obj’ and  ’spi.obj’ files for ‘main.c’, ‘timer.c’ and ‘spi.c’ respectively which is suitable for linker.  Then the linker generates the output file that can be programmed to the processor. One main take of the linker is address resolution. We’ll see in-depth details of the linker later.

To know more about linker. click here

I hope you understood the purpose of the tools at-least through the links provided, if not by my description. I like to refer the book “An Embedded Software Primer” by David E Simon. Good book to understand the embedded software concepts. Here is an image from that book specific to our topic.

I think the above contents are long enough for a single post. Remaining i’ll write in the next post.

Ready to lay hands on ARM

June 1st, 2010 Jeega No comments

Technically can’t do that because most of the Integrated circuits are static sensitive. :)

Its always hard for me to choose which processor to use in next project.

First choice is NXP 89V51RD2BN. It has 64kB Flash, 1kB data RAM. 64kB code memory is ok but 1kB of RAM is not enough. My project involves data acquisition, the acquired data’s needs to be transfered to PC. 89V51 got only one serial port, and serial ports are nearly extinct in commercial PC’s. So, processor with USB peripheral is required.

Next choice is Freescale MCF52223. 32 bit, 256kB Flash, 32kB RAM, USB On-the-Go with Coldfire Architecture. This is suitable but target ports for this processor is not readily available from many RTOS’s.

Finally I settled to NXP LPC2148 which is 32 bit, 500kB Flash, 40kB RAM, USB device (not host) with ARM7TDMI-S Architecture. Advantages of using ARM Processor is virtually all RTOS’s readily provide ports. Many ready-to-use libraries are also freely available. You can know about ARM Architecture in Wikipedia.

Xpress-CMS – New Beginning

April 12th, 2009 Jeega No comments

This is new project assigned to me by myself. Like this name? I like it because I loved my Nokia Xpress Music Mobile. Yesterday I lost it. Now you know why I named it Xpress. I am part time website designer. Most of the website I design is normal static page sites which requires constant editing of contents. Actually I accept projects keeping in mind I’m not a full time Web Developer. Normally it takes much time to design the catchy dynamic pages with lot of scripts in it, at least for me.

Initially I used to design the sites with just HTML and CSS. I was very comfortable with it and happy to do it. There came the villain. Clients used to call me for every additions and modification in the content. Although it is simple and easy, I felt it as useless and waste of time to edit the html files again and again. To avoid this annoying I started making the websites with Open Source Content Management Systems. In fact I hate to use others work, have to do it some times when there is no other way. It also consumes some time to get the knowledge of the target CMS.

Recently I felt, why I have to use the others work, when I am capable of doing my own. I can list out numerous advantages on it. I am aware it consumes more time than using and learning others available work. I am going to count on satisfaction after completion.

This is one reason. I got another. I can call that as inspiration. I am using Windows Live Writer for uploading contents to my blogs. I feel editing and uploading contents this way is lot more easier than doing through administration pages comes with CMS. So if I design application of that sort and give it to clients I can avoid the annoying. But this is long term objective of this project. Here are the objectives/requirements for the initial version of Xpress CMS.

  1. Simple and Understandable Administrative Panel
  2. User Authentication.
  3. Theme/Template Selection
  4. Light Weight. Must occupy lesser space.
  5. XML-RPC implementation (for writer application)

I planned to do this project using PHP and MySQL, frontrunners in open source development. Going to use whatever latest technologies strikes my mind, not forgetting the objectives.

I am managing the code with Google Codes. If you want to contribute or take part in this project, you are always welcome. I initiated this, but I don’t want it to be all mine. Contributors will get their respective credits. If you participate, it is not mine, it is ours.

Keep in touch with this blog to know about the progress of this project.

Categories: Technical Stuffs Tags:

Yet another Bug

January 20th, 2009 Jeega No comments

Ha Hah. I found another bug with the Microsoft’s Product. I was creating a custom WPF User Control with VC# 2008 and Expression Blend 2 for my project. Nothing to complain about .NET Framework 3.5, one of the master pieces of Microsoft. The problem is with the tools. At Start, the user control is working fine. Whatever I did in the User Control XAML file, the changes are perfectly effected on the Main Window (where I placed that Control) after a Build. Suddenly the routine stopped as if there is no relation between XAML file and the control. I tried to build the project both in Blend as well as VS Workspace. No problem with the compilation or execution, only that control is not updated with new corrections. I was reviewing my code again and again for errors.

After two days of frustration, I found a quick fix. Just deleted the files inside “bin” and “obj” folders (inside the project folder). I think the problem is with Application Manifest files but not sure. I am eager to find out the real problem. I will update this post if found. Please do let me know if you are aware.