FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [July 2009 Threads] AVR32 Global Variable CorruptionPosted 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 CorruptionPosted 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 CorruptionPosted 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
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|