Wednesday, June 3, 2009

Trouble producing the HEX file

I wanted to compile and load a .hex file onto the PIC.

Powered up MPLAB IDE, modified the example source code:
     blink LED 1 instead of LED 0.

I finally got the compiler to work (I was having many issues, including the Virtual Store).

So, let's compile and load the .hex file... 
    Build Succeded!
but a message box pops up saying it couldn't load the .hex file.

Odd, but I can just do it manually.
wait, there is no .hex file!

I poured through the compiler options.  There was an option called FAKELOCAL...
Gee, that is suspicous, let's look there.

Sure enough, if I go to the HI-TECH Linker in Project->Build Options of the MPLAB IDE, there is a checkbox for Produce MPLAB debugging info.  Uncheck that and the FAKELOCAL goes away.

Viola, on the next compile, a .hex file appears!

Vista Virtual Store

Okay,
I just found something out: Windows Vista is stubborn about letting you save files in 
     C:\Program Files\...
Instead, it recreates the data files and directory structure in 
     C:\users\[USER]\app_data\local\virtual store\Program Files\...

Yes, Vista recreates a copy of all the files that you use from Program Files and hides it in some backwoods directory.

Vista then merges the program files in C:\Program Files\... and the data files in C:\...\Virtual Store\Program Files\... when you run an application.
According to the file browser in the application, the data files should be in C:\Program Files\...

Vista goes through great effort to conceal the fact that the data and program are in separate locations.

That's fine and dandy, but I couldn't find the .hex file that I just compiled (and neither could the loader)

Partial solution:
I ran the application with Run as Administrator and Win XP SP2 Compatibility Mode, and it appears to be working correctly now.


Well, that is 3 nights of my life I won't get back.