Quality RTOS & Embedded Software

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


Loading

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
Scott,

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)?

Regards,
John


[ 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