Brian C. Lane wrote: >
> flash_erase:
> ; Reserve a word on the stack
> SP += #-1
>
> A = #8555h
> nop
> nop
> nop
> *SP(0) = #0AAh
> prog(A) = *SP(0)
>
> repeat(#WRITE_DELAY)
> nop
For the record, things like this happen when CPL = 0 and you are trying
to use the stack. They also happen because the C54xx is a PITA to debug
with its pipeline -- if I had added nops after the *SP(0) and noticed
that IMR changed after the attempted stack write, not after the prog(A)
I would have caught it sooner.
Oh, and the other code ran with interrupts disabled, so even though its
a nasty bug, it didn't effect it.
Brian
--
-----------------
Brian C. Lane (W7BCL) Programmer
www.shinemicro.com RF, DSP & Microcontroller Design
Reply by Brian C. Lane●December 2, 20032003-12-02
What could cause a prog(A) call that has worked in previous instances to
fail to work properly? This is code I have used in several reflash
routines, but in my latest implementation it is writing to memory
location 0x00 (although it still seems to successfully erase the flash).
Here's a piece of the code:
flash_erase:
; Reserve a word on the stack
SP += #-1