FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [July 2008 Threads] Kernel aborting during startup code, STR730Posted by John Hughes on July 28, 2008 I'm having some issues getting the kernel running on my STR730 board. I started with the STR75x GCC port and demo, modified for the differences in periferal api to provide the tick interrupt, and have everything compiled and flashed to the board. The problem I'm having is on when starting the scheduler. I've stepped through the code, and invariably I get an abort exception in vPortISRStartFirstTask() which from the STR75x port contains some inline ASM which I think sets the MCU registers up for starting the first task:
<pre> void vPortISRStartFirstTask( void ) { /* Simply start the scheduler. This is included here as it can only be called from ARM mode. */ asm volatile ( \ "LDRR0, =pxCurrentTCB \n\t"\ "LDRR0, [R0] \n\t"\ "LDRLR, [R0] \n\t"\
/* The critical nesting depth is the first item on the stack. */\ /* Load it into the ulCriticalNesting variable. */\ "LDRR0, =ulCriticalNesting\n\t"\ "LDMFDLR!, {R1}\n\t"\ "STRR1, [R0]\n\t"\ \ /* Get the SPSR from the stack. */\ "LDMFDLR!, {R0}\n\t"\ "MSRSPSR, R0\n\t"\ \ /* Restore all system mode registers for the task. */\ "LDMFDLR, {R0-R14}^\n\t"\ "NOP\n\t" \ \ /* Restore the return address. */\ "LDRLR, [LR, #+60]\n\t"\ \ /* And return - correcting the offset in the LR to obtain the */ \ /* correct address. \ "SUBS PC, LR, #4\n\t"\ ); } </pre>
The MCU aborts after the last line, which sets the PC to somewhere whack out of range. I dumped the registers after it loads them from the stack. These look like the values set on the stack in pxPortInitialiseStack(). It looks like something isn't right with LR. Am I right in thinking it's somehow loaded LR with data in the wrong position on the stack, or should it look like that?
<pre> r0 0x0 0 r1 0x1010101 16843009 r2 0x2020202 33686018 r3 0x3030303 50529027 r4 0x4040404 67372036 r5 0x5050505 84215045 r6 0x6060606 101058054 r7 0x7070707 117901063 r8 0x8080808 134744072 r9 0x9090909 151587081 r10 0x10101010 269488144 r11 0x11111111 286331153 r12 0x12121212 303174162 sp 0xa00002d0 0xa00002d0 lr 0xaaaaaaaa 2863311530 pc 0x80000f28 0x80000f28 <vPortISRStartFirstTask+40> fps 0x0 0 cpsr 0x400000df 1073742047 </pre>
Any hints would be appreciated. I've been tearing my hair out for the past few days on this.
Thanks
RE: Kernel aborting during startup code, STR730Posted by Richard on July 28, 2008 It is (very) highly likely that you have not put the processor into Supervisor mode before starting the scheduler. The easiest thing to set the processor into Supervisor mode prior to calling main() from the crt0 file.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|