avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: SPM Problem


From: Bill Somerville
Subject: [avr-gcc-list] Re: SPM Problem
Date: Sun, 21 Dec 2003 01:09:57 +0000

> 
> I've got an odd problem.   I'm porting some code from IAR to GCC and have
> hit a brick wall.
> 
> All the C works BUT we have some assembler to reprogram the internal
> flash.   With the IAR it works just fine, with the GCC it hangs the moment
> it executes the SPM instruction after loading the SPMCR with 0x03 (erase).
> 
> The code is the same, its locating it in the correct place (1F800), its
> calling it correcly, its just not working.
> 
> We have alot of other assembly routines that work correctly.
> 
> I've replaced the IAR 'DW' with '.word' but I have not changed the
> parameter register numbers.   The programming sequence is entirely assembly
> and is called by  void program_flash(void) and then each assembler function
> sets the correct registers before calling the next so I cannot see how
> changing from R18 etc.. to R24 etc.. would make a difference.

Not much detail here so I could be well off the track. I don't know IAR
tools but it is easy to assume that 'as' allocates storage with .word
which is not true. Storage is only allocated for each argument of .word.

e.g.

        .word
        .word

allocates no storage and assembles without warning or error, whereas

        .word   0,0

allocates 4 bytes (each set to zero).

> 
> Anyone else had issues with SPM?
> 
> Many thanks!
> 
> --

Bill Somerville


reply via email to

[Prev in Thread] Current Thread [Next in Thread]