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.

Compiler/CCSTUDIO: difference between autoinitialization of --ram_model(-cr) and --rom_model(-c)

Part Number: CCSTUDIO

Tool/software: TI C/C++ Compiler

Hi:

Our working project has always used the rom autoinitialization model.

I have tested these two autoinitialization models and the content of each object file shows in the picture below. The main difference is that bin file generated with ram model has no ".cinit" section.

I have read the "ARM Assembly language Tools User's Guide" and found the picture below which manifesting load time of ram model.

My questions are that:

1.our system includes a bootloader file and an application bin file both burned into flash. The bootloader is just derived from TI's AM335x StarterWare.

Can I use the bin file generated by ram autoinitialization model? Because in this example, the size of bin file with ram model is just 2MB contrasting to 65MB of rom model.

2.If no, what are the reasons?

3.If yes, does the bootloader functions as "Loader" shown in the picture?

Best regards!

  • Wang Wei said:
    Can I use the bin file generated by ram autoinitialization model?

    No.  The loader in the figure you show has access to the binary executable file, knows the format of that file, and has the ability to copy the .data section from that file directly into system memory.  None of that is the case in your system.

    Thanks and regards,

    -George

  • Hi George,

    Thanks very much for your reply.

    Sorry for that I haven't clearly figured out when and where to use the ram autoinitialization model properly.

    My current understanding is that there is no any program work as a "Loader" in our system. In both autoinitialization cases, the object files have already been burned into ROM. When it comes to a reset, the bootloader only works as the "Boot routine" as shown in the picture of rom model.

    Are these statements true?

    Thanks and best regards!

      

  • Your understanding is correct.

    Thanks and regards,

    -George

  • I have been confused by a test that burning the bin file with ram autoinitialization model into ROM.

    After a reset, the application runs properly. It seems that the bootloader has copied all the sections including ".data" into system RAM successfully.

    Can you please offer some hints about this abnormal result?

    Thanks and best regards!

  • You say you perform these steps.

    1. Link with RAM initialization model
    2. Burn the program into ROM
    3. Start the program running on the system

    Then you see the correct values of the .data section in the correct addresses in system RAM.  I don't understand how that is possible.  

    Thanks and regards,

    -George

  • I do perform the same steps as what you said.

    I'm confused because firstly, our system works as properly as that with a rom initialziton model, second, I took control of the system by CCS debugger with the method of load symbols while the system is running. I found all the RAM address of the global data in the .data section is identical with that showed in map file.

    So

    George Mock said:
    Then you see the correct values of the .data section in the correct addresses in system RAM

    I'm appreciate for your nice and timely response all the same.

  • I apologize for the delay.  

    I still do not understand how your build that uses linker option --ram_model works correctly.

    In the executable file DMC5800_50x201650_debug_ram.out, the .data section starts at address 0x801d1758, and is 1036 bytes long.  For your code to work, this range of memory has to be RAM and not ROM.  Is that the case?  And if that range of memory is RAM, what happens at system start to cause that range of memory to change from an uninitialized state to holding the .data section?

    Thanks and regards,

    -George

  • George Mock said:
    For your code to work, this range of memory has to be RAM and not ROM.  Is that the case?

    I have checked the memory browser in CCS that it's just the case as you said.

    George Mock said:
    And if that range of memory is RAM, what happens at system start to cause that range of memory to change from an uninitialized state to holding the .data section?

    I don't know the details of bootloader working mechanism. Is it possible that it handles .data section just the same as .const and .text sections?

    Maybe it has the ability to recognize these three sections and initialize corresponding memory in RAM according to the contents of each section that lying in ROM.

    That's what I could infer from current phenomenon and my limited knowlege.

    Thanks and best regards!

  • Wang Wei said:
    I don't know the details of bootloader working mechanism. Is it possible that it handles .data section just the same as .const and .text sections?

    No.  All 3 of those sections are initialized sections in DMC5800_50x201650_debug_ram.out.  The sections .const and .text are probably programmed into ROM or FLASH.  The .data section cannot be programmed into ROM or FLASH.  It must be in RAM.  When the system starts running, .data can only be in DMC5800_50x201650_debug_ram.out.  Please explain how it gets from the .out file and loaded into RAM in the system.

    Thanks and regards,

    -George

  • George Mock said:
    The .data section cannot be programmed into ROM or FLASH.  It must be in RAM

    Did you mean that though the .data section appears in the .out object file, but it won't be put into .bin file by StarterfWare toolchain?

    The bin file is generated using .out file by "tiimage.exe". I learnt from this thread " that the bin file contains initialized sections only. It shows that with -ram_model, the linker makes .data initialize as the picture shows below.

    It's load addr is 0x801d1758 which demonstrates the size of generated bin file should be nearly 1860KB, and that's identical with the bin file I have got.

    According to these evidences I think the .data section is inlcuded in the bin file that I burned into FLASH and it(.data) behaves as my last post.

    This is where I can touch with my limited StarterWare knowledge.

    Thanks and best regards!

  • Wang Wei said:
    According to these evidences I think the .data section is inlcuded in the bin file that I burned into FLASH

    The .data section is included in the bin file just like .const and .text.  If it is also burned into FLASH, then that is where I see a problem.  While the program never needs to modify any memory location in .const or .text, it does need to modify locations in .data.  That is why .data must be in RAM, or some kind of memory which can be modified while the program runs.

    Wang Wei said:
    This is where I can touch with my limited StarterWare knowledge.

    Please keep in mind I also know nothing about StarterWare.

    Thanks and regards,

    -George