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


AVR32 Global Variable Corruption

Posted by scott_ish on July 12, 2009
I'm trying to run freeRTOS on an ATMEL AVR32 (UC3 A0512) on the EVK1100 dev board.
I am having a problem with global variables being overwritten between task calls.
I took the example and added a global (declared as static volatile) to the top of the main.c file. I then try to copy that to a temp variable in the error check task on each cycle and debug to check its value. It seems to be getting corrupted and I don't know why. Usually it has the initial value correct but then it is either 1 or changes each cycle.
Anyone know about a specific AVR32 issue or I'm I just doing something stupid?

RE: AVR32 Global Variable Corruption

Posted by Mathias Zenger on July 13, 2009
What are you doing with your global variable (e.g. where and how do you read/write it)? What's its type? Are you sure it gets corrupted 'between' task calls? Check the AVR32 Studio help: C/C++ Development User Guide>Tasks>Running and debugging projects>Debugging. Perhaps you could add a watchpoint for your variable that breaks whenever the content has been changed.

RE: AVR32 Global Variable Corruption

Posted by John W. on July 14, 2009

You know what they say about globals.

As Mathias suggested above - you should be able to set a breakpoint on writes to the address of the global so the debugger will break - and that way you can look at your stack trace to see what task (and/or function) accessed the variable.

Can you use a semaphore and/or a queue to accomplish the same thing (and a lot safer)?


[ 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