how do I override rt_main in embedded coder?
Ältere Kommentare anzeigen
Using embedded coder to generate code, I want to exclude rt_main.c from the build and use my own customized version (since the one that gets included does not actually run any of my code). I see that I can generate an example main program (ert_main.c) but I don't see how I can incorporate my customized version of that file into the build. I can add my own main function to the build, but then I get a linker error because main is defined twice. How do I write a customized main function?
Antworten (1)
Vandit
am 31 Mai 2023
Bearbeitet: Stefanie Schwarz
am 18 Nov. 2025
0 Stimmen
Hi,
To modify main function ‘ert_main.c’, you can navigate to ‘Model_Name_ert_rtw’ folder and customize ‘ert_main.c’ file as per your requirements.
Now to generate a new executable, please refer to the steps shown below:
1. Inside the ‘Model_Name_ert_rtw’ folder, delete all ‘.obj’ files.
2. Delete the already existing ‘Model_Name.exe’ file from your current working directory.
3.Run the ‘Model_Name.bat’ file by running the command ‘!Model_Name.bat’ in the command window to generate the executable again.
Hope this helps.
3 Kommentare
Paul
am 20 Jun. 2023
serena aiello
am 26 Okt. 2023
Hi Paul, I want to do the same thing. Do you have find an automatic solution?
Paul
am 26 Okt. 2023
Kategorien
Mehr zu Simulink Coder finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!