how to load my code c++ to raspberrypi

7 次查看(过去 30 天)
I have generated my simulink model code into c ++, and produced many c++ files with the header. but I don't know how to bring it all to raspberry pi and run it. how do all the files generate code run on raspberry pi? what should I do after generate code and getting the c ++ file? does the folder just copy it to raspberry?
this is the contents file of the generated code
ss file code1.png
ss file code2.JPG

回答(1 个)

Shaunak
Shaunak 2025-6-10
It is my understanding that you have generated C++ code from your Simulink model and have a Raspberry Pi setup ready, and now you want to deploy and run the generated code on the Raspberry Pi.
Here’s how you can do it:
  • Copy the Generated Code to Raspberry Pi: Use scp or a USB to copy the entire code generation folder (including .cpp, .h, and Makefile if available) to your Raspberry Pi:
scp -r mySimulinkCode pi@<raspberry_ip>:~/simulink_build/
  • Compile the Code on Raspberry Pi: SSH into the Pi, go to the folder, and compile the cpp file using:
g++ *.cpp -o myModelApp
  • Run the Executable: After successful compilation, you can run the generated executable on your Raspberry Pi hardware.
For additional information on deploying generated code onto Raspberry Pi, kindly refer to the following MathWorks documentation:
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Embedded Coder 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by