avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] Need a make guru; embedding web pages


From: David Kelly
Subject: Re: [avr-chat] Need a make guru; embedding web pages
Date: Tue, 30 Aug 2011 14:41:38 -0500
User-agent: Mutt/1.4.2.3i

On Tue, Aug 30, 2011 at 11:38:23AM -0700, Rick Mann wrote:
> I realize this isn't strictly AVR-related, but I am using AVRs in my
> projects, and the info might be useful to the list.
> 
> I'm working on an internet-enabled embedded project that is
> configurable via internal web server. I build the web pages directly
> into the application binary and then read them out at the appropriate
> address. This part is working well enough (on ARM, actually, but I
> need to do it on an AVR soon).
> 
> I use objcopy to convert the .html, .png, and .css files to .o that
> then get linked into the resulting image. I then try to generate a
> web.h file that creates lines like
> 
> extern const char index_html[];
> extern const char index_html_end[];
> extern const char error_html[];
> extern const char error_html_end[];
> extern const char main_css[];
> extern const char main_css_end[];
> WebFileTOC sWebTOC = {
> { "index.html", index_html, index_html_end },
> { "error.html", error_html, error_html_end },
> { "main.css", main_css, main_css_end },
> };
> 
> This lets my web server code get at the content (I realize on AVR I'd
> have to the pgm-space access stuff; that's not the issue).
> 
> I'm having trouble getting the rules to properly make things in order,
> and generate the header file, and then analyze the dependencies and
> build all the files that depend on the web.h.

I think I'd put the WebFileTOC in a .c and define an empty extern
WebFileTOC in the .h. You really don't want memory allocation occurring
in a .h as you show above.

Then in your Makefile add a pattern rule:

%.html : %.o
        avr-objcopy -B elf $< $@

Perhaps rename your files to index_html.html, error_html.html, and
main_css.html so as to get something close to the names you have used
above.

Put index_html.o, error_html.o, and main_css.o in your list of objects
to link and that should be it.

-- 
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]