Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/04/07 04:06
Read: times


 
#147828 - How to write portable code
Partly because of my hobby and partly because of my career I have collected and used many different CPU's and done that with varying success. At the moment I have about 10 different types of MCU's on my shelf plus 25 more types which are all too obsolete to be seriously considered to any, even hobby, project.

During these 30+ years I have also collected lot of experience which just cannot be read in a single "bible". The bible that is so often referenced in this forum is just another spesification - nothing more - nothing less. It is mandatory reading if one intents to use the '51 family of microcontrollers. That is the case even if one is going to use a portable compiler like 'C' with them.

What is so nice about portability then? Is it worth the effort? Where did I put that pizza slice? How does the development platform contribute to the portability?

As an example I have created a library that can drive a LCD module (diverse manufacturers) whom all seem to have the same sort of 4/8 bit interface. They may vary in display size and organization but they all seem to boil down to the identical CPU interface. This might be because they all seem to use the same driver chip....

My choise as development environment is Linux because it is free and because it is relatively stable. I also have my Eagle running on linux (bought the license) and therefore I really do not have the choise. There is no reason why the tool chain would not be on another platform - this is merely a matter of taste but sometimes it feels like the needed tools sooner or later available on Linux as well if not originally so.

When it comes to the compiler there really is no choise. The only even near portable compiler is the 'C'.

Creating portable code always involves some sort of libraries. Whether they are text libtraries (include files) or binary libraries ready to be linked with the target MCU. Either case, this is what portability is by default - reusability.





List of 20 messages in thread
TopicAuthorDate
How to write portable code            01/01/70 00:00      
   C is a language - not a compiler            01/01/70 00:00      
      PL/M            01/01/70 00:00      
         Have you considered PLM2C?            01/01/70 00:00      
   A good point - often missed            01/01/70 00:00      
   So what's the downside?            01/01/70 00:00      
      Complex code - Libraries            01/01/70 00:00      
         COTS libraries versus inhouse libraries            01/01/70 00:00      
            Hence portability is not such a big issue!            01/01/70 00:00      
      There are downsides            01/01/70 00:00      
         Portability vs. Readability/Maintainability.            01/01/70 00:00      
   who gives a hoot about portability            01/01/70 00:00      
      Portable by BIOS            01/01/70 00:00      
   I give a hoot about portability            01/01/70 00:00      
      I am definitely not arguing against "code reuse"            01/01/70 00:00      
         HAL            01/01/70 00:00      
   Small and easy things that may make Your day            01/01/70 00:00      
   The developer is probably the biggest factor            01/01/70 00:00      
      I may take issue with this one...            01/01/70 00:00      
   general re 'portable code'            01/01/70 00:00      

Back to Subject List