Friday 18 May 2012

"FreeRTOS port on NXP LPC1768 GCC Compiler"

Cheers!!! Long time after Feeling this kind of pleasure because what i thought i did that ... because of the grace of god and obviously some human beings are also responsible they came in the form of God.
As i was talking about the P 3DX robots and we gonna make prototype of P3DX robots (robots same like P3 DX ) with more functionality and power than present P3DX has and the important thing is that we gonna make right from the physical structure of the robot to all the softwares required to make our bot working.  In totality the robot is fully made by us only.
   Actually P3DX provide development environment for the robots which are used for the mission critical purposes. I mean they are very basic and more complex robots can be developed using these bots by extending them like attaching more number of peripherals to them and etc.
From past 2 weeks i was having great stress on me those were very anguishing days for me because we were not able to get progress on our project and we just stuck at one point. Aakash was busy with his product and all the way i was the only who was trying to make it work. The task was to port FreeRTOS on the board NXP LPC1768 that we bought for our project. Everything we have done correctly but the board was not responding, we were not able to port correctly. I thought that i will port before Aakash and this problem i will solve before aakash but as time was progressing and i was not able to catch the bug i was frustrated, at last one night i decided i will port FreeRTOS today at any price,  i tried very hard i was tracing the code (In between i faced lot of problems because i was running my windows in Virtual Box and also i formatted my laptop once just leave those intricacies those are painful) and the night was 15 May night, I was struggling with my code, for debugging purpose i used a LED of the board and i was playing with the led inserting the instructions for led on off in between the code same like inserting printf statement (used in C) for debugging the program i think the best way to grab the bug (Thanks to aakash he suggested the way). The program was simply blink the three led's of the board with different- different frequencies.
FreeRTOS was managing the three tasks, where each task was responsible for one led.

I was at the last stage of debugging my program and here i got that where is tick interrupt handler.........  i was continuously thinking that where this tick handler is. I just opened the startup.c and found that the handler is systickhandler  and where is the code of the tick handler ? And i found no where that means it is going into the default handler which is nothing but a infinite loop it means i have to give port specific handler to my startup.c and i thought probably this is the only error that has not been traced yet,  what i did is i gave the names of the port handlers in the startup.c .. the names were there in port.c and xportsystickhandler, and two more handlers i just gave those name in the startup.c.. Compiled the program and ported my .elf on the LPC 1768 board and code is up for running the great part is all the three led's were flashing with different frequencies yes yes yes ... i did it  Led's are flashing.
 And yes I did it. The pleasure i am feeling today, i did not feel something like this from past 6 months. I was able to do it probably because Aakash was involved in some other stuff otherwise probably he would be able to do it before me, and also Credit goes to Shreya Ghoshal as i was hearing her songs when i was debugging the program and in the meantime i watched her interview too. Thanks Shreya i love you, you constantly and continuously inspire me don't know how but you do it somehow.
 I will come up with more finer details about the project in my next posts.

No comments:

Post a Comment