Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Kernel aborting during startup code, STR730

Posted 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, STR730

Posted 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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists