• AVR Freaks

Helpful ReplyHot!Simple homepage based on "web_net_server_nvm_mpfs"

Author
yts
Super Member
  • Total Posts : 637
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
2020/07/06 18:59:08 (permalink)
0

Simple homepage based on "web_net_server_nvm_mpfs"

PIC32MZ2048EFM064-I/PT + LAN8740Ai
net v3.6.1
 
I am making a simple homepage (Status of LED and ON/OFF button for LED) basing on "web_net_server_nvm_mpfs". See fig1.
 
The minimum files I need are shown in figs 2 and 3.
 
After Generating Code, the unnecessary files and folders (dyndns etc.) are created and registered as shown in figs 4 and 5.
I would like to know how to suppress (stop) this creation of the unnecessary files.
 
This type of creation has not occurred in case of "web_server_nvm_mpfs".

yts


post edited by yts - 2020/07/06 19:01:01

Attached Image(s)

#1
BillP
Super Member
  • Total Posts : 436
  • Reward points : 0
  • Joined: 2014/09/28 07:53:35
  • Location: CA
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/07 07:42:10 (permalink) ☄ Helpfulby yts 2020/07/07 17:49:09
5 (1)
Did you turn off the "Custom code" option in the http_net config?
Did you run the mpfs2.jar to create the .c file for your new web pages?
Did you exclude the Microchip demo .c file from the project?
 
Any (or all) of these can cause problems when using your own web pages.
 
#2
yts
Super Member
  • Total Posts : 637
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/07 17:48:41 (permalink)
0
Thank you for your suggestions.

Trial (success):

Inspired by your suggestion, I can suppress the unnecessary files/folders.
The fig1.png shows the setting in Configuration Options of HTTPNET SERVER component. I clear the "web pages source directory path".

---------------------------
Trials (failure):

#1 When I uncheck the check box named "Include HTTP NET CUSTUM Template" as seen in fig2.png, my project causes compiler errors. The unnecessary files/folders are created in this case.

#2 After the trial #1, I check the check box again and recover the “web pages source directory path” as showing in fig3.png. As a result, the custom_http_net_app.c is overwritten without any caution (dangerous?) and my project doesn’t work anymore. The unnecessary files/folders are also created in this case.


From my trials described above, I wonder what the meaning (or merit) of including “web pages source” in the project is.

yts


P.S.
>Did you turn off the "Custom code" option in the http_net config?
Do you mean Configuration Options of HTTPNET SERVER component by “http_net config”?

>Did you run the mpfs2.jar to create the .c file for your new web pages?
I am using the mpfs_net.jar instead of mpfs2.jar. Should I use mpfs2.jar?

>Did you exclude the Microchip demo .c file from the project?
 It seems that demo.c doesn’t exist in my project. Will you tell me where this file exists?

Attached Image(s)

#3
BillP
Super Member
  • Total Posts : 436
  • Reward points : 0
  • Joined: 2014/09/28 07:53:35
  • Location: CA
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/08 07:55:26 (permalink)
0
@yts. I need to add more explanation here.

Checking the "Include HTTP NET Custom Template" creates the custom_http_net_app.c file which contains the logic to process the Microchip demo web pages.  If you are doing your own web pages, much of that file is not needed.  My suggestion is to run MHC with the option checked one time to create the file, then turn it off. Modify the file for your own web pages.  

The “web pages source” is the location of the web pages you want to include in the project.  This MHC configuration option now allows you to run the mpfs2.jar program in MHC rather than having to do it outside of the IDE.  I think you will understand the process better if you run the mpfs2.jar program manually to see what it produces and where it puts the output file (such as the mpfs_net_img.c file). If you name the output file something else (such as my_img.c) that file will show up in the project directory.  Then you need to exclude the mpfs_net_img.c file and include the my_img.c file.  If you edit these files you can see they contain the web pages in the source directory you entered for mpfs2.

This all makes sense once you unravel the ball of string.  I have shown this in my previous books for Hv2 and will also include how to do this in my new book on Hv3.  If you still can't make this work, send me a PM and I can send some more detailed info.
BillP
#4
yts
Super Member
  • Total Posts : 637
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/08 17:22:34 (permalink)
0
Thank you for your reply.
 
>My suggestion is to run MHC with the option checked one time to create the file, then turn it off. Modify the file for your own web pages.
 
