cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone ever got a web server running using CubeMx generated LWIP and Keil uvision?

recently
Associate II

... I'm currently trying this on an STM32H7 nucleo board.

Is it at all possible to use cubemx generated LWIP ? ... I don't think so!

It must be said that there is a "no-go" point: It is completely unacceptable to choose a compiler version <= 5 in Keils latest uvision (37.0.0). There is no developer who could endure the compile times on larger projects (beyond 30 minutes). In this case the Keil support recommends switching to V6. And ok, if I switch to compiler version >= V6 in uvision, then I can compile very quickly. But, if I then want to use freertos, it no longer works. Freertos generated by Cubemx only works with V5 in uvision. But without freertos I can't activate the LWIP library, which I absolutely need for a web server. This means I will be forced to use V5, which is totally unacceptable. The freertos / compiler V5 problem has existed for years now, I`m patiently waiting for a fix. Is nobody interested in fixing it? This is probably due to the fact that the problem cannot be clearly assigned to Keil (the V5 compilation time disaster) or ST (the generation of buggy code), it probably affects both sides. How far away are we from finally successfully configuring a web server using Cubmx that actually works after code generation and compilation with uvision ?

Friendly regards

Recently

1 ACCEPTED SOLUTION

Accepted Solutions
PHolt.1
Senior III

The Cube kit is good enough, especially as it is free. But I doubt many commercial devs use Cube. They pay for support, and you won't get support from ST. So they buy one of the kits which have a "pay" option. The kit itself is probably no better than Cube.

It is not possible to produce a code generator where you just click and you get a web server. Or anything much else really. Cube MX will generate primitive code fragments so if you want to flash an LED, drive a UART, etc, the code will work. It is not granular enough so there is a huge amount of bloat, but it does generally work. It also contains some bad code, so I have used ex-MX code and chopped it around. The thing MX is good for is the initial CPU and peripheral config, clock config, and such, which would take you weeks of reading the RM and you would really struggle. The RM is 2000 pages...

A lot of code which comes with Cube is not working code. For example the NTP module is basically empty. I never looked at FTP etc etc. I paid someone 1k to write an NTP module. I then spent 4x that on a simple HTTP server, before that was aborted (I then wrote it myself, using the above mentioned netconn one as a starting point, and it took me 1-2 weeks full time equivalent. I will happily send you the source; it will be given away with my product when it comes out. But this isn't what anybody would call a "web server" which, if general, needs to do much more. It needs to be linked to a filesystem, to work as people expect. And nowadays, commercially speaking, you need HTTPS (MbedTLS, or some commercial lib) which is way more work. I have TLS in my project (someone working 1 day a week did MbedTLS and I think it took him 6 months) but it has limitations e.g. only one connection at a time (each one needs ~50k of RAM). You need to define your requirements very clearly in this area (IOT). You aren't ever going to get Apache or Nginx...

If you are a proper business then you need to get paid support. You cannot have a guy on 50k spending a year fumbling around, like I do. All this Cube and ST forum stuff is just for hobby projects. Most posts here get no replies, very occassionally somebody gives you a useful pointer, but in general there is no support on ST stuff unless you get it from a commercial vendor.

There is also no support on the other popular modules e.g. LWIP, FreeRTOS, MbedTLS, FatFS. I have all these running but it took many man-months. But this is the world of "open source".

https://www.eevblog.com/forum/programming/a-rant-about-lack-of-support-on-open-source-software-or-anything-else-actually/

View solution in original post

11 REPLIES 11
Piranha
Chief II

Some years ago I was developing a project with FreeRTOS and lwIP in uVision IDE and compiling it with ARM Compiler 5 (Armcc). I definitely didn't have such a ridiculous compile times. Full rebuild took less than a minute and that was on a Core 2 Duo with HDD, not SSD.

About the network part the answer is there:

https://community.st.com/s/question/0D53W00001iI95pSAC/http-request-to-stm32-lwip-results-that-ping-stops-working

And here are the Ethernet/lwIP related issues and solutions for ST's broken bloatware:

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32

Guillaume K
ST Employee

About the slow compilation on Keil MDK-ARM with compiler V5: in the project options, in Output tab, try to disable the generation of browse information.

recently
Associate II

@Piranha: That's a lot of input that I have to work through first, thank you very much!

@Guillaume: I use the "goto definition" function hundreds of times a day. It is completely impossible to work without it. This elementary stuff needs to work in a modern IDE !

Keil support should resolve your issue. They are good and you've paid for this.

But their response can be slower in the vacation season.

Meanwhile, could you answer a few questions?

Do you have other projects built with the MDK on this machine, either with v5 or v6 compiler? Are the build times normal?

Do you have "antivirus", "endpoint protection" and so on installed? If yes, tried to disable it?

Add any other useful details ( Windows version...)

recently
Associate II

@Pavel:

  • I tried to attach this post to the Keil support forum first. There this post was rejected as "abusive" (If you follow the links from Piranha you can guess why they react so sensitively). I think I have to write to them directly as a paying customer :)
  • Thank you very much for your efforts. However, the point here is not to make the V5 compiler faster with the actual uvision version 37.0.0 . Keil knows that this is not possible and recommends the use of V6, but that's all already decribed at the top ...
PHolt.1
Senior III

This is only a limited contribution because I am using a 32F417 but I got a web server running pretty nicely on it. I am using the netconn API based demo code as a base; this is supplied by ST but also found in various places online e.g.

https://github.com/particle-iot/lwip/blob/master/contrib/apps/httpserver/httpserver-netconn.c

