Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI C/C++ Compiler
I have bare-metal application which always runs fine under debug, but crashes consistently when the same code is loaded into ram and executed from my secondary bootloader.
Loading of the application code has been verified, and the branch to its start address works as well. The culprit is always the "svc" instruction used by the (standard) start files in the application, and the problem is that no specific svc exception vector has been loaded -- it just goes to a standard branch-to-myself loop of death.
Curiously, under debug, you can step through the svc command, and it goes to the exception vector ok, but then magically returns to the instructions following the svc. But when loaded and executed by the bootloader the svc exception is taken correctly, and it ends up in the death loop.
I've tried a lot of different ways to get around this, and put too many hours into it, all to no avail. Can someone please help out here?
Here's a dump from the reset vector (at 0x86000000) through to the svc instruction in _start . .
86000000: E59FF018 ldr pc, [pc, #0x18]
86000004: E51FF008 ldr pc, [pc, #-8]
86000008: E59FF018 ldr pc, [pc, #0x18] <<< svc exception (load pc from address 0x86000028)
8600000c: E51FF008 ldr pc, [pc, #-8]
86000010: E51FF008 ldr pc, [pc, #-8]
86000014: E51FF008 ldr pc, [pc, #-8]
86000018: E51FF008 ldr pc, [pc, #-8]
8600001c: E51FF008 ldr pc, [pc, #-8]
86000020: 86000050 .word 0x86000050
86000024: 00000000 andeq r0, r0, r0
86000028: 86000049 strhi r0, [r0], -r9, asr #32 << thumb mode vector to 0x86000048
8600002c: 00000000 andeq r0, r0, r0
86000030: 00000000 andeq r0, r0, r0
86000034: 00000000 andeq r0, r0, r0
86000038: 00000000 andeq r0, r0, r0
8600003c: 00000000 andeq r0, r0, r0
86000040: 8600004F strhi r0, [r0], -pc, asr #32
86000044: E7FEE7FE udf #0xee7e }
86000048: E7FEE7FE udf #0xee7e } pairs of Thumb instr's, all branch to self
8600004c: E7FEE7FE udf #0xee7e }
Entry():
86000050: E59F002C ldr r0, [pc, #0x2c]
86000054: EE0C0F10 mcr p15, #0, r0, c12, c0, #0
86000058: EE113F50 mrc p15, #0, r3, c1, c0, #2
8600005c: E383360F orr r3, r3, #0xf00000
86000060: EE013F50 mcr p15, #0, r3, c1, c0, #2
86000064: E3A03000 mov r3, #0
86000068: E3A00101 mov r0, #0x40000000
8600006c: EEE80A10 vmsr fpexc, r0
86000070: EE073F95 mcr p15, #0, r3, c7, c5, #4
86000074: E59FA00C ldr r10, [pc, #0xc] <<<<< load _start address from 0x86000088
86000078: E1A0E00F mov lr, pc
8600007c: E12FFF1A bx r10
86000080: E24FF008 sub pc, pc, #8
86000084: 86000000 strhi r0, [r0], -r0
86000088: 86000128 strhi r0, [r0], -r8, lsr #2 <<<<<<<<<< _start
8600008c: 00000000 andeq r0, r0, r0
.....
_start
86000128: E3B00016 movs r0, #0x16
8600012c: E28F1F4A add r1, pc, #0x128
86000130: EF123456 svc #0x123456 <<<<< CRASH - no real vector loaded for svc exception
86000134: E59F0120 ldr r0, [pc, #0x120]
86000138: E5901004 ldr r1, [r0, #4]
8600013c: E59F2138 ldr r2, [pc, #0x138]
86000140: E5821000 str r1, [r2]
[My setup is:
Custom PCB
AM3352BZCZ30
CCS Version: 6.1.2.00015
bios_6_45_01_29
pdk_am335x_1_0_3
GNU v4.9.3 (Linaro)
Win 7 64-bit]
Thanks,
GerryL