Shop OBEX P1 Docs P2 Docs Learn Events
32KB EEPROM Usage for Data Storage? — Parallax Forums

32KB EEPROM Usage for Data Storage?

Miner_with_a_PICMiner_with_a_PIC Posts: 123
edited 2010-03-30 22:02 in Propeller 1
Working on the premise that a 32KB (not 64 KB etc.) sized EEPROM is used to boot the Propeller from, is it possible to write to a location within the EEPROM's memory that is unused for program storage?

If so are there any guidelines or advice regarding an address region that is free for data storage? For example if the program just happens to be 16,348 bytes (half of the EEPROM's capacity) in length does this mean the program resides in the region $0000 - $3FFF and the address range $4000 - $7FFF are free for data storage? If the EEPROM is reprogrammed will the data stored in the EEPROM's non-program region be overwritten?


On another note, I noticed that the final 8 bytes in most programs (view info, pressing the F8 key) is a repeat of 2 longs - $FFFFF9FF $FFFFF9FF --> End of program designator? Does anyone have the scoop regarding what this is?

Post Edited (Miner_with_a_PIC) : 3/30/2010 6:18:54 PM GMT

Comments

  • MacGeek117MacGeek117 Posts: 747
    edited 2010-03-30 19:22
    As far as I understand, you can use the unused EEPROM space, but it will be written over every time you load a new program.
    The final 8 longs are a very tight repeat loop that causes the Prop to lock up at the end of a program that does not have an infinite loop.
    It works the same way as PBASIC's 'END'.
    MacGeek

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    BS2: $49


    SX48 Protoboard: $10

    Propeller Protoboard: Priceless

    www.apple.com

    www.parallax.com

    www.goldmine-elec.com

    www.expresspcb.com

    www.jameco.com
  • Mike GreenMike Green Posts: 23,101
    edited 2010-03-30 19:33
    The final 8 longs are normally zeros, not a "tight loop". The area from the end of the program to the end of the 32K of EEPROM is normally zeros, cleared by the ROM bootloader when a new program is downloaded from the Propeller Tool. Some of this "zeros" area is used for variables followed by the run-time stack for the main (initial) cog. The portion of the EEPROM corresponding to the stack is available for user data. Normally this is allocated from the end of EEPROM downwards. You can also store data in the area of EEPROM corresponding to the VARs of a program. In that case, when the program is initially loaded from EEPROM to RAM, the variables have the values stored in the EEPROM.

    When the main (initial) method exits, it executes a return. The run-time stack is initialized with a return address to a location in ROM that executes a COGSTOP with an argument of COGID. This causes the current cog to stop.
  • Miner_with_a_PICMiner_with_a_PIC Posts: 123
    edited 2010-03-30 22:02
    MacGeek117 and Mike, thank you very much for your inputs they were very helpful..

    The reason for the post was the need to tag Propeller based systems with a unique ID number that must have a very small probability of being overwritten or lost. Based on your inputs I am thinking...

    1) To the top level object set a serial number by altering data contained within a data block (i.e. dat ....)
    2) Disable write protect and load the target EEPROM with the program which contains the serial number
    3) Enable write protect in hardware
    4) Validate functionality and perform a test read of the serial number....
    5) Next unit...goto step 1

    The key is WP and utilizing a data block...not too elegant but this will actually save some development time as the serial number will be loaded to RAM as part of the program during a boot, so no EEPROM read/write routines needed.

    Any other ideas, suggestions or cautions would be welcome.
Sign In or Register to comment.