[RTEMS Project] #4504: RTEMS6 has incorrect code generation for stm32f4 bsp
RTEMS trac
trac at rtems.org
Thu Aug 19 23:07:19 UTC 2021
#4504: RTEMS6 has incorrect code generation for stm32f4 bsp
-----------------------------+----------------------------------
Reporter: Andrei Chichak | Owner: (none)
Type: defect | Status: new
Priority: normal | Milestone:
Component: tool/gcc | Version: 6
Severity: normal | Keywords: gcc multilib stm32f4
Blocked By: | Blocking:
-----------------------------+----------------------------------
I'm working with the master head targeting arm/stm32f4 for RTEMS 6.
I built the tools and RTEMS using:
{{{
mkdir -p rtems/6
export PREFIX=`pwd`/rtems/6
mkdir external
cd external
git clone git://git.rtems.org/rtems.git
git clone git://git.rtems.org/rtems-source-builder.git
cd rtems-source-builder/rtems
../source-builder/sb-set-builder --prefix=${PREFIX} --log=../b-rsb-
toolchain-arm.log 6/rtems-arm
cd ../../rtems
./waf bsp_defaults --rtems-bsps=arm/stm32f4 > config.ini
./waf configure --prefix=${PREFIX}
./waf
}}}
This setup gives me code that faults when calling the memset() function
from bsp_start_clear_bss(). The version of memset() being used in any of
the compiled samples has the flags (from rtems-execinfo -O) of:
{{{
| memset.c : -mcpu=arm7tdmi -marm
-march=armv4t
}}}
whereas other functions in the executable have:
{{{
| lseek.c : -mthumb -mcpu=cortex-m4
-march=armv7e-m
}}}
If I rebuild with
{{{
./waf bsp_defaults --rtems-bsps=arm/stm32f105rc > config.ini
}}}
then all of the functions are compiled with the correct architecture flags
for a 105rc and the program can reach Init() when run on a 105rc chip.
{{{
Common flags: 3
| -mthumb -mcpu=cortex-m3 -march=armv7-m
}}}
If I configure for stm32f4 and change the config.ini file to use:
{{{
ABI_FLAGS = -mthumb -mcpu=cortex-m3
}}}
Then rtems-exeinfo shows that all functions are using the same common
flags as the stm32f105rc bsp configuration. The generated code cannot be
used on an stm32f407, but it does compile an executable with one
consistent instruction set.
So, providing -mcpu=cortex-m4 in ABI_FLAGS triggers the use of the wrong
version of functions from libgcc (I think).
--
Ticket URL: <http://devel.rtems.org/ticket/4504>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list