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

How to force string (rodata.str) alignment with ARM 6.6.3

Hi

is there a way to force constant strings to be aligned on 4 byte boundary?

For example: createTask("Taskname");

I tried the linker option "OVERALIGN", but it just generates a warning.

Cheers

Parents
  • Yes this works for me as well. This is actually my workaround:

    /* Workaround */
    void func()
    {
      char name[12]; /* automatic aligned to 4 bytes as it is on stack*/
      
      strcpy(name, "process");
      create(name);
    }
    
    void func2()
    {
      create("process"); /* constant string might be placed on any boundary */
    }
    

    func2() would show the original code.

    create() (assembly function) would read the name 32bit wise. This works fine on architecture > Armv6-M, but not for Armv6-M.

    The workaround is ok and I can live with it, but it is a pity there is no way to force alignment.

Reply
  • Yes this works for me as well. This is actually my workaround:

    /* Workaround */
    void func()
    {
      char name[12]; /* automatic aligned to 4 bytes as it is on stack*/
      
      strcpy(name, "process");
      create(name);
    }
    
    void func2()
    {
      create("process"); /* constant string might be placed on any boundary */
    }
    

    func2() would show the original code.

    create() (assembly function) would read the name 32bit wise. This works fine on architecture > Armv6-M, but not for Armv6-M.

    The workaround is ok and I can live with it, but it is a pity there is no way to force alignment.

Children
No data