cancel
Showing results for 
Search instead for 
Did you mean: 

porting from FREERTOS to RTX

chandra mouli
Associate
Posted on November 09, 2017 at 13:35

Hi,

I am porting my code from FREERTOS to RTX on stm32 nucleo platform,but once data transmission starts programs stucks with in second in hardfault handler because of the stack over flow, but if I put some delay between data transfer application runs for minutes.

The same application is working fine in freeRTOS.

In order to back trace I added  code in the hard fault handler but still I am not able get the function which caused the hard fault.

Can any one help me out.

Below is what I added

HardFault_Handler\

                PROC

                B    .

                TST LR, #4

                ITE EQ

                MRSEQ R0, MSP

                MRSNE R0, PSP

                MOV R1, LR

                IMPORT hard_fault_handler_c[DATA]

                B hard_fault_handler_c

               ENDP

void hard_fault_handler_c (unsigned int * hardfault_args, unsigned int lr_value)

{

 volatile unsigned int stacked_r0 ;

 volatile unsigned int stacked_r1 ;

 volatile unsigned int stacked_r2 ;

 volatile unsigned int stacked_r3 ;

 volatile unsigned int stacked_r12 ;

 volatile unsigned int stacked_lr ;

 volatile unsigned int stacked_pc ;

 volatile unsigned int stacked_psr ;

 volatile unsigned int _CFSR ;

 volatile unsigned int _HFSR ;

 volatile unsigned int _DFSR ;

 volatile unsigned int _AFSR ;

 volatile unsigned int _BFAR ;

 volatile unsigned int _MMAR ;

stacked_r0 = ((unsigned long)hardfault_args[0]) ;

stacked_r1 = ((unsigned long)hardfault_args[1]) ;

stacked_r2 = ((unsigned long)hardfault_args[2]) ;

stacked_r3 = ((unsigned long)hardfault_args[3]) ;

stacked_r12 = ((unsigned long)hardfault_args[4]) ;

stacked_lr = ((unsigned long)hardfault_args[5]) ;

stacked_pc = ((unsigned long)hardfault_args[6]) ;

stacked_psr = ((unsigned long)hardfault_args[7]) ;

  // Configurable Fault Status Register

  // Consists of MMSR, BFSR and UFSR

_CFSR = (*((volatile unsigned long *)(0xE000ED28))) ;

// Hard Fault Status Register

_HFSR = (*((volatile unsigned long *)(0xE000ED2C))) ;

// Debug Fault Status Register

_DFSR = (*((volatile unsigned long *)(0xE000ED30))) ;

// Auxiliary Fault Status Register

_AFSR = (*((volatile unsigned long *)(0xE000ED3C))) ;

// Read the Fault Address Registers. These may not contain valid values.

// Check BFARVALID/MMARVALID to see if they are valid values

// MemManage Fault Address Register

_MMAR = (*((volatile unsigned long *)(0xE000ED34))) ;

// Bus Fault Address Register

_BFAR = (*((volatile unsigned long *)(0xE000ED38))) ;

__asm('BKPT #0\n') ; // Break into the debugger

 

}

Regards

Chandra

0 REPLIES 0