Prog Flash Memory Window Not Updating With DebugWire

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

Am trying to debug the bootloader:

 

http://spaces.atmel.com/gf/proje...

 

Using AS 6.2 to a ATMega328p (Arduino) via Atmel Dragon.

 

Basically, the program flash just shows erased (0xff), even after the writing procedure (asm).

 

However the flash has been overwritten, since starting the program again shows the flash written correctly.

 

Have got no optimisations, and the -mrelax flag disabled.

 

Have set the BL size to 2048W, since with optimisation off it builds >2K, and set .text=0x3800 in the Linker-Memory-FlashSegment.

 

Slightly off topic:

Also noticed that if -nostartfiles present (as is default with the above bootloader), then debugwire will start and break - but no variables can be evaluated in the Watch window - just get 'Unable to evaluate the expression. Invalid pointer'. Taking off -nostartfiles fixes that.

 

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

I've been bitten by this. Atmel make the assumption that once loaded the flash won't change so there's no need for them to keep reading a whole bunch of data from flash memory across the debug link each time program execution stops. There is a user settable option somewhere that says "don't cache flash contents" that changes this behaviour and lets you debug bootloader code.

but no variables can be evaluated in the Watch window - just get 'Unable to evaluate the expression. Invalid pointer'. Taking off -nostartfiles fixes that.

Why are you surprised -  the -nostartfiles option switches off the _do_clear_bss and _do_copy_data loops so .bss and .data variables are not valid in a bootloader built with -nostartfiles. Even if you write your own loops to replace the default loops I don't think it'll "see" them.

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

Yes - Unchecking the Tool-'Cache all flash memory except'  checkbox fixed it.

 

I was not particularly surprised, just did not know exactly what was causing it. Now I dosmiley

 

Thanks for the answers.