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.

MSPM0L1228: copy prebuilt file into project

Part Number: MSPM0L1228


Tool/software:

Hello,

I'm trying to copy a prebuilt .bin file to a specific location in the output file using the linker.
The goal is to place a previously created bootloader at 0x0000 of memory so that I have both projects in one hex file

I created a new section in the linker command file and tried to load the bootloader.bin into the defined MEMORY area.

SECTIONS
{
	.my_boot: type = NOINIT {../Bootloader/bootloader.bin } > BOOT

But I'm getting the error

Description    Resource    Path    Location    Type
#10004 unrecognized file:  "../Bootloader/bootloader.bin"    linker.cmd    /firmware-ti    line 68    C/C++ Problem

maybe I have to specify my file as a binary. But I don't know how. And I didn't find something about this in the TI ARM clang User's Guide.

I'm using CCS 12.8.1. The bootloader.bin is found by the linker, otherwise I'm getting an other error.

I hope it is clear what I would like to do and you can help me out.

Thanks in advance

Regards,
Timo

  • Hi Timo,

    Previously I have only done this by keeping my desired memory region for the second binary blank, and then loading the other binary in separately after programming the initial project. Of course this is an annoying extra few steps.

    I think that you are getting this issue because the linker does not support the use of raw .bin files. My recommendation is to build the output as a .o file, or .hex should be possible as well. If you're able to build it as a .o file, you should be able to use similar linker commands:

    SECTIONS{
        .myPrebuiltObjectFile : {
            objectFile.o (.data)
            } > BOOT
    }

    Could you give this a try and let me know if this resolves the issue? My main point is that I believe using the .bin will always cause issues here.

    Another option is to convert the output file to a c array, include it in your project and place it at your desired memory location.

  • Hi Dylan,

    thanks for your answer.

    Loading two binaries by hand is unfortunately not a good option for me.

    My bootloader is a separate Project which is compiled for its own. So I only got a finished file as an executable, like .bin, .hex or .out. As I know it is not possible to get a single .o for a complete project. Or can you tell me how?

    when I try a .hex I got the error
    Description    Resource    Path    Location    Type
    #10034-D illegal file type:  "../Bootloader/bootloader.hex" must specify an object or archive file    linker.cmd    /firmware-ti    line 68    C/C++ Problem

    I thought there must be a way to load the bootloader in linker file like GCC. Are you sure there is no option with Ti Clang for a .bin or .hex?
    I had already thought about the possibility with the C array, if there is no other way I will try this.

    Regards,
    Timo

  • The default build process in CCS should provide you with a singular .o file -> found in the debug directory in your project, named [project_name].o. Unless you disabled this in the project properties I would expect this to be present.

    I'm going to loop in a member of our software tools organization to see if they can provide some more helpful comments here.

  • Hi Dylan,

    I didn't get a [project_name].o. Only single .o for each source file. And I would say I didn't change something in the Properties. Please tell me where I can enable it.
    What I get is a .out, as I said. But this will force the error
    Description    Resource    Path    Location    Type
    #10417 file "../Bootloader/bootloader.out" could not be statically or dynamically linked    /firmware-ti       C/C++ Problem

    If somebody from software tools could support, that would be nice.

    Regards,
    Timo

  • Hi Timo,

    We're looking into this please give us a moment.

    Regards,
    Luke

  • Thanks Luke.

    Hi Timo,

    I just spoke with a member of our software tools organization. TIClang does not currently offer a method for including your prebuilt binary using linker inputs. So you have two options to get these programmed into your device:

    1) You can merge your CCS projects, build them together, and specify their locations in the linker, so both are built in one step and programmed in one step, and placed where you want them. Drawback is that you need to adjust your source.

    2) You can program the device with one application code, then manually flash the second one in as I mentioned previously. You won't need to rewrite any of your projects, but you do have the extra step of manually flashing the second file. One method for doing so is described in the 

    MSPM0 Boot Image Manager (BIM) User’s Guide.

    Let me know if you have further questions about this.