This procedure is exactly what I tried to do in trial #1 (failure).
The unnecessary files/folders are created in this case as seen in figs 4 and 5 (please see topic #1). Moreover, this procedure causes compile errors.
I wonder if I'm misunderstanding.
 
By the way, isn't the mpfs_net.jar the new version of mpfs2.jar?
 
yts
#5
yts
Super Member
  • Total Posts : 637
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/08 18:06:19 (permalink)
0
I find the solution.
 
The origin of my problem is in the setting of Web pages source directory pass in Include HTTP NET CUSTUM Template as shown in fig.png.
 
Original path was C/\Usres\yts\Harmony3\net\web_pages. I change it to C:\Users\yts\HarmonyProjects\my project_name\firmware\src\web_pages.
 
I should have check more carefully. Sorry about this.
 
Thank you again.
 
>This MHC configuration option now allows you to run the mpfs2.jar program in MHC rather than having to do it outside of the IDE.
 
I understand what this sentence means.
I will check if this mechanism works in my project.
 
yts
 
 
post edited by yts - 2020/07/08 19:11:25

Attached Image(s)

#6
yts
Super Member
  • Total Posts : 637
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/09 18:32:39 (permalink)
0
>This MHC configuration option now allows you to run the mpfs2.jar program in MHC rather than having to do it outside of the IDE.

It seems that this mechanism works only for web_net_server_nvm_mpfs.
The mechanism doesn’t work for my own webpage and the created image file “mpfs_net_img.c” is always one for web_net_server_nvm_mpfs (not for my webpage).

I think that the mpfs_net.jar may be essential to get “mpfs_net_img.c” for my project within the results of my trials

If someone can success to create your own “mpfs_net_img.c” basing on HTTPNET SERVER without using the mpfs_net.jar/ mpfs2.jar utility, please teach me how to set up the configurations.

yts


EDIT:
P.S. Template file of the image file “mpfs_net_img.c” for web_net_server_nvm_mpfs is \Harmony3\net\tcpip\config\custom_app\mpfs_img2_net.c.ftl. The “mpfs_net_img.c” seems to be just the copy of this template file. This means that the mechanism don't work for web_net_server_nvm_mpfs either. I am confused.
post edited by yts - 2020/07/10 06:40:02
#7
freebsd
Super Member
  • Total Posts : 163
  • Reward points : 0
  • Joined: 2011/03/07 04:15:29
  • Location: 0
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/11 05:36:41 (permalink)
4 (1)
Regarding mpfs2.jar - this utility will generate the DynRcrd.bin and FileRcrd.bin. This utility is used for the HTTP module.
 
if we compare the mpfs_net.jar utility -

The new MPFS utility is capable of parsing SSI directives.The utility is intended to be used with the HTTP_NET server.  It generates the http_net_print.h and http_net_print.c files. HTTP_Net Application initialization and HTTP registration are now part of http_net_print.c file. 
#8
yts
Super Member
  • Total Posts : 637
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/12 16:25:01 (permalink)
0
Hi. freebsd,
 
Thank you for your information.
 
Now I am analyzing Harmony3\net\tcpip\config\tcpip_httpnet.py.
 
yts
#9
yts
Super Member
  • Total Posts : 637
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/25 05:19:13 (permalink)
0
Hi. freebsd,

Thanks a lot.

I find your comment in the post #23 on the topic https://www.microchip.com/forums/m1147829-p2.aspx .
I confirmed that mpfs_net.jar can be executed on a pre-build step.




Attached Image(s)

#10
yts
Super Member
  • Total Posts : 637
  • Reward points : 0
  • Joined: 2005/09/06 17:45:30
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/07/25 16:21:30 (permalink)
0
Empirical solution to my problem.

1. I delete Harmony3\net\web_pages folder for safety.
Otherwise, there is a risk that my web_pages folder (see fig1) is overwritten by Harmony3\net\web_pages folder.

2. The mpfs_net.jar is set to be executed on a pre-build step (see #10 post).
This step enables to create http_net_print.c, http_net_print.h, mpfs_net_img.c and http_net_print.idx from my web_pages folder.

3. I don’t need to change Include HTTP NET Custom Template setting in HTTPNET SERVER configurations at all. Though Web pages source directory Path is set to be Harmony3\net\web_pages (see fig2), there is no folder on this path (this folder is deleted at #1). My web_pages folder is not overwritten by Harmony3\net\web_pages folder any more.

If there is a sophisticated solution, please let me know.

yts
post edited by yts - 2020/07/25 22:08:59

Attached Image(s)

#11
floatingpoint
Super Member
  • Total Posts : 207
  • Reward points : 0
  • Joined: 2008/12/01 15:52:03
  • Location: below Equator
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/08/25 19:06:22 (permalink)
0
BillP
Did you turn off the "Custom code" option in the http_net config?
Did you run the mpfs2.jar to create the .c file for your new web pages?
Did you exclude the Microchip demo .c file from the project?
 
Any (or all) of these can cause problems when using your own web pages.
 



I went through this recently and add some notes that may help others:
 
- Harmony uses the term "Custom" where I would use "Microchip Web Demo"
- Turning off Harmony "Custom Code" net option removes the "http_net_print.h" and "http_net_print.c" and "custom_http_net_app.c" files from the project.
 
 
So before turning off the Harmony "Custom Code" net option, copy each of the files above to your project folder under a new name so that they are there for reference/ template.
 
Subsequent compiles are not successful until these files or your newly generated ones are manually added back to the project.
 
- Regarding the jar utilities, to generate new "http_net_print.h" and "http_net_print.c" I only found 2 jar utilities in the Harmony folder: mpfs.jar and mpfs2.jar.
 
After some trial and error, I found that what is referred to above, "mpfs_net.jar" appears to be the file "mpfs.jar".
If like me you remember the very early Microchip TCPIP stack then seeing a jar named "mpfs.jar" may make you wonder whether this is a legacy utility.
 
 
In fact it appears to be the opposite - it appears to be the new utility that is needed to generate new HTTP "net"  formatted http_net_print files.
 
 
Please Microchip, show some imagination and thought when naming these new utilities.
 
FP
 
#12
BillP
Super Member
  • Total Posts : 436
  • Reward points : 0
  • Joined: 2014/09/28 07:53:35
  • Location: CA
  • Status: offline
Re: Simple homepage based on "web_net_server_nvm_mpfs" 2020/09/01 07:41:29 (permalink)
0
There seems to be some confusion about the “Include HTTP NET Custom Template” option in the HTTPNET Server.  I could find no description in the Harmony documentation for this option so the only information I know of is what I have observed on my own and what people have posted on this forum. 
 
OBSERVATIONS
 
SAM E70 Xplained Ultra Kit
Windows 10 PC
MAC
MPLAB X v5.40
XC32 v2.41
mhc v3.4.1
net 3.6.1
 
On a PC, if there is no web_pages directory in the project src-directory, when you run MHC/Generate, MHC copies the web_pages directory and its contents from the net repo to the project src-directory.
 
On a MAC, if there is no web_pages directory in the project src-directory, when you run MHC/Generate, MHC copies a tree structure into the project src-directory (web_pages/Applications/microchip/harmony/v3/net/web_pages) and the contents of the final web_pages directory in that tree are the files from the net repo.  This appears (to me) to be an error.
 
When the web_pages directory does exist in the src-directory, then MHC/Generate copies the mpfs_net_img.c file from the web_pages directory to the src-directory of the project (whether or not the option is checked).  From what I can determine, it does NOT run the mpfs_net.jar utility program because all the necessary files are already in the net repo and are simply copied to the project src-directory.
 
Note: these actions with the web_pages directory occur even when the Demo option is unchecked. 
 
My recommendations to Microchip for the HTTP NET custom template option:
 
  1. Change the title of the option “Include HTTP NET Custom Template” to "Microchip Web Demo" (see @floatingpoint’s post above which makes it clear that the option is only to include and process the Microchip Web Demo.
  2. If the "Microchip Web Demo" option is unchecked, MHC should do nothing.  Do not copy the web_pages directory or the mpfs_net_img.c file to the project src-directory.
  3. Fix the documentation to describe how this option works and also how to add custom web pages using the unchecked option.
  4. Fix the MAC version of MHC to copy the web_pages directory exactly as it occurs in the repo file (the same way the PC version does it).
 
Until changes are made to the HTTP NET custom template option, do not touch the web_pages directory or any of its contents because they get refreshed from the net repo tcpip/config/custom_app/ ftl and pyton files (even if the option is not checked!). 
 
If you want to add custom web pages to a project, do not use the web_pages directory (leave it alone).  Create a folder in the src-directory and fill it with your custom web pages.  For example, create a folder named my_pages and fill it with your own html files.  Create a mypages.c file that processes your web pages.  [Use the template file for the Microchip Demo as a guide for what needs to be in that file.]  Now run the mpfs_net.jar program to create a mypages_img.c file with the my_pages as the source directory and the output going to the project src-directory.  Finally, exclude the mpfs_img.c file from the project and then include the mypages_img.c file. 
 

New book: Learn Harmony v3.  Go to amazon.com/books, then search for Bill Petrick
#13
Jump to:
© 2020 APG vNext Commercial Version 4.5