Including Arduino.h into S function builder
15 ビュー (過去 30 日間)
古いコメントを表示
Trying to build a s Function using simulink Sfunction builder block
S function will wrap a library for a ExtendedADCSheild used for voltage measurement (see link)
Have been following these tutorials
Stuggling to include Arduino.h
In the tutorials the arduino.h header is not placed in the same folder as the other headers so i assume simulink has some way of finding this without moving the file
I have simulink support package for Arduino installed
In an attempt to resolve this issue i have tried placing arduino.h in the same folder as the other headers for the extendedadcshield and setting as directory in matlab. This works to an extent but then you need to also add all the files referenced by the ardino.h header for example
In file included from C:\Matlab_Arduino\Test\Test_Sfunc_wrapper.c:16:0: C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\arduino\avr\cores\arduino/Arduino.h:28:26: fatal error: avr/pgmspace.h: No such file or directory #include <avr/pgmspace.h> ^ compilation terminated.
I tried instead to add include paths to the locations of the files referenced which is seemed to work but when compliing the s function i get the following error
In file included from C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/inttypes.h:37:0, from C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/stdio.h:44, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc_compcond.h:112, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc.h:64, from C:\Matlab_Arduino\Test\Test_Sfunc.c:58: C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/stdint.h:146:17: error: conflicting types for 'intptr_t' typedef int16_t intptr_t; ^~~~~~~~ In file included from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/limits.h:6:0, from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/limits.h:168, from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/syslimits.h:7, from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/limits.h:34, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc_compcond.h:107, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc.h:64, from C:\Matlab_Arduino\Test\Test_Sfunc.c:58: C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/crtdefs.h:62:35: note: previous declaration of 'intptr_t' was here __MINGW_EXTENSION typedef __int64 intptr_t; ^~~~~~~~ In file included from C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/inttypes.h:37:0, from C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/stdio.h:44, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc_compcond.h:112, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc.h:64, from C:\Matlab_Arduino\Test\Test_Sfunc.c:58: C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/stdint.h:151:18: error: conflicting types for 'uintptr_t' typedef uint16_t uintptr_t; ^~~~~~~~~ In file included from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/limits.h:6:0, from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/limits.h:168, from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/syslimits.h:7, from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/limits.h:34, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc_compcond.h:107, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc.h:64, from C:\Matlab_Arduino\Test\Test_Sfunc.c:58: C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/crtdefs.h:75:44: note: previous declaration of 'uintptr_t' was here __MINGW_EXTENSION typedef unsigned __int64 uintptr_t; ^~~~~~~~~ In file included from C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/inttypes.h:37:0, from C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/stdio.h:44, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc_compcond.h:112, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc.h:64, from C:\Matlab_Arduino\Test\Test_Sfunc.c:58: C:\ProgramData\MATLAB\SupportPackages\R2020b\3P.instrset\arduinoide.instrset\hardware\tools\avr\avr\include/stdint.h:589:0: warning: "SIZE_MAX" redefined #define SIZE_MAX UINT16_MAX In file included from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/limits.h:168:0, from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/syslimits.h:7, from C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/lib/gcc/x86_64-w64-mingw32/6.3.0/include-fixed/limits.h:34, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc_compcond.h:107, from C:\Program Files\MATLAB\R2020b/simulink/include/simstruc.h:64, from C:\Matlab_Arduino\Test\Test_Sfunc.c:58: C:/ProgramData/MATLAB/SupportPackages/R2020b/3P.instrset/mingw_w64.instrset/x86_64-w64-mingw32/include/limits.h:76:0: note: this is the location of the previous definition #define SIZE_MAX _UI64_MAX
not sure how to progress from here
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Arduino Hardware についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!