MPLAB will not generate Hex file

Thread Starter

RichardO

Joined May 4, 2013
2,270
I am using MPLAB 8.92 to assemble an absolute source file. It assembles and says that the build was successful but a .hex file is not created. The same file assembles and creates a hex file using MPLAB 7.31.
I am running MPLAB 8.92 under Win7 64-bit and MPLAB 7.31 under WinXP.

Obviously I am doing something wrong, but what?
 

jpanhalt

Joined Jan 18, 2008
11,087
When you say it won't generate a hex file, does that mean you can't export a hex file, or you cannot program a chip using an MPLAB-compatible programmer such as a PK2, PK3, ICD2, or ICD3?

John
 

ErnieM

Joined Apr 24, 2011
8,377
Perhaps you just can't find it? Look on the menu: Project | Build Options... | Project. Select the "Directories" tab and see what's there for "Output Directory".

That is where your hex file is going. If you don't like the choice (or if it is blank) you can add whatever you wish.
 

Thread Starter

RichardO

Joined May 4, 2013
2,270
When you say it won't generate a hex file, does that mean you can't export a hex file, or you cannot program a chip using an MPLAB-compatible programmer such as a PK2, PK3, ICD2, or ICD3?
John
Neither. As far as I can tell, the file is not created at all.

Perhaps you just can't find it? Look on the menu: Project | Build Options... | Project. Select the "Directories" tab and see what's there for "Output Directory".
I think I am looking in the right directory since I can see the .o, .map and the .err files.
 

jpanhalt

Joined Jan 18, 2008
11,087
Neither. As far as I can tell, the file is not created at all.
I think you need to try to program a chip. If the chip programs, then you know there is a hex file somewhere, and you need to find it. Hex files in my setup end up in the project folder. For example, this is what the hex file for a particular project looks like in the folder:

upload_2015-3-25_12-14-40.png

Notice, there is no extension indicating a hex file.

John
 

Thread Starter

RichardO

Joined May 4, 2013
2,270
You should be able to "import" the hex file into your project (if it does indeed exist).
I don't follow you. Shouldn't the assembler create the hex file? Where would I get the hex file to import if the assembler does not create it?
 

jpanhalt

Joined Jan 18, 2008
11,087
What evidence do you have that no hex file is generated at all?

Does the program "build?" Can you debug the program (e.g., with MPLab SIM)? Have you tried programming? That does not mean you actually need to program.

John
 

atferrari

Joined Jan 6, 2004
4,764
Hola Richard

At least in my version of MPLAB (previous to yours) this is a somewhat unusual (but reliable) way to see if an .hex file is produced (just request "Build all" twice:

When asking MPLAB to compile your code, look into the OUTPUT window and you could get something like this:

Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.o".
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.err".
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.hex".
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.lst".
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.cof".
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\SCOPE IMAGE 01.mcs".
If no .hex file was produced before, you would get this instead:

Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.o".
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.err".
Clean Warning: File "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.hex" doesn't exist.
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.lst".
Clean: Deleted file "C:\Documents and Settings\Agustín\Escritorio\SCOPE IMAGE 01\000 SCOPE IMAGE 01.cof".
Clean: Done.
As far as I can recall, MPLAB is reliable on this regard. But, you know, as my ex proved many times, I could be wrong.
 

takao21203

Joined Apr 28, 2012
3,702
Use the clean option to remove all files first when you imported from older version.

You can also make a new project using the existing source files.
 

Thread Starter

RichardO

Joined May 4, 2013
2,270
I am still around but have not had a chance to get you better information. Thanks for your help so far.

p.s. I have been distracted by making a fixture to use a microscope to take photos of IC's I have decapped. Also, pictures of a couple of RFPIC's I was given. :)
 

Thread Starter

RichardO

Joined May 4, 2013
2,270
Well...
I have finally programmed my PIC.

It is a long story but the essentials are that the old program would assemble using MPLAB 8.xx but would not build without an error. Using MPLAB 7.31, I could both assemble and build without a problem. Because MPLAB 8.xx gave an error, it would not generate a hex file.

Part of the confusion was that I thought that MPLAB 7.31 had generated the hex file when only assembling. This appears to not be the case. After many installs, uninstalls, driver installs and cleans and other frustrations under win7-64 bit I gave up and cheated. I ran MPLAB 7.31 in a Windows emulator (VMware). I was able to successfully do a build all and install the ICD2 USB driver. After that it was a "simple" matter of programming the PIC.

Thanks for all the help you gave me. I wish I had given you better input as to my actual problem.
 

ErnieM

Joined Apr 24, 2011
8,377
Thanks for another example of the stunning success of the MPLAB-EX platform and it's ability to insure no bad (or good) code will ever be generated.
 

jpanhalt

Joined Jan 18, 2008
11,087
I have MPLab 8.92 running on Win7 64 (x86 mode), and it is solid as a rock. It does seem to like to have everything, including the assembly program, in the same folder. However, it will still run with the assembly program in another folder.

John
 

Thread Starter

RichardO

Joined May 4, 2013
2,270
I have MPLab 8.92 running on Win7 64 (x86 mode), and it is solid as a rock. It does seem to like to have everything, including the assembly program, in the same folder. However, it will still run with the assembly program in another folder.

John
It is not a folder problem since all of my files are in one directory.

The problem I had was that old code would not link with MPLAB 8.10 or 8.92. I have no problem assembling and linking the code using MPLAB 7.31. The "improved" features added to MPLAB have caused me other problems with old code...
 
Top