Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

search inside this forum
How do I specify a .mac file with the cprogppcnexus command line interface?
Tanmayee S. Apr 21, 2017 at 02:11 PM (14:11 hours)
Staff: Takao Y.

  • I want to download an ELF file and run it using a batch script to my TRK-USB-MPC5643L board. When debugging the code with the ICDPPNEXUS GUI, I had to specify the .mac file. Do I need to do this with the cprogppcnexus command line tool? If so, what is the syntax? The help documentation does not specify this.

    Thank you,
    Tanmayee




    Comments

  • Greetings,

    There are 2 options to flash program your chip using commandline. Directly using CPROG with a batch file, which only flash programs your device. Or you can program your chip within ICD, which calls CPROG, then you can continue with your debug session.

    For CPROG, you should see a CPROG documentation within your ICD software install. This document has all of the commandline parameters and commands you need to program successfully. If that is missing, let me know and I can send you the file.

    Within ICD what you can do is specify within the mac file to do the flash programming for you. The command is HLOAD x, where x is the path of the file you wish to program and load the binary files.


    Takao Yamada

  • Thank you for the prompt response Takao. I have already updated my .mac file with the HLOAD command and specified the ELF file inthere. For a command-line call is the following syntax appropriate - 
    cprogppcnexus.exe mpc5643L_vle.mac hideapp

    Also how do I incorporate a cfg file with this? I want to specify the ppc file and I guess the way to that is with the CFG script.
    And last question is, can the .mac file be parameterized like the CFG file?

  • Greetings,

    Mac files will not work with commandline CPROG. Mac files only work within ICD, in which you can call HLOAD to use CPROG. But the syntax you mentioned will not work.

    A typical CPROG command-line looks like:

    CPROG.exe myconfig.cfg interface=USBMULTILINK PORT=USB1

    Where the CFG file might have commands like...

    CM C:\myalgorithm.PCP
    SS C:\mybinary.ELF
    EM
    PM
    VC


    Do you have the CPROG documentation?


    Takao Yamada

  • I do have the documentation. I guess my confusion stemmed from the fact that I was required to use the .mac file with ICD.  I had run into issues because I did not specify the file with ICD and wasn't able to get my ELF file to run. But if I understand you correctly, there is no need to do so with CPROG?

  • Greetings,

    In CPROG, you need to setup the CFG file, which you would specify the ELF file. In my example above I used "mybinary.elf" inside the CFG file.

    Do you need help getting the HLOAD to work for ICD?

    The benefit of using ICD with mac file is that it can program your flash and setup the debug information so that you can debug your code. In CPROG all it does is flash program but it will be fast and easy way to start a mini-production line by automating the programming.


    Takao Yamada

    • I created the CFG file - 
      RE ;Reset the MCU
      CM /PARAM1 ;Choose Flash Module
      SS /PARAM2 ;Specify the ELF to use
      EM ;Erase the module
      PM ;Program the module with the ELF
      VC
      RE ; Reset the MCU
      GO ; Run the program

      The invocation at the cmdline is -
      cprogppcnexus INTERFACE=USBMULTILINK PORT=USB1 BDM_SPEED 0 example.cfg "/PARAM1=C:\PEMicro\freescale_mpc5643l_1x32x256k_cflash.pcp 3000" /PARAM2=C:\MyProject\MPC5643L_INTC-SW-VLE-LSM.elf hideapp

      I am able to download and run the ELF file with ICD. The above command exits with a success however the program is not running. I am flashing an LED in the program to ensure that the program is actually being run. Is there anything obviously incorrect in my CFG file/the invocation command?

  • Greetings,

    What version of PROG/CPROG are you running? In version 6.9.0.0 is when I made the fix for reset and go to run the code.

    Note, you should remove the first RE command before the CM command. The CM command already resets the chip for you so doing it twice is unnecessary.


    Takao Yamada

  • Hi Takao,

    I am evaluating the starter edition. The version is 6.22.0.
    Looks like I probably need to get the full edition. Is there any workaround for me to validate the download and run of the program prior to buying the software?

    Thanks,
    Tanmayee

  • Greetings,

    No, the starter edition should work just fine as long as your binary file is less than 64K. Reset and Go should work.

    If you power cycle the board does the LED's turn on? If not, then it is not a problem with reset and go, but something in your ELF file is not functioning.


    Takao Yamada

  • The ELF file is 26KB. I am able to download and run the file with ICD but not CPROG. I would like to imagine that the ELF file should work with both. Do I need to build the ELF file with some different configurations for it to work with CPROG?

    When you say power-cycle, do you mean reset? If so then reset just flashes the reset LED. The ELF file I have is supposed to light LEDs connected to pin 106 and 99 alternately.

  • Greetings,

    Power cycle means to power down and power up the board. What you should do is after flash programming, disconnect the P&E hardware and power cycle the board. See if your program runs. If not, then there is something wrong with your ELF file.

    If the LEDs are toggling within ICD, then what you should do is after using the ICD software please power cycle the board. If that makes the LEDs not work, then that means something in the macro file you used is making it work. Whether that is the watchdog disabling, initialization of RAM and cache, etc. Remember that the macro file is just a script that runs only when you have your board connected to a debugger using ICD. Your ELF file may be missing crucial setup code that is preventing your project from running when not debugging.


    Takao Yamada

  • Thanks Takao. I am missing the setup code. Is there any documentation to look up the syntax used in this file? That way I can convert the setup in this file into a C init routine and call it before my main.

  • Greetings,

    The commands used in the macro are just commands found in our ICD software. This is not going to translate at all to any C code routine.

    You need to look into disabling the watchdog and initializing the RAM. If you use a software like Codewarrior 10.x or S32 Power, then just open a new project for your device and check the startup.S file. This has all the initialization you need to get the device running.


    Takao Yamada

Add comment


   Want to comment? Please login or create a new PEMicro account.







© 2017 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement