Debugging Bootloader Code on Atmega328P with AS 6.1 and Dragon

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a custom bootloader that I want to debug with the Dragon tool in AS 6.1.

 

I have these linker flags:

 

-Wl,--section-start=.text=0x3800

The 2048_3800 fuse is set and the BOOTRST fuse is set.

 

Both compiler and assembler have default debug data.

 

The .text section starts at 0x3800 according to the loadmap file(attached as AES.txt) and the address of main looks reasonable (0x00003dbe   )

 

 

But, when I click

 

   Debug->Start Debugging and Break

 

I can see the status message indicating the boot code is loaded over debugWire, but the first line of main is never reached.  If I do

 

Debug->Break All

 

and bring up assembly view, I see code running in low memory:

 

00000283  SBIS 0x09,2		Skip if bit in I/O register set 
00000284  RJMP PC+0x0003		Relative jump 
00000285  SBIC 0x09,3		Skip if bit in I/O register cleared 
00000286  RJMP PC-0x0003		Relative jump 

 

It's like the bootloader code was loaded at 0x0 (or at least control was transferred to low memory)  instead of the 0x3800, despite the linker settings and what's reported in the loadmap file.

 

I feel like I'm missing some simple configuration option. Can anyone help?

 

Thanks,

 

Dave Thomas

 

 

Attachment(s): 

Last Edited: Mon. Sep 22, 2014 - 12:08 PM