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.

CC2640R2F: Error while flash Hex file generated from output_converter.py

Part Number: CC2640R2F


Hello,

I am using the multirole and simple_peripheral on cc2640r2f. I am using simplelink_cc2640r2_sdk_1_40_00_45. I want to have output in Intel hex format. The post build command line is following:

$TOOLS_BLE_DIR$\output_converter\output_converter.exe $EXE_DIR$\$TARGET_BNAME$.bin

It generates the hex file but when i try to flash the generated hex file using I-jet or TI-XDS debugger. It shows following error:

Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00020000,0x0002000F] will not be flashed
Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00020010,0x0002001F] will not be flashed
Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00020020,0x0002002F] will not be flashed

...

...

...

Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00020000,0x0002000F] will not be flashed
Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00020010,0x0002001F] will not be flashed
Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00020020,0x0002002F] will not be flashed
Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00040370,0x0004037F] will not be flashed
Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00040380,0x0004038F] will not be flashed
Fri Jan 05, 2018 14:52:39: Flash download warning: 16 out of 16 bytes from data record CODE:[0x00040390,0x0004039F] will not be flashed
Fri Jan 05, 2018 14:52:39: Flash download warning: 2 out of 2 bytes from data record CODE:[0x000403A0,0x000403A1] will not be flashed
Fri Jan 05, 2018 14:52:39: There were warnings while generating flash loader input.

Fri Jan 05, 2018 14:52:58: The flash loader program reported an error.

Why the cc2640r2f is not getting flash? The hex file is converted from .bin to hex with the python script provided by TI.

I will be waiting for your kind reply.

  • Are you by any chance trying to load simple peripheral that is configured for OAD?

    The projects provided in the SDK will "out-of-the-box" generate .hex files. Is there a particular project and/or buiild configuration that isn't working for you? Did you make any changes to the project configuration?

    Tom
  • Hi Tom,

    Thanks for your reply. I am using simple peripheral without OAD. I didn’t done any change in build configuration.
    In case of multirole i am using cash as ram configuration and it’s generated hex file does not work.

    I tried both ble_5 and ble_4.2 multirole but none of them generates a runable hex file. Only .out files work fine.
  • Hi Tom,

    Is there any solution? When i compile the multirole application with FlashROM_StackLibrary-CacheAsRAM. It generates the following set of files.

    I tried to flash hex file with the IAR it shows the error i have mentioned in the first post.
    When i tried to flash the files using Smar RF flash programmer 2

    While flashing out file:

    It shows following errors:

    While flashing the hex file: it shows following error:

    I have attached the python script which is at location C:\ti\simplelink_cc2640r2_sdk_1_40_00_45\tools\blestack\output_converter. I have attached it as text file as .py extension was not being attached.

    '''
    /******************************************************************************
     @file  output_converter.py
    
     @brief This script converts a bin file into a hex file.
    
     Group: CMCU, SCS
     Target Device: CC2640R2
    
     ******************************************************************************
     
     Copyright (c) 2017-2017, Texas Instruments Incorporated
     All rights reserved.
    
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:
    
     *  Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.
    
     *  Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in the
        documentation and/or other materials provided with the distribution.
    
     *  Neither the name of Texas Instruments Incorporated nor the names of
        its contributors may be used to endorse or promote products derived
        from this software without specific prior written permission.
    
     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
     ******************************************************************************
     Release Name: simplelink_cc2640r2_sdk_1_40_00_45
     Release Date: 2017-07-20 17:16:59
     *****************************************************************************/
    '''
    import argparse
    import intelhex
    import ntpath
    import os
    import re
    import sys
    
    
    __version__ = '1.0.0'
    
    
    def verifyFilePath(file, extension=None):
        abs_file = ntpath.abspath(file)
    
        # Check if input file exists
        if ntpath.isfile(abs_file):
            # Check if input file ends with extension if passed in
            if extension:
                if not abs_file.endswith(extension):
                    raise Exception('Error: File must be a ' + extension +
                                    ' file! (' + abs_file + ')')
                else:
                    return abs_file
            else:
                return abs_file
        else:
            raise Exception('Error: File is not valid! (' + abs_file + ')')
    
    
    def assembleOutputPath(out_param, input_path):
        if out_param:
            # Make sure that output directory exists if output param exists
            abs_out_path = ntpath.abspath(out_param)
            output_dir, output_filename = ntpath.split(abs_out_path)
            if not ntpath.exists(output_dir):
                os.mkdir(output_dir)
    
            return abs_out_path
        else:
            # Default output is same directory and name as input .bin file
            output_dir, input_filename = ntpath.split(input_path)
            output_filename = input_filename[:-4] + '.hex'
    
            return ntpath.join(output_dir, output_filename)
    
    
    def processBoundaryFile(file_param):
        boundary = '0x0'
    
        if file_param:
            abs_bd_path = verifyFilePath(file_param, '.bdef')
            with open(abs_bd_path, 'r') as f:
                bd_file = f.read()
    
            re_str = r'^-D (ICALL_STACK0_START|OAD_TGT_FLASH_START)=(0x[0-9a-z]+)'
            regex_output = re.findall(re_str, bd_file, re.MULTILINE)
    
            if len(regex_output) == 1:
                boundary = regex_output[0][1]
            else:
                raise Exception('Error in boundary file! Stack boundary not found!')
    
        return boundary
    
    
    def convertBinToHex(inputBin, outputHex, offset=0):
        try:
            intelhex.bin2hex(inputBin, outputHex, offset)
        except:
            print('Error: Conversion failed!')
    
    
    def main(args):
        # Check if input file is valid
        abs_bin_path = verifyFilePath(args.inputBinPath, '.bin')
    
        # Set output path and output name
        output_path = assembleOutputPath(args.output, abs_bin_path)
    
        # Extract ICALL_STACK0_ADDR boundary
        boundary = processBoundaryFile(args.boundary)
        if args.address:
            boundary = args.address
    
        # Convert .bin to .hex
        convertBinToHex(abs_bin_path, output_path, int(boundary, 16))
    
    
    def parse_args():
        script_description = 'This script converts a bin file into a hex file'
        parser = argparse.ArgumentParser(prog='output_converter',
                                         description=script_description)
        parser.add_argument('-v', '--version', action='version',
                            version='%(prog)s ' + __version__)
        parser.add_argument('inputBinPath', help='Path to input bin file')
        parser.add_argument('-b', '--boundary', help='Path to boundary file '
                                                     'generated by Frontier')
        parser.add_argument('-a', '--address', help='Start address of image in hex')
        parser.add_argument('-o', '--output', help='Path to output hex file. The '
                                                   'default is the same directory '
                                                   'and name of the input bin file')
        args = parser.parse_args()
    
        if args.boundary and args.address:
            raise Exception('Only one of the boundary and address arguments can be '
                            'provided')
    
        return args
    
    
    def version_control():
        if sys.version[:5] != '2.7.3':
            raise Exception('Must be using Python 2.7.3!')
    
    
    if __name__ == '__main__':
        version_control()
        output_converter_args = parse_args()
        main(output_converter_args)
    


    Please help me to resolve the problem. We have to provide the hex files to CE testing.
    I will be waiting for your kind help.

  • Hi Tom,

    I have resolved my issue. Thanks for your kind help.