Tuesday, November 19, 2013

Debugging a bootloader code

I am currently working on a bootloader for a dsPIC33FJ.

If you develop a bootloader, you might want to test it during its development. What better is there to see if a code is running, then a blinky? The blinky in the previous post is also the testing blinky for the bootloader.

The quirks of downloading code to dsPIC

I wanted to see how my compiled program runs on my dsPIC33FJ. Never did I imagine this was going to be so hard.

Usually you write your blinky code, you download it via your IDE to your uC, and then you lean back and watch the blinky code do its magic on the LED.

Turns out the dsPICs do not have a hardware to support direct debugging, therefore you can compile 2 different codes.

  • Debug code:
    • Debugable
    • Does not run standalone
  • Standalone code:
    • you download it, it runs, that's it