[gas][cortex-m23] why does this beq.w results in hard fault?

Francesco Prosperi francesco.prosperi@ssgsrl.it
Mon Mar 8 17:37:23 GMT 2021


Hi,

compiling some cortex-m23 code I stumbled across an issue.

I defined an assembly function with the following directives:
.arch        armv8-m.base
.syntax      unified
.code        16
.thumb_func
.text

Compilation and linking were fine: no error / warning (for this module). 
Assembler invocation is at the end.

Debugging, a hard fault occurs executing the wide conditional branch in 
the following line of code:

|00001240: 0x01f0ef80 beq.w 0x2422 <cmp_r0__r1_failed> |
The wide contidional branch is supported only for the Armv7-M.
The Armv8-M architectural reference manual states that:
/    Armv7-M compatibility requires the Main Extension/
Cortex-M23 implements the ARMv8-M baseline instruction set (so no Main 
Extension).


For these reasons, could there be a problem with the assembler that is 
not giving out any error?

Regards,
FP



Compilation command:||arm-none-eabi-gcc -mcpu=cortex-m23 -mthumb 
-mthumb-interwork -O3 -fmessage-length=0 -fsigned-char 
-ffunction-sections -fdata-sections -Wunused -Wuninitialized -Wall 
-Wextra -Wmissing-declarations -Wpointer-arith -Wshadow -Wlogical-op 
-Waggregate-return -Wfloat-equal  -g -x assembler-with-cpp 
-D_RENESAS_RA_ 
-I"C:\SSG\ARISTON\development\whb\CCS\CCS_ARI_trunk\Code\Script" 
-Wa,-adhlns="Src/outgen.o.lst" -MMD -MP -MF"Src/outgen.d" 
-MT"Src/outgen.o" -c -o "Src/outgen.o" 
"C:/SSG/ARISTON/development/whb/CCS/CCS_ARI_trunk/Code/Src/outgen.asm"

||






More information about the Binutils mailing list