AnsweredAssumed Answered

privelege violation when attempting to erase a flash block

Question asked by Tom Dininio on Feb 23, 2016
Latest reply on Feb 29, 2016 by TomE

I have an application written in C (new to me) in CodeWarrior. The processor is MCF51QE128.  I am familiar with assembly language in the old MC6809 (8 bit) processors.

The troublesome code is:

 

 

    FSTAT=(byte)(0x30);

    asm {

      move.l D0,0x1f000;       // Dummy address writeVarA_Flash

    }//End of asm

    FCMD=(byte)(0x40); // Sector Erase Command (4000 cycles 0f 5 microsec period = 20,000 microsec.

    FSTAT=(byte)(0x80); // Start the command

 

 

 

In the .lcf file I have changed the permissions as

    MEMORY {

       code (RWX) : ORIGIN = 0x00000410, LENGTH = 0x0001DBF0

     userram     (RWX) : ORIGIN = 0x00800000, LENGTH = 0x00002000

     userrom     (RWX) : ORIGIN = 0x0001E000, LENGTH = 0x00000002

    }

 

 

The code causes a "Protection Violation" flag to appear in the FSTAT register (observed in DeBug) and the program goes into lala land.

The Security is turned off. Is the userrom section still considered as a "protected" area of flash? I need to store volatile integers during power outages.

What am I missing?

Outcomes