Which version of hexmate is in MPLABX?

Author
aschen0866
Super Member
  • Total Posts : 4074
  • Reward points : 0
  • Joined: 2006/01/08 22:18:32
  • Location: San Diego
  • Status: offline
2013/04/10 11:20:31 (permalink)
0

Which version of hexmate is in MPLABX?

I have a version of hexmate obtained from Hi-Tech years ago. If I run "hexmate -help", it reports its version as:

HEXMATE - Intel hex editing utility (Build 1.128)
Copyright (C)2005 HI-TECH Software
USAGE: hexmate [input1.hex] [input2.hex]... [inputN.hex] [options]
use --HELP=<option> for usage of these command line options
available command-line options:
...

The same command run from MPLABX gives no information on the version:

C:\Program Files (x86)\Microchip\MPLABX\mplab_ide\bin>hexmate -help
(1030) An error, warning or message was generated, but no description is availab
le
Copyright (C)2005 HI-TECH Software
(1031) An error, warning or message was generated, but no description is available
(1032) An error, warning or message was generated, but no description is available
(1033) An error, warning or message was generated, but no description is available

I know these two versions are different in terms of the correct command format. So, which one is newer or better? If I decide to use the one from MPLABX, where is the user manual?
 
Here is my specific problem - I use the -FILL command (for PIC32) as:
-FILL=FF@1D009000-1D07EFFF

This works fine when using hexmate Build 1.128 but fails when using the one from MPLABX. I also tried
-FILL=FF@1D009000:1D07EFFF
to no avail.
#1

