EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Help with True Time simulator

Started by Keith Gilman April 16, 2006
I am using CW 5.7.0 to build a very simple asm program. I am then
using the True Time 6.1 simulator to test. The problem is the
simulator thinks there is no RAM. I get two warnings when compiling -
Variable "_starupData" not found ... and Stack not initialized. I
assume these are of no concern since I don't need startup code and I
do initialize the stack in the code. Here is the contents of my
linker file:

NAMES END
SEGMENTS
RAM = READ_WRITE 0x3800 TO 0x3FFF;

ROM_4000 = READ_ONLY 0x4000 TO 0x7FFF;
ROM_C000 = READ_ONLY 0xC000 TO 0xF77F;
END

PLACEMENT
DEFAULT_RAM, DataSec
INTO RAM;
DEFAULT_ROM, CodeSec
INTO ROM_4000,ROM_C000;
END

ENTRIES /* keep the following unreferenced variables */
END

INIT ResetFunc
VECTOR 0 ResetFunc

-------------
Here is the code:

; include derivative specific macros
INCLUDE 'mc9s12c32.inc'

;Public Function
XDEF ResetFunc

; Defines
Stack EQU $3F80

; variable/data section
DataSec: SECTION
StackSpace DS 20

CodeSec: SECTION

ResetFunc:
LDS #Stack

JSR AFunc

LDAA #$42
Loop:
DBNE A, Loop
BRA ResetFunc

AFunc:
LDAA #$07
RTS

END
When the simulator executes the RTS I get No memory at [3F7E:2]

Thanks for any help
-Keith
--- In 6..., "Keith Gilman" wrote:

I'm not a Codewarrior user, but I understand what's happening here.
The startup code is device-specific and it does a couple things:

1) map RAM to the right addr range

2) set SP to point into the RAM

3) set speed of PLL

You don't care about the PLL in a simulator, but items 1 and 2 are
critical. The C32 powers up with bad defaults and these items have to
be set immediately when your program starts - before it executes your
own code.

Hopefully a Codewarrior user can tell you how to specify your startup
code file. There's likely one that comes with Codewarrior that would
be suitable for the C32. You might figure it out by nosing around in
the help file for the word "startup".

They're usually named with "crt0" or "startup" in their name, but
Codewarrior might have a different naming convention.

Eric
Anyone ever tried to simulate the serial port in code warrior? We want
to test our getchr and putchr functions. Could this be accomplished
using a stimulation file, or is there an easier way using a module?
S. Prince
CSUN

>
>
> Anyone ever tried to simulate the serial port in code warrior? We want
> to test our getchr and putchr functions. Could this be accomplished
> using a stimulation file,
You can use stimulation to simulate input.
> or is there an easier way using a module?
>
The simplest way is to use the Terminal component.
Just open it with Component->Open.
By default it connects to sci0, bit in its configuration you can connect
it to any simulated sci and also to a COM port of a PC, when you are
using HW and not the simulator.
For sci input, the terminal does support to feed in a input file via
some escape sequences, see TERM_Direct in terminal.h/terminal.c.

Daniel
> S. Prince
> CSUN
>
>
>>
>>
>>
>
>
>
Dan
Many thanks....I guess we won't have to worry about writing our own
getchr and putchr subroutines because terminal.c has everything we
need. We just tried the calculator program that uses terminal, and it
works great.

We're have a tough time with the help files for CW-it it better with the
professional version? Perhaps you can recommend another website
(besides Metrowerks) where the documentation is clearer.

S. Prince
CSUN

Daniel Friederich wrote:

>>Anyone ever tried to simulate the serial port in code warrior? We want
>>to test our getchr and putchr functions. Could this be accomplished
>>using a stimulation file,
>>
>>
>You can use stimulation to simulate input.
>
>
>>or is there an easier way using a module?
>>
>>
>>
>The simplest way is to use the Terminal component.
>Just open it with Component->Open.
>By default it connects to sci0, bit in its configuration you can connect
>it to any simulated sci and also to a COM port of a PC, when you are
>using HW and not the simulator.
>For sci input, the terminal does support to feed in a input file via
>some escape sequences, see TERM_Direct in terminal.h/terminal.c.
>
>Daniel
>
>
>>S. Prince
>>CSUN
>>
>>
>>
>>
>>>
>>>
>>>
>>>
>
--- In 6..., "Eric Engler" wrote:
>
> --- In 6..., "Keith Gilman" wrote:
>
> I'm not a Codewarrior user, but I understand what's happening here.
> The startup code is device-specific and it does a couple things:
>
> 1) map RAM to the right addr range
>
> 2) set SP to point into the RAM
>
> 3) set speed of PLL
>
> You don't care about the PLL in a simulator, but items 1 and 2 are
> critical. The C32 powers up with bad defaults and these items have
to
> be set immediately when your program starts - before it executes
your
> own code.
>
> snip

> Eric
>

Eric,

Thanks for the help. I think the startup code you refer to is
for "C" programs. I'm writing in assembler and in fact the assembler
code I have written does the initialization. I'm not sure how to get
rid of the warnings.

I found the answer to my question. In the True Time simulator the
menu item HCS12FCS->Set Derivative was not set up properly. Once I
fixed that by selecting MC9S12C32 everything worked great.

-Keith

Memfault Beyond the Launch