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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/20/08 06:12
Read: times


 
#154941 - It is fully possible....
Responding to: ???'s previous message
It is fully possible to declare a global string array as Raj has done in the data or xdata memory spaces. The compiler / linker process goes ahead and places the initializer data into the code space for you and then there is a loop of code in the standard C startup code that copies initialized variables off to the appropriate data area, variable by variable before your main() is called.

On most commercial projects that I do I have a policy to NOT use any initialized RAM variables and I then remove the code that does the block moves from the C-Startup code. My reasoning is that if I want to have constant data I want it to be in FLASH as I've managed it and not have that hidden by the compiler where code reviews and audits can often miss subtle details of the standard implementation. I also cannot see the value of using up twice the storage for these variables....the CODE space initializer and the RAM or XRAM based run time copy. And in the end if I need a copy of the constant in the RAM variable I can copy it there in code making it directly obvious as to what is going on,

Michael Karas



List of 16 messages in thread
TopicAuthorDate
Array size limitation for Keil ?            01/01/70 00:00      
   if you breakpoint            01/01/70 00:00      
      Time to check the assembler output....            01/01/70 00:00      
      RE: you can not break on the declaration of a vari            01/01/70 00:00      
         you can not break on the declaration of a variable            01/01/70 00:00      
   You seem to be declaring constant            01/01/70 00:00      
      It is fully possible....            01/01/70 00:00      
         idata as stack            01/01/70 00:00      
   Keil compiler limits            01/01/70 00:00      
      I agree - its not a limit            01/01/70 00:00      
         Well maybe....            01/01/70 00:00      
            64 or 128            01/01/70 00:00      
   It was the stack            01/01/70 00:00      
      The compiler cannot really guess ..            01/01/70 00:00      
      Glad you have it working            01/01/70 00:00      
   Map the variables in correct memory area            01/01/70 00:00      

Back to Subject List