avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] bootloader with boot.h


From: Rok Markovic
Subject: [avr-libc-dev] bootloader with boot.h
Date: Fri, 09 Sep 2005 22:58:52 +0200
User-agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720)

Hi

I have a problem with programing the bootloader. I am using atmega128, avrlibc 1.2.5, avr-gcc 4.0.1, binutils 2.16.1. Linker report problem with undefined reference 'Y'. This problem is in function boot_page_erase(addr) from boot .h. I will explain my problem on two examples.

First instance of call boot_page_erase():

 51:program.c     ****  boot_page_erase (70);
 80                     .LM2:
 81                     /* #NOAPP */
 82 0008 23E0                   ldi r18,lo8(3)
 83 000a 86E4                   ldi r24,lo8(70)
 84 000c 90E0                   ldi r25,hi8(70)
 85 000e A0E0                   ldi r26,hlo8(70)
 86 0010 B0E0                   ldi r27,hhi8(70)
 87                     /* #APP */
 88 0012 FC01                   movw r30, r24
 89 0014 A093 5B00              sts  91, r26
 90 0018 2093 6800              sts 104, r18
 91 001c E895                   spm


When I am calling this function for second time compiler produces this:

131 004e C8E6                   ldi r28,lo8(104)
132 0050 D0E0                   ldi r29,hi8(104)
133 0052 93E0                   ldi r25,lo8(3)
134 0054 A8E6                   ldi r26,lo8(104)
135 0056 B0E0                   ldi r27,hi8(104)
136                     .L8:
 69:program.c     ****                  // erase only main section (bootloader 
protection)
70:program.c **** address = 0; 71:program.c **** while ( address < 0x1dfff ){
 72:program.c     ****                          // Perform page erase
 73:program.c     ****                          boot_page_erase (address);
138                     .LM10:
139                     /* #APP */
140 0058 F901                   movw r30, r18
141 005a 4093 5B00              sts  91, r20
142 005e 9093 0000              sts Y, r25              <<--PROBLEM
143 0062 E895                   spm


Problem is in call sts Y,r25. Compiler loads 104 which is addres of SPM_REG but you cannot write to Y with sts only with st. If you look into boot.h there is output operators "=m". What do they stand for. I haven't found any documentatio for them. How can you force the compiler to do correct code.

Cheers,
Rok




reply via email to

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