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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/17/12 16:40
Read: times


 
#185536 - Hw variants or debugging are big users of conditionals
Responding to: ???'s previous message
It is very common to have the same code base used for a family of products.

Some models are premium editions with extra hardware capabilities, while some are lite editions with only the bare minimum.

Conditional compilation/assembly then allows you to build the same source multiple times.
One time to produce a big binary with lots of menu options, but only working with a product with much hardware.
One time to produce a small binary with fewer menu options, but (probably) working on all hardware. But intended for the lite hardware that doesn't have a temp sensor, ...

Also, you may have the same product but produce with one processor for the first 2 years. Then you need to switch to a different processor because of support (or capability) issues. So you select conditionaly if building for the old or new processor. Might be a different UART initialization in the newer processor.

Another thing is that you may want to conditionally turn off some of the product features, to release code/RAM space for conditional addition of special debug test code. So when testing GPS functionality, you turn off temperature sensor processing but adds extra debug output for the GPS. When testing temperature sensors, you remove support for the GPS but instead stores lots of temperature samples allowing you to emit noise and response-time information from the temp sensor.

Compile/assembly time conditionals are very very useful. Note that in most situations, it's possible to skip these features and instead use a standard C preprocessor and feed the already preprocessed files to the assembler. The advantage with that is that you can make use of a common C header file to control both assembler and C/C++.

But a compiler/assembler that does not come with any built-in support for conditional processing is really a quite poor and lite product.

List of 17 messages in thread
TopicAuthorDate
Conditional Statements            01/01/70 00:00      
   Hex constants?            01/01/70 00:00      
      0x00, 0x01, 0x02??            01/01/70 00:00      
   What is the octothorpe?            01/01/70 00:00      
      #            01/01/70 00:00      
         Immediate or not            01/01/70 00:00      
      what is an octothorpe?            01/01/70 00:00      
         Previously, on 8052.com            01/01/70 00:00      
   Problem solved, query still remains            01/01/70 00:00      
      Do some trial and error            01/01/70 00:00      
      Check the CJNE instruction...            01/01/70 00:00      
         Handy that!            01/01/70 00:00      
      run time vs compile time            01/01/70 00:00      
         IF only at assemble            01/01/70 00:00      
            Not Really!!            01/01/70 00:00      
               I second that            01/01/70 00:00      
            Hw variants or debugging are big users of conditionals            01/01/70 00:00      

Back to Subject List