Saturday, January 13, 2007

The old good C and embedded

It is a little strange that guys like me still prefer procedural ANSI C to things like C++ ( although I have to program in C++ at my job) but then I am just commenting on what I do like best. I might add that a real good embedded system might benefit of C++ classes in the OS level, but for the lowest level or the application level I still insist in using C. Because it is funnier? No. It is easier.

It is a little weird to think that people see embedded systems as a single man's tasks. Rather complex systems require a ton of complexity that a single soul could not handle alone. Today, you have people that make the architecture, the design, and people that integrate large portions of the project. It is crazy to see people wondering why such a small thing is so complex.

For example, check a Palm system. A few guys create the hardware. Other guys write the low level code that access its I/Os ( USB, bluetooth, whatever, etc ) and display. Other guys integrate them on OS making probably avail APIs to access them.

Then, another group of people write applications to run at it.

The designer leaves just the hints and joinings for every group.

Complexity is an issue that does not hit regular people. Although they might say that "I don't have a clue how it works" they could claim that, "for those who know it, it might be no big deal".
Yeah.

Suppose you have a real good RTOS and it allows you to create tasks ( I assume that you are a hardcore tech fan from now ), a real simple and ingenous skeleton for your application would be:

int main( void )
{
/* OS does it, untill now the start up code set tons of things*/
InitiateAllLowLevelHardware();
/*Good do it*/
TestMemory();
StartYourTasks();
while ( true )
{/**/};

}

void StartYourTaks( void )
{
createTask1( functionthatdoes it, stacksize , priority);
/* the list goes on */
}

The OS will handle the tasks, interruptions and access to shared memory contents, I/os like printers, or serial ports.

I am lazy now.

I will stop.

Thursday, January 11, 2007

I never thought

... I would professionally work with Unix or Linux. But I do now. I never thought it would be such a pain, basically because people that work with them expect you to be an expert on it. I can't tell you that right now, but I am intermediate right now. Perhaps.

These "experts" have taught me a big deal of shell, but none of them agree which is the best. I chose bash because it was the one that had more easy support. I won't start writting code on it like crazy, but whenever I need I will try.

I am basically about to not use Windows at home either. Allowing kids and wife to have Windows 98 for their fun. All that I need is to get my WinModem working on Linux.

One of the signs of age is when you realize that doing something just because it is hard just does not matther. So, if I was young, I would try slackware, but I will be happy with Red Hat 9, which runs well at my AMD K7 1 GHz 128Mbytes of RAM. With GNOME. KDE was very slow. I like GNOME so I don't mind.

There is also some tricky C++ code that I have had to write. I never thought some of it would give me troubles, but these lines use polymorphism like hell and thus a few times require a great deal of casting. It is scary.

BTW, if you know how to teach an old and big fan of ANSI C programming like me how to undertsand design patterns go ahead and drop me a line.

Friday, January 05, 2007

Pspad

Due to job issues I don't have any particular IDE to write code so, I have strongly searched for a good one. Although I need to write code and compile at UNIX, I can edit it on Windows. I tested many editors, at UNIX, LINUX and Windows and the best one by far is Pspad. It is a freeware editor free of malware and that has received many awards.

I cannot pay the guy who wrote it ( though I plan to do it ) now but can give the software a lot of praise. It gives you so many tools:

1 Syntax Highlight:
Yes, most editos also support it, but Pspad is easy to set. I personally use its C template with the Dark scheme. I have just made a few changes.

2 Integration with windows explorer
Well, as I edit code from a ClearCase vobs, located at UNIX, I need to map this vobs and open and manage the files from explorer. I mainly do it because I don't like any editor at UNIX or LINUX ( except Emacs which is awesome, but I am lazy to learn ) , thus by right clikcing a file at PsPad allows me to checkout or checkin files.

(Later edit: I gave a new try to nedit as I found my self typing nedit everytime and upgraded to 5.5 and truth to be told I am enjoying it a ton ).

3 Bookmarks

4. Find and Search in files

5. I comes with an ASCII table.

6. I navigate through the code easily.

So, that is the best one, PSPAD!


A note for Emacs: I of course have used it. Loved it, but one needs to get used with its many command lines. As a matter of fact, when viewing a file I use it a lot.