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/DK-TM4C129X: TI ARM assembler .align directive broken

Part Number: DK-TM4C129X


Tool/software: TI C/C++ Compiler

alignProblem.s

The attached assembly file emits .word, .short, and .byte directive data to section "rodata".  Prior to emitting each item, an ".align" directive attempts to force byte alignment.  However, the tools insist on aligning each output item to the associated boundary.  I have tried leaving off the "1" parameter, and having just one ".align" directive at the top of the file, with the same results.  How can I generate a stream of byte-aligned bytes without padding?  I am running CCS 7.1.0, with link-time optimization enabled.  Thanks.

  • Normally, when I post a response, I am extremely confident my answer is correct.  That is not the case this time.  I am still waiting for confirmation that my proposed solution is correct.  Rather than make you wait until tomorrow for that, I decided to tell you what I know at this point.

    I'm pretty sure the answer is to change something like ...

    l036:
            .align  1
            .byte   115
    l038:
            .align  1
            .short  106

    to ...

    l036:
            .bits 115, 8
    l038:
            .bits 106, 16

    In the .bits directive, the first operand is the value, the second is the size in bits.  It packs the values together in memory.

    Thanks and regards,

    -George

  • Thanks for your response. I decided, however, to rework the code using this assembly file to permit all ".word" directives and work around the problem.
  • The assembler manual states this for .word: " Each value is placed in a 32-bit word by
    itself and is aligned on a word boundary."
    So there is no way to "unalign" it with .word
  • I confirm that the .bits solution I discuss in an earlier post is, all things considered, the best solution for this situation.

    Thanks and regards,

    -George