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.

Support two-phase code integrity check at boot with TI's Linker.

Apologies for the thread title, this is hard to summarize in a single sentence.

Here are my goals. I have a single code base. Part of this code is "boot code," part is "run-time code," and some is "shared code." The shared code consists of particular functions that both the boot code and run-time code use. These shared functions may be present in source files that have functions that are not shared between the boot and run-time code.

I want all of the code used by boot, that is the "boot code" and "shared code," to be present in particular segment of memory. The run-time code is then present in other segments of memory, but I don't want the run-time code to include its own copy of the shared code. I want it to link and use the copy stored with the boot code.

The reason for this setup is that I want to integrity check the code memory at boot, but in phases. First check the boot and shared code, then finish boot activities, then prior to switching from "boot-time" to "run-time," integrity check the run-time code. For speed and management of the integrity check it is important for the boot and shared code to be in contiguous memory together and to not include extra code that only the run-time code needs.

I do not need the TI Linker to generate the integrity check codes.

Is this possible using TI's linker, if so how?

  • There must be a reason why you don't make this one single program.  What is it?

    Thanks and regards,

    -George

  • The motivating requirements are to:
    1) Integrity check code prior to execution
    2) Perform certain boot activities within a strict time limit
    3) Fit all the code within tight code memory constraints

    There is not time to integrity check all the code prior performing the "certain boot activities." But I must integrity check the code responsible for those activities prior to running it.

    If the code was two independent code bases, this would be easy. However, there is shared code between the boot code and run-time code. The code size restrictions means we can't afford to have two copies of that code present.
  • Further, this can all be built as a single program. But the memory layout must be as a specified. Further, we don't want to hand select the shared code in a linker file or with pragmas. Doing so would be error-prone. We must know that all the code used at boot was part of the first integrity check.
  • Please read the article Linker Command File Primer.  I'm pretty sure you will work out a way to organize your code, then refer to it in your linker command file, that is easy to manage.

    Thanks and regards,

    -George