Hello,
I am trying to run unit tests written with CppUTest on the simulator and then the actual target. I am forced to use CCS 3.3.38 because my company uses it, and I am using Code Generation Tools v5.2.4.
After figuring out a whole slate of problems on my own (ranging from memory map to choosing the correct addressing mode in the simulator), I finally got stuck because of a strange crash I get in malloc(). I am linking rts2800_ml_eh.lib, because I need the large memory model, as well as exceptions, for CppUTest.
I single-stepped into malloc() in assembler, where this code can be found just before the crash:
32D9E3 06A6 MOVL ACC,@XAR6
32D9E4 0901 ADDB ACC,#1
32D9E5 86A9 MOVL XAR2,@ACC
32D9E6 761F MOVW DP,#0x4095
32D9E8 C53C MOVL XAR7,@60 ; what exactly is this supposed to do?
32D9E9 3E67 LCR *XAR7 ; jumps to address 0x000000 and subsequently crashes
It seems little wonder that it crashes upon the LCR instruction. From what I can assertain, probably a call to _lock() should be in this place.
I am not very familiar with this particular assembler dialect, but I would take the statement just before to mean "load the address contained in the fixed location 60 (dec) into XAR7". There is, however, nothing useful at that address (0x00000000) and why should there be? Unless _lock() and _unlock() have been registered (in which case they would point to the functions concerned), they should point to _nop() -- also a function and not a fixed address.
There are many more similar accesses to addresses contained at @56, @58 and @60 throughout the code generated from memory.c. There is nothing in the C code to suggest anything is read from any fixed address, e.g. like the interrupt table.
What is happening here? Should there be anything at 56..60 dec (0x0038..0x003C)?
How do I know that the library has been initialized correctly? After doing "Reset CPU" in the simulator, SP is set to 0x0000. I find that strange, since my .cmd file says:
PAGE 1 : /* Data Memory */
RAMM : origin = 0x000080, length = 0x000800
/* ... */
.stack : RUN = RAMM,
RUN_START(_HWI_STKBOTTOM),
RUN_END(_HWI_STKTOP),
PAGE = 1
I would take this to mean that SP should be 0x0080 not 0x0000?
Your help would be much appreciated, also what I might be missing and any relevant documents (spru514 and spru430 have not helped me so far).
Thanks a lot
Arnd
P.S. spru430 does not do a particularly good job defining the '@'-operator. One can infer that @var means "the contents of var" mostly from comments in example code, from which I would conclude that @number means the contents at that address. However, when I change the value in the debugger before executing the instruction, XAR7 does not contain the new value, even though memory does.