Error: "error: ld returned 1 exit status " during the deploy to hardware in Tiva C
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm learning how to use C code in the Simulink function block to be applied in my Tiva C launchpad. If i test the link in the simulation all works fine, the error appears when I try to deploy to the launchpad.
These are the codes:
Doblez.C Code:
#include <stdio.h>
#include "dobloh.h"
double u;
int main() {
return 0;
}
double doble(double u){
double car;
car=2*u;
return car;
}
dobloh.Header:
#ifndef DOBLADOR_C_
#define DOBLADOR_C_
double doble(double u);
#endif /* DOBLADOR_C_ */
Simulink blocks:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/161563/image.png)
Matlab function block code:
function y = callingDoblez(u)
%#codegen
y=0.0;
y = coder.ceval('doble',u);
Error Message:
MW_EnergiaTivaHWInit.o MW_EnergiaTimerInit.o io_wrappers.o Energia_main.o arm_cortex_m_multitasking.o ert_main.o -lm
ert_main.o: In function `main':
C:\\Users\\Alberto\\Desktop\\untitled_ert_rtw/ert_main.c:39: multiple definition of `main'
doblez.o:C:\\Users\\Alberto\\Desktop\\untitled_ert_rtw/../doblez.c:7: first defined here
collect2.exe: error: ld returned 1 exit status
gmake: *** [../untitled.elf] Error 1
### Creating HTML report file untitled_codegen_rpt.html
### Build procedure for model: 'untitled' aborted due to an error.
Error(s) encountered while building "untitled":
### Failed to generate all binary outputs.
I hope you can help me to understand the error, because I can't find any solution.
Thanks
Regards Alberto
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Run on Target Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!