Forums » Req. WJ2(ESP32) support »
Can not build a single example for ESP32
Added by Max Rockatansky about 2 years ago
I have tried uninstalling and re-installing Waijung, MATLAB, and even Windows, several times, to ensure I do not have any interference from other packages.
It always fails with "Code Generation information file does not exist"
I have tried External Mode and Deploy to Hardware build modes. I have tried deleting the autogenerated folders in between build attempts: "slprj" "<project name>_esp32" and "<project_name>_esp32_build_system"
Here is the full build log of one of the demo projects. I have tried most of the demo projects. The only change I make to the demos is to double click on "Waijung 2 Target Setup" block and change the COM port to my actual port, and change the flash size to match my hardware, then saving, and building. I have read the Waijung 2 User Guide and have attempted to follow all the instructions.
If this does not work I will just get a STM32 instead since that seems to be better supported by MATLAB directly.
Top Model Build 3 6 Elapsed: 19 sec Waijung 2: System information Computer: PCWIN64 Operating System: Microsoft Windows 10 Enterprise LTSC Evaluation Matlab: 9.10.0.1602886 (R2021a) Waijung 2 version: 22.8a Waijung 2 root: C:\waijung2 Waijung 2 System Target File: esp32.tlc Waijung 2: 'RTWVerbose' is: 'on' Waijung 2: SimulationMode is: 'normal' Waijung 2: Removing remaing source files from previous build ### Starting build procedure for: esp32_digital_input_demo End of entry ### Generating code and artifacts to 'Model specific' folder structure ### Generating code into build folder: C:\Users\user\demo\digital_input_demo\esp32_digital_input_demo_esp32 Source 'esp32_digital_input_demo/Digital Input' specifies that its sample time (-1) is back-inherited. You should explicitly specify the sample time of sources. You can disable this diagnostic by setting the 'Source block specifies -1 sample time' diagnostic to 'none' in the Sample Time group on the Diagnostics pane of the Configuration Parameters dialog box. Component: Simulink | Category: Block warning The model reference sample time inheritance rule for block 'esp32_digital_input_demo/Digital Input' is not set and the model is sample time independent. The generated code from the block might produce incorrect results if it is referenced by a Model block. For S-functions, specify the model reference sample time inheritance rule through the ssSetModelReferenceSampleTimeInheritanceRule macro. You can suppress the diagnostic by setting Unspecified inheritability of sample time to 'none'. [3 similar] Component: Simulink | Category: Block warning ### Invoking Target Language Compiler on esp32_digital_input_demo.rtw ### Using System Target File: C:\waijung2\targets\esp32\esp32.tlc ### Loading TLC function libraries ### Generating TLC interface API for custom data . ### Initial pass through model to cache user defined code . ### Caching model source code ### Writing header file esp32_digital_input_demo_types.h . ### Writing header file waijung2_hwdrvlib.h ### Writing source file waijung2_hwdrvlib.c ### Writing header file esp32_digital_input_demo.h ### Writing header file rtwtypes.h . ### Writing source file esp32_digital_input_demo.c ### Writing header file esp32_digital_input_demo_private.h ### Writing header file rtmodel.h ### Writing source file ert_main.c . ### TLC code generation complete. . ### Processing Template Makefile: C:\waijung2\targets\esp32\src\esp32.tmf ### Created makefile C:\Users\user\demo\digital_input_demo\esp32_digital_input_demo_esp32\esp32_digital_input_demo.mk ### Building esp32_digital_input_demo: .\esp32_digital_input_demo.bat C:\Users\user\demo\digital_input_demo\esp32_digital_input_demo_esp32>set MATLAB=C:\Program Files\Polyspace\R2021a C:\Users\user\demo\digital_input_demo\esp32_digital_input_demo_esp32>"C:\Program Files\Polyspace\R2021a\bin\win64\gmake" -f esp32_digital_input_demo.mk GENERATE_ASAP2=0 OPTS="-DTID01EQ=0" ### BUILD_MODE : real_time ### PRODUCT : esp32_digital_input_demo.out ### SHRLIBTARGET : 0 ### MODULES : ert_main.c esp32_digital_input_demo.c waijung2_hwdrvlib.c rt_main.c ### MODELREF_TARGET_TYPE : NONE ### MAKEFILEBUILDER_TGT : 0 ### STANDALONE_SUPPRESS_EXE : 0 ### Source ert_main.c done ### Source esp32_digital_input_demo.c done ### Source waijung2_hwdrvlib.c done ### Ending esp32_digital_input_demo.out real_time ### Created esp32_digital_input_demo.out successfully (or it was already up to date) ### Successful completion of build procedure for: esp32_digital_input_demo Waijung 2: Post processing started. Warning: Directory already exists. [2 similar] Waijung 2: Creating custom partition table Waijung 2: Deleting pre-built src files. Waijung 2: Copying required header and source files to the target build directory. Waijung 2: Setting the ESP32 target to ESP32 ### Build procedure for esp32_digital_input_demo aborted due to an error. Build Summary 1 Elapsed: 0.22 sec Top model targets built: Model Action Rebuild Reason ==================================================================================== esp32_digital_input_demo Failed Code generation information file does not exist. 0 of 1 models built (0 models already up to date) Build duration: 0h 0m 20.044s The call to esp32_make_rtw_hook, during the exit hook generated the following error: Invalid file identifier. Use fopen to generate a valid file identifier. The build process will terminate as a result. Caused by: Invalid file identifier. Use fopen to generate a valid file identifier. Component: Simulink | Category: Block diagram error
Replies (4)
RE: Can not build a single example for ESP32 - Added by Parth Maheshwari (พาร์ท) about 2 years ago
Hi Max,
We are sorry to hear about your experience.
I have tried multiple demos with the same MATLAB and Waijung 2 version as you (R2021a & Waijung 22.8a) and everything works fine for me without any build errors. My colleagues are also able to build all demos successfully.
The error you are facing is most likely an issue related to your computer. Please book a technical session with us as per your convenience https://calendly.com/aimagin/30-minutes-discovery-call and we shall solve this problem in real-time.
In the meantime, if you have a backup computer, you may give it a try with that. It is quite likely that it will work.
Either way, we hope to talk to you soon.
Sincere regards,
Parth Maheshwari
Application Engineer
RE: Can not build a single example for ESP32 - Added by Max Rockatansky about 2 years ago
Thank you for the response. I have scheduled a technical session for tomorrow.
I did try with multiple computers, because I suspected my computer may be the problem. I have used MATLAB for a long time and have lots of other software installed that could be interfering. So I tried creating a new Virtual Machine with VMWare Workstation with a brand new Windows install with nothing else. That did not work. I thought maybe it would not work in a Virtual Machine so I also have set up spare computers with new install of Windows, Matlab, and Waijung and also get that same results on all systems. Are all versions of Windows supported?
RE: Can not build a single example for ESP32 - Added by Max Rockatansky about 2 years ago
I have gotten Waijung to build finally, after a few days of messing with it.
The error messages and the rest of the logs give NO information what the problem actually is.
I saw that Waijung generated C code from the Simulink model, but it seemed to fail somewhere in compiling that to ESP binary. I saw Waijung2 directory contained ESP-IDF and .espressif, I tried running 'C:\Waijung2\targets\esp32\setup\ESP-IDF\activate.bat' and then '.\install.bat' from command prompt.
This gives me error that Git and Python aren't installed. I install those manually. Try again. Fails and gives me a link to Microsoft to download Visual Studio Build Tools 2022. Now I can run install.bat and activate.bat and manually compile the C code with idf.py build. After installing all these things into my system, then Waijung2 begins to work also.
So, it seems that- there are actually more requirements than listed here https://waijung2-doc.aimagin.com/system-requirements.html
- I thought the 4GB Waijung package would require all the needed tools
- I wonder if you and your colleague are using fresh installs of Windows and MATLAB or a pre-build image with other software (git, python, visual studio) already installed on it?
- There are NO USEFUL ERROR MESSAGE when these basic things goes wrong. I spent 3 days trying to make LED blinks, and the problem was a basic missing requirement. This is most frustrating part. Normally MATLAB gives very good error message, with line numbers, source code. We can not rely on a tool that gives random failure with no error message.
Despite this thankfully the Waijung build works and I can evaluate further, if we can deploy or Simulink model to an ESP32 successfully and relialy that is all that matters.
RE: Can not build a single example for ESP32 - Added by Parth Maheshwari (พาร์ท) about 2 years ago
Hi Max,
Kindly allow me to answer your questions:
1 & 2) These are actually all the requirements everyone has needed https://waijung2-doc.aimagin.com/system-requirements.html. Unfortunately in your case this is untrue, we shall try to fix this tomorrow.
3) None of us are using a pre-build image with other software (git, python, visual studio). Git and python are automatically installed with the Waijung 2 library while Visual Studio hasn't been required in any of our devices. The reason you got the error of Git and Python not being installed is because you ran it externally from command prompt.
4) We have fixed this and the error message now gives some more information about the error. We would like to send you the patch file and see the changes in real-time in the meeting tomorrow.
It is quite strange because this doesn't seem like a Windows or a Waijung 2 problem and is related to MATLAB only found in some devices. Every resource found on this error says it could be a permission/directory issue. Sometimes just running MATLAB as administrator seems to solve the problem for some while changing the folder path of where the Simulink files are stored seems to solve the problem for some others. We are truly sorry you have had to go through so much trouble for running simple demos.
We hope to talk to you and discuss more in the meeting tomorrow on the possibilities of solving this error.
Sincere regards,
Parth