2024-03-15 09:41 AM
Heyho,
I'm about to start writing an ethernet bootloader for the H7.
I found the F7's LwIP_IAP example, a good way to get ideas how to realize the bootloader, although I'll probably put the new bin into an external SPI flash.
As I have an http-webserver with a few pages already up and running, I will use the http method.
The example is using LwIP's "standard" fs_data.c file containing the STM32's webpage, prepared with makefsdata.
But where can I find the original html-files which served as the fs_data source ?
I don't want to learn any more html, the webserver is more or less a debugging tool, so it would be a great help if I could simply modify the original html-files to fit my purpose.
Maybe @STea or @Peter BENSCH might help
Thanks in advance!
PS: I already checked the original F4 example on Github, no html there.
Solved! Go to Solution.
2024-03-15 10:32 AM - edited 2024-03-15 10:42 AM
> I don't want to learn any more html, the webserver is more or less a debugging tool
Well. AI to the rescue!
Me: Dear Copilot, show me example html code for a button that starts upload of a file from web browser on a PC to the http server. How the upload of file works form the point of view of the server?
Copilot (5 seconds later): - Let’s start by creating a simple HTML button that allows users to upload files from their web browser to an HTTP server. Then I’ll explain how the file upload process works from the server’s perspective.
HTML Code for File Upload Button
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Upload Example</title>
</head>
<body>
<form action="/upload" method="POST" enctype="multipart/form-data">
<label for="fileInput">Choose a file:</label>
<input type="file" id="fileInput" name="file">
<input type="submit" value="Upload">
</form>
</body>
</html>
AI-generated code. Review and use carefully.
In this example:
How File Upload Works from the Server’s Perspective
Client Request:
Server Handling:
File Storage:
Response to Client:
Handling on the Server:
(end session)
That's it for the embedded server. Example html for simple page can be found in the original LwIP examples:
https://github.com/lwip-tcpip/lwip/tree/master/src/apps/http/fs
You can instead want to be a web client and pull the update file from a simple tcp or http server or a cloud service.
2024-03-15 10:32 AM - edited 2024-03-15 10:42 AM
> I don't want to learn any more html, the webserver is more or less a debugging tool
Well. AI to the rescue!
Me: Dear Copilot, show me example html code for a button that starts upload of a file from web browser on a PC to the http server. How the upload of file works form the point of view of the server?
Copilot (5 seconds later): - Let’s start by creating a simple HTML button that allows users to upload files from their web browser to an HTTP server. Then I’ll explain how the file upload process works from the server’s perspective.
HTML Code for File Upload Button
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>File Upload Example</title>
</head>
<body>
<form action="/upload" method="POST" enctype="multipart/form-data">
<label for="fileInput">Choose a file:</label>
<input type="file" id="fileInput" name="file">
<input type="submit" value="Upload">
</form>
</body>
</html>
AI-generated code. Review and use carefully.
In this example:
How File Upload Works from the Server’s Perspective
Client Request:
Server Handling:
File Storage:
Response to Client:
Handling on the Server:
(end session)
That's it for the embedded server. Example html for simple page can be found in the original LwIP examples:
https://github.com/lwip-tcpip/lwip/tree/master/src/apps/http/fs
You can instead want to be a web client and pull the update file from a simple tcp or http server or a cloud service.
2024-03-18 12:27 AM
Thanks a lot @Pavel A.
Interesting that only such few lines of html are needed for this.
2024-03-18 08:13 AM
Anyway, it would be nice to see the original files from STM used for that, also to compare the tags:
So again, maybe @STea or @Peter BENSCH might help, please?
2024-03-19 10:00 AM
@Pavel A. Thanks to you again, and kudos to your copilot pal! ;)
I found a POST method example from the lwIP guys on github, and now login, file upload and system reset all work via a simple additional html page and http / POST.
I had the http webserver already running, but only used GET and PUT. So it was actually not that hard to implement the POST method.
Next: saving data to external SPI flash, then check and use that data for a bootloader. Still some stuff to do...
2024-07-29 02:15 AM
I am trying to do something similar.
Can toy please point me to POST method example in lwip
2024-07-29 03:36 AM
Check lwip's httpd.c / h files, everything already prepared in lwip.
Then google for lwip post example, for the "post finish" and other functions.