Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arch: arm: cortex_a_r: XIP=y causes linker error #72696

Open
sigmundklaa opened this issue May 13, 2024 · 4 comments
Open

arch: arm: cortex_a_r: XIP=y causes linker error #72696

sigmundklaa opened this issue May 13, 2024 · 4 comments
Assignees
Labels
area: ARM ARM (32-bit) Architecture bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@sigmundklaa
Copy link

When a Cortex A/R based SoC is compiled with CONFIG_XIP=y, linking fails with the following syntax error:

/home/sigmundk/src/zephy-extra/zephyr-extra/toolchain/be-gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/9.3.1p1/../../../../arm-none-eabi/bin/ld.bfd:zephyr/linker_zephyr_pre0.cmd:175                                                                  
: syntax error
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I am compiling for an ARM Cortex R4F, using out-of-tree SoC support for the TMS570LS1224 which is linked at the bottom of the issue. The cause seems to be the below line (from linker_zephyr_pre0.cmd:175):

bss (NOLOAD) : ALIGN_WITH_INPUT ALIGN(_region_min_align)

which is the result of:

SECTION_DATA_PROLOGUE(_BSS_SECTION_NAME,(NOLOAD), BSS_ALIGN)

From what I can tell, combining ALIGN_WITH_INPUT and ALIGN is not supported, however I'm not sure of this. For me, replacing
SECTION_DATA_PROLOGUE with SECTION_PROLOGUE fixed the issue, but I don't know if that is the best solution.

To Reproduce
Steps to reproduce the behavior:

  1. Select a Cortex A/R based SoC
  2. Compile with `CONFIG_XIP=y
  3. See error

Expected behavior
Successful compilation

Impact
Prevents compilation

Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • Toolchain Both the latest version of the Zephyr SDK, as well as the toolchain in the repository linked below was tried.
  • Commit SHA or Version used: 23a03b7

Additional context
My setup, including a patched big endian ARM GCC toolchain, is available at https://github.com/OrbitNTNU/zephyr-hw

@sigmundklaa sigmundklaa added the bug The issue is a bug, or the PR is fixing a bug label May 13, 2024
@henrikbrixandersen henrikbrixandersen added the area: ARM ARM (32-bit) Architecture label May 13, 2024
@cfriedt
Copy link
Member

cfriedt commented May 14, 2024

@sigmundklaa - can you potentially reproduce this with an in-tree board?

@aescolar
Copy link
Member

CC @dleach02

@aescolar aescolar added the priority: medium Medium impact/importance bug label May 14, 2024
@sigmundklaa
Copy link
Author

@sigmundklaa - can you potentially reproduce this with an in-tree board?

Yes ofcourse. I get the same error when compiling for the nxp/s32z2xxdc2/s32z270/rtu1 board, using:

west build -p always -b s32z2xxdc2/s32z270/rtu1 samples/hello_world -- -DCONFIG_XIP=y

@ntavish
Copy link
Contributor

ntavish commented May 27, 2024

I am facing the same problem, trying to compile zephyr for another chip in the family. My toolchain is even older, GCC 7.5.0 (big endian).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM ARM (32-bit) Architecture bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

8 participants