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.

Compiler/TMS570LS3137: Can I generate only 1 MB Binary where as the compiler and linker generates 4 MB file

Part Number: TMS570LS3137


Tool/software: TI C/C++ Compiler

I am using the following post build command to generate Binary file , as there are non necessary section that are being generated in the object files .

I want to limit the binary file generation to only 1MB even if the actual contents may exceed 1MB i do not care more than 1MB

"${CCE_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/ofd470.exe" "${CG_TOOL_ROOT}/bin/hex470.exe" "${CCE_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe"

  • Hello,

    The size of *.out file is much bigger than the size of binary file generated using the post command listed in your post. If the size of *.out file is 4MB, the size of *.bin file is smaller than 10%*4MB.

  • Hello , 

    Thank you for explaining difference between .out file and .bin file . Our requirement is different as mentioned below.

    Is there a method to have single linker script , so that this linker script working both for RELEASE and DEBUG . 

    This will only be possible if we Can use the binary generation script tiobj2bin.bat to generate only 1MB required binary region file even if the .out file contains the ECC regions at 0xF040_0000

    Our working model is as follows :

    We are having 2 different builds but would like to use only one Linker script .

    SECTION 1 )

    BUILD NO 1) This build where we generate 1 MB BINARY file and provide it to Boot-loader for downloading to the FLASH AREA .

    Our linker script is as in the SECTION 2 below

    Post build Binary Creation script:-

    I use the following script to generate a binary (*.bin) file from the *.out file in post build commend of ccs 

    "${CCS_INSTALL_ROOT}/utils/bin/tiobj2bin.bat"  "${BuildArtifactFileName}"  "${BuildArtifactFileBaseName}.bin"  "${CG_TOOL_ROOT}/bin/ofd470.exe" "${CG_TOOL_ROOT}/bin/hex470.exe" "${CCS_INSTALL_ROOT}/utils/bin/mkhex4bin.exe"

    in post-build command. It is working successfully fine if only we remove ECC at 0xF040_0000.

    If we generate ECC at address 0xF040_0000 , the post-build command fail to generate binary file correctly i.e. creating a very big binary file about 4 GB size .we have FLASH code to load 1 MB part of code in internal FLASH memory i.e. 0x0000_0000 to  0x0010_0000. We do not need the ECC for binary file that we pass to the boot loader .

    This is happening because tiobj2bin.bat will generate a binary file for continuous memory if address starts at 0x0000_0000 it will fill it with zero in binary file till 0xF040_0000 .

    So we need that the tiobj2bin.bat generate only 1MB address range of FLASH information to the binary file . 

    BUILD NO 2)  Second build is to DEBUG the source code with ECC checks enable while development in this build we are using as method mentioned in step 3. 

    SECTION 2) our linker script

    /* Memory Map */

    MEMORY

    {

    /* Add a vfill directive to the end of each line that maps to Flash */

    VECTORS (X) : origin=0x00000000 length=0x00000020 vfill = 0xffffffff

    FLASH0 (RX) : origin=0x00000020 length=0x000FFFE0 vfill = 0xffffffff

    SRAM (RWX) : origin=0x08002000 length=0x0002D000

    STACK (RW) : origin=0x08000000 length=0x00002000

    /* USER CODE BEGIN (3) */

    #if 1

    /* Add memory regions corresponding to the ECC area of the flash bank */

    ECC_VEC (R) : origin=(0xf0400000 + (start(VECTORS) >> 3))

    length=(size(VECTORS) >> 3)

    ECC={algorithm=algoL2R5F021, input_range=VECTORS}

    ECC_FLA0 (R) : origin=(0xf0400000 + (start(FLASH0) >> 3))

    length=(size(FLASH0) >> 3)

    ECC={algorithm=algoL2R5F021, input_range=FLASH0 }

    #endif

    /* USER CODE END */

    }

    /* USER CODE END */

    }

    /* USER CODE BEGIN (4) */

    /* Add an ECC {} directive describing the algorithm that matches the device */

    ECC

    {

    algoL2R5F021 : address_mask = 0xfffffff8 /*Address Bits 31:3 */

    hamming_mask = R4 /*Use R4/R5 build in Mask */

    parity_mask = 0x0c /*Set which ECC bits are Even & Odd parity */

    mirroring = F021 /*RM57Lx and TMS570LCx are build in F021*/

    }

    /* USER CODE END */

  • Yes, if the project uses linker cmd to generate ECC for both program flash and data flash, the generate binary file is around 4GB which contains the data of almost whole memory range.