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.

TMS320F2812: Boot Process of Microcontroller...

Part Number: TMS320F2812

Hi,

I have a very general query targeting any Microcontroller in general and TMS320F2812 in specific. The queries are as following:


1) Consider a compiler output to be in COFF format. Now in order burn it to flash, it need to be converted to some suitable format like ASCII-Hex /Intel-Hex. As we know COFF contains sections and segments. Now OS can load data from .data/.bss sections and code from .text section. Now in ASCII-Hex /Intel-Hex format we don't have any sections so how a Micrcontroller/Processor (like C671x) will load data into ram and execute instruction from Flash (NOR).


2) How does a microcontroller know which part of the program (variables etc) need to loaded into RAM before jumping to main function??? how does it distinguish between data and instructions??? In short how a microcontroller loads variables from Flash (NOR burned with Intel-hex), who tell the microcontorller what to load in RAM and what to execute from flash.

Regards,

Aimal

  • Aimal,

    1) When the coff is converted to some hex format, say Intel-hex, usually there will be a load address, data and length.  You can read the Intel-hex documentation to know the exact format.  Loader should have a parser to decode that format correctly so that loader can get the target address (whether it is RAM or Flash) and data to be loaded.  If the target load address is Flash, then loader should use Flash API to program the data in to Flash.

    2) Application's linker command file determines where each of the section has to be mapped to (RAM or Flash).  Compiler, assembler and linker will generate the code and map as per the inputs in cmd file.  The C-startup RTS library takes care of initializing global initialized data as needed by the application before reaching the main().  Apart from that, if there are sections that need to be copied from Flash to RAM at run time, application's linker command file can use different load and run addresses.  In this case, application should copy those contents from Flash to RAM before executing them (application can use memcpy() function for this).

    Hope this helps.

    Thanks and regards,
    Vamsi

      

  • Very Informative reply Gudivada. just few queries.

    So you mean that the startup code basically does this???
    1) By Startup code you mean crt0?
    2) Does compiler adds both crt0 and startup code that we provide at reset vector?
    3) whats the difference between crt0 and _c_int00?
    4) does RTS libraries contains these startup/crt0/_c_init00 code??

    I believe that startup code and the code your are talking about (that initialize global variables etc.) are different. I have been through a lot of startup codes from ARM, Atmel etc. i never saw anything that copies various code sections into memory. so the startup code and CRT0 (or code you are talking about) is different. or at least there is something else that compiler/linker adds apart from startup code that copies and initialize .data and .bss sections.

    Kindly correct me if i am wrong.