15 Replies Related Threads

    Jose Diaz
    Administrator
    • Total Posts : 1672
    • Reward points : 0
    • Joined: 2010/06/23 11:10:56
    • Location: 0
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/04/10 13:44:54 (permalink)
    0
    To run the hexmate outside of its native environment (outside of a compiler installation) you need to tell it where to get its message file via the --edf option:
     
    c:\Program Files (x86)\Microchip\MPLABXv1.70\mplab_ide\bin>hexmate --edf=en_msgs.txt -help
     
    Here is part of the output. The version info:
    HEXMATE - Intel hex editing utility (Build 1.42595)
    Copyright (C)2005 HI-TECH Software
     
    The -FILL help:
     
     
      -FILL     : Specify a code for filling unused memory locations within an address range, where
            "fill_expr" can be a constant (e.g. 0x1234), a comma-separated list of constants (e.g. 5,076,0b1101)
            or a constant followed by an increment/decrement value (e.g. 0+=1 or 0xAA55-=0x1111).
            "wN" is the width of each constant in bytes, specified by the numeral, N.
            Specifying "@address" will put the fill expression at the address, while "@address:end_address" will fill an addre
            Leaving off the "@address" specification entirely (or using the keyword "@unused") will fill all unused memory.
    #2
    Ian.M
    Super Member
    • Total Posts : 13030
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/04/10 14:22:48 (permalink)
    0
    Unfortunately using --edf is a pain for command line users.  Fortunately there is a solution as posted [here].  If you are a windows user, its probably simplest to create a dat folder where hexmate expects to find it, and simply copy en_msgs.txt there.     After that (or patching the executable binary to look in ..\bin instead of ..\dat) it finds its messages no matter where you run it from.
     
    I assume this will be resolved properly in a future MPLAB X release?
    #3
    aschen0866
    Super Member
    • Total Posts : 4074
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/04/11 07:33:19 (permalink)
    0
    Thanks for the help. However, I am still unable to run the -FILL command. Here is what I have:
    1. In the MPLABX's post-build, I am calling my batch file

    post_build.bat ${ImagePath}


    2. The post_build.bat looks like this:
      
    hexmate --edf="C:\Program Files (x86)\Microchip\MPLABX\mplab_ide\bin\en_msgs.txt" %0 -FILL=FF@1D009000:1D07EFFF -Opackage.hex


    3. The error I get is:

    "User defined post-build step: [post_build.bat "dist\default\production\MPLABX_C32.X.production.hex"]"

    (941) bad "-FILL" assignment; USAGE: -FILL=[wN:]fill_expr[@address:[end_address]]

    make[1]: *** [.build-conf] Error 1
    make[1]: Leaving directory `C:/Projects/MPLABX_C32/MPLABX_C32.X'
    make: *** [.build-impl] Error 2

    Any idea what could be the problem with my -FILL command? This command works with my old hexmate (build 1.128) if the address range symbol changes from ":" to "-", i.e., -FILL=FF@1D009000-1D07EFFF
     
    Project attached.
    post edited by aschen0866 - 2013/04/11 07:55:40

    Attachment(s)

    Attachments are not available: Download requirements not met
    #4
    aschen0866
    Super Member
    • Total Posts : 4074
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/04/12 08:22:17 (permalink)
    +1 (1)
    I found the problem - Apparently the -FILL command in the current version of hexmate (Build 1.42595) inside MPLABX v1.70, requires the use of C style hex notation. In the example I have, the -FILL should be constructed as:
     
    -FILL=0xFF@0x1D009000:0x1D07EFFF
     
    This is inconsistent with other hexmate commands or commands from previous versions of hexmate, but as a C programmer I like this change and I only wish that "-help=FILL" could mention this requirement.
     
     
    #5
    Jose Diaz
    Administrator
    • Total Posts : 1672
    • Reward points : 0
    • Joined: 2010/06/23 11:10:56
    • Location: 0
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/04/12 15:27:36 (permalink)
    0
    "I assume this will be resolved properly in a future MPLAB X release?"
    We included hexmate to be used by the IDE itself. The IDE calls it the way hexmate expects it.
    But since people are using it on their own, we'll look into addressing the --edf issue.
     
    #6
    aschen0866
    Super Member
    • Total Posts : 4074
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/04/12 16:48:59 (permalink)
    0
    Jose Diaz
    "I assume this will be resolved properly in a future MPLAB X release?"
    We included hexmate to be used by the IDE itself. The IDE calls it the way hexmate expects it.
    But since people are using it on their own, we'll look into addressing the --edf issue.

    Jose,
    I think Ian.M might be talking about the version of hexmate (Build 1.48060) that comes with the XC8 Compiler, not the one from MPLABX. Therefore hexmate, in the general term, is not just for the IDE itself.  It is a very powerful tool. However, as it stands today, it is not user-friendly, and if the IDE can make it friendly, it would be a huge improvement.
     
    #7
    Ian.M
    Super Member
    • Total Posts : 13030
    • Reward points : 0
    • Joined: 2009/07/23 07:02:40
    • Location: UK
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/04/12 18:17:01 (permalink)
    0
    No, I was referring to the one bundled with MPLAB X. 
     
    I have been advocating HEXMATE for command line manipulation of PIC hex files for years.    Not having to install a compiler one may not want to get it is a significant step forward.  However I do hope it can be kept compatible with the HiTech C and XC8 versions.
    #8
    sensslen
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2012/06/04 00:38:29
    • Location: Switzerland
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/05/16 06:51:37 (permalink)
    0
    I'm trying to combine the hex file of the Bootloader with my application Code. In MPLAB8 I simply called a Bat File that copied the correct hex files and combined them by using hexmate. How do I accomplish that with MPLAB X ? I haven't been able to find the correct place to call hexmate from the MPLAB X (v1.70).
     
    Thanks for help!
     
    Regards, Simon
    #9
    Jose Diaz
    Administrator
    • Total Posts : 1672
    • Reward points : 0
    • Joined: 2010/06/23 11:10:56
    • Location: 0
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/05/16 10:10:09 (permalink)
    0
    sensslen,
    MPLAB X has a post-build step option too. But there is something better in MPLAB X to help you combine two hex files in memory automatically. You can look at section 5.5: "Loadable Projects and Files" in the MPLAB_X_IDE_Users_Guide_52027B.pdf file available in the $inst_dir_mplabx/docs folder. You can have two projects that get merged together, or a project and a hex/elf file...
    Jose
     
     
     
    #10
    aschen0866
    Super Member
    • Total Posts : 4074
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/05/16 10:15:17 (permalink)
    0
    This is how I do it:
    1. Put the batch, for example "combine_bl.bat",  in the .X project folder.
    2. Go to Project Properties and check "Execute this line after build", then add this line to the window below:

    ${ProjectDir}\combine_bl.bat ${ImagePath}

    3.  My batch file for a PIC32 project looks like this:

    @echo off

    rem Input parameter from MPLABX
    SET APP_HEX=%1

    rem Where the bootloader hex file is.
    SET BL_INPUT="C:\Projects\MX_FP_Bootloader\MX_FP_Bootloader.X\dist\default\production\MX_FP_Bootloader.X.production.hex"

    rem Where you want the final output to go
    SET PKG_OUT="..\Out\MX_FP_package.hex"

    rem Location for the hexmate's message file
    SET MSG_FILE="C:\Program Files (x86)\Microchip\MPLABX\mplab_ide\bin\en_msgs.txt"

    IF NOT EXIST %BL_INPUT% GOTO NOT_FOUND
    @echo on
    @echo **** Combining Bootloader and Application ...                 ****
    @echo off

    rem Extract application code between 0x1D009000 and 0x1D07EFFF and add to the bootloader
    rem Store intermediate hex file in %PKG_OUT%
    hexmate --edf=%MSG_FILE% %BL_INPUT% +r1D009000-1D07EFFF,%APP_HEX% -O%PKG_OUT%

    rem Fill unused locations with 0xFF
    rem Compute byte-wise checksum between 0x1D009000 and 0x1D07EFFB
    rem Inject the 4-byte checksum at location 0x1D07EFFC using the little endian format
    rem Store the final hex file to %PKG_OUT%
    hexmate --edf=%MSG_FILE% %PKG_OUT% -FILL=0xFF@0x1D009000:0x1D07EFFF +-CK=1D009000-1D07EFFB@1D07EFFCw-4 -O%PKG_OUT%


    @echo on
    @echo **** Done! Output file: %PKG_OUT% ****
    @echo off
    GOTO DONE
    :NOT_FOUND
    @echo "**** Bootloader Hex File Not Found ****"
    :DONE

    #11
    Jose Diaz
    Administrator
    • Total Posts : 1672
    • Reward points : 0
    • Joined: 2010/06/23 11:10:56
    • Location: 0
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/05/16 17:24:26 (permalink)
    +1 (1)
    Using loadables will have the makefiles contain the same kind of code aschen0866 showed above...
    However, with aschen0866 approach you have total control of how the hex file is loaded... But you have to write the batch file and call it in the post build. Adding the boot as a loadable will make things happen automatically. If you are debugging the boot and app at the same time, you can have one project as the main project and the other as a loadable. You can step from one project source code into the other (assuming they can call each other) and MPLAB X will be able to differentiate both sets of symbols.
    So, you can use whatever suits your needs/taste.
     
    #12
    Jose Diaz
    Administrator
    • Total Posts : 1672
    • Reward points : 0
    • Joined: 2010/06/23 11:10:56
    • Location: 0
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/05/16 17:30:50 (permalink)
    +1 (1)
    aschen0866,
    In MPLAB X v1.80 we added $inst_dir/mplab_ide/dat/en_msgs.txt so you do not have to pass --edf to hexmate anymore (as requested).
    Jose
     
    #13
    aschen0866
    Super Member
    • Total Posts : 4074
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/05/16 17:52:38 (permalink)
    +2 (2)
    Jose Diaz

    In MPLAB X v1.80 we added $inst_dir/mplab_ide/dat/en_msgs.txt so you do not have to pass --edf to hexmate anymore (as requested).


    Thanks. Another reason to tell my colleagues to use MPLABX.
    #14
    sensslen
    New Member
    • Total Posts : 28
    • Reward points : 0
    • Joined: 2012/06/04 00:38:29
    • Location: Switzerland
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/05/16 23:21:09 (permalink)
    +1 (1)
    Jose Diaz

    sensslen,
    MPLAB X has a post-build step option too. But there is something better in MPLAB X to help you combine two hex files in memory automatically. You can look at section 5.5: "Loadable Projects and Files" in the MPLAB_X_IDE_Users_Guide_52027B.pdf file available in the $inst_dir_mplabx/docs folder. You can have two projects that get merged together, or a project and a hex/elf file...
    Jose




     
    You saved my day! This is a really great Feature - especially since it compiles both Projects! Thanks again for pointing me to the right direction!
    #15
    Jose Diaz
    Administrator
    • Total Posts : 1672
    • Reward points : 0
    • Joined: 2010/06/23 11:10:56
    • Location: 0
    • Status: offline
    Re:Which version of hexmate is in MPLABX? 2013/05/17 10:49:24 (permalink)
    +1 (1)
    By the way, the version of hexmate using in MPLAB X is a binary copy of the one used by picc-18 v9.80. That was the most recent version of hexmate (xc8 was being born) at the time we started including hexmate in MPLAB X. We will be updating the next version of MPLAB X to include the hexmate that comes with the next (latest) version of xc8 v1.20. There have been no significant changes to hexmate, but we should be shipping the latest...
    Jose
     
    #16
    Jump to:
    © 2017 APG vNext Commercial Version 4.5