Saturday, March 11, 2017

How to load EEPROM *.hex file in new MPLABX IDE?

Before beginning the post, i would like to share the problem which i faced while porting the firmware written for my client in MPLAB IDE to the new and cool MPLAB-X IDE with some minor changes.

Introduction
I have a PIC project which was written for PIC18F45K50 micro-controller in MPLAB IDE v8.92 and the compiler used was MPLABC18 compiler, the specialty about this project is its configuration tool, which generates EEPROM file (which we called as configuration file), this EEPROM file is loaded into MPLAB IDE along with the project and after building the source code we get *.hex file which has both the program code and EEPROM data, this configuration tool is proprietary tool for this particular project and can be made easily for any other project, using any PC programming language.
Configuration Tool for generating configuration/EEPROM.
Now i have to do some modification in this MPLAB project, like few changes in source code and then porting it to MPLABX IDE with XC8 Compiler, which i did very easily, but i didn't find any way to load the EEPROM file into the MPLABX IDE, which was done easily in old MPLAB IDE by just clicking the "File -> Import" menu, which is shown below.
Blank EEPROM Section

File->Import
Select Configuration File.

File Loaded with Contents
So now the problem is how can i import the EEPROM file generated by configuration tool, i do have some workarounds for this but still i didn't have any proper method, i searched on various forums and didn't find any proper solution which i want, but after some struggle i found one solution on Microchip forum.

Solution
If you see the Microchip's new IDE, in the Project view, it has a new category of "Loadables" as shown below:
Loadables
Add the EEPROM hex file into this project folder by right clicking and selecting the file, and now you have to build your code, after building your code you will get the EEPROM data with your compiled file, and can be seen in EEPROM view of MPLABX IDE.
EEPROM View after building file
One thing more you will notice that, MPLABX IDE has generated two hex files in the production folder, once is "PROJECT_NAME.X.production.hex" and the another is "PROJECT_NAME.X.production.unified.hex" as shown below.
Files Generated
So the basic difference with these files is that, one contains only compiled code without EEPROM data and the other one contains compiled code plus EEPROM data(appended with unified string).
I wasted my few days in figuring out this feature (maybe others already know about this), and that's why decided to write a post on it, i hope all the readers of this post found it useful.

No comments:

Post a Comment