MPLAB will not generate Hex file

Discussion in 'Embedded Systems and Microcontrollers' started by RichardO, Mar 24, 2015.

  1. RichardO

    Thread Starter Well-Known Member

    May 4, 2013
    1,238
    385
    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?
     
  2. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    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
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    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.
     
  4. RichardO

    Thread Starter Well-Known Member

    May 4, 2013
    1,238
    385
    Neither. As far as I can tell, the file is not created at all.

    I think I am looking in the right directory since I can see the .o, .map and the .err files.
     
  5. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    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
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    You should be able to "import" the hex file into your project (if it does indeed exist).
     
  7. RichardO

    Thread Starter Well-Known Member

    May 4, 2013
    1,238
    385
    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?
     
  8. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    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
     
  9. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    Good point.

    Richard, can you post the build window output? Either grab the text or do a screen shot.
     
  10. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    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:

    If no .hex file was produced before, you would get this instead:

    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.
     
  11. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    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.
     
  12. RichardO

    Thread Starter Well-Known Member

    May 4, 2013
    1,238
    385
    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. :)
     
  13. RichardO

    Thread Starter Well-Known Member

    May 4, 2013
    1,238
    385
  14. RichardO

    Thread Starter Well-Known Member

    May 4, 2013
    1,238
    385
    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.
     
  15. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,606
    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.
     
  16. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Not sure what you mean. I used MPLAB 8.x in the past and currently MPLAB X. Seems to be working fine for me and I'm on a Mac.
     
  17. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    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
     
  18. RichardO

    Thread Starter Well-Known Member

    May 4, 2013
    1,238
    385
    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...
     
Loading...