Comment 4 for bug 1996610

Revision history for this message
Hans Gfirtner (hgfirtne) wrote (last edit ):

ok understood,
I isolated the issue with a small main.c and linker script scatter.ld.

gcc version:
arm-none-eabi-gcc (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

compile command:
arm-none-eabi-gcc -mcpu=cortex-m33 --specs=nosys.specs -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv5-sp-d16 -mfloat-abi=hard --save-temps -mthumb -mcmse -O2 -Wl,--cmse-implib main.c -T scatter.ld

create disassably:
arm-none-eabi-objdump -D a.out >a.dis

wrong gcc code generated:
in a.dis:
10000052: f000 e806 blx 10000060 <____gnu_cmse_nonsecure_call_veneer>
!This is ARM code not THUMB2 code as expected from -mthumb!

not relevant for the issue, but correct code can be generated, when scatter.ld line 14 is changed from:
  CODE2 (rxw) : ORIGIN = 0x11800000, LENGTH = 512K
to
  CODE2 (rxw) : ORIGIN = 0x11000000, LENGTH = 512K
the gcc does not generate a veneer code since the distance is less than 16MB I guess, then the issue is not seen