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