Hi, after long time I discovered that the error:
mingw32-make: *** [KL15_397200_OUTDOOR_SIREN_rev2_dual.elf] Error 1 |
was because of I had the same variable definition in two different .c file.
but no warning hint me the reason.
I wander if there is the possibility to set the compiler to warn me when I define the same variable twice.
Thank you.
Stefano
解決済! 解決策の投稿を見る。
Hi Stefano,
In fact the error message is reproduced.
1st Build or build after clean operation I got in Console:
+++++++++++++++++++++
'Building target: KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Executing target #26 KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Invoking: ARM Ltd Windows GCC C Linker'
"F:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"KL15_397200_OUTDOOR_SIREN_rev2_dual.args" -o"KL15_397200_OUTDOOR_SIREN_rev2_dual.elf"
../codice/inizializzazioni.c: In function 'inizializza':
../codice/inizializzazioni.c:94:1: warning: implicit declaration of function 'init_spi' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:99:1: warning: implicit declaration of function 'init_Shock' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:100:1: warning: implicit declaration of function 'init_ADC0' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:101:1: warning: implicit declaration of function 'init_Batteria' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:102:1: warning: implicit declaration of function 'init_LPTMR0' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:7:12: warning: unused variable 'i' [-Wunused-variable]
../codice/batteria.c: In function 'leggiBatteria':
../codice/batteria.c:32:2: warning: implicit declaration of function 'sprintf' [-Wimplicit-function-declaration]
../codice/batteria.c:33:2: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../codice/LPTMR0.c: In function 'LPTMR0_ISR':
../codice/LPTMR0.c:44:2: warning: implicit declaration of function 'gestione_sirena' [-Wimplicit-function-declaration]
../codice/LPTMR0.c:279:3: warning: implicit declaration of function 'gestione_sintesi_vocale' [-Wimplicit-function-declaration]
../codice/radio.c: In function 'bRadio_Check_Tx_RX':
../codice/radio.c:92:17: warning: unused variable 'shexx2' [-Wunused-variable]
../codice/radio.c: In function 'miaStartTx':
../codice/radio.c:187:43: warning: unused parameter 'pioRadioPacket' [-Wunused-parameter]
../codice/radio_cw.c: In function 'invia_cw':
../codice/radio_cw.c:22:2: warning: implicit declaration of function 'radio_init' [-Wimplicit-function-declaration]
../codice/spi_radio.c: In function 'SpiReadWrite':
../codice/spi_radio.c:114:11: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
../codice/sirena.c: In function 'sirenaSetVolume':
../codice/sirena.c:335:10: warning: unused variable 'i' [-Wunused-variable]
../codice/sintesi.c: In function 'gestioneSPI':
../codice/sintesi.c:109:12: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
../codice/sintesi.c:108:11: warning: variable 'bValue' set but not used [-Wunused-but-set-variable]
../codice/uart0.c: In function 'riceviCar':
../codice/uart0.c:92:14: warning: unused variable 'len' [-Wunused-variable]
../codice/uart0.c: In function 'riceviNum':
../codice/uart0.c:128:2: warning: pointer targets in passing argument 1 of 'atol' differ in signedness [-Wpointer-sign]
../codice/uart0.c: In function 'riceviNumHex':
../codice/uart0.c:143:2: warning: pointer targets in passing argument 1 of 'strtol' differ in signedness [-Wpointer-sign]
../codice/uart0.c: In function 'aspettaCar':
../codice/uart0.c:163:14: warning: unused variable 'len' [-Wunused-variable]
../codice/si446x_api_lib.c: In function 'si446x_set_property':
../codice/si446x_api_lib.c:257:29: warning: 'uint8_t' is promoted to 'int' when passed through '...' [enabled by default]
../Sources/main.c: In function 'main':
../Sources/main.c:108:3: warning: implicit declaration of function 'inizializza' [-Wimplicit-function-declaration]
../Sources/main.c:109:3: warning: implicit declaration of function 'invia_cw' [-Wimplicit-function-declaration]
../Sources/main.c:110:1: warning: pointer targets in passing argument 1 of 'stampa' differ in signedness [-Wpointer-sign]
../Sources/main.c:379:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:380:4: warning: implicit declaration of function 'riceviNum' [-Wimplicit-function-declaration]
../Sources/main.c:385:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:391:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:396:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:402:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:408:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:414:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:420:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:438:7: warning: implicit declaration of function 'sprintf' [-Wimplicit-function-declaration]
../Sources/main.c:439:6: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:489:4: warning: pointer targets in passing argument 1 of 'stampa' differ in signedness [-Wpointer-sign]
../Sources/main.c:100:14: warning: unused variable 'volume' [-Wunused-variable]
../Project_Settings/Startup_Code/__arm_end.c: In function '_ExitProcess':
../Project_Settings/Startup_Code/__arm_end.c:69:30: warning: unused parameter 'status' [-Wunused-parameter]
mingw32-make: *** [KL15_397200_OUTDOOR_SIREN_rev2_dual.elf] Error 1
+++++++++++++++++++++
Here the error is generated without all information.
At this time perform a second build and I got:
+++++++++++++++++++++
**** Build of configuration FLASH for project KL15_397200_OUTDOOR_SIREN_rev2_dual_trans2 ****
"F:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" -j8 all
'Building target: KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Executing target #26 KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Invoking: ARM Ltd Windows GCC C Linker'
"F:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"KL15_397200_OUTDOOR_SIREN_rev2_dual.args" -o"KL15_397200_OUTDOOR_SIREN_rev2_dual.elf"
./codice/radio.o:(.rodata.Radio_Configuration_Data_Array_433+0x0): multiple definition of `Radio_Configuration_Data_Array_433'
./codice/radio_cw.o:(.rodata.Radio_Configuration_Data_Array_433+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [KL15_397200_OUTDOOR_SIREN_rev2_dual.elf] Error 1
+++++++++++++++++++++
Now the linker detects multiple definition.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Stefano,
I think you're using MCU V10.6.
I don't think there is a problem with the compiler option or not.
In all case the duplicated variable is checked at link phase.
Under Eclipse, by default the "Problems" component is displayed.
this component is not providing lot of information regarding the problem.
When there is an error (in Problems Component) when you build a project, to have more details, I recommend to switch to the Console component.
The console component will capture all exchange messages sent to (command line tool) and generated (information, warning and error) by tools (Assembler, compiler, linker etc ...).
In this dialog you will have exactly the error reported by the tool.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Pascal, console window show me only the point where the compiler stops but no indication about what is the error. It's strange because in general compiler warn me if there is a duplicated #define.
Anyway thank you.
Stefano,
I think this is architecture dependent.
I've created an example with the wizard for KL15 and define the test_val in main.c file and duplicated in test.h file with different value.
The compiler detects the problem.
Attached the example.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Pascal, I'm using CW 10.6 and I confirm the compiler detects duplicated #define but I referred to duplicated global variables in two different .c file. The compiler is not able to highlight the cause.
Stefano,
I've created another example using test_val global variable in 2 .c files.
When I build the project I got a linker error:
'Invoking: ARM Ltd Windows GCC C Linker'
"F:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"test_kinetis.args" -o"test_kinetis.elf"
./Sources/main.o:(.data.test_val+0x0): multiple definition of `test_val'
./Sources/test.o:(.data.test_val+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [test_kinetis.elf] Error 1
Attached the new project.
If I'm missing something, can you please provide me a sample example showing the behavior ?
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Pascal, in your project all work but in mine no. I send you my project as you can see file radio_cw.c and radio.c have the same variable const uint8_t Radio_Configuration_Data_Array_433[] = RADIO_CONFIGURATION_DATA_ARRAY_433;
Only I get:
**** Build of configuration FLASH for project KL15_397200_OUTDOOR_SIREN_rev2_dual_trans2 ****
"C:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" -j16 all
'Building file: ../codice/radio.c'
'Executing target #5 ../codice/radio.c'
'Invoking: ARM Ltd Windows GCC C Compiler'
"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" "../codice/radio.c" @"codice/radio.args" -MMD -MP -MF"codice/radio.d" -o"codice/radio.o"
'Finished building: ../codice/radio.c'
' '
'Building target: KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Executing target #26 KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Invoking: ARM Ltd Windows GCC C Linker'
"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"KL15_397200_OUTDOOR_SIREN_rev2_dual.args" -o"KL15_397200_OUTDOOR_SIREN_rev2_dual.elf"
../codice/radio.c: In function 'bRadio_Check_Tx_RX':
../codice/radio.c:92:17: warning: unused variable 'shexx2' [-Wunused-variable]
../codice/radio.c: In function 'miaStartTx':
../codice/radio.c:187:43: warning: unused parameter 'pioRadioPacket' [-Wunused-parameter]
mingw32-make: *** [KL15_397200_OUTDOOR_SIREN_rev2_dual.elf] Error 1
Hi Stefano,
In fact the error message is reproduced.
1st Build or build after clean operation I got in Console:
+++++++++++++++++++++
'Building target: KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Executing target #26 KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Invoking: ARM Ltd Windows GCC C Linker'
"F:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"KL15_397200_OUTDOOR_SIREN_rev2_dual.args" -o"KL15_397200_OUTDOOR_SIREN_rev2_dual.elf"
../codice/inizializzazioni.c: In function 'inizializza':
../codice/inizializzazioni.c:94:1: warning: implicit declaration of function 'init_spi' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:99:1: warning: implicit declaration of function 'init_Shock' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:100:1: warning: implicit declaration of function 'init_ADC0' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:101:1: warning: implicit declaration of function 'init_Batteria' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:102:1: warning: implicit declaration of function 'init_LPTMR0' [-Wimplicit-function-declaration]
../codice/inizializzazioni.c:7:12: warning: unused variable 'i' [-Wunused-variable]
../codice/batteria.c: In function 'leggiBatteria':
../codice/batteria.c:32:2: warning: implicit declaration of function 'sprintf' [-Wimplicit-function-declaration]
../codice/batteria.c:33:2: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../codice/LPTMR0.c: In function 'LPTMR0_ISR':
../codice/LPTMR0.c:44:2: warning: implicit declaration of function 'gestione_sirena' [-Wimplicit-function-declaration]
../codice/LPTMR0.c:279:3: warning: implicit declaration of function 'gestione_sintesi_vocale' [-Wimplicit-function-declaration]
../codice/radio.c: In function 'bRadio_Check_Tx_RX':
../codice/radio.c:92:17: warning: unused variable 'shexx2' [-Wunused-variable]
../codice/radio.c: In function 'miaStartTx':
../codice/radio.c:187:43: warning: unused parameter 'pioRadioPacket' [-Wunused-parameter]
../codice/radio_cw.c: In function 'invia_cw':
../codice/radio_cw.c:22:2: warning: implicit declaration of function 'radio_init' [-Wimplicit-function-declaration]
../codice/spi_radio.c: In function 'SpiReadWrite':
../codice/spi_radio.c:114:11: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
../codice/sirena.c: In function 'sirenaSetVolume':
../codice/sirena.c:335:10: warning: unused variable 'i' [-Wunused-variable]
../codice/sintesi.c: In function 'gestioneSPI':
../codice/sintesi.c:109:12: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
../codice/sintesi.c:108:11: warning: variable 'bValue' set but not used [-Wunused-but-set-variable]
../codice/uart0.c: In function 'riceviCar':
../codice/uart0.c:92:14: warning: unused variable 'len' [-Wunused-variable]
../codice/uart0.c: In function 'riceviNum':
../codice/uart0.c:128:2: warning: pointer targets in passing argument 1 of 'atol' differ in signedness [-Wpointer-sign]
../codice/uart0.c: In function 'riceviNumHex':
../codice/uart0.c:143:2: warning: pointer targets in passing argument 1 of 'strtol' differ in signedness [-Wpointer-sign]
../codice/uart0.c: In function 'aspettaCar':
../codice/uart0.c:163:14: warning: unused variable 'len' [-Wunused-variable]
../codice/si446x_api_lib.c: In function 'si446x_set_property':
../codice/si446x_api_lib.c:257:29: warning: 'uint8_t' is promoted to 'int' when passed through '...' [enabled by default]
../Sources/main.c: In function 'main':
../Sources/main.c:108:3: warning: implicit declaration of function 'inizializza' [-Wimplicit-function-declaration]
../Sources/main.c:109:3: warning: implicit declaration of function 'invia_cw' [-Wimplicit-function-declaration]
../Sources/main.c:110:1: warning: pointer targets in passing argument 1 of 'stampa' differ in signedness [-Wpointer-sign]
../Sources/main.c:379:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:380:4: warning: implicit declaration of function 'riceviNum' [-Wimplicit-function-declaration]
../Sources/main.c:385:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:391:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:396:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:402:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:408:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:414:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:420:4: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:438:7: warning: implicit declaration of function 'sprintf' [-Wimplicit-function-declaration]
../Sources/main.c:439:6: warning: pointer targets in passing argument 1 of 'stampanr' differ in signedness [-Wpointer-sign]
../Sources/main.c:489:4: warning: pointer targets in passing argument 1 of 'stampa' differ in signedness [-Wpointer-sign]
../Sources/main.c:100:14: warning: unused variable 'volume' [-Wunused-variable]
../Project_Settings/Startup_Code/__arm_end.c: In function '_ExitProcess':
../Project_Settings/Startup_Code/__arm_end.c:69:30: warning: unused parameter 'status' [-Wunused-parameter]
mingw32-make: *** [KL15_397200_OUTDOOR_SIREN_rev2_dual.elf] Error 1
+++++++++++++++++++++
Here the error is generated without all information.
At this time perform a second build and I got:
+++++++++++++++++++++
**** Build of configuration FLASH for project KL15_397200_OUTDOOR_SIREN_rev2_dual_trans2 ****
"F:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" -j8 all
'Building target: KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Executing target #26 KL15_397200_OUTDOOR_SIREN_rev2_dual.elf'
'Invoking: ARM Ltd Windows GCC C Linker'
"F:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" @"KL15_397200_OUTDOOR_SIREN_rev2_dual.args" -o"KL15_397200_OUTDOOR_SIREN_rev2_dual.elf"
./codice/radio.o:(.rodata.Radio_Configuration_Data_Array_433+0x0): multiple definition of `Radio_Configuration_Data_Array_433'
./codice/radio_cw.o:(.rodata.Radio_Configuration_Data_Array_433+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [KL15_397200_OUTDOOR_SIREN_rev2_dual.elf] Error 1
+++++++++++++++++++++
Now the linker detects multiple definition.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Muchas gracias
Hi Stefano,
thanks.
With your project I've reproduced the problem.
No error regarding the duplicated variable is generated whereas this is the cause of the generic error.
If I removed the
const uint8_t Radio_Configuration_Data_Array_433[] = RADIO_CONFIGURATION_DATA_ARRAY_433;
in the radio.c file, the elf file is generated without problem.
I will investigate the problem and will keep you informed.
PS: if you want you can remove the project above ...
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------