Peristent vars

Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
Post Reply
pjc30943
Posts: 220
Joined: 01 December 2005, 18:45 PM

Peristent vars

Post by pjc30943 »

After compiling, 32 bytes of peristent memory is used--but I haven't declared any persistent variables.
Where do these bytes arise from?

EDIT: compiled for a 1280n
Paul
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post by mikep »

The first 32 bytes of persistent memory (chip EEPROM) is reserved by the VM or ZX library. It contains things like the FirstTime flag.

The 32 bytes is not reported by the VM compiler as it already is reserved by the VM. It is reported by the native mode compiler because GCC (avr-size) reports the total memory used for each memory type. Potentially I guess Don could subtract 32 from the persistent memory number so that the compiler results are the same for VM and native mode devices.
Mike Perks
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Peristent vars

Post by dkinzer »

pjc30943 wrote:Where do these bytes arise from?
Those are the 32 bytes of Persistent Memory that are reserved for system use. At one time, we were planning to report only the number of bytes of Persistent Memory used by the application. We decided not to do so because we could not report RAM and Program Memory in the same way. The reason we cannot do so for those is because the contribution to RAM and Program Memory use from non-user sources varies depending on which System Library routines are used in a particular application. Moreover, the system and user items are intermixed in the memory spaces (other than Persistent Memory).

If you add the --keep-files option to your project file, you'll find a symbol file produced by the linker that will help you see which elements are from your program; all of them will have name that begin with a prefix like zf_, zv_. All other elements are system elements.
- Don Kinzer
Post Reply