Re: [coldfire-gnu-discuss] How to access FLASHBAR?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coldfire-gnu-discuss] How to access FLASHBAR?



Hi again, had a long (very needed) :) weekend since my question.

On Thu, 30 Sep 2010 16:07:13 +0100, Nathan Sidwell
<nathan@xxxxxxxxxxxxxxxx> wrote:
> On 09/30/10 16:00, m8847 wrote:
>>
>> Hi,
>>
>> I am trying to get my flash programming to work. I have copied the
>> functions to RAM, but I need to clear the WP bit in FLASHBAR in order
to
>> program.
>>
>> I tried something like this from within a C function;
>>      asm( "move.l   #0x21,d0" );
>>      asm( "movec    %d0,0xC04" );
> 
> I think something like
> 
>     __asm__ volatile ("movec %0,FLASHBAR" : : "r"(0x21));
> 
> will do what you want.  You may need %% before FLASHBAR, I'm not sure.


OK, 
     __asm__ volatile ("movec %0,%%FLASHBAR" : : "r"(0x21));

compiles fine, but when I look in the assember window in the debugger, it
comes out as 
    moveq #33,%d0
    movec %d0,%rambar0


RAMBAR0?? Is there some relation here that I don't see? rambar ought to be
C05, flashbar C04.

Looking in the "registers" view, flashbar still says 0x0121, that is with
WP still set, and naturally my software gets a 'access' violation when
trying to write the first longword @ address 0. 


> 
> nathan