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/TMS570LS1224: How is code execution from RAM possible when the linker assigns only a (RW) attribute to the RAM memory range?

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

Dear TI Experts,

I am reading through the ARM Assembly Language Tools (SPNU118W), with the intention of understanding the linker file of a CCS project.

My question is related to the MEMORY directive, as explained on page 210 of SPNU118W ( 8.5.4.2 MEMORY Directive Syntax ), in particular, the "attr" field of a memory range.

Per definition, "attr" "restricts the allocation of output sections into certain memory ranges".

What does that mean for the initialized (.text, .data) and the uninitialized (.bss, ...) sections? From what I understand, the .bss section shouldn't be assigned to a (R) or (RX) memory range, as the .bss also needs to be written (W) to also, thus the reason it resides in RAM. Is my understanding of this correct?

But here comes what I don't quite understand - how is it possible to execute instructions from RAM then during the update process of a MCU using the F021 API if the attribute of the RAM range is only (RW), but not (RWX)?

 

Thank you in advance!

 

Kind regards,

Mihail

  • Another good place to learn about the linker is the article Linker Command File Primer.  The last part of it is about memory attributes.  It explains how, in actual practice, they are only used to document the intended use of each memory range.  I recommend you use memory attributes in the same manner, and not pursue the details any further.

    Thanks and regards,

    -George

  • Thank You for the reply!

  • Mihail Milchev said:
    But here comes what I don't quite understand - how is it possible to execute instructions from RAM then during the update process of a MCU using the F021 API if the attribute of the RAM range is only (RW), but not (RWX)?

    The attributes in the linker command file are copied to the Section Headers in the ELF format executable created by the linker.

    However, with MCUs then there is no dynamic loader uses the attributes in the section headers of the executable to determine the difference between RW and RWX for the running program. Instead:

    a. The flash programmer, e.g. the CCS debugger, programs the sections marked as PROGBITS and ALLOC into flash without regard to the write or exec ELF flags.

    b. At runtime the MPU in the MCU is required to configure memory regions as execute permission. HalCoGen has a facility to specify the MPU configuration.