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

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 ]    [ 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