Platform Independency

Thread Starter

genji

Joined Dec 13, 2010
2
Hello

I'm a graduate student and I have to program a microcontroller. I have to write some drivers to let the system work.
Because the school is interested in using my code for other projects, some teachers asked me to make the code platform independent.
They told me to do some reasearch about it so I in the best case they can take some parts from the wall and make it a plug and play system around my microcontroller.

For example: now I have a GPS, a GPRS and a debug UART programmed on it. If they want to use another GPS, they want to modify a minimum of code to let the system work.

My question is where I have start my search for such problems/solutions. The code is C and I make it all with seperate .c and .h files. I really don't know how I have to make it more independent. I looked on the interent and I found some information about PIM (platform independent modulating), but I think it's only interesting with a RTOS, is it?

Thank you
Genji
 

sceadwian

Joined Jun 1, 2009
499
Learn how Java was created...
That's exactly what you need.

Basically what happens is, you create a language yourself... Seriously yourself. You then write translators for each piece of hardware you want your language to run on.
Java calls them Virtual Machines.

Java would be something to look into. The Android OS is based on Java, there are Java micro controllers, but if you want to support a truly wide variety of micro controller systems you have to program the VM's yourself. Which is often difficult or impossible to do given the dramatic variety of system specifications and architectures.
 
Wonderful! So not only will the .h files need to be expanded, lets add another assembler, etc. to handle the different micro manufacturer. Maybe that's why you don't see commercial compilers handling multi-brands of micro's.

EDIT:I may have had this wrong. Perhaps this is just a multi-driver library dependent on a single micro? In that case it would using the pre-compiler commands like #ifdef, #ifndef or whatever to sort out the different hardware and calling separate procedures. For instance if there were different graphics lcd's:

Rich (BB code):
Write_GLCD_Byte()
   #ifdef KS108 Then call ThisSub
   #ifdef SED1520 Then call ThatSub
end sub
 
Last edited:

Thread Starter

genji

Joined Dec 13, 2010
2
Hi

Thank you for your reactions.
Basically I know how Java was created, but I don't want to do the same job on my own. Sun worked on it with a big team over years and years and...

@ Nickelflicker:
That was my first idea to, but there are two problems:
1. I don't know all the components the school is using and they don't want to give me a list or something
2. #ifdef's is not what they want ?!? So I have a big questionmark above my head since that remark.

I think it's the most interesting to make some .h files like I'm used to, but add every variable in it from the .c code. So everything can be changed easily and fast for a new component. The biggest problem with jobs like that is that it all comes next to your thesis. And the first thing I want to complete now is that. Everything I can do more would be nice, but isn't necessary in my opinion.
 
Top