How can I generate S19, Intel Hex, and Binary files for my project?

For many embedded applications, you not only want the file to debug the target, that is generate *.abs or *.elf file, but you also need an S19 (Motorola S-Record) file, an Intel Hex file, or a Binary file of the application. Very likely you need these files for production programming or as input to other tools.

The wizard generated 8/16 bit projects for MCU10 includes a burner.bbl file for exactly this purpose. BBL stands for Batch Burner Language and is a simple batch/script language to generate and process S-Records, Intel Hex, and Binary files.

You can find the burner.bbl file within the Project_settings\Linker_Files folder in the project.

Figure 1. Burner File

Burner File

The file includes a script to generate an S19 file.

Listing: Burner file contents

OPENFILE "%ABS_FILE%.s19"
format=motorola

busWidth=1

origin=0

len=0x1000000

destination=0

SRECORD=Sx

SENDBYTE 1 "%ABS_FILE%"

CLOSE

The script in burner file opens/creates a .s19 file, configures some settings, such as the output file format, sends all bytes from the application .abs file to the output file, and then closes it.

The *.bbl file is processed by the make file after linking the application binary. There is a graphical way to configure or create such a script file.

Note: For more information about the burner file, refer to the Microcontrollers V10.x HC(S)08/RS08 Build Tools Utilities Manual.

To configure burner script file graphically, perform these steps.

  1. Browse to the CWInstallDir\MCU\prog folder.
  2. Double-click burner.exe.

    The Burner Default Configuration dialog box appears.

  3. Click the Burner Dialog button on the toolbar (as the image, Burner Default Configuration Dialog Box listed below shows).

    The Burner dialog box appears (as the image, Burner Dialog Box - Input/Output Tab listed below shows).

    Figure 2. Burner Default Configuration Dialog Box

    Burner Default Configuration Dialog Box

    Figure 3. Burner Dialog Box - Input/Output Tab

    Burner Dialog Box - Input/Output Tab

  4. Configure the input file in the Input/Output tab.
  5. Click the Content tab and configure the output format in the Content tab page.
    Figure 4. Burner Dialog Box - Content Tab

    Burner Dialog Box - Content Tab

  6. Click the Command File tab.

    The Command File tab page displays the script as per the settings done in the Input/ Output and Content tabs.

    Figure 5. Burner Dialog Box - Command File Tab

    Burner Dialog Box - Command File Tab

  7. Copy the commands from the Command File tab page and paste the commands in your script file.

Now, you can easily create a burner.bbl file that can generate three different output files, S19, Intel Hex, and Binary, as shown in the following listing.

Listing: Script for generating S19, Intel Hex, and Binary files

busWidth=1
origin=0

len=0x1000000

destination=0

SRECORD=Sx

undefByte=0xff

format=motorola

OPENFILE "%ABS_FILE%.s19"

SENDBYTE 1 "%ABS_FILE%"

CLOSE

format=binary

OPENFILE "%ABS_FILE%.bin"

SENDBYTE 1 "%ABS_FILE%"

CLOSE

format=intel

OPENFILE "%ABS_FILE%.hex"

SENDBYTE 1 "%ABS_FILE%"

CLOSE

Also, the BBL file allows you to merge multiple files. For example, you can take a Binary file as input and convert it into an S-Record file. Or you add additional information to your files.

For example, if there is an S19 file that defines a firmware signature, and you want to make sure this signature is included into the S19 file for production.

You can implement the burner.bbl file as shown in the following listing.

Listing: Adding additional information to file using burner file

OPENFILE "%ABS_FILE%.s19"
format=motorola

busWidth=1

origin=0

len=0x1000000

destination=0

SRECORD=Sx

SENDBYTE 1 "%ABS_FILE%"

SENDBYTE 1 "MyFirmwareSignature.S19"

CLOSE