AnsweredAssumed Answered

Atollic Toolchain Bug ?

Question asked by fm on Mar 14, 2012
Latest reply on Mar 16, 2012 by fm
I had a strange problem with the Atollic TruStudio Lite toolchain, V2.2.
In my project, I had the USART receiving data in the interrupt handler into a buffer, and a main thread evaluating this data, called from main.
First, I had defined that buffer as:
char  buffer[BUFSIZE] = {0};
in main.c, and declared it as:
extern char  *buffer;
in stm32f4xx_it.c.
Building the project this way, I received all bytes correctly, but the buffer contained nothing but zeros.
If I defined the buffer in the module containing the interrupt routine (stm32f4xx_it.c) and declared it in main.c, the buffer was filled correctly, but landed in the HardFaultHandler when trying to access this buffer.

The problem went away when I declared that buffer as:
extern char  buffer[BUFSIZE];
in stm32f4xx_it.c.

Did I miss something ?

For all the time I remember, it was legal to declare a pointer to an external variable, and use array subscription. With other words, a pointer and an array name were treated equally.

This was not a C++ project, as Atollic Lite does not support C++.