Quality RTOS & Embedded Software

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


Loading

PIC32 Release vs Debug problem

Posted by https://www.google.com/accounts on June 11, 2012
I'm having a strange problem. I have an application that uses FreeRTOS and I've been building debug versions on MPLAB-X for a couple of months now. I switched to a release build today and the program builds but stops running after starting the scheduler. I've stripped out all of my code except the toggling of an LED when a queue times out in the main loop. There is now only one task running with a single queue. If I switch to a debug build, it works fine. It's a newer processor from Microchip, the PIC32MX250F128D. I have another application for a different client that does not use FreeRTOS and it builds and deploys a release version with no problems. I have the Dotstack Bluetooth stack in the app that doesn't work in release mode but I have it commented out for now. I know it's probably something stupid that I'm missing but... I upgraded to the latest stable build of FreeRTOS, V 7.1.1 and that didn't fix the problem. I recently upgraded the compiler to the new xC32 compiler and have tried it and the 2.02 version of the C32 compiler and neither one works. Same symptoms, builds fine, stops after starting up the task scheduler.

Any ideas? Thanks in advance...

RE: PIC32 Release vs Debug problem

Posted by MEdwards on June 11, 2012
XC32 is GCC right? How far up did you crank the optimization? I have no direct experience of that particular compiler, but it is not uncommon for GCC to be overly optimistic at the top optimization levels. What happens if you optimize at O2? There will not be much difference between O2 and O3 in performance anyway.

RE: PIC32 Release vs Debug problem

Posted by Richard on June 11, 2012
I have just tried the following setup:

PIC32MX460
(X)C32 V2.02
Optimisation set to -Os
Release build
Standard FreeRTOS PIC32 demo running on an Explorer 16 board.

So far, everything is running without any errors being indicated...it has been running since about ten minutes after your post and is still running on the desk next to me now.

How long is yours taking to fall over?

Regards.

RE: PIC32 Release vs Debug problem

Posted by https://www.google.com/accounts on June 12, 2012
I have optimizations turned off for now. I don;t usually turn them on until everything is up and running solid.

My code runs until I call xQueueReceive( xExecQueue, &xNewMessage, 10 / portTICK_RATE_MS );

It never returns in release mode but works fine in debug mode.

I found another thread on this forum from ulmus71 who is having the same problem with a different PIC32 part.

RE: PIC32 Release vs Debug problem

Posted by https://www.google.com/accounts on June 12, 2012
This is the line of code I'm using:

if ( xQueueReceive( xExecQueue, &xNewMessage, 10 / portTICK_RATE_MS ) == pdTRUE )
{
}

Just for clarification...

RE: PIC32 Release vs Debug problem

Posted by Richard on June 12, 2012
So if not the optimisation level, what is different between your debug and release builds?

Regards.

RE: PIC32 Release vs Debug problem

Posted by https://www.google.com/accounts on June 12, 2012
Same linker file. I have not set anything different between the debug and release modes. What do you think the problem is related to? It seems as if the timer isn't running that is used for the scheduler.

RE: PIC32 Release vs Debug problem

Posted by Richard on June 12, 2012
If the debug build works, but the release build does not work, there must be a difference between the two. I'm afraid I cannot guess what that might be - you have both builds in front of you and I don't. Maybe you could look at the command line generated by two builds (shown as the code builds) to see what the differences are.

Regards.

RE: PIC32 Release vs Debug problem

Posted by https://www.google.com/accounts on June 13, 2012
Using a bit twiddler to toggle an LED I managed to confirm my suspicion. Timer 1 is used by the FreeRTOS scheduler and is not working properly in the release build. I put the LED toggle in the starting of the timer and the code gets there. If I move it to the T1 interrupt handler, it never gets there. Interrupts are enabled because my timer 2 interrupt will toggle the LED but the timer 1 interrupt never fires. I'll take a look at the command lines next....

RE: PIC32 Release vs Debug problem

Posted by https://www.google.com/accounts on July 3, 2012
I found the problem. It turned out to be the Bluetooth stack, which required an update to be used with the XC32 compiler. Even though I commented out it's use in my first testing, it had to be removed entirely from the project. I received an update from the stack vendor and everything is happy now.


[ 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