FreeRTOS Sucessfully Ported - Raspberry Pi Forums
hi all,
first post raspberrypi forums, i've been watching while. 1 of requests amongst bare-metal programmers port of freertos.
on last few days i've managed create functioning port. shall provide source-code shortly.
main delay source release closely coupled own os, , therefore need remove dependencies. used own api's configure interrupts, , timer etc.
1 problem had used previous port arm11, didn't work properly. made function calls in vtickisr like:
volatile __asm("bl vtaskincrementtick");
seemed result in lr being modified on entry function = pc, wrong.
changing call vtaskincrementtick(); fixed problem.
have no idea why, because actual instructions should same. i'll investigate more, wondered if had seen this?
please let me know how interested people functioning port, , i'll publish asap.
thanks,
james walmsley (author fullfat - www.fullfat-fs.co.uk).
first post raspberrypi forums, i've been watching while. 1 of requests amongst bare-metal programmers port of freertos.
on last few days i've managed create functioning port. shall provide source-code shortly.
main delay source release closely coupled own os, , therefore need remove dependencies. used own api's configure interrupts, , timer etc.
1 problem had used previous port arm11, didn't work properly. made function calls in vtickisr like:
volatile __asm("bl vtaskincrementtick");
seemed result in lr being modified on entry function = pc, wrong.
changing call vtaskincrementtick(); fixed problem.
have no idea why, because actual instructions should same. i'll investigate more, wondered if had seen this?
please let me know how interested people functioning port, , i'll publish asap.
thanks,
james walmsley (author fullfat - www.fullfat-fs.co.uk).
i worked out problem bad branching mentioned!
if function calls in function made through inline assembly compiler doesn't know push lr stack on function entry. therefore end-up corrupting lr making function call.
imagine reason arm11 port using did this, vtickisr() function called directly arm on isr entry, , therefore corruption wouldn't have mattered.
in port matter, use bottom half irq handler find actual irqn has triggered first.
in anycase, know reason me pulling hairs our while!
below listings curious!
broken code:
if function calls in function made through inline assembly compiler doesn't know push lr stack on function entry. therefore end-up corrupting lr making function call.
imagine reason arm11 port using did this, vtickisr() function called directly arm on isr entry, , therefore corruption wouldn't have mattered.
in port matter, use bottom half irq handler find actual irqn has triggered first.
in anycase, know reason me pulling hairs our while!
below listings curious!
broken code:
code: select all
//void vtickisr( void ) __attribute__((naked)); void vtickisr( void ) { 13608: e52db004 push {fp} ; (str fp, [sp, #-4]!) // ooops no saving of lr 1360c: e28db000 add fp, sp, #0 //__asm volatile( "bl vtaskincrementtick" ); //vtaskincrementtick(); __asm volatile("bl vtaskincrementtick"); 13610: ebfffc5c bl 12788 <vtaskincrementtick> #if configuse_preemption == 1 __asm volatile( "bl vtaskswitchcontext" ); 13614: ebfffd2c bl 12acc <vtaskswitchcontext> //vtaskswitchcontext(); #endif pregs->cli = 0; 13618: e59f3014 ldr r3, [pc, #20] ; 13634 <vtickisr+0x2c> 1361c: e5933000 ldr r3, [r3] 13620: e3a02000 mov r2, #0 13624: e583200c str r2, [r3, #12] } 13628: e28bd000 add sp, fp, #0 1362c: e8bd0800 pop {fp} 13630: e12fff1e bx lr 13634: 000155a8 andeq r5, r1, r8, lsr #11 code: select all
//void vtickisr( void ) __attribute__((naked)); void vtickisr( void ) { 13608: e92d4800 push {fp, lr} // note saving context of lr! 1360c: e28db004 add fp, sp, #4 //__asm volatile( "bl vtaskincrementtick" ); vtaskincrementtick(); 13610: ebfffc5c bl 12788 <vtaskincrementtick> //__asm volatile("bl vtaskincrementtick"); #if configuse_preemption == 1 __asm volatile( "bl vtaskswitchcontext" ); 13614: ebfffd2c bl 12acc <vtaskswitchcontext> //vtaskswitchcontext(); #endif pregs->cli = 0; 13618: e59f300c ldr r3, [pc, #12] ; 1362c <vtickisr+0x24> 1361c: e5933000 ldr r3, [r3] 13620: e3a02000 mov r2, #0 13624: e583200c str r2, [r3, #12] } 13628: e8bd8800 pop {fp, pc} 1362c: 000155a0 andeq r5, r1, r0, lsr #11
raspberrypi
Comments
Post a Comment