Topic : Fatal Error C041

Forum : ST7/STM8

Original Post
Post Information Post
September 15, 2010 - 11:21pm
Guest

I'm getting this error:
*** FATAL ERROR C041 IN LINE 46 OF src/FailTest.c : (null) (00,00,00,00,00,00,45)

compiling the following code:

#include
#define DELAY_1_US() do { \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
nop(); \
}while(0)

#define DELAY_10_US() do { \
DELAY_1_US(); \
DELAY_1_US(); \
DELAY_1_US(); \
DELAY_1_US(); \
DELAY_1_US(); \
DELAY_1_US(); \
DELAY_1_US(); \
DELAY_1_US(); \
DELAY_1_US(); \
DELAY_1_US(); \
}while(0)

static void fail()
{
uint8_t testvar = 0;
if(testvar)
{
DELAY_10_US();
}
else
{
DELAY_1_US();
}
testvar = 1;
}

If I comment out the testvar assignment at the end it compiles fine.
The command line I'm using is:

C:/Program Files/Raisonance/Ride"/bin/RCSTM8.exe src/FailTest.c OBJECT\(src/FailTest.o\) PR\(src/FailTest.lst\) PIN\(""C:/Program Files/Raisonance/Ride"/inc/ST7"\) PIN\(""C:/Program Files/Raisonance/Ride"/inc"\) PIN\(.\) PIN\(lib/inc\) WRV\(0\) STM8\(SMALL\) DGC\(data\) AUTO OT\(7,SIZE\) NOIS CO SB LAOB NODEBUG

I'm running it from a Makefile in Cygwin, hence the backslashes to escape the parentheses. I get the same error running from STVD, though.

The compiler version string is:
RCSTM8 COMPILER V2.28.10.092 Lite (32 Kb code limited)

Replies
Post Information Post
+1
0
-1
September 16, 2010 - 9:49am
Raisonance Support Team

Hi,

Thanks for your report.
This problem has been reproduced in our labs and our engineers are working on it.

The problem comes from the o(3) optimization level, so as a temporary workaround you can compile this file as O(2).

The bug will be fixed in the next RKit-STM8 release.

Regards,