Application crash

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
diurpaneus
Posts: 7
Joined: Thu Sep 15, 2011 3:37 pm

Application crash

Post by diurpaneus »

Hi,

I seem to have a strange crash in my application. Whenever the CPU executes the instruction ldr r3, [r3, #0] it goes to the unhandled exception function.
If I jump over this instruction the code executes with no problem. The value contained in r3 seems to be a valid address. Here is the screenshots of the code and the memory dump.
Image

Here's the lst file for this particular function:

Code: Select all

1030                 _ads_lld_calculate_coeff:
 1031                 .LFB59:
 1032                    .loc 2 227 0
 1033                    .cfi_startproc
 1034                    @ args = 0, pretend = 0, frame = 16
 1035                    @ frame_needed = 0, uses_anonymous_args = 0
 1036 0000 00B5           push   {lr}
 1037                 .LCFI17:
 1038                    .cfi_def_cfa_offset 4
 1039 0002 85B0           sub   sp, sp, #20
 1040                 .LCFI18:
 1041                    .cfi_def_cfa_offset 24
 1042                    .loc 2 235 0
 1043 0004 0C4B           ldr   r3, .L58
 1044 0006 1B68           ldr   r3, [r3, #0]
 1045 0008 1846           mov   r0, r3
 1046                    .cfi_offset 14, -4
 1047 000a FFF7FEFF       bl   fix16_from_int
 1048 000e 0390           str   r0, [sp, #12]
 1049                    .loc 2 236 0
 1050 0010 0A4B           ldr   r3, .L58+4
 1051 0012 1B68           ldr   r3, [r3, #0]
 1052 0014 1846           mov   r0, r3
 1053 0016 FFF7FEFF       bl   fix16_from_int
 1054 001a 0290           str   r0, [sp, #8]
 1055                    .loc 2 237 0
 1056 001c 074B           ldr   r3, .L58+4
 1057 001e 1B68           ldr   r3, [r3, #0]
 1058 0020 1846           mov   r0, r3
 1059 0022 0399           ldr   r1, [sp, #12]
 1060 0024 FFF7FEFF       bl   fix16_div
 1061 0028 0190           str   r0, [sp, #4]
 1062                    .loc 2 238 0
 1063 002a 0198           ldr   r0, [sp, #4]
 1064 002c FFF7FEFF       bl   fix16_to_int
 1065 0030 0090           str   r0, [sp, #0]
 1066                    .loc 2 240 0
 1067 0032 05B0           add   sp, sp, #20
 1068 0034 00BD           pop   {pc}


Here are the variables in the map file:

Code: Select all

COMMON         0x20000610       0x40 objs/ads7843_lld.o
                0x20000610                g_det
                0x20000614                g_touchMatrix
                0x20000628                g_Y2Det
                0x2000062c                g_u16X2
                0x20000630                g_X3Det
                0x20000634                g_u16Y2
                0x20000638                g_Y3Det
                0x2000063c                g_X1Det
                0x20000640                g_u16Y1
                0x20000642                g_u16X1
                0x20000644                g_Y1Det
                0x20000648                g_u16X3
                0x2000064a                g_u16Y3
                0x2000064c                g_X2Det
                0x20000650                . = ALIGN (0x4)
                0x20000650                _bss_end = .
                0x20000650                PROVIDE (end, .)
                0x20000650                _end = .
                0x20000650                __heap_base__ = _end
                0x20001800                __heap_end__ = (__ram_end__ - __stacks_total_size__)
OUTPUT(TempBoard.elf elf32-littlearm)
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Application crash

Post by Giovanni »

Strange, it would be helpful to know which is the triggered exception, by default all the unhandled exceptions go into the same handler.

Giovanni
diurpaneus
Posts: 7
Joined: Thu Sep 15, 2011 3:37 pm

Re: Application crash

Post by diurpaneus »

I don't really know how to find out which exception is triggered. Could you please tell me how to find out?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Application crash

Post by Giovanni »

You just have to redefine the vector names defined in vectors.c, if you give a function the same name it replaces the default vector. It should be one of the following:

void NMIVector(void);
void HardFaultVector(void);
void MemManageVector(void);
void BusFaultVector(void);
void UsageFaultVector(void);
Post Reply