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

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

[avr-gcc-list] Problems after boot_page_erase()


From: John Butera
Subject: [avr-gcc-list] Problems after boot_page_erase()
Date: Sun, 4 Apr 2004 21:32:39 -0500

<x-flowed>
I've been debugging some bootloader code for a mega8515 and to make things easier, I decided to hook up and LCD.

I found what I thought was a great LCD library at..
http://homepage.sunrise.ch/mysunrise/pfleury/avr-software.html
..but there seems to be something wrong after I use boot_page_erase, and I'm not sure if it's a problem with the LCD library or the bootloader functions or my code.

After calling boot_page_erase(), any LCD output function I try to use never returns. I simplified the problematic portion of my code to see if the issue would clear up, but the same thing happens.

With the following code, "Erasing..." shows up, but never "Erased!" and PORTA stays at 0x99. I have tried erasing different pages, and have verified that the pages do, in fact, get erased. My bootloader section is set to start at word 0x0C00 (byte 0x1800). The page I chose to erase in this code was arbitrary.

I can't figure out why erasing a page in the flash would make the LCD functions not work. I've tried using different optimization settings, and got the same result. Any ideas as to what's going on?

Thanks,
John Butera

#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/boot.h>

#include "lcd.h"
#include "hwfunc.h"

int main(void) __attribute__ ((section (".bootloader") ));

void ioinit(void)
{
        DDRC = 0xFF;
        PORTC = 0x00;
        DDRA = 0xFF;
        PORTA = 0x00;
}

int main(void)
{
        ioinit();
        lcd_init(LCD_DISP_ON);
        
        // make sure we are alone
        WatchdogDisable();
        cli();
        
        lcd_puts_p(PSTR("Erasing..."));
        PORTA = 0x88;
        boot_page_erase(0x17C0); // erase the page just before boot section
        PORTA = 0x99;
        lcd_puts_p(PSTR("\nErased!"));  // NEVER GETS PAST HERE
        PORTA = 0xAA;
        abort();
}


_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list

</x-flowed>

reply via email to

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