Hi all, The Overlay mechanism implemented by Keil is ingenious. Moreover if we want add some functionnality in Eeprom without change ROM code is to my mind impossible because DATA GROUP area will be modified with new local variables used in our new functions in Eeprom. What do you think about this? Thanks a lot, Daniel
Are the following guesses correct? You currently have a system that has both rom and eeprom in it. The interrupt jmp table in eeprom. You currently have code the resides in both the rom and eeprom. You want to modify the eeprom part and leave the rom part alone.
I already generated ROM code and i would to use Eeprom memory to add some fucntionality but without any change of ROM code since it is already loaded. But when i add more than 1 local variable in my function the ROM code changed and cause problemes after link. Thank you
Hi Daniel, Split your Project into two. One for your ROM and one for EEPROM. After generating ROM-Project look the used resources in DATA, XDATA etc. These had to be excluded from EEPROM-Project. And for using functions in EEPROM use adresstabel with entrypoints. Chris
I am very confused. How can you extend the fuctionality of rom code without changing the rom?
One of the disgusting facts about the Keil software is that if you change the name of a variable (or add one) the whole DATA segment layout changes. Not using overlay is usually not an option. I sometimes work with software written by someone or another who uses variable names that are meaningless and in reforming such code I like to change the names and then compare the hex files to ensure that the namechange was the only change (I do make mistakes). This works fine for functions, but try it with a variable and booooooom, the whole hex file changes. As testing only guarantees the absence of KNOWN bugs, it takes an inordinate amount of time to verify what could be verified with a simple hex compare if the sequence of the variables were not shuffled. It would make sense to order the variables by occurence rather than some random? order. Happy hollidays, Erik
Hi Jon, Daniel wrote that he had ROM and EEPROM. And he want to add some functionnality in Eeprom: So i understand he will change the content of EEPROM. Physical by exchange or by in circuit programming. By writing/generating code with uvision he need to split his project. One for target ROM and one for target EEPROM. And when he calls function in EEPROM the ROMcode need the locations of EEPROM function. And this can be done tables with function entry points. This is what i have done in an project with Bootloader and reprogrammable Applikation. Chris
If you want no sorted variables use NOSO (no sort) as directive for the Linker. This is not documented but comes as info directly from Keil. Chris *<|:-), merry xmas
The NOSO (short for NOSORTSIZE) is documented on p316 in the current Linker manual (07.2000) But this relates to the ordering of Segments - not variables.
If I understand what he originally posted: Some code in ROM, some in flash. Adding a variable using ONLY in flash changes the location of variables used in ROM AND flash. Happy hollidays Erik
NOSORTSIZE has been available for a long time (since Version 5.50). We continually add new features to the Keil tools. This means that features are added each week or month--not just once every year or two so we can sell upgrades. With this continual development comes New Features. Unfortunately, we cannot reprint manuals each month or two. We also cannot send new printed manuals to customers who download updates. So, we added a file of Release Notes to each installation. The NOSORTSIZE linker directive has been documented in the release notes since it was introduced. Refer to the following knowledgebase article for the C51 V6.00 release notes. http://www.keil.com/support/docs/1258.htm Jon
It would make sense to order the variables by occurence rather than some random? order. The variables are not ordered randomly. They are ordered according to their placement in the symbol table manager (in the compiler). It is the job of the symbol table manager to maintain symbols in a "database" that the compiler can search. Symbols must be maintained by name and by scope level and the strategy must be such that the compiler can locate a symbol very quickly (or else compiler speed suffers). If you were to take a look at different strategies for symbol table management algorithms you will find that this is a sufficiently complex thing to do and on the 8051 this is further complicated by the lack of stack frames. Jon
But i think the concept is incorrect. The code in ROM should (must?) have a data space separate from the code in EEPROM/FLASH. I don't think you can ask a compiler or linker to maintain variables in one spot over whatever changes may be made in the future. Suppose a module is completely eliminated; would you want to maintain the variables it used in memory to maintain compatibility? I don't think so. What you are dealing with here essentially is the ability to download code and execute it independent of the code in ROM. The only other way to do this is to fix the locations of memory. This can be done using the _at_ option when declaring a variable. This is very un flexible, which is really the point I'm trying to make. The compiler/linker shouldn't be in charge of this decision. It is up to the developer to recognize the problem and address it.
One idea is to make the ROM code a library, whose segments are at fixed addresses. If the system wakes up in the ROM code, then the 1st call to the EEPROM has to fix the stack pointer. This scheme will not overlay the data segments of the program as a whole, but should allow the ROM data segments to be overlayed and the EEPROM data segments overlayed. Of course the entry points into the EEPROM are at fixed locations.
There are a lot of people already doing this kind of stuff. To do this, you must be very careful and thoughtfully design your interfaces (ROM-EEPROM). I've come up with the following list of tips and suggestions. Note that I would create 2 separate programs: one for the ROM portion and one for the EEPROM portion. Here are my assumptions: 1. ROM goes from 0x0000-0x7FFF. 2. EEPROM goes from 0x8000-0xFFFF. 3. A call-table will be generated in the EEPROM to provide addresses for functions in EEPROM called from ROM. 4. ROM functions can call EEPROM functions but not vice-versa. The ROM Program... 1. The ROM program will be fixed. It will not change and so the EEPROM must work around it. 2. Note the last used DATA address for the ROM area. 3. Locate the stack pointer at 0x80. The space between the last data address (noted in step 2) and 0x7F may be used by the EEPROM program. 4. Do not include the EEPROM code in the ROM project. Instead, create a call table (that will be located in the EEPROM) using the function names (for the functions in EEPROM). For example:
cseg at 0x8000 func_1_redirect: ljmp func_1 func_2_redirect: ljmp func_2 . . .
"If you were to take a look at different strategies for symbol table management algorithms ...." I am not concerned with that, that is a coding issue. Any algorithm can be used with assigning addresses in the sequence they exist in a module, rather than some other way. happy hollidays, Erik