Searching \ for 'mpsim help' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=mpsim+help
Search entire site for: 'mpsim help'.

Truncated match.
PICList Thread
'mpsim help'
1996\04\01@133725 by Norm Cramer

flavicon
face
I am testing some software using mpsim.  I get the warning "Caution - register
file read before write"  I have eliminated most of them but am having trouble
finding one.  Is there a way to get mpsim to break at the instruction causing
this warning?  I know I could probably find it with enough looking thru the
code but if the tool can help, I'll let it.  BTW this one must be in a
infrequently executed segment since it occurs infrequently.

Thanks for any help.

Norm

1996\04\02@090458 by Norm Cramer

flavicon
face
The listserver rejected my first post so I am re posting.  I found the problem
area but still want to know if the capability exists.

I am testing some software using mpsim.  I get the warning "Caution - register
file read before write"  I have eliminated most of them but am having trouble
finding one.  Is there a way to get mpsim to break at the instruction causing
this warning?  I know I could probably find it with enough looking thru the
code but if the tool can help, I'll let it.  BTW this one must be in a
infrequently executed segment since it occurs infrequently.

Thanks for any help.

Norm

1996\04\02@093042 by myke predko

flavicon
face
Hi Norm,

The Warning Message is saying it all.  The warning is telling you that you
are using an unitialized Register.

Unfortunately, MPSIM will show all your registers as having "00" (except for
Registers which are initialized on Power Up), so it makes it hard to find.
In reality, RAM Registers actually power up to some non-zero value.

If you have an interrupt handler, check your code for context switching, you
may be experiencing an interrupt before all the registers that are saved are
setup.  In this case, you are saving something that hasn't be setup (which
really isn't an error).

The only way of finding it using MPSIM that I can recommend is running your
program (and varying your stimulus) until you can make the message come up
reliably.  Once you do that, go through your code, jumping over your
subroutines (ie putting a breakpoint at the instruction after the
subroutine) until you can narrow it.

In the simulator, I just waxed poetic on, I do a hard stop during execution
in just such a case because I consider this to be a potentially big problem.

Good Luck!

Myke


{Quote hidden}

Myke

"We're Starfleet officers, weird is part of the job."

Capt. Catherine Janeway

1996\04\02@114544 by John Payson

flavicon
face
> Unfortunately, MPSIM will show all your registers as having "00" (except for
> Registers which are initialized on Power Up), so it makes it hard to find.
> In reality, RAM Registers actually power up to some non-zero value.

When trying to debug stuff using "real" chips, I'll write code to ensure
that all the registers are initialized to zero via loop but generally I'll
try to avoid relying on that: for testing I'll make my init-loop initialize
the memory with other junk to ensure the system 'still' works.

1996\04\02@133218 by Norm Cramer

flavicon
face
I understand why the situation gets flaged.  What I want to know is if the
sim allows you to break point when it happens.  I guess if the message had
more info in it i.e. pc value or register file address it would be easier to
find.  I did find my error, it was an index into an array getting overwritten.
The array was used inside an ISR but filled outside of the ISR.  I eventually
had to do a trace around where it was happening and search the trace dump to
find the error.  It sure would have been easier if the sim could have given
more help.  BTW I don't like to initalize all of memory when using the sim
since I want it to find these conditions.  I do initalize all of the locations
that I use.  Maybe we should ask microchip to add more info to the warning
messages ie pc value and register file address if appropriate.  What do others
think?


>> Unfortunately, MPSIM will show all your registers as having "00" (except for
>> Registers which are initialized on Power Up), so it makes it hard to find.
>> In reality, RAM Registers actually power up to some non-zero value.
>
>When trying to debug stuff using "real" chips, I'll write code to ensure
>that all the registers are initialized to zero via loop but generally I'll
>try to avoid relying on that: for testing I'll make my init-loop initialize
>the memory with other junk to ensure the system 'still' works.
>
>

1996\04\02@222234 by Darrel Johansen

picon face
Norm Cramer wrote:
>
> ...It sure would have been easier if the sim could have given
> more help.  BTW I don't like to initalize all of memory when using the sim
> since I want it to find these conditions.  I do initalize all of the locations
> that I use.  Maybe we should ask microchip to add more info to the warning
> messages ie pc value and register file address if appropriate.  What do others
> think?
>

Your requests are pretty reasonable, and it'll be put on the request list for
potential
inclusion into a future release of the simulator.  Some things were added
recently to the
simulator to help find this kind of problem, notably the IR, LR, and UR commands
to
initialize file registers, load them from files, and save them to files for
debugging.  The
PICMASTER emulator has similar features, and MPLAB-SIM, when it is released,
will have
similar function for both emulator and simulator to do "mock" power-on-reset
randomization
of file registers.

For those waiting for MPLAB-SIM, the simulator running under the fantastic MPLAB
Windows
IDE:
 It should be available in a few weeks.

Those attending the seminars will probably get the first peek, and a later
posting on the
Web page will follow.

1996\04\03@102004 by Michael S. Hagberg

flavicon
face
re: Warning message Uninitilized Regeister

This happens when I use bit variables and set them

ie

Local_byte      res     1               ; reserve a byte
Local_bit_0     equ     Local_byte.0    ; reserve a bit in local byte

start
       bcf     Local_bit_0
end

microchip says the bit modify op codes are actually read/modify byte
instructions and the mpsim is giving the warning on the read portion.
I you have a few bytes of program space to spare you could zero all
ram locations (not Special Function Regeisters 00-1F and 80-9F depending
on the processor) and this sould get rid of the message.


michael.

More... (looser matching)
- Last day of these posts
- In 1996 , 1997 only
- Today
- New search...