This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PRU loadable hex file as output from CCS

How do I create a PRU loadable hex file from the output of the CCS build process?  I see a *.out and a *.obj file, but I don't see a loadable hex file.  When using PASM you to a *.bin file you could load into a PRU. 

  • LJ50738 said:
    I see a *.out and a *.obj file, but I don't see a loadable hex file.

    By default, when a PRU project is created in CCS 6 the "PRU Hex Utility" used to create a loadable file is disabled.

    Under the CCS Project Properties select "Enable PRU Hex Utility" and then a hex file will be created when the project is built:

    Under the Output Format Options you can select the format of the output file generated.

  • I'm assuming that the proper Output Format Option is "--ti_txt" since that is what you have set. How come you specified it as a CL argument and then suggested setting it in the Output Format Options?

    What is the name of the file that is output from the PRU Hex Utility?
    Is that file suitable to be loaded by prussdrv_exec_program(int prunum, const char *filename); ?
    ( github.com/.../prussdrv.h )
  • LJ50738 said:
    I'm assuming that the proper Output Format Option is "--ti_txt" since that is what you have set. How come you specified it as a CL argument and then suggested setting it in the Output Format Options?

    The "--ti_txt" output format was just an example, since I didn't originally know what output format you needed.

    [When the "Enable PRU Hex Utility" is first enabled the "Output format" is initially blank and the "ti_txt" wasn't part of the command line argument. For that example screen shot the "Output format" was changed to "Output TI-TXT hex format (--ti_txt)" which added ti_txt to the CL argument].

    LJ50738 said:
    What is the name of the file that is output from the PRU Hex Utility?
    Is that file suitable to be loaded by prussdrv_exec_program(int prunum, const char *filename); ?
    ( github.com/.../prussdrv.h )
    The prussdrv_exec_program function requires a binary file.

    To get PRU_Hex to generate binary output filies:

    1. Under CCS Project Properties CCS Build -> PRU Hex Utility select "Enable PRU Hex Utility". Append ${PROJECT_LOC}/bin.cmd to the Command-line pattern, so that the complete command-line pattern is:

    ${command} ${flags} ${output_flag} ${output} ${inputs} ${PROJECT_LOC}/bin.cmd

    2. Add a bin.cmd file to the CCS project which contains the following contents:

    -b
    -image
    
    ROMS {
                    PAGE 0:
                    text: o = 0x0, l = 0x2000, files={text.bin}
                    PAGE 1:
                    data: o = 0x0, l = 0x2000, files={data.bin}
    }

    The option file for the PRU_hex specifies the binary filenames to create for the PRU IRAM and DRAM contents.

    3. In the CCS Project Explorer right-click on the bin.cmd file and tick "Exclude from build". This prevents CCS form trying to pass the bin.cmd file to the PRU linker when performing the build.

    4. When the project is built this will create two 8K binary files:

    - text.bin, for loading with the prussdrv_exec_program() function

    - data.bin, for loading with the prussdrv_load_datafile() function.

    Note that I haven't test loading a PRU program generated with the above, the instructions were determined from looking at the readme file form the PRU 2.1.0 compiler and the source code of the prussdrv driver.