OK, znalazłem błąd na poniższy problem. Źle miałem ustawiony adres powinno być:
(zmieniłem adres sekcji .text na 0x1800) bo wartość 0x0C00 jest w słowach czyli po 2 bajty. Ech to nazewnictwo
To koledzy pomóżcie

, procek to atmega8, rozmiar bootloadera największy czyli adres 0x0C00, fusbit BOOTRESET zaprogramowany, w AvrStudio przesunąłem wszystko (zmieniłem adres sekcji .text na 0x0600) pod adres 0x0C00, program tam wchodzi ale nie zapisuje flasha. Chciałem zapisać cokolwiek pod adres 0x0000.
Zrobiłem prosty program dwie funkcje main i boot_program_page z biblioteki avr-libc:
void boot_program_page (uint32_t page, uint8_t *buf)
{
uint16_t i;
uint8_t sreg;
// Disable interrupts.
sreg = SREG;
cli();
eeprom_busy_wait ();
boot_page_erase (page);
boot_spm_busy_wait (); // Wait until the memory is erased.
for (i=0; i<SPM_PAGESIZE; i+=2)
{
// Set up little-endian word.
uint16_t w = *buf++;
w += (*buf++) << 8;
boot_page_fill (page + i, w);
}
boot_page_write (page); // Store buffer in flash page.
boot_spm_busy_wait(); // Wait until the memory is written.
// Reenable RWW-section again. We need this if we want to jump back
// to the application after bootloading.
boot_rww_enable ();
// Re-enable interrupts (if they were ever enabled).
SREG = sreg;
}
int main(void)
{
unsigned int i;
unsigned char buf[128] = {1,2,3,4,5,6,7,8,9,0xAA};
// wypelniamy bufor
for(i = 0; i < SPM_PAGESIZE; i++)
buf[i] = 0xAA;
boot_program_page(0x0000,buf);
while(1);
return 0;
}
O czym jeszcze zapomniałem? Głównie piszę na PIC-e i dlatego przecieram szlak w bootloderze dla AVR-a.