In this HOW TO you'll learn to adapt the Hercules Web Server example to your own needs. You will learn how to change the text on the web page, and how to render your own image.
It's a step-by-step guide with sample code attached.
Your first task is to follow the steps of the excellent guide and build the Texas Instruments Web Server example for the TMS570LC43x LaunchPad:http://processors.wiki.ti.com/index.php/LAUNCHXL2_570LC43:_lwIP_Demo.
Once you have successfully built this project from source, and you've successfully surfed to the LaunchPad, you can start to celebrate YiKai Chen Week.
Adapting the ExampleWe'll first take a copy of the folder with the html.
Copy the following folder from the location where the 'HALCoGen EMAC Driver with lwIP Demonstration' is installed:C:\ti\Hercules\HALCoGen EMAC Driver with lwIP Demonstration\v00.03.00\lwip-1.4.1\apps\httpserver_raw
Copy it to some location on your computer.
I've copied it to C:\Users\Jan\Documents\elektronica\Texas Instruments\Hercules\ycd\httpserver_raw.
In CCS:Exclude the original copy of httpserver_raw from build, by right-clicking on it and selecting Exclude from Build.
Create link to the new copy, by right-clicking on the apps folder and selecting new -> Other
Select Folder -> Next
Press advanced
Name the folder httpserver_raw_ycd.Select Link to Another LocationBrowse to the copy folder (for me, C:\Users\Jan\Documents\elektronica\Texas Instruments\Hercules\ycd\httpserver_raw).
Finish
Open that new httpserver_raw_ycd, and exclude the makefsdata folder and the fsdata.c file.
Recompile and run to see if your code still works. Everything should be the same.
Making ChangesYou need a unix or linux machine with perl to do this.
For those that don't have access to a *n*x, I've attached an archive that you can copy over your local copy of httpserver_raw (for me, C:\Users\Jan\Documents\elektronica\Texas Instruments\Hercules\ycd\httpserver_raw).
Check the attachments for httpserver_raw.zip.
Be creative with the following files:
httpserver_raw\makefsdata\fs\index.html
httpserver_raw\makefsdata\fs\img\Hercules_block_diagram.gif
httpserver_raw\makefsdata\fs\img\ti_logo.gif
I changed some of the text in the html file, and put other drawings in the gif files.
Copy your local httpserver_raw and all its content over to a linux machine, if you aren't working on one.
Navigate to that copy.
Go to the makefsdata subfolder
> $ cd makefsdata
execute the conversion script
> $ perl makefsdata
Copy the file makefsdata/fsdata.c back to your httpserver_raw_ycd folder root in CCS (It should overwrite the existing one, and should stay excluded from build)
Build, load, retest, surf and enjoy.
Bonus: change the execution logYou can even get creative on the source file /Build-LAUNCHXL2-570LC43/example/hdk/src/lwip_main.c and adapt some message there.
Learning Moment: why is fsdata.c excluded from build, and is part of the compiled code anyways?Hah, It took me some time to figure that one out. The fsdata.c file that's generated by our script isn't a compilable file. Try to include it in the build, and you'll get errors.But the fsdata.c file has this line of code:
#include "fsdata_custom.c"
So the c file is pulled into fsdata.c during the build cycle. It's the same as copying the contents of fsdata.c and pasting them where the #include is.
And now that you are able to create the whole project from source, it's a good time to start looking at how it works. Start from the HL_sys_main.c source, and from that lwip_main.c file that we've touched in the bonus.
Have Fun!
Comments
Please log in or sign up to comment.