Debugging bootloader and application code

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

Now that I have a working bootloader, I need to start writing and debugging application code. However, the bootloader and application code were compiled seperately and have seperate COFF and Hex files.

Since the JTAGICEMKII debug wire interface wants to erase the chip whenever new code is uploaded, how do I upload and maintain the seperate HEX or COFF files ? If I program the bootloader with a seperate programmer and set the boot lock bits, then just upload the application code, will the MKII still try to erase or reprogram the boot section ?

Thanks

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

gahelton wrote:
Since the JTAGICEMKII debug wire interface wants to erase the chip whenever new code is uploaded, how do I upload and maintain the seperate HEX or COFF files ?

You can combine the two .hex files. Unfortunately, you cannot just concatenate the two files because each .hex file has an "end" record in it. What you want is the two .hex files concatenated with the "end" record corresponding to the first one removed.

You can do this manually by editing the combined .hex file. The "end" record looks like this:

:00000001FF

You also need to remove the "start address record" for the bootloader portion. It begins with

:04000003

I wrote an awk script to do the combining for me but you could use almost any scripting language to do the same, e.g. Perl.

Another alternative, if you're using Windows, is to install WinAVR and use the srec_cat.exe program. There is also a Linux version of it.

Don Kinzer
ZBasic Microcontrollers
http://www.zbasic.net

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

Any additional thoughts on how to accomplish simultaneous debug (symbolic) of boot and application code using studio ?

Here is what I've tried and results.

1. Using ImageCraft C complier, each two seperate projects were created, one for boot code and one for application code. Two seperate COFF and HEX files were creates, one for each project as previously described.
2. The end of record marker was removed from one of the files and the two HEX files were concatenated into a single HEX file.
3. A third project AVR Studio project was created. This project was setup to load the concatenated hex file along with the COFF file for the application code.

Result.
Since the initial reset vector is in the boot code, and since Studio has no information about the boot code, Studio is confused and the reset button in studio will not work.

Surely someone other that myself has found this tremendous, gaping hole in the debug capabilties of studio when tring to debug boot and application code when there a created as two seperate projects.

Has anyone had any experience with this ? Any thoughts ?