Hi,
I'm developing with ATmega64M1-AU using AtmelStudio version 7, I'm trying to realize a simple bootloader for this microcontroller.
First, I've created two separate projects as Test_main , and Test_boot.
Test_boot project contains a simple program a LED that blinks once every 1 second and jump to the "0x0000h" that is main program address.
int main(void)
{
atmel_start_init();
_delay_ms(500);
DEbug_set_level(1);
_delay_ms(500);
DEbug_set_level(0);
_delay_ms(500);
DEbug_set_level(1);
_delay_ms(500);
asm("jmp 0x0000");
}
Test_main contains a while loop as following.
int main (void)
{
atmel_start_init();
while (1)
{
RS485_sel_set_level(1);
_delay_ms(50);
RS485_sel_set_level(0);
_delay_ms(50);
}
}
You can see the fuse settings in the following pictures
Clock source is Internal RC Oscillator.
///////////////////////////// Programming Boot Section usning AtmelStudio////////////////////////
first of all I programmed the configuration for post build events as following to produce the bin file.
Then, I First build the Test_main program and program the micro, in the next step I build the Test_boot program and again program the microcontroller without erase and set the first
address as 0x7800 (and also 0xF000 if linker forget not converting the word address to byte)
You can see the boot section programming in the below figure
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
When I read the Flash I can see that Boot section and Program section are filled with proper values and in correct sectors.
But finally I can not understand why after the restart program can not see the RESET at the begining of boot section and
everytime start the main application program and doesn't go jump to boot section.
Thank you so much for considering my application.
GrüÃe