Forum Discussion
Altera_Forum
Honored Contributor
19 years agoThanks R.B. Your suggestion got me pointed in the right direction.
I didn't really want to modify any original NIOS files for one particular project, so I ended up adding a builder to run ZIP on the zipfile first, then do the objcopy to create a .o file, then include that in the linker script. The following trivial test program then worked fine and printed out one of the files in the original zip tree.#include <stdio.h>
# include "../../../altera_ro_zipfs/HAL/inc/altera_ro_zipfs.h"
extern char _binary_web_zip_start, _binary_web_zip_end,
_binary_web_zip_size;
# define WEB_BASE ((int)_binary_web_zip_start)# define WEB_NAME "/mnt/web"# define WEB_OFFSET 0
ALTERA_RO_ZIPFS_INSTANCE( WEB, web );
int main()
{
FILE *fd; int ch;
printf( "ZIP File - Start:%X End:%X Size:%d\n",
(int)_binary_web_zip_start,
(int)_binary_web_zip_end,
(int)_binary_web_zip_size );
ALTERA_RO_ZIPFS_INIT( WEB, web );
fd = fopen( WEB_NAME "/web/index.html", "r" );
if( fd ) { while( (ch = getc(fd)) != EOF ) putchar( ch ); }
return 0;
} There's a bit of hackery in the include file using ../../, as I did not know how to specify the HAL include directory symbolically (without using an absolute pathname)