hankhank wrote on Monday, August 24, 2009:

Running freertos on AVR UC3A EVK1100 dev board and I have run into a few problems using queues.
I have two task, one which receives data from usb connection and another which does something with the data. I wish to setup up a queue to communicate between the two.
However whenever I attempt to place data onto the queue I can only add 1 item, despite the fact the queue is 32 items deep. If I add another element the code crashes and nothing else on the board continues to run.
Has anyone else had any issues, or can post some sample code demonstrating queue usuage between threads.
Currently I am declaring a global variable and using createqueue() inside one of the tasks.


davedoors wrote on Tuesday, August 25, 2009:

There are loads of examples in the demo/common/minimal directory of the download. Most likely you are passing bum data. Data is copied into the queue and then copied out so if you queue a pointer to some data make sure the data pointed to is not on a stack or anywhere else it could get overwritten. Also never use a standard queue function in an interrupt, only use the ones with FromISR in their name.

hankhank wrote on Wednesday, August 26, 2009:

FIXED: Was infact a problem with the linker settings. Narrowed it down to the memcpy instruction and it turns out the projects that come with the software framework I am using have a bogus linker option.
Fix from sma on avrfreaks

Well, the real question is: what are your gcc -mpart and -march options?
The UC3 memcpy() supports all alignements so this is not the problem. I suspect you link with something like -march=uc instead of -march=ucr1 (uc3a0512es) or -march=ucr2 (uc3a0512). This was an old toolchain bug that makes the compiler links with AP7 libraries (of course the AP7 memcpy() will crash on UC3).