Using rlink.exe to link a binary file at a certain addres

I have a fixed set of bytes that I want to download to my RX65N+2MB code flash at a specific address.  This set of bytes is generated by an external tool from another program image.  I came across the e2Studio debugger feature that lets you specify multiple images to download to the target for debugging

Run -> Debug Configurations -> Startup tab -> Load image and symbols

but the input to that feature is apparently an RX ELF file (I tried specifying my raw binary file, but it complained about the format).

So I figured I could use rlink.exe to link the binary file into an ELF file, specifying a section at the target address and specifying the binary file be loaded into that section.

    rlink.exe -binary=mybinaryfile.bin(HEADER_SECTION) -form=object -output="mybinaryfile.header.obj" -start=HEADER*/0FFF00000

...but rlink.exe complains about not knowing what CPU it's linking for.

F0563020:No cpu information in input files

Questions:

  • Am I going about this the wrong way?
  • How do I use the Load image and symbols feature?
  • How do I use rlink.exe to link a bunch of bytes into an output file suitable for input to this feature?
  • ...or, more directly, how do I get my bytes into code flash?

Note: I cannot simply poke the bytes into a uint8_t array in my program, because the bytes are a hash of the program data.

Thanks in advance!

  • you can merge your .mot file (program data and resources) in C# with hexfile.cs (which is part of firmware obfuscation). The code looks something like

    uint resourcesStartAddress = ...;

    HexFile hexFile = new HexFile();

    hexFile.Read("program.mot");

    hexFile.SetBytes(resourcesStartAddress, File.ReadAllBytes("resources.bin"));

    hexFile.Write("programWithResources.mot");

     

  • When you load a binary file using rlink you can define a section name with the binary file where the data should be placed and add the start address of this section in the start option as shown in the compiler manual.

    The debugger can load Motorola hex files as images but no binary files as binary files don't include any address information.

  • In reply to FrankL:

    Thanks, I already had the section specifier in my -binary parameter, I just had to convert my binary data to Motorola S-record format.  Then the debugger loaded it fine.