• AVR Freaks

Hot!How to customize ImagePath/ImageDir/ImageName?

Author
fox
New Member
  • Total Posts : 11
  • Reward points : 0
  • Joined: 2013/04/16 20:24:42
  • Location: 0
  • Status: offline
2013/04/16 20:36:22 (permalink)
0

How to customize ImagePath/ImageDir/ImageName?

Hi,
 
I'm a novice at MPLABX.
I generated a project with it but don't know how to change the hex file name in the "/dist" folder.
Is there any way to change ImagePath/ImageDir/ImageName definitions in MPLABX?
I found these MACRO in "Project Properties -> Building -> Insert Macro", but it seems I cannot change any of it.
I've googled this problem for a while but got nothing. Maybe I missed some configuration item deep in the IDE?
 
Thanks in advance!
#1

6 Replies Related Threads

    aschen0866
    Super Member
    • Total Posts : 4587
    • Reward points : 0
    • Joined: 2006/01/08 22:18:32
    • Location: San Diego
    • Status: offline
    Re:How to customize ImagePath/ImageDir/ImageName? 2013/04/17 07:27:13 (permalink)
    +3 (3)
    If you want to change the default hex file name, you can use the DOS copy command as part of post build process. This is what I would do - Go to Properties -> Building, check "Execute this line after build" then add:
    ${ProjectDir}\post_build.bat ${ImagePath}

    The batch file looks like this:

    SET INPUT_HEX=%1
    SET OUTPUT_HEX="..\Out\my_hex.hex"
    COPY %INPUT_HEX% %OUTPUT_HEX% /Y

    #2
    fox
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2013/04/16 20:24:42
    • Location: 0
    • Status: offline
    Re:How to customize ImagePath/ImageDir/ImageName? 2013/04/17 18:15:55 (permalink)
    0
    Hi, aschen0866
     
    Brilliant!
    I tried to modify project xml files manully, but generated some error during compilation. The post build batch file would be a nicer solution. Anyway, as my project is a new one, I guess it will also be acceptable if I generate a new project with the hex name I want, and then copy all source files into the project.
    Thanks a ton!
    #3
    Neiwiertz
    Super Member
    • Total Posts : 2124
    • Reward points : 0
    • Joined: 2004/09/01 02:58:52
    • Status: offline
    Re:How to customize ImagePath/ImageDir/ImageName? 2018/01/10 03:09:16 (permalink)
    0
    5 Years Later 2018 vs 2013,
     
    @aschen0866
    Thanks for the workaround
    Yeah we are still forced to the "dist" folder :(, we can create a second conf and move this up or down if desired in our view project properties window which is great
     
    Manual edit *.mk is unallowed, and also i do not prefer this, but i hope the feature of adjusting the output folder will be introduced asap
     
    ie At Project Properties Window
    1.  we could change/ adjust the "string" of the BuildSetting: ImagePath
    2.  we could change/ adjust the "string" of the BuildSetting: ImageDir
    3.  we could change/ adjust the "string" of the BuildSetting: ImageName
     
    For ImagePath and ImageDir support ./ or .\ or ../ or ..\ to be used at start of the "string"
    and store those "strings" at the belong nbproject *.xml file belonging conf section

    Flying With --|Explorer 16|HardWare|SoftWare|-- Fav(s) Gallery Lists
    #4
    diond31
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2016/09/13 11:04:41
    • Location: 0
    • Status: offline
    Re:How to customize ImagePath/ImageDir/ImageName? 2020/02/11 16:44:56 (permalink)
    0
    Nearly 6 Years Later 2019 vs 2013,
     
    @aschen0866
    Thanks for the workaround.  It still works and we're still forced to the "dist" folder in 2019!
     
    The sad bit folks is Microchip had this feature in MPLab 8, but no longer supports it in MPLab X.  However, Microchip has offered an FAQ that might also provide a workaround (I admit, I haven't tried this solution).
    #5
    diond31
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2016/09/13 11:04:41
    • Location: 0
    • Status: offline
    Re:How to customize ImagePath/ImageDir/ImageName? 2020/02/11 17:05:22 (permalink)
    0
    A quick follow up.  I tried the examples within the FAQ and they work like a charm and can produce the same results as the batch file workaround.  For example I entered the following;
     
    gnumkdir -p ${ProjectDir}\hex && cp ${ImagePath} ${ProjectDir}\hex\myNewFileName.${OUTPUT_SUFFIX}
     
    And, copied the hex file into a new fold with the desired name.
    #6
    kjo
    Junior Member
    • Total Posts : 94
    • Reward points : 0
    • Joined: 2006/07/11 15:11:02
    • Location: 0
    • Status: offline
    Re: How to customize ImagePath/ImageDir/ImageName? 2020/08/11 15:14:46 (permalink)
    0
    If all you want to do is rename the output HEX file to something unique to a build, it can be done with a one liner.
     
    I have a USB project that uses 2 very different PIC devices and each can be programmed either natively (ICD3/4) or via a bootloader. there is one collection of source for all 4 configurations. That means that MPLABX will create 4 unique distribution directories, one for each. The directory names will be based on the configuration names, but within each directory all 4 configurations will use the same name. I have found no way to get MPLABX to alter this.
     
    I use a simple version system that redeposits all source for each version in a unique directory. But you also want an image of the executable archived. That means 4 hex files with identifiable unique names.
     
    This one-liner in the configuration build will do the trick:
    copy $(ImageDir)\$(ImageName) $(ImageDir)\hp5315usb.X.${IMAGE_TYPE}_18F14K50_NBL.${OUTPUT_SUFFIX}
     
    will create, at build time, a unique file name and leave the original in place. You do not want to change the original build name as if you do MPLABX will not be able to find the original name it had memorized for device programming or debugging.
    post edited by kjo - 2020/08/12 07:22:42
    #7
    Jump to:
    © 2020 APG vNext Commercial Version 4.5