Subversion Repositories HomeAutomation

Rev

Blame | Last modification | View Log | SVN | RSS feed

   1                    .file   "flash.c"
   2                    .arch atmega168
   3                __SREG__ = 0x3f
   4                __SP_H__ = 0x3e
   5                __SP_L__ = 0x3d
   6                __tmp_reg__ = 0
   7                __zero_reg__ = 1
   8                    .global __do_copy_data
   9                    .global __do_clear_bss
  11                    .text
  12                .Ltext0:
  89                    .section    .bootloader,"ax",@progbits
  91                .global flash_flush_buffer
  93                flash_flush_buffer:
   1:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** #include <avr/interrupt.h>
   2:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** #include <avr/boot.h>
   3:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** #include <avr/pgmspace.h>
   4:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** #include <avr/wdt.h>
   5:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** #include <flash.h>
   6:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
   7:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** static uint16_t flash_prev_addr;
   8:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** static uint8_t flash_buffer_dirty = 0;
   9:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** static uint8_t* flash_pagebuf;
  10:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  11:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** void flash_flush_buffer() {
  95                .LM0:
  96                /* prologue: frame size=0 */
  97                /* prologue end (size=0) */
  12:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint8_t sreg;
  13:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint16_t word;
  14:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint8_t i;
  15:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint16_t* buf = (uint16_t*)flash_pagebuf; // Access buffer on a word basis.
  99                .LM1:
 100 0000 4091 0000         lds r20,flash_pagebuf
 101 0004 5091 0000         lds r21,(flash_pagebuf)+1
  16:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  17:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    if (!flash_buffer_dirty) return; // Nothing to flush.
 103                .LM2:
 104 0008 8091 0000         lds r24,flash_buffer_dirty
 105 000c 8823              tst r24
 106 000e 09F4              brne .+2
 107 0010 30C0              rjmp .L12
 109                .LM3:
 110 0012 20E0              ldi r18,lo8(0)
 111 0014 30E0              ldi r19,hi8(0)
 112 0016 61E0              ldi r22,lo8(1)
 113 0018 DA01              movw r26,r20
 114                .L4:
  18:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  19:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // Copy the sram buffer to the temporary page buffer.
  20:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    for (i = 0; i < SPM_PAGESIZE/2; i++) {
  21:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        word = buf[i];
  22:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        boot_page_fill(i*2, word); // Absolute addressing is not neccessary.
 116                .LM4:
 117 001a 8D91              ld r24,X+
 118 001c 9D91              ld r25,X+
 119                /* #APP */
 120 001e 0C01              movw  r0, r24
 121 0020 F901              movw r30, r18
 122 0022 6093 5700         sts 87, r22
 123 0026 E895              spm
 124 0028 1124              clr  r1
 125                    
 126                /* #NOAPP */
 127 002a 2E5F              subi r18,lo8(-(2))
 128 002c 3F4F              sbci r19,hi8(-(2))
 130                .LM5:
 131 002e 2038              cpi r18,128
 132 0030 3105              cpc r19,__zero_reg__
 133 0032 99F7              brne .L4
  23:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    }
  24:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  25:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // Disable interrupts.
  26:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    sreg = SREG;
 135                .LM6:
 136 0034 9FB7              in r25,95-0x20
  27:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    cli();
 138                .LM7:
 139                /* #APP */
 140 0036 F894              cli
 141                /* #NOAPP */
 142                .L6:
  28:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  29:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    eeprom_busy_wait(); // Make sure any eeprom access has finished.
 144                .LM8:
 145 0038 F999              sbic 63-0x20,1
 146 003a FECF              rjmp .L6
  30:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  31:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    boot_page_erase(flash_prev_addr);
 148                .LM9:
 149 003c 2091 0000         lds r18,flash_prev_addr
 150 0040 3091 0000         lds r19,(flash_prev_addr)+1
 151 0044 83E0              ldi r24,lo8(3)
 152                /* #APP */
 153 0046 F901              movw r30, r18
 154 0048 8093 5700         sts 87, r24
 155 004c E895              spm
 156                    
 157                /* #NOAPP */
 158                .L8:
  32:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    boot_spm_busy_wait();  // Wait until the memory is erased.
 160                .LM10:
 161 004e 07B6              in __tmp_reg__,87-0x20
 162 0050 00FC              sbrc __tmp_reg__,0
 163 0052 FDCF              rjmp .L8
  33:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  34:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    boot_page_write(flash_prev_addr); // Store buffer in flash page.
 165                .LM11:
 166 0054 85E0              ldi r24,lo8(5)
 167                /* #APP */
 168 0056 F901              movw r30, r18
 169 0058 8093 5700         sts 87, r24
 170 005c E895              spm
 171                    
 172                /* #NOAPP */
 173                .L10:
  35:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    boot_spm_busy_wait();  // Wait until the memory is written.
 175                .LM12:
 176 005e 07B6              in __tmp_reg__,87-0x20
 177 0060 00FC              sbrc __tmp_reg__,0
 178 0062 FDCF              rjmp .L10
  36:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  37:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    flash_buffer_dirty = 0;
 180                .LM13:
 181 0064 1092 0000         sts flash_buffer_dirty,__zero_reg__
  38:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  39:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // Reenable RWW-section again so we can return to BIOS after flashing.
  40:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    boot_rww_enable ();
 183                .LM14:
 184 0068 81E1              ldi r24,lo8(17)
 185                /* #APP */
 186 006a 8093 5700         sts 87, r24
 187 006e E895              spm
 188                    
  41:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  42:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // Re-enable interrupts (if they were ever enabled).
  43:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    SREG = sreg;
 190                .LM15:
 191                /* #NOAPP */
 192 0070 9FBF              out 95-0x20,r25
 193                .L12:
 194 0072 0895              ret
 195                /* epilogue: frame size=0 */
 196                /* epilogue: noreturn */
 197                /* epilogue end (size=0) */
 198                /* function flash_flush_buffer size 76 (76) */
 204                .Lscope0:
 205                    .text
 208                .global flash_load_buffer
 210                flash_load_buffer:
  44:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** }
  45:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  46:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** void flash_load_buffer(uint16_t addr) {
 212                .LM16:
 213                /* prologue: frame size=0 */
 214                /* prologue end (size=0) */
  47:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint8_t i;
  48:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint8_t byte;
  49:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint16_t page = (addr / SPM_PAGESIZE) * SPM_PAGESIZE;
 216                .LM17:
 217 0000 8078              andi r24,lo8(-128)
  50:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  51:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // Load current flash page contents into sram page buffer to implement
  52:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // flash read-modify-writes with word granularity.
  53:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    for (i = 0; i < SPM_PAGESIZE; i++) {
  54:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        byte = pgm_read_byte(page + i);
  55:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        flash_pagebuf[i] = byte;
 219                .LM18:
 220 0002 4091 0000         lds r20,flash_pagebuf
 221 0006 5091 0000         lds r21,(flash_pagebuf)+1
 222 000a 20E0              ldi r18,lo8(0)
 223 000c 30E0              ldi r19,hi8(0)
 224                .L22:
 225                .LBB2:
 227                .LM19:
 228 000e A22F              mov r26,r18
 229 0010 BB27              clr r27
 230 0012 FC01              movw r30,r24
 231 0014 EA0F              add r30,r26
 232 0016 FB1F              adc r31,r27
 233                /* #APP */
 234 0018 E491              lpm r30, Z
 235                    
 236                /* #NOAPP */
 237                .LBE2:
 239                .LM20:
 240 001a A40F              add r26,r20
 241 001c B51F              adc r27,r21
 242 001e EC93              st X,r30
 243 0020 2F5F              subi r18,lo8(-(1))
 244 0022 3F4F              sbci r19,hi8(-(1))
 246                .LM21:
 247 0024 2038              cpi r18,128
 248 0026 3105              cpc r19,__zero_reg__
 249 0028 91F7              brne .L22
 250                /* epilogue: frame size=0 */
 251 002a 0895              ret
 252                /* epilogue end (size=1) */
 253                /* function flash_load_buffer size 26 (25) */
 261                .Lscope1:
 262                    .section    .bootloader
 266                .global flash_write_word
 268                flash_write_word:
  56:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    }
  57:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** }
  58:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  59:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** void flash_write_word(uint16_t addr, uint16_t word) {
 270                .LM22:
 271                /* prologue: frame size=0 */
 272 0074 EF92              push r14
 273 0076 FF92              push r15
 274 0078 0F93              push r16
 275 007a 1F93              push r17
 276 007c CF93              push r28
 277 007e DF93              push r29
 278                /* prologue end (size=6) */
 279 0080 EC01              movw r28,r24
 280 0082 7B01              movw r14,r22
  60:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint16_t* buf = (uint16_t*)flash_pagebuf; // Access buffer on a word basis.
 282                .LM23:
 283 0084 0091 0000         lds r16,flash_pagebuf
 284 0088 1091 0000         lds r17,(flash_pagebuf)+1
  61:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  62:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // Check if page address has changed since last write
  63:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    if ((addr / SPM_PAGESIZE) != (flash_prev_addr / SPM_PAGESIZE)) {
 286                .LM24:
 287 008c 9C01              movw r18,r24
 288 008e 220F              lsl r18
 289 0090 232F              mov r18,r19
 290 0092 221F              rol r18
 291 0094 330B              sbc r19,r19
 292 0096 3195              neg r19
 293 0098 8091 0000         lds r24,flash_prev_addr
 294 009c 9091 0000         lds r25,(flash_prev_addr)+1
 295 00a0 880F              lsl r24
 296 00a2 892F              mov r24,r25
 297 00a4 881F              rol r24
 298 00a6 990B              sbc r25,r25
 299 00a8 9195              neg r25
 300 00aa 2817              cp r18,r24
 301 00ac 3907              cpc r19,r25
 302 00ae 29F0              breq .L28
  64:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        flash_flush_buffer(); // Flash buffer contents to previous page
 304                .LM25:
 305 00b0 0E94 0000         call flash_flush_buffer
  65:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        flash_load_buffer(addr); // Read new page contents into buffer
 307                .LM26:
 308 00b4 CE01              movw r24,r28
 309 00b6 0E94 0000         call flash_load_buffer
 310                .L28:
  66:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    }
  67:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  68:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    buf[(addr % SPM_PAGESIZE)/2] = word;
 312                .LM27:
 313 00ba FE01              movw r30,r28
 314 00bc EE77              andi r30,lo8(126)
 315 00be F070              andi r31,hi8(126)
 316 00c0 E00F              add r30,r16
 317 00c2 F11F              adc r31,r17
 318 00c4 F182              std Z+1,r15
 319 00c6 E082              st Z,r14
  69:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    flash_prev_addr = addr;
 321                .LM28:
 322 00c8 D093 0000         sts (flash_prev_addr)+1,r29
 323 00cc C093 0000         sts flash_prev_addr,r28
  70:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    flash_buffer_dirty = 1;
 325                .LM29:
 326 00d0 81E0              ldi r24,lo8(1)
 327 00d2 8093 0000         sts flash_buffer_dirty,r24
 328                /* epilogue: frame size=0 */
 329 00d6 DF91              pop r29
 330 00d8 CF91              pop r28
 331 00da 1F91              pop r17
 332 00dc 0F91              pop r16
 333 00de FF90              pop r15
 334 00e0 EF90              pop r14
 335 00e2 0895              ret
 336                /* epilogue end (size=7) */
 337                /* function flash_write_word size 56 (43) */
 339                .Lscope2:
 342                .global flash_init
 344                flash_init:
  71:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** }     
  72:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  73:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** void flash_init(uint8_t* buf) {
 346                .LM30:
 347                /* prologue: frame size=0 */
 348                /* prologue end (size=0) */
  74:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // 0xffff is never in any page that can be written on devices with <= 64K flash,
  75:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    // so the first flash_write_word will always trigger a buffer load.
  76:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    flash_prev_addr = 0xffff;
 350                .LM31:
 351 00e4 2FEF              ldi r18,lo8(-1)
 352 00e6 3FEF              ldi r19,hi8(-1)
 353 00e8 3093 0000         sts (flash_prev_addr)+1,r19
 354 00ec 2093 0000         sts flash_prev_addr,r18
  77:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    flash_pagebuf = buf;
 356                .LM32:
 357 00f0 9093 0000         sts (flash_pagebuf)+1,r25
 358 00f4 8093 0000         sts flash_pagebuf,r24
  78:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    flash_buffer_dirty = 0;
 360                .LM33:
 361 00f8 1092 0000         sts flash_buffer_dirty,__zero_reg__
 362                /* epilogue: frame size=0 */
 363 00fc 0895              ret
 364                /* epilogue end (size=1) */
 365                /* function flash_init size 13 (12) */
 367                .Lscope3:
 368                    .section    .flash_code,"ax",@progbits
 373                .global flash_copy_data
 375                flash_copy_data:
  79:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** }
  80:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  81:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** extern void __flash_code_start; // Start of .flash_code from ld-script
  82:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  83:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** void flash_copy_data(uint16_t src, uint16_t dst, uint16_t len) {
 377                .LM34:
 378                /* prologue: frame size=0 */
 379                /* prologue end (size=0) */
 380 0000 DC01              movw r26,r24
  84:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    uint16_t data;
  85:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  86:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    cli(); // From this point we're on our own
 382                .LM35:
 383                /* #APP */
 384 0002 F894              cli
  87:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  88:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    len = (len | (SPM_PAGESIZE - 1)) + 3; // Round len up to a whole page + 2
 386                .LM36:
 387                /* #NOAPP */
 388 0004 4F67              ori r20,lo8(127)
 389 0006 4D5F              subi r20,lo8(-(3))
 390 0008 5F4F              sbci r21,hi8(-(3))
 391 000a 2EC0              rjmp .L34
 392                .L35:
  89:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    
  90:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****    while (len -= 2) {
  91:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        if (dst >= (uint16_t)&__flash_code_start) break;
 394                .LM37:
 395 000c 80E0              ldi r24,hi8(__flash_code_start)
 396 000e 6030              cpi r22,lo8(__flash_code_start)
 397 0010 7807              cpc r23,r24
 398 0012 08F0              brlo .+2
 399 0014 2DC0              rjmp .L36
  92:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  93:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        wdt_reset();
 401                .LM38:
 402                /* #APP */
 403 0016 A895              wdr
 404                /* #NOAPP */
 405                .LBB3:
  94:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c **** 
  95:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        data = pgm_read_word(src); // Read source word
 407                .LM39:
 408 0018 FD01              movw r30,r26
 409                /* #APP */
 410 001a 8591              lpm r24, Z+
 411 001c 9491              lpm r25, Z
 412                    
 413                /* #NOAPP */
 414                .LBE3:
  96:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        boot_page_fill(dst, data); // Write word to destination
 416                .LM40:
 417 001e 21E0              ldi r18,lo8(1)
 418                /* #APP */
 419 0020 0C01              movw  r0, r24
 420 0022 FB01              movw r30, r22
 421 0024 2093 5700         sts 87, r18
 422 0028 E895              spm
 423 002a 1124              clr  r1
 424                    
  97:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        
  98:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        if ((dst + 2) % SPM_PAGESIZE == 0) { // If we just wrote the last word of a page
 426                .LM41:
 427                /* #NOAPP */
 428 002c 9B01              movw r18,r22
 429 002e 2E5F              subi r18,lo8(-(2))
 430 0030 3F4F              sbci r19,hi8(-(2))
 431 0032 C901              movw r24,r18
 432 0034 8F77              andi r24,lo8(127)
 433 0036 9070              andi r25,hi8(127)
 434 0038 892B              or r24,r25
 435 003a A1F4              brne .L38
  99:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****            boot_page_erase(dst);
 437                .LM42:
 438 003c 83E0              ldi r24,lo8(3)
 439                /* #APP */
 440 003e FB01              movw r30, r22
 441 0040 8093 5700         sts 87, r24
 442 0044 E895              spm
 443                    
 444                /* #NOAPP */
 445                .L40:
 100:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****            boot_spm_busy_wait(); // Wait until the memory is erased.
 447                .LM43:
 448 0046 07B6              in __tmp_reg__,87-0x20
 449 0048 00FC              sbrc __tmp_reg__,0
 450 004a FDCF              rjmp .L40
 101:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****            boot_page_write(dst); // Store buffer in flash page.
 452                .LM44:
 453 004c 85E0              ldi r24,lo8(5)
 454                /* #APP */
 455 004e FB01              movw r30, r22
 456 0050 8093 5700         sts 87, r24
 457 0054 E895              spm
 458                    
 459                /* #NOAPP */
 460                .L42:
 102:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****            boot_spm_busy_wait(); // Wait until the memory is written.
 462                .LM45:
 463 0056 07B6              in __tmp_reg__,87-0x20
 464 0058 00FC              sbrc __tmp_reg__,0
 465 005a FDCF              rjmp .L42
 103:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****            boot_rww_enable();
 467                .LM46:
 468 005c 81E1              ldi r24,lo8(17)
 469                /* #APP */
 470 005e 8093 5700         sts 87, r24
 471 0062 E895              spm
 472                    
 473                /* #NOAPP */
 474                .L38:
 104:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        }
 105:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****         
 106:/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c ****        src += 2;
 476                .LM47:
 477 0064 1296              adiw r26,2
 478 0066 B901              movw r22,r18
 479                .L34:
 481                .LM48:
 482 0068 4250              subi r20,lo8(-(-2))
 483 006a 5040              sbci r21,hi8(-(-2))
 484 006c 09F0              breq .+2
 485 006e CECF              rjmp .L35
 486                .L36:
 487                .L49:
 488 0070 FFCF              rjmp .L49
 489                /* epilogue: frame size=0 */
 490                /* epilogue: noreturn */
 491                /* epilogue end (size=0) */
 492                /* function flash_copy_data size 82 (82) */
 498                .Lscope4:
 499                    .lcomm flash_buffer_dirty,1
 500                    .lcomm flash_prev_addr,2
 501                    .lcomm flash_pagebuf,2
 505                    .text
 507                .Letext0:
 508                /* File "/home/linus/HomeAutomation/trunk/EmbeddedSoftware/AVR/avr-lib/bios/flash.c": code  253 = 0
DEFINED SYMBOLS
                            *ABS*:00000000 flash.c
     /tmp/ccYj0Hyz.s:3      *ABS*:0000003f __SREG__
     /tmp/ccYj0Hyz.s:4      *ABS*:0000003e __SP_H__
     /tmp/ccYj0Hyz.s:5      *ABS*:0000003d __SP_L__
     /tmp/ccYj0Hyz.s:6      *ABS*:00000000 __tmp_reg__
     /tmp/ccYj0Hyz.s:7      *ABS*:00000001 __zero_reg__
     /tmp/ccYj0Hyz.s:93     .bootloader:00000000 flash_flush_buffer
     /tmp/ccYj0Hyz.s:500    .bss:00000003 flash_pagebuf
                             .bss:00000000 flash_buffer_dirty
     /tmp/ccYj0Hyz.s:499    .bss:00000001 flash_prev_addr
     /tmp/ccYj0Hyz.s:210    .text:00000000 flash_load_buffer
     /tmp/ccYj0Hyz.s:268    .bootloader:00000074 flash_write_word
     /tmp/ccYj0Hyz.s:344    .bootloader:000000e4 flash_init
     /tmp/ccYj0Hyz.s:375    .flash_code:00000000 flash_copy_data

UNDEFINED SYMBOLS
__do_copy_data
__do_clear_bss
__flash_code_start