linking troubles with STM32F platforms Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: linking troubles with STM32F platforms

Postby Giovanni » Tue Jun 11, 2019 6:12 pm

This is what that alignment 4->16 should have fixed.

I will play with constructors and destructors some more.

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: linking troubles with STM32F platforms

Postby Giovanni » Sun Jun 16, 2019 2:43 pm

I found that -falign-functions=16 in Makefile is probably the trigger, it enforces alignment in VMA but not in LMA, adjusting alignment in .ld files just hides the problem.

Could you try to remove that option in Makefile and see if it fixes the problem for you?

Giovanni

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: linking troubles with STM32F platforms

Postby Giovanni » Sun Jun 16, 2019 5:04 pm

Perhaps I found a solution to the problem or, at least, a problem.

Could you try using this rule in rules_code.ld?

Code: Select all

    .text : ALIGN_WITH_INPUT
    {
        __text_base = .;
        *(.text)
        *(.text.*)
        *(.glue_7t)
        *(.glue_7)
        *(.gcc*)
        __text_end = .;
    } > TEXT_FLASH AT > TEXT_FLASH_LMA


It is a new keyword not present in the old documentation I was looking at.

Giovanni

_helmut_
Posts: 7
Joined: Thu Jun 06, 2019 8:50 am
Has thanked: 1 time
Been thanked: 2 times

Re: linking troubles with STM32F platforms

Postby _helmut_ » Tue Jun 18, 2019 8:12 am

Hi,

the ALIGN_WITH_INPUT did the trick. It fixes the problem:

Code: Select all

diff -y good.readelf bad.readelf | less


Code: Select all

Program Headers:                                                Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSi     Type           Offset   VirtAddr   PhysAddr   FileSiz MemSi
  LOAD           0x010000 0x00200000 0x08000000 0x09e68 0x09e |   LOAD           0x010000 0x00200000 0x08000000 0x00208 0x002
  LOAD           0x019e68 0x08009e68 0x08009e68 0x02784 0x027 |   LOAD           0x010220 0x00200220 0x08000208 0x09c48 0x09c
  LOAD           0x020000 0x20020000 0x0800c5ec 0x000dc 0x000 |   LOAD           0x029e50 0x08009e50 0x08009e50 0x02784 0x027
  LOAD           0x030000 0x20000000 0x20000000 0x00000 0x02e |   LOAD           0x030000 0x20020000 0x0800c5d4 0x000dc 0x000
  LOAD           0x0200dc 0x200200dc 0x200200dc 0x00000 0x5ff |   LOAD           0x040000 0x20000000 0x20000000 0x00000 0x02e
                                                              >   LOAD           0x0300dc 0x200200dc 0x200200dc 0x00000 0x5ff


Thx,
Helmut

User avatar
Giovanni
Site Admin
Posts: 14455
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: linking troubles with STM32F platforms

Postby Giovanni » Tue Jun 18, 2019 8:30 am

Thanks for confirming, I will commit this fix to all active branches.

Giovanni


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 33 guests