Vector table init at rpi2 - Raspberry Pi Forums
hi! have troubles printing info occurred exception.
mentioned in subj target rpi2 i.e. bcm2836 , cortex a-7
followed kind of setup https://github.com/dwelch67/raspberrypi/tree/master/mmu
how vectors initialized , copied zeroth address how exception handlers like: in c code initialize uart , print vector table sure it's ok. print sctlr register, interesting because of bit 13 - bit selects base address of exception vectors. gives me following output: ok according objdump objdump
try generate exception in following way: i.e. jump addr content 0x00008040 undefinstr
, see .. nothing! not getting exception vector printing. according sctlr value, vector table mapped 0x00000000 address, means undef instruction vector located @ addr 0x04. if jump exception vector place try generate exception directly (i.e. asm("b 0x04")) exception printing function works ok! it's looks jumps addr when exception generated (for reason?) please, me in resolving issue?
mentioned in subj target rpi2 i.e. bcm2836 , cortex a-7
followed kind of setup https://github.com/dwelch67/raspberrypi/tree/master/mmu
how vectors initialized , copied zeroth address
code: select all
.globl _start _start: ldr pc,add_handler_00 ldr pc,add_handler_04 ldr pc,add_handler_08 ldr pc,add_handler_0c ldr pc,add_handler_10 ldr pc,add_handler_14 ldr pc,add_handler_18 ldr pc,add_handler_1c add_handler_00: .word reset add_handler_04: .word handler_04 add_handler_08: .word handler_08 add_handler_0c: .word handler_0c add_handler_10: .word handler_10 add_handler_14: .word handler_14 add_handler_18: .word handler_18 add_handler_1c: .word handler_1c // entry point uart bootloader reset: mov r0,#0x8000 mov r1,#0x0000 // setup vectors ldmia r0!,{r2,r3,r4,r5,r6,r7,r8,r9} stmia r1!,{r2,r3,r4,r5,r6,r7,r8,r9} ldmia r0!,{r2,r3,r4,r5,r6,r7,r8,r9} stmia r1!,{r2,r3,r4,r5,r6,r7,r8,r9}
code: select all
handler_04: mov r0,#0x04 ldr r3, =exception_handler bx r3 ... handler_1c: mov r0,#0x1c ldr r3, =exception_handler bx r3 ... void exception_handler(uint32_t r0) { guart->puts("exception handler reached code: "); guart->puts(int_to_str(exception_str, r0, 16)); guart->puts("\n"); while(1){}; }
code: select all
(int = 0; < 16; i++) { uart.puts(int_to_str(exception_str, vt[i], 16)); uart.puts("\n"); } uint32_t reg; asm volatile("mrc p15, 0, %[r], c1, c0, 0": [r]"=r" (reg)::); uart.puts("\n"); uart.puts(int_to_str(exception_str, reg, 16));
code: select all
e59ff018 e59ff018 e59ff018 e59ff018 e59ff018 e59ff018 e59ff018 e59ff018 8040 8094 80a0 80ac 80b8 80c4 80d0 80dc c50878
code: select all
disassembly of section .text: 00008000 <__start>: 8000: e59ff018 ldr pc, [pc, #24] ; 8020 <add_handler_00> 8004: e59ff018 ldr pc, [pc, #24] ; 8024 <add_handler_04> 8008: e59ff018 ldr pc, [pc, #24] ; 8028 <add_handler_08> 800c: e59ff018 ldr pc, [pc, #24] ; 802c <add_handler_0c> 8010: e59ff018 ldr pc, [pc, #24] ; 8030 <add_handler_10> 8014: e59ff018 ldr pc, [pc, #24] ; 8034 <add_handler_14> 8018: e59ff018 ldr pc, [pc, #24] ; 8038 <add_handler_18> 801c: e59ff018 ldr pc, [pc, #24] ; 803c <add_handler_1c> 00008020 <add_handler_00>: 8020: 00008040 .word 0x00008040 .... 0000803c <add_handler_1c>: 803c: 000080dc .word 0x000080dc
code: select all
asm("b 0x20");
, see .. nothing! not getting exception vector printing. according sctlr value, vector table mapped 0x00000000 address, means undef instruction vector located @ addr 0x04. if jump exception vector place try generate exception directly (i.e. asm("b 0x04")) exception printing function works ok! it's looks jumps addr when exception generated (for reason?) please, me in resolving issue?
i keep meaning check out/work on mmu stuff rpi2. rpi3 coming fun. ill try motivated. big difference lf late last year rpi2 in hyp mode, rpi1 not/doesnt have mode has traditional svc, user, irq, fiq modes. there combination of stuff cant and/or addresses wrong because of mode guess, have not looked @ it, have not finished porting examples rpi a/b+ nor rpi2, did of blinking led ones , interrupt one.
raspberrypi
Comments
Post a Comment