ricaharina
Joined: 15 Jun 2005 Posts: 1
|
Locate compiler's scratchpad and generated variables |
Posted: Wed Jun 15, 2005 11:17 am |
|
|
My project is to have my code split in two parts :
1) A LOADER : This part does not change over time. It is basically the low-level routines (Serial line, I2C, internal E2PROM and external E2PROM,… ) plus code to update the application code (2) over a modem. This LOADER is placed in the upper part of the memory (#org) and once defined it cannot be changed.
2) The APPLICATION code, which does change over time and is to be downloaded. This APPLICATION (2) is sharing code with the LOADER (1).
When compiling the APPLICATION (2), the LOADER code (1) is included so the linker knows were they are located.
The problem is with RAM.
Using « typemod » and « #type default= … », it is rather easy to define a « protected » memory segment.
All RAM variables related to the LOADER functions (global, local and function parameters) are located within my protected segment.
*BUT*
- the ram for the compiler generated code
- the compiler’s scratchpad variables for my loader code
are always located outside the protected segment.
Therefore, every time I modify the APPLICATION code and recompile, the locations of these variables can be modified. When uploading a recompiled APPLICATION, there can be a mismatch between where the LOADER « thinks » his variable are, and their actual location.
Does anyone have a trick to locate the compiler’s scratchpad variables at a given address in RAM ? (But only for part of the program’s functions – not by modifying the device file)
Same question for the variables defined by the compiler generated code ?
(Other than rewriting my own set of functions)
PIC18F6720 - PCH v3.225
Many thanks |
|