amineos1 wrote on Saturday, August 02, 2014:
Hello,
it’s strange but it’s microchip stupid compiler, the problem touchs not only synchronization mechanisms (semaphores mutexes …) but all normal variables (arrays etc…)
I will give you an example : when I fill a STATIC array with data in “FFT TASK” the UART TASK sends to the computer zeros, so in fact, the FFT TASKS doesnt fill the static array but it’s filling another thing I don’t know really which one, that’s really odd) and this is the compiler fault !
if the array contains zeros, it means that it has not been filled, but when I give to the FFT task or any normal task a pointer the array or the variable to modify, in fact, it works !
I want to say a message to those who want to use your work under MPLABX (Microchip PIC32) yesterday I had many problems with interrupts, I spend hours to find the solution, so you can compile : you must use extern “C” with the functions that will be ISRs and not in the prototype of the ISRs wrapper as commonly known, this is for the compilation.
if the interrupt level of the interrupt source (e.g. timer) which you have put in its IRQ register is higher than the level you have put in the ISR wrapper prototype (the iplx argument where x is a number between 1 and 7) your application will crash (you will have this ugly message in debug mode console : No source code lines were found at current PC …)
Stefano, the hardware initialization method with a task crashed my application so when I put instructions that perform dynamic allocation inside the constructor instead of that method, my application didn’t crash, but I noticed this problem with only one task… so I avoid using this method.
I think that all those problems come from the LAME microchip XC32++ compiler, if you dont know : optimization are not available for the free version of XC32++, this is really a joke, if the compiler doesnt’t do the optimization work, who will do it ??? Microchip is a tightwad company, you will notice that also in their dev kits I’m glad I started working with the STM32.
Stefano, did you know that in order to work with interrupts under FreeRTOS and PIC32 we must use assembly wrappers (a single .S file for each ISR inside we must put the name of the C written ISR) ? does this exist also with the STM32 ? I started working with the STM32F4 and I don’t know how ISR’s are managed under this ARM based mcu and its FreeRTOS port, I hope that you can give a fast answer to my question before I start searching the information and Thank you in advance.
I ll look at the example you gave me, but I know that’s unuseful since it’s the compiler fault, I must avoid using static variables inside the tasks, the program will compile but it will not run as expected because the Microchip is not reliable when compiling C++ projects.
In debug mode I can’t even browse the insctructions !!!
To conclude, your work works under PIC32 but tasks must use pointers to the mutexes, semaphores, queues or even arrays or simple variables… otherwise the application will not work, in debug mode, in the IDE console we can read :
“No source code lines were found at current PC 0x…”
if my advices concerning interruptions are not respected you will have the same message,
avoid also to use HardwareInitalize and put your hardware initialization in the constructor.
Thank you and sorry for bad english.