Ingo,
yeah i figured the memory placement would have been the main thing.
I'd welcome someone elses comments here. My comments below feel right but i stand ready to be corrected.
By the way, i'm surprised your compiler did not show this as an error or at least a warning.
ORG Z_RAMStart signifies that the following items should be placed in RAM in sequential incrementing order starting at the address defined by the EQU (equate define) Z_RAMStart.
ORG ROMStart signifies that the following code,tables or other constants will be placed into ROM in sequential incrementing order starting at the address defined by the EQU (equate define) ROMStart
I'm interested to see what the comiler actually did with your declaration of an "initialised" string in the RAM space.
Usually i would just declare some likely RAM space for the string with a bit of head room(if its a variable).
Ordinarily in assembly I would normally initialise variables with intial values whether bytes, words or strings during an initialisation subroutine. In the case of a string it would come from a table somewhere in ROM.
In Ansi C compiled code, you can initialise a string at the same time you declare it. But for instance in the case of global variables, the compiler puts the value into some space in ROM. A helper routine copies them from ROM into RAM before your program reaches the main entry point.
Unless you do the same sort of thing in assembly, if the compiler is actually reserving an amount of space for your string variable, the data for that string is probably random and unpredictable. One routine that many people run during startup in assembly is to clear the RAM with some value (often 0x00 but not necessarily). I can't see, unless ive missed it anywhere where you have cleared RAM during startup of your device. If your program resets because of watchdog, reset button or other, it's quite likely that the RAM will not change since you restarted.
OK still with me? I get the feeling that your degugging software is being nice to you and initialising your string in the RAM space for you using commands outside of your program(even though maybe it shouldn't?). I think when you use it without the debugger, the debug software is no longer there to manipulate the RAM.
I notice that when the string was declared and initialised in RAM that it was the last "variable" in the list.
Your compiler should generate some sort of list file that should show what RAM addresses variable were assigned to and how many bytes they actualy took up.
I still wonder how many bytes were reserved by the comiler for the string. I further wonder whether if you had declared any variables after the string whether they would have been safe from being overwritten.
What do you and others think?
JD