This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Split firmware files

Hi,
I wrote an application in a 8051 device containing several modules.
One of them needs some certification and after that it can no longer be modified.
To ensure this a CRC is computed on the firmware file.

The problem is that after certificates the other modules need to be modified and this will affect the firmware CRC even if I didn't modify the certified module.

The solution would be to somehow isolate the certified module in a separate firmware file and the just load both files into the device.

Is there any way to do this?

  • CODE keyword in the linker command line

  • CODE keyword in the linker command line

    Well, yeah, if he wants to do it on the linker level.

    On the "firmware file" level, there's tools like srecord (very useful, and free, too) for splitting/merging binary and hex files.

  • The CODE keyword would generate a COD file, but all code would still be mixed up inside right?
    I'm probably missing something because I don't understand how this would help me.

  • About splitting merging binary files, Is there a way I can't find where to split the firmware file?
    How can I know where the code for the non-modifiable module is placed?

  • Have you discussed this plan with your certification authority? In my world (DO178b), any combination of certified (by which I assume you mean safety critical) and not certified code would need a partitioning plan, approved by the cert. authority, to deal with this and a bunch of other issues.


  • http://www.keil.com/support/man/docs/bl51/bl51_code.htm

    "The absolute memory location of individual CODE segments"

    Erik

    Erik,
    I did read the manual, but I'm actually using LX51 instead of BL51 because I'm using a bigger ROM size than 64KB.
    The definition of the CODE keyword seems to be completely different.
    http://www.keil.com/support/man/docs/lx51/lx51_code.htm

    Can something like the BL51 definition be done in LX51?
    If not this option can be ruled out.

    I noticed that using Code banking I can generate different firmware files, but I'd rather stay away from this option if something simpler can be done.

    I apologize if I'm asking stupid questions, I'm quite a newbie in regards to this stuff.

  • What about making it a library?

    That's quite unlikely to succeed. A library is just a pack of object files, after all. It won't help a bit with keeping the CRC of the critical parts of that code identical.

    If anything one would have to link the critical parts as a separate project, creating an absolute, non-relocatable output file. Other code could then be linked with that to form a complete program. It should be possible to achieve largely the same effect by fixing absolute address for single object files, but the intermediate project is probably easier to handle in the long run, particularly if there's more than one source code module involved.

    OTOH, this being C51, I doubt that even this would fully guarantee a constant CRC of that code section. Overlay analysis would tend to work against that.

  • Yes,
    the library option is certainly not an option.
    If dynamic libraries were an option it would be different, but a static library is linked in the main code so the CRC whould change.

    I checked all the possible options and what I found is this:

    1.- CODE option: Useless with LX51 (the linker I'm using)

    2.- srecord option: I don't know how the firmware should be split to make this work. I guess that all certified functions could be placed in a fixed position, but even if possible, it seems rather complex taking into account the amount of functions we have.

    3.- Code banking: This option can generate different files directly when compiling. It seems I just need to assign the different files the bank I want. With our current hardware (512MB RAM + 512MB Flash). I'm wondering if there's some trick to store both files in the same physical bank which can hold both files. If not possible then we can load one of the banked files it into the flash memory.

    Any comments, criticisms, laughs?

  • 1.- CODE option: Useless with LX51 (the linker I'm using)

    Only in a strictly literal sense. LX51 has the same capability. It just hides under a different name.

    2.- srecord option: I don't know how the firmware should be split to make this work.

    Obvious: into the fixed part, and the rest.

    I guess that all certified functions could be placed in a fixed position, but even if possible, it seems rather complex taking into account the amount of functions we have.

    That is not the "srecord" option --- that's the CODE option again.

    3.- Code banking:

    Is totally a red herring.

    With our current hardware (512MB RAM + 512MB Flash).

    You absolutely have to be kidding.

  • 1.- CODE option: Useless with LX51 (the linker I'm using)

    Only in a strictly literal sense. LX51 has the same capability. It just hides under a different name.

    Well since no one contradicted me the first time I assumed that it just wasn't possible. There no dialog in uVision under "LX51 Locate" similar to "BL51 Locate" to help me guess what this magic command might be.

    2.- srecord option: I don't know how the firmware should be split to make this work.

    Obvious: into the fixed part, and the rest.

    What I don't know is how to determine which parts of the generated firmware belong to each section. Are you suggesting that I should combine the CODE and the srecord options?

    With our current hardware (512MB RAM + 512MB Flash).

    You absolutely have to be kidding.

    What's so funny about my hardware configuration?

    I'm using 16MB contiguous mode. so 512kb doesn't seem so far fetched.

    The 512kb of flash are intended for non-critical data such as some basic logging.

    I guess the banking option is not a feasible solution.

    As I said I'm new to this, so I apologise if I say stupid things. Still I really need to solve this even if the cost is people making fun of my ignorance.

  • there no dialog in uVision under "LX51 Locate" similar to "BL51 Locate" to help me guess what this magic command might be.

    Well, tough luck. So you'll actually have to Please read the manual.

    What I don't know is how to determine which parts of the generated firmware belong to each section.

    So how did you arrive at the conclusion in the first place that you need to split it? How can you know you need to split, but not into what parts?

    You>With our current hardware (512MB RAM + 512MB Flash).

    Me>You absolutely have to be kidding.

    You>What's so funny about my hardware configuration?

    Nothing. But read what you actually wrote. Slowly. I'm quite sure you'll eventually spot it.