ATmega64M1-AU Boot Problem

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


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 bytesmiley

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

This topic has a solution.
Last Edited: Fri. May 15, 2020 - 08:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry but where in all that is the bit where you do -Ttext=0xF000 to position the bootloader code at the BLS afddress?

 

(rather than -Ttext= you may be using the long version: -Wl,-section-start=.text=0xF000 perhaps?)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Good question, I programmed the boot sector first with 0x7800 and another time with 0xF000. You can see for example the picture in attachment (set the programming address),

I also sent the Flash content, Please take a look in the Document.hex file. You will see that the program and boot contents are placed in correct position,

many thanks

 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried  -Ttext=0xF000 when I compiled the test_boot program and doesn't work

Attachment(s): 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you so much for your answer and help,

I solved the problem,

I wrote the  -Ttext=0xF000  in a "Toolchain\AVR/GNU linker\ Miscellaneos\ Other Linker Flags" .

There is no need to generate bin files and also you don't need to set the programming address when program the Chip.

 

Last Edited: Fri. May 15, 2020 - 08:12 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

could you share your last and correct .hex file please?

 

I'm also doing the same thing in order to use the SLIM can Bootloader with the IXXAT USB-to-CAN converter

 

Thanks in advance