undefined instructions in kernel.elf generated in arm-none-eabi-gcc compilation
Hi !
I'm having a problem in a bare metal application that compile correctly for raspbarry pi b+ v1.2 2014, but don't work properly. The application is a RTOS.
For example: the following function in C:
float StrToFloat(char valor[25]) /* Convert a string stored in a global variable dado[25] for floating point representation */
{
int i;
float F1 = 1;
float F2 = 10;
if(valor[0] != '-'){
for(i=dot-1; i>=0; i--)
{
V+=((
F1*=10;
}
for(i=dot+1; i<pos; i++)
{
V+=((
F2*=10;
}
return(V);
}
else{
for(i=dot-1; i>=1; i--)
{
V+=((
F1*=10;
}
for(i=dot+1; i<pos; i++)
{
V+=((
F2*=10;
}
V *= -1;
return(V);
}
}
I disassembly the kernel.elf using objdump and get the following lines for the above function "StrToFloat" (the undefined instructions are almost in the end):
00009f78 <StrToFloat>:
9f78: e52db004 push {fp} ; (str fp, [sp, #-4]!)
9f7c: e28db000 add fp, sp, #0
9f80: e24dd01c sub sp, sp, #28
9f84: e50b0018 str r0, [fp, #-24] ; 0xffffffe8
9f88: e3a035fe mov r3, #1065353216 ; 0x3f800000
9f8c: e50b300c str r3, [fp, #-12]
9f90: e59f3244 ldr r3, [pc, #580] ; a1dc <StrToFloat+0x264>
9f94: e50b3010 str r3, [fp, #-16]
9f98: e51b3018 ldr r3, [fp, #-24] ; 0xffffffe8
9f9c: e5d33000 ldrb r3, [r3]
9fa0: e353002d cmp r3, #45 ; 0x2d
9fa4: 0a000040 beq a0ac <StrToFloat+0x134>
9fa8: e59f3230 ldr r3, [pc, #560] ; a1e0 <StrToFloat+0x268>
9fac: e5933000 ldr r3, [r3]
9fb0: e2433001 sub r3, r3, #1
9fb4: e50b3008 str r3, [fp, #-8]
9fb8: ea000015 b a014 <StrToFloat+0x9c>
9fbc: e51b3008 ldr r3, [fp, #-8]
9fc0: e51b2018 ldr r2, [fp, #-24] ; 0xffffffe8
9fc4: e0823003 add r3, r2, r3
9fc8: e5d33000 ldrb r3, [r3]
9fcc: ee073a90 vmov s15, r3
9fd0: eef87a67 vcvt.f32.u32 s15, s15
9fd4: ed9f7a7e vldr s14, [pc, #504] ; a1d4 <StrToFloat+0x25c>
9fd8: ee377ac7 vsub.f32 s14, s15, s14
9fdc: ed5b7a03 vldr s15, [fp, #-12]
9fe0: ee277a27 vmul.f32 s14, s14, s15
9fe4: e59f31f8 ldr r3, [pc, #504] ; a1e4 <StrToFloat+0x26c>
9fe8: edd37a00 vldr s15, [r3]
9fec: ee777a27 vadd.f32 s15, s14, s15
9ff0: e59f31ec ldr r3, [pc, #492] ; a1e4 <StrToFloat+0x26c>
9ff4: edc37a00 vstr s15, [r3]
9ff8: ed5b7a03 vldr s15, [fp, #-12]
9ffc: ed9f7a75 vldr s14, [pc, #468] ; a1d8 <StrToFloat+0x260>
a000: ee677a87 vmul.f32 s15, s15, s14
a004: ed4b7a03 vstr s15, [fp, #-12]
a008: e51b3008 ldr r3, [fp, #-8]
a00c: e2433001 sub r3, r3, #1
a010: e50b3008 str r3, [fp, #-8]
a014: e51b3008 ldr r3, [fp, #-8]
a018: e3530000 cmp r3, #0
a01c: aaffffe6 bge 9fbc <StrToFloat+0x44>
a020: e59f31b8 ldr r3, [pc, #440] ; a1e0 <StrToFloat+0x268>
a024: e5933000 ldr r3, [r3]
a028: e2833001 add r3, r3, #1
a02c: e50b3008 str r3, [fp, #-8]
a030: ea000015 b a08c <StrToFloat+0x114>
a034: e51b3008 ldr r3, [fp, #-8]
a038: e51b2018 ldr r2, [fp, #-24] ; 0xffffffe8
a03c: e0823003 add r3, r2, r3
a040: e5d33000 ldrb r3, [r3]
a044: ee073a90 vmov s15, r3
a048: eef87a67 vcvt.f32.u32 s15, s15
a04c: ed9f7a60 vldr s14, [pc, #384] ; a1d4 <StrToFloat+0x25c>
a050: ee377ac7 vsub.f32 s14, s15, s14
a054: ed5b7a04 vldr s15, [fp, #-16]
a058: ee877a27 vdiv.f32 s14, s14, s15
a05c: e59f3180 ldr r3, [pc, #384] ; a1e4 <StrToFloat+0x26c>
a060: edd37a00 vldr s15, [r3]
a064: ee777a27 vadd.f32 s15, s14, s15
a068: e59f3174 ldr r3, [pc, #372] ; a1e4 <StrToFloat+0x26c>
a06c: edc37a00 vstr s15, [r3]
a070: ed5b7a04 vldr s15, [fp, #-16]
a074: ed9f7a57 vldr s14, [pc, #348] ; a1d8 <StrToFloat+0x260>
a078: ee677a87 vmul.f32 s15, s15, s14
a07c: ed4b7a04 vstr s15, [fp, #-16]
a080: e51b3008 ldr r3, [fp, #-8]
a084: e2833001 add r3, r3, #1
a088: e50b3008 str r3, [fp, #-8]
a08c: e59f3154 ldr r3, [pc, #340] ; a1e8 <StrToFloat+0x270>
a090: e5933000 ldr r3, [r3]
a094: e51b2008 ldr r2, [fp, #-8]
a098: e1520003 cmp r2, r3
a09c: baffffe4 blt a034 <StrToFloat+0xbc>
a0a0: e59f313c ldr r3, [pc, #316] ; a1e4 <StrToFloat+0x26c>
a0a4: e5933000 ldr r3, [r3]
a0a8: ea000044 b a1c0 <StrToFloat+0x248>
a0ac: e59f312c ldr r3, [pc, #300] ; a1e0 <StrToFloat+0x268>
a0b0: e5933000 ldr r3, [r3]
a0b4: e2433001 sub r3, r3, #1
a0b8: e50b3008 str r3, [fp, #-8]
a0bc: ea000015 b a118 <StrToFloat+0x1a0>
a0c0: e51b3008 ldr r3, [fp, #-8]
a0c4: e51b2018 ldr r2, [fp, #-24] ; 0xffffffe8
a0c8: e0823003 add r3, r2, r3
a0cc: e5d33000 ldrb r3, [r3]
a0d0: ee073a90 vmov s15, r3
a0d4: eef87a67 vcvt.f32.u32 s15, s15
a0d8: ed9f7a3d vldr s14, [pc, #244] ; a1d4 <StrToFloat+0x25c>
a0dc: ee377ac7 vsub.f32 s14, s15, s14
a0e0: ed5b7a03 vldr s15, [fp, #-12]
a0e4: ee277a27 vmul.f32 s14, s14, s15
a0e8: e59f30f4 ldr r3, [pc, #244] ; a1e4 <StrToFloat+0x26c>
a0ec: edd37a00 vldr s15, [r3]
a0f0: ee777a27 vadd.f32 s15, s14, s15
a0f4: e59f30e8 ldr r3, [pc, #232] ; a1e4 <StrToFloat+0x26c>
a0f8: edc37a00 vstr s15, [r3]
a0fc: ed5b7a03 vldr s15, [fp, #-12]
a100: ed9f7a34 vldr s14, [pc, #208] ; a1d8 <StrToFloat+0x260>
a104: ee677a87 vmul.f32 s15, s15, s14
a108: ed4b7a03 vstr s15, [fp, #-12]
a10c: e51b3008 ldr r3, [fp, #-8]
a110: e2433001 sub r3, r3, #1
a114: e50b3008 str r3, [fp, #-8]
a118: e51b3008 ldr r3, [fp, #-8]
a11c: e3530000 cmp r3, #0
a120: caffffe6 bgt a0c0 <StrToFloat+0x148>
a124: e59f30b4 ldr r3, [pc, #180] ; a1e0 <StrToFloat+0x268>
a128: e5933000 ldr r3, [r3]
a12c: e2833001 add r3, r3, #1
a130: e50b3008 str r3, [fp, #-8]
a134: ea000015 b a190 <StrToFloat+0x218>
a138: e51b3008 ldr r3, [fp, #-8]
a13c: e51b2018 ldr r2, [fp, #-24] ; 0xffffffe8
a140: e0823003 add r3, r2, r3
a144: e5d33000 ldrb r3, [r3]
a148: ee073a90 vmov s15, r3
a14c: eef87a67 vcvt.f32.u32 s15, s15
a150: ed9f7a1f vldr s14, [pc, #124] ; a1d4 <StrToFloat+0x25c>
a154: ee377ac7 vsub.f32 s14, s15, s14
a158: ed5b7a04 vldr s15, [fp, #-16]
a15c: ee877a27 vdiv.f32 s14, s14, s15
a160: e59f307c ldr r3, [pc, #124] ; a1e4 <StrToFloat+0x26c>
a164: edd37a00 vldr s15, [r3]
a168: ee777a27 vadd.f32 s15, s14, s15
a16c: e59f3070 ldr r3, [pc, #112] ; a1e4 <StrToFloat+0x26c>
a170: edc37a00 vstr s15, [r3]
a174: ed5b7a04 vldr s15, [fp, #-16]
a178: ed9f7a16 vldr s14, [pc, #88] ; a1d8 <StrToFloat+0x260>
a17c: ee677a87 vmul.f32 s15, s15, s14
a180: ed4b7a04 vstr s15, [fp, #-16]
a184: e51b3008 ldr r3, [fp, #-8]
a188: e2833001 add r3, r3, #1
a18c: e50b3008 str r3, [fp, #-8]
a190: e59f3050 ldr r3, [pc, #80] ; a1e8 <StrToFloat+0x270>
a194: e5933000 ldr r3, [r3]
a198: e51b2008 ldr r2, [fp, #-8]
a19c: e1520003 cmp r2, r3
a1a0: baffffe4 blt a138 <StrToFloat+0x1c0>
a1a4: e59f3038 ldr r3, [pc, #56] ; a1e4 <StrToFloat+0x26c>
a1a8: edd37a00 vldr s15, [r3]
a1ac: eef17a67 vneg.f32 s15, s15
a1b0: e59f302c ldr r3, [pc, #44] ; a1e4 <StrToFloat+0x26c>
a1b4: edc37a00 vstr s15, [r3]
a1b8: e59f3024 ldr r3, [pc, #36] ; a1e4 <StrToFloat+0x26c>
a1bc: e5933000 ldr r3, [r3]
a1c0: ee073a90 vmov s15, r3
a1c4: eeb00a67 vmov.f32 s0, s15
a1c8: e24bd000 sub sp, fp, #0
a1cc: e49db004 pop {fp} ; (ldr fp, [sp], #4)
a1d0: e12fff1e bx lr
a1d4: 42400000 submi r0, r0, #0
a1d8: 41200000 ; <UNDEFINED> instruction: 0x41200000
a1dc: 41200000 ; <UNDEFINED> instruction: 0x41200000
a1e0: 000120e8 andeq r2, r1, r8, ror #1
a1e4: 0000dcc8 andeq sp, r0, r8, asr #25
a1e8: 0000dcc4 andeq sp, r0, r4, asr #25
Note the last lines just above with undefined instructions. I do not know how to eliminate this problem or what they mean and how hurt my program. There is not warning messages in compilation time.
There are many undefined instructions for all disassembly file that have 13800+ lines.
The Linux installation tarball is gcc-arm-
My laptop is a i5 core and S.O. is Ubuntu 16.04 LTS.
Sorry by the long text and thanks for attention!
Miguel
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Tejas Belagod
- Solved:
- Last query:
- Last reply: