How to declare and assign variables in ROM to an specific address
Why do you never listen to me, Jonathan? How many times I told you to read attentively the documentation? If you had done it, you would have known that what you ask for is impossible in a direct way. Quant aux indirectes - c'est pas pour toi. Michael.
"what you ask for is impossible in a direct way" Depends on what you mean by a, "direct way" It can be done easily in Assembler, or by use of Linker controls. It is a very frequent question on this forum - so just try a 'Search' Why do they need to be at a specific address? If you remove that requirement, it's a doddle!
"Why do they need to be at a specific address? If you remove that requirement, it's a doddle" Just one example: A scale which access a small external ROM mounted on the loadcell which contain the calibration. This ROM, due to being separate WILL have a specific address. This is but one example of an application of this. I once had to maintain a project where, for this reason, the developer had everything in C except the RAM and ROM variable storage, what a nightmare - if e.g. the size of an array in the .h file changed, you had to remember to calculate and change the ds size in assembler. This is not a 'asking for the moon' issue - it does have practical applications. Erik
I want it too! It would be useful to reserve a place for a CRC/checksum value or for placing configuration data at the prom programming stage independently of the compilation. It would seem that many users want the feature and that we all imagine that it cannot really be all that difficult to implement. However, the most annoying thing is that that Keil does not seem to be listening. So, the key questions are: Is the demand real? Is it really difficult to implement? I think we should be told.
"It would seem that many users want the feature" I know; I raised that very point on this forum a while ago: http://www.keil.com/forum/docs/thread1163.asp And again here: http://www.keil.com/forum/docs/thread856.asp "and that we all imagine that it cannot really be all that difficult to implement." I believe that the Raisonance compiler does it already - so why can't Keil!? "However, the most annoying thing is that that Keil does not seem to be listening." Yes, that is very annoying. "Is the demand real?" I think we've already answered that one! At the very least, as I've said before, the workaround should be properly documented in the manual - not hidden away in some App Note or Knowledgebase article.
Keil already has this feature in the '167 toolset. The command line 'ASSIGN' function to the linker creates a public symbol with a numeric value which can be used to fill an unresolved symbol. Maybe the problem is that nobody uses the '51 (just joking). Best luck
LX51 (but not BL51) has this option but, from the description in the manual, I don't think it's quite what this question is after: it assigns an address to an unresolved symbol. The question, if I understand correctly, wants to assign a specific value and a specific address to a symbol? Standard 'C' initialisation can do the value, and Keil's _at_ extension can do the address, but C51 - for some unknown reason - won't let you use the two together :-( We await a reply from Keil to tell us why this is so... (as Graham noted, we've been waiting some time...)
View all questions in Keil forum