Quality RTOS & Embedded Software

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


Loading

Using gcc -finstrumental-functions for profiling on cortex-m1

Posted by qmor on October 13, 2016

Hello, i have a project for cortex-m1 with FreeRTOS and i'm trying to find out hard faults reasons. Because of that i want to use -finstrumental-functions of GCC compiler. Unfortunatelly this option cause new Hard Fault somethere at the beginning of execution. Did someone try to use this option on ARM arch? Thich FreeRTOS function should be marked with attribute((noinstrumentfunction))? Or maybe i need to use some other tricks?

Thanks in advance


Using gcc -finstrumental-functions for profiling on cortex-m1

Posted by xz8987f on October 13, 2016

Hi Oleg, yes, I have used that function both for M0+ and M4, but not for M1 (which is available only for FPGA's?). See https://mcuoneclipse.com/2015/04/04/poor-mans-trace-free-of-charge-function-entryexit-trace-with-gnu-tools/ But I think you won't find easier your problem with that option: what you need is a hard fault handler (have you used one? See https://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/).

I hope this helps, Erich


Using gcc -finstrumental-functions for profiling on cortex-m1

Posted by qmor on October 13, 2016

~~~ But I think you won't find easier your problem with that option: what you need is a hard fault handler (have you used one? ~~~ Thanks. I have Hard Fault handler, but unfortunatelly it's not easy to understand that's wrong with code.For example stacked_pc points to code like

add r3,#8

Why it could cause Fault?


Using gcc -finstrumental-functions for profiling on cortex-m1

Posted by xz8987f on October 13, 2016

keep in mind that the PC usually is after the instruction who caused the problem. And you need to check the stacked LR as well.


Using gcc -finstrumental-functions for profiling on cortex-m1

Posted by qmor on October 13, 2016

Okay. Thanks a lot. I'll describe my problem more deeper. I've got an application with a several tasks. Couple of these tasks is using for external interface communication (CAN and 1553B) and one of the tasks is using to compute some math. If we are enable this task sooner or later app will end in Hard Fault. Usualy it's crashes at the same place, and it's looks like some unaligment access. I dont understand how function may be executed for a thousands times without any problem and then suddenly crash with unaligment memory access. Can you suggest something to check?


Using gcc -finstrumental-functions for profiling on cortex-m1

Posted by xz8987f on October 13, 2016

Are you indeed running on an FPGA model? I suggest to run your code on a real M0+ as it could be that your syntesized model has an issue? Is that unaligned access on the stack (so maybe a stack problem)?


Using gcc -finstrumental-functions for profiling on cortex-m1

Posted by qmor on October 14, 2016

Are you indeed running on an FPGA model?

No, i'm using Russian SoC 1986VE1T which is real SoC.

Is that unaligned access on the stack (so maybe a stack problem)?

I think the same, because of that i want to trace execution to see which functions called just before hard fault, i hope this will help me to find a problem.


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 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.


Careers

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

Renesas

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