How to add a new tool into Visual X-Tools™ to perform an 'Objcopy' to an S-Record or Binary format using ELF/COFF generated object files.

 

Assumptions: User has a Visual X-Tools™ toolsuite product installed on a Windows or Linux host machine.

To add a tool to produce an S-Record or Binary object file, perform the following procedures:

1. Open a Visual X-Tools project that you want to add a special command tool for object file conversion.

2. Click on 'Project | Project Properties ...'

3. Click on the 'Tools' tab.

4. Click on 'New...' and enter the tool name into the dialog and click OK.  The tool name may be whatever you wish to name it (e.g., 'Objcopy to srec' or 'Objcopy to binary').

5. Click 'Up' or 'Down' to position the tool name on your menu to where you want. If not certain, you can edit this dialog later if you desire.

6. On the command line enter one of the following:

    S-Record Format: <target-alias>-objcopy  -O  srec  %bd%o %bd%on.srec
    Binary Format: <target-alias>-objcopy  -O  binary %bd%o  %bd%on.bin

    Examples
    arm-elf-objcopy  -O srec %bd%o  %bd%on.srec
    or
    arm-elf-objcopy  -O binary %bd%o  %bd%on.bin

7. Next, click on 'Capture output', 'Output to process buffer', and 'Clear process buffer'. Last, click on OK.

8. To test your new tool, build a cross-executable (ELF or COFF format).  Click on 'Build | <new-tool-name>' and the result should display in the 'Build' window at the bottom of the screen.  The converted object file should be either in the S-Record or Binary format. You can perform a command line Objdump (<target-alias>-objdump -<switch>  <object-name>) on the file if it is an S-Record to see the header or other information (refer to the Binary Utilities PDF documentation that comes with GNU X-Tools -- also located on the web site at Microcross.com).

Notes: The '-O' switch is a capital O, not a zero.  %bd is an environment variable representing the configuration build directory; %o is an environment variable representing the output file name; and %on is an environment variable representing the output filename without extension. We add '.bin' or '.srec' as extensions to give the object filename a recognizable name. Figure 1 shows environment variables in general that can be used on the command line in addition to the normal tool '-' tool switches , and they can be added as desired.

Figure 1.  Objcopy to srec Tool in Visual X-Tools

 

© 2009 Microcross, Inc.  All rights reserved.