Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Machine Check execption PPC405 Xilinx

Posted by Charles on February 17, 2009

I did not realise that you can run the software simulator through the hardware debugger. I can download code and single step looking at registers and variables.

The start of the loop in mem_alloc() line 262 causes a machine check exception. The line that causes this instruction lwz r5, -32408(r13) but r13 is not initialised (0xa5a5a5a5).

Standalone version r13 = 0x43728

Found that the pointer to the short data area (r13) and the pointer to the second small data area (r2) are
not initialised in pxPortInitialiseStack() in port.c (as in xil_crt0.s)

I have now added this into source/portable/GCC/PPC405_Xilinx/port.c

I've added:

extern const unsigned _SDA_BASE_;
extern const unsigned _SDA2_BASE_;

* Initialise the stack of a task to look exactly as if the task had been
* interrupted.
* See the header file portable.h.
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
/* Place a known value at the bottom of the stack for debugging. */
*pxTopOfStack = 0xDEADBEEF;

/* EABI stack frame. */
pxTopOfStack -= 20;/* Previous backchain and LR, R31 to R4 inclusive. */

/* Parameters in R13. */
*pxTopOfStack = ( portSTACK_TYPE ) &_SDA_BASE_; /* address of the first small data area */
pxTopOfStack -= 10;

/* Parameters in R3. */
*pxTopOfStack = ( portSTACK_TYPE ) pvParameters;

/* Parameters in R2. */
*pxTopOfStack = ( portSTACK_TYPE ) &_SDA2_BASE_;/* address of the second small data area */

/* R1 is the stack pointer so is omitted. */

*pxTopOfStack = 0x10000001UL;;/* R0. */
*pxTopOfStack = 0x00000000UL;/* USPRG0. */
*pxTopOfStack = 0x00000000UL;/* CR. */
*pxTopOfStack = 0x00000000UL;/* XER. */
*pxTopOfStack = 0x00000000UL;/* CTR. */
*pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler;/* LR. */
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* SRR0. */
*pxTopOfStack = portINITIAL_MSR;/* SRR1. */
*pxTopOfStack = ( portSTACK_TYPE ) vPortEndScheduler;/* Next LR. */
*pxTopOfStack = 0x00000000UL;/* Backchain. */

return pxTopOfStack;

RE: Machine Check execption PPC405 Xilinx

Posted by Dave on February 17, 2009
And that fixes the problem? Thanks for reporting this, can you add a bug to the SourceForge bug list. Thanks.

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

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner