View previous topic :: View next topic |
Author |
Message |
guestplanet Guest
|
write to ROM |
Posted: Mon Sep 10, 2007 3:14 am |
|
|
Is there a way for me to place/write a string at the end of program memory without the need to change the string's start address whenever i update my firmware?
currently, i check my firmware size and use the last memory address filled as a reference before entering a 'string of words' at the end of my firmware using #rom 0xXXXX = {"xxxxx....."} |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Sep 10, 2007 12:21 pm |
|
|
Do something like this:
Code: |
#include <16F877.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#rom 0x1FF0 = {"End of ROM"}
//===================================
void main()
{
while(1);
}
|
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Sep 10, 2007 2:22 pm |
|
|
Guestplanet,
Why is it important to your application to have the data directly after the code memory? Like in PCM's example, why bother, just place your data at a fixed location at the program's end.
Or if the location of the data is not important you can declare the data as 'const' and then use the function label_address() to retrieve the address.
Also read the CCS manual chapter 'Using Program Memory for Data' for the v4 compiler supporting some new (and non standard C) methods for storing data in ROM. |
|
|
|