cancel
Showing results for 
Search instead for 
Did you mean: 

#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:56(8+3) bad struct/union operand

MQi.1
Senior II

I used COSMIC in STVP for stm8s001j3, when I built, it shown:

----------- Project test_stm8s001j3 - STM8 Cosmic - Configuration Debug -------------
 
Compiling f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c...
cxstm8 -if:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver -if:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\inc +debug -pxp -no -l +mods0 -pp -iF:\CXSTM8\Hstm8  -clDebug\ -coDebug\ f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c 
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:56(8+3) bad struct/union operand
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:57(8+3) bad struct/union operand
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:58(8+3) bad struct/union operand
...
 
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:365(26+12) ADC2_CSR_EOC undefined
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:365(2+4) ADC2 undefined
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:376(26+3) bad struct/union operand
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:376(32+12) ADC2_CSR_EOC undefined
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:376(20+4) ADC2 undefined
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:386(8+3) bad struct/union operand
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:386(26+12) ADC2_CSR_EOC undefined
#error cpstm8 f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:386(2+4) ADC2 undefined
f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c:
 The command: "cxstm8 -if:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver -if:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\inc +debug -pxp -no -l +mods0 -pp -iF:\CXSTM8\Hstm8  -clDebug\ -coDebug\ f:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\src\stm8s_adc2.c " has failed, the returned value is: 1
exit code=1.
 
test_stm8s001j3.elf - 86 error(s), 0 warning(s)

3 REPLIES 3
MQi.1
Senior II

I found a solution here - http://embedded-lab.com/blog/starting-stm8-microcontrollers/6/

During compilation, you may get tons of errors for hardware files that are not available in your target STM8S micro. For instance, CAN hardware is not available in STM8S003K3 and so if you have added CAN source and header files you will get an error for that. Once identified by the error messages, the corresponding header and source files for that particular hardware must be removed.

​

while it still has an error:

Compiling main.c...
cxstm8 -if:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver -if:\stm8\stm8s_stdperiph_lib\libraries\stm8s_stdperiph_driver\inc +debug -pxp -no -l +mods0 -pp -iF:\CXSTM8\Hstm8  -clDebug\ -coDebug\ main.c 
#error cpstm8 main.c:5 bad #include syntax

my code is this:

#include “stm8s.h�? 
 
main()
{
	while (1);
}

what's wrong with the "#include" ?

when I commented it, it was OK.

WilkoL
Senior

"During compilation, you may get tons of errors for hardware files that are not available"

Another way of getting a lot of errors is forgetting a semicolon somewhere higher up in your code. Doing it at the end of another file that you #include makes it even more fun. :grinning_face: