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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/26/11 10:14
Read: times


 
#181321 - single const byte in code
Responding to: ???'s previous message
I don't know how what your code looks like.

But why do you force a constant char to be stored in the code segment? Have you checked if you save any code size by making the constant into a physical entity stored in the flash, compared to being just a numeric value defined by #define or inside an enum {...} block? Having constant data forced into "code" is great when you may have printable text strings, structures representing the menu tree for an LCD etc. But I would not be in a hurry to try to force a one-byte constant into "code" since the compiler needs a number of code bytes whenever it is going to fetch this value into a register to be able to make use of the value.

And if you really do want to have it as a constant stored in the code segment, and that constant needs access from both banks - shouldn't you then make sure that it gets linked into the common bank? You must definitely don't gain anything from having it duplicated.

List of 15 messages in thread
TopicAuthorDate
Multiple public definitions in code banking            01/01/70 00:00      
   single const byte in code            01/01/70 00:00      
      The meaning of 'const' in ANSI 'C'            01/01/70 00:00      
         Yes            01/01/70 00:00      
            Keil C51 isn't a C++ compiler            01/01/70 00:00      
      Coding Standard Rules - Netrino            01/01/70 00:00      
         Rule #2 is a bit broken or at least incompletely formulated            01/01/70 00:00      
         issue with #define usage            01/01/70 00:00      
      extern const code declaration            01/01/70 00:00      
         Insufficient detail            01/01/70 00:00      
         Conceptually wrong            01/01/70 00:00      
            Thanks, it's working !            01/01/70 00:00      
               Why?            01/01/70 00:00      
                  correction            01/01/70 00:00      
   Fundamental 'C' programming error!            01/01/70 00:00      

Back to Subject List