cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX 6.10.0 hanging in Generate Code when adding Mongoose HTTP Library

kbch
Associate II

I'm unable to add the Mongoose HTTP Library as a Third_Party Middleware and then generate code. How can I fix this?

- Create project for NUCLEO-G474RE
- Generate Code (Makefile) - working
- Copy unpacked mongoose source code (https://github.com/cesanta/mongoose/archive/refs/tags/7.12.zip) to Middlewares/Third_Party/mongoose
- Generate Code (Makefile) - now hanging forever, doesn't work anymore to generate code

 

9 REPLIES 9
Oskar_H
Senior

Show something that would help to understand the issue: generated makefile with paths, execution log, errors...

kbch
Associate II

Here is an example project with this issue. I have just copied in the mongoose library.

 

Oskar_H
Senior

I have tried your project as is and it compiles fine without any change.

Then I have done what you describe in your first post : unzip the mongoose library into Middlewares/Third_Party/mongoose subfolder of your project. And it compiles fine too (it is just slow, about 1 minute to complete), but it also deletes completely Middlewares folder ! I guess it is normal because it is not used at all...

First remark: you cannot expect your project to use this library by just copying it into its filetree. If there are no paths declarations to headers and no function calls to the library API from your project code, then no magic, it won't work !

Second remark: you may have noticed this library contains a lot of examples which supports STM32 platform, just go to mongoose-7.12/examples/stm32, it is full of *.ioc files and Makefile. Just take some time to read the documentation and tutorials like https://mongoose.ws/documentation/tutorials/stm32/all-cube-freertos-builtin/ and you will understand how to use it properly.

Third remark: sadly the board you are using (NUCLEO-G474RE) is not listed in the examples... I don't know if it is not supported by this library or if the examples are just a few samples of what can be achieved... In the latter case it will require additional efforts from you to get it work.

Thanks for testing it on your end! Can you mention which version of CubeMX you've used to generate the project? Also, might impact on which OS (Windows, Mac, Linux) you did it on.


Using the library is not the issue, that task is done and working great. The only issue is that CubeMX hangs when generating the project. I'm currently solving that with this process:
- Move the Mongoose Folder out of the CubeMX Project (in File Explorer)
- Generate the CubeMX project with changes to Pins or other stuff
- Move back in the Mongoose Folder

Oskar_H
Senior

I am using STM32CubeMX 6.10.0 on Ubuntu 23.10.

I did not succeed to make the code generation hang the tool by just adding the library folder at any place. Strange...

Do you get some error messages or anything suspect in the execution log ?

Interesting, I'm using CubeMX 6.10.0 too, but on ArchLinux.

I have checked it, there is an Exception:

2024-01-25 22:12:15,863 [INFO] ProjectBuilder:617 - [PM] Start Project Generation Thread
2024-01-25 22:12:15,876 [INFO] BlockDiagram:2759 - set Specific Code input for plugin: SYS
2024-01-25 22:12:15,876 [INFO] BlockDiagram:2759 - set Specific Code input for plugin: RCC
2024-01-25 22:12:15,876 [INFO] BlockDiagram:2759 - set Specific Code input for plugin: LPUART
2024-01-25 22:12:15,876 [INFO] BlockDiagram:2759 - set Specific Code input for plugin: NVIC
2024-01-25 22:12:15,877 [INFO] BlockDiagram:2759 - set Specific Code input for plugin: GPIO
2024-01-25 22:12:15,877 [INFO] CodeGenerator:807 - code generatio: config db path: /opt/stm32cubemx//db/
2024-01-25 22:12:16,086 [INFO] CodeEngine:255 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/MXTmpFiles/license.tmp_save
2024-01-25 22:12:16,373 [INFO] CodeEngine:279 - Generated code: /home/user/Downloads/cubemx_mongoose/MXTmpFiles/license.tmp
2024-01-25 22:12:16,461 [INFO] CodeEngine:255 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/MXTmpFiles/gpio.tmp_save
2024-01-25 22:12:16,611 [INFO] CodeEngine:279 - Generated code: /home/user/Downloads/cubemx_mongoose/MXTmpFiles/gpio.tmp
2024-01-25 22:12:16,759 [INFO] CodeEngine:255 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/Core/Src/stm32g4xx_it.c_save
2024-01-25 22:12:16,890 [INFO] CodeEngine:279 - Generated code: /home/user/Downloads/cubemx_mongoose/Core/Src/stm32g4xx_it.c
2024-01-25 22:12:16,892 [INFO] CodeEngine:255 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/Core/Inc/stm32g4xx_it.h_save
2024-01-25 22:12:16,956 [INFO] CodeEngine:279 - Generated code: /home/user/Downloads/cubemx_mongoose/Core/Inc/stm32g4xx_it.h
2024-01-25 22:12:16,961 [INFO] CodeEngine:255 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/Core/Src/stm32g4xx_hal_msp.c_save
2024-01-25 22:12:17,068 [INFO] CodeEngine:279 - Generated code: /home/user/Downloads/cubemx_mongoose/Core/Src/stm32g4xx_hal_msp.c
2024-01-25 22:12:17,071 [INFO] CodeEngine:255 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/MXTmpFiles/system.tmp_save
2024-01-25 22:12:17,143 [INFO] CodeEngine:279 - Generated code: /home/user/Downloads/cubemx_mongoose/MXTmpFiles/system.tmp
2024-01-25 22:12:17,146 [INFO] CodeEngine:311 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/Core/Inc/stm32g4xx_hal_conf.h_save
2024-01-25 22:12:17,210 [INFO] CodeEngine:335 - Generated code: /home/user/Downloads/cubemx_mongoose/Core/Inc/stm32g4xx_hal_conf.h
2024-01-25 22:12:17,232 [WARN] IPConfigManager:2946 - Warning: the RefConfig RCC_CommonPeriphClockConfig is not available in your config.xml file
2024-01-25 22:12:17,238 [INFO] CodeEngine:255 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/Core/Inc/main.h_save
2024-01-25 22:12:17,314 [INFO] CodeEngine:279 - Generated code: /home/user/Downloads/cubemx_mongoose/Core/Inc/main.h
2024-01-25 22:12:17,316 [INFO] CodeEngine:255 - oldGeneratedFile, /home/user/Downloads/cubemx_mongoose/Core/Src/main.c_save
2024-01-25 22:12:17,428 [INFO] CodeEngine:279 - Generated code: /home/user/Downloads/cubemx_mongoose/Core/Src/main.c
2024-01-25 22:12:17,436 [ERROR] ProjectBuilder:2205 - 
java.lang.NullPointerException: Cannot read the array length because "<local4>" is null
        at com.st.microxplorer.codegenerator.CodeGenerator.cleanDir(CodeGenerator.java:2529) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.cleanDir(CodeGenerator.java:2535) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.cleanDir(CodeGenerator.java:2535) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.cleanDir(CodeGenerator.java:2535) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.cleanDir(CodeGenerator.java:2535) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.cleanDir(CodeGenerator.java:2535) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.cleanDir(CodeGenerator.java:2535) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.cleanDirectory(CodeGenerator.java:2400) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.generateDefaultConfig(CodeGenerator.java:9769) ~[STM32CubeMX:?]
        at com.st.microxplorer.codegenerator.CodeGenerator.generateCode(CodeGenerator.java:1485) ~[STM32CubeMX:?]
        at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.generateCode(ProjectBuilder.java:2827) ~[?:?]
        at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createCode(ProjectBuilder.java:2202) ~[?:?]
        at com.st.microxplorer.plugins.projectmanager.engine.ProjectBuilder.createProject(ProjectBuilder.java:830) ~[?:?]
        at com.st.microxplorer.plugins.projectmanager.engine.GenerateProjectThread.run(GenerateProjectThread.java:61) ~[?:?]
Jan 25, 2024 10:12:38 PM java.util.prefs.FileSystemPreferences checkLockFile0ErrorCode
WARNING: Could not lock System prefs. Unix error code 2.
Jan 25, 2024 10:12:38 PM java.util.prefs.FileSystemPreferences syncWorld
WARNING: Couldn't flush system prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.

 

Oskar_H
Senior

Ok, it looks like a parameter becomes null in a recursive cleanDir() function and there is no catch of this exception !

Get sure you don't let a shell open to one of the folders which are cleaned at code generation, check for any special file attributes within the filetree, and if still no clue then you will have to handover the support to ST developers...

lonejack
Associate III

I've the same problem!

What left me astonished is that with STM32CubeIDE the code generation is correct !

see this on log:

2024-02-09 23:18:54,568 [ERROR] ProjectBuilder:2205 -
java.lang.NullPointerException: Cannot read the array length because "<local4>" is null

I resolved!

As you suggested...  removed some corrupted files in some directories.