It took me a while to get it working because virtually nobody is using netconn; most use sockets.

Much depends on how much functionality you need. Mine just responds to some GET / commands and serves various pages. It also implements file editing and download and upload (FatFS filesystem on an Adesto SPI FLASH). FreeRTOS and LWIP.

There is practically no help here due to the vast number of daily posts (most presenting unsolvable issues) but I got a lot of help on EEVBLOG over time e.g.

https://www.eevblog.com/forum/programming/fatfs-sorted-directory-listing-but-without-needing-a-large-ram-buffer/

Remember there is a lot of crappy software out there which comes with these devkits, and which will blow up if you use an RTOS e.g.

https://www.eevblog.com/forum/microcontrollers/is-st-cube-ide-a-piece-of-buggy-crap/msg4357555/#msg4357555

I know nothing about Keil; the current ST Cube (which is a well usable tool, despite annoying features) works fine and uses GCC v10 compiler.

I doubt you will find any kind of full featured and working http server, for free. There is a guy going around the forums offering a paid server called Mongoose. With the ST port of LWIP you get a thing called HTTPD which I believe doesn't actually work; I terminated a subcontracted project using that when it went well past 100hrs with not much working.

recently
Associate II

@PHolt.1: Thank you for the effort you put into your answer. I really believed that nowadays in Cubemx you would just click on a web server button. Oh, what a mistake. Your comment about giving up a project after 100 hours makes me think...

PHolt.1
Senior III

The Cube kit is good enough, especially as it is free. But I doubt many commercial devs use Cube. They pay for support, and you won't get support from ST. So they buy one of the kits which have a "pay" option. The kit itself is probably no better than Cube.

It is not possible to produce a code generator where you just click and you get a web server. Or anything much else really. Cube MX will generate primitive code fragments so if you want to flash an LED, drive a UART, etc, the code will work. It is not granular enough so there is a huge amount of bloat, but it does generally work. It also contains some bad code, so I have used ex-MX code and chopped it around. The thing MX is good for is the initial CPU and peripheral config, clock config, and such, which would take you weeks of reading the RM and you would really struggle. The RM is 2000 pages...

A lot of code which comes with Cube is not working code. For example the NTP module is basically empty. I never looked at FTP etc etc. I paid someone 1k to write an NTP module. I then spent 4x that on a simple HTTP server, before that was aborted (I then wrote it myself, using the above mentioned netconn one as a starting point, and it took me 1-2 weeks full time equivalent. I will happily send you the source; it will be given away with my product when it comes out. But this isn't what anybody would call a "web server" which, if general, needs to do much more. It needs to be linked to a filesystem, to work as people expect. And nowadays, commercially speaking, you need HTTPS (MbedTLS, or some commercial lib) which is way more work. I have TLS in my project (someone working 1 day a week did MbedTLS and I think it took him 6 months) but it has limitations e.g. only one connection at a time (each one needs ~50k of RAM). You need to define your requirements very clearly in this area (IOT). You aren't ever going to get Apache or Nginx...

If you are a proper business then you need to get paid support. You cannot have a guy on 50k spending a year fumbling around, like I do. All this Cube and ST forum stuff is just for hobby projects. Most posts here get no replies, very occassionally somebody gives you a useful pointer, but in general there is no support on ST stuff unless you get it from a commercial vendor.

There is also no support on the other popular modules e.g. LWIP, FreeRTOS, MbedTLS, FatFS. I have all these running but it took many man-months. But this is the world of "open source".

https://www.eevblog.com/forum/programming/a-rant-about-lack-of-support-on-open-source-software-or-anything-else-actually/

recently
Associate II

@PHOLT: Thank you for your detailed answers and thank you for your code offer.

ST actually has a web server example program for the 743 Nucleo board. Unfortunately, this does not use Cubemx. But I have to add the web server to an existing program that is based on Cubemx and of course I would also like to use Cubemx for the web server addon.

Finally we got this example running with cubemx. A colleague has now sat down and taken care of all the errors generated by Cubemx: After calling cubemx, you have to start a batch file that replaces 9 files with corrected versions. Each correction required intensive Google research. 2 files of it enable the use of Compiler V6 for Free-Rtos.

Let's see how it goes :)

Friendly regards

Recently

Here my modification.bat :

C:\Windows\System32\xcopy.exe ..\Modifications\ethernetif_mod.c ..\LWIP\Target\ethernetif.c* /y
C:\Windows\System32\xcopy.exe ..\Modifications\fs_mod.c ..\Middlewares\Third_Party\LwIP\src\apps\http\fs.c* /y
C:\Windows\System32\xcopy.exe ..\Modifications\fsdata_mod.h ..\Middlewares\Third_Party\LwIP\src\apps\http\fsdata.h* /y
C:\Windows\System32\xcopy.exe ..\Modifications\main_mod.c ..\Core\Src\main.c* /y 
C:\Windows\System32\xcopy.exe ..\Modifications\slipif_mod.c ..\Middlewares\Third_Party\LwIP\src\netif\slipif.c* /y 
C:\Windows\System32\xcopy.exe ..\Modifications\lwip_mod.c ..\LWIP\App\lwip.c* /y 
 
C:\Windows\System32\xcopy.exe ..\Modifications\cc.h ..\Middlewares\Third_Party\LwIP\system\arch\cc.h* /y 
C:\Windows\System32\xcopy.exe ..\Modifications\port.c ..\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM4F\port.c* /y 
C:\Windows\System32\xcopy.exe ..\Modifications\portmacro.h ..\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM4F\portmacro.h* /y