mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-07 05:31:17 -07:00
Tailor zlib to our needs:
- disable support for fixed code blocks. Saves 2KByte code tables in ARM Flash memory
This commit is contained in:
parent
fb22897415
commit
28b9faccea
2 changed files with 12 additions and 2 deletions
|
@ -28,7 +28,7 @@ FPGA_BITSTREAMS = fpga_lf.bit fpga_hf.bit
|
||||||
#the zlib source files required for decompressing the fpga config at run time
|
#the zlib source files required for decompressing the fpga config at run time
|
||||||
SRC_ZLIB = inflate.c inffast.c inftrees.c adler32.c zutil.c
|
SRC_ZLIB = inflate.c inffast.c inftrees.c adler32.c zutil.c
|
||||||
#additional defines required to compile zlib
|
#additional defines required to compile zlib
|
||||||
ZLIB_CFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP
|
ZLIB_CFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
|
||||||
APP_CFLAGS += $(ZLIB_CFLAGS)
|
APP_CFLAGS += $(ZLIB_CFLAGS)
|
||||||
# zlib includes:
|
# zlib includes:
|
||||||
APP_CFLAGS += -I../zlib
|
APP_CFLAGS += -I../zlib
|
||||||
|
|
|
@ -92,7 +92,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* function prototypes */
|
/* function prototypes */
|
||||||
|
#ifdef ZLIB_PM3_TUNED
|
||||||
|
extern void Dbprintf(const char *fmt, ...);
|
||||||
|
#else
|
||||||
local void fixedtables OF((struct inflate_state FAR *state));
|
local void fixedtables OF((struct inflate_state FAR *state));
|
||||||
|
#endif
|
||||||
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
||||||
unsigned copy));
|
unsigned copy));
|
||||||
#ifdef BUILDFIXED
|
#ifdef BUILDFIXED
|
||||||
|
@ -258,6 +262,7 @@ int value;
|
||||||
used for threaded applications, since the rewriting of the tables and virgin
|
used for threaded applications, since the rewriting of the tables and virgin
|
||||||
may not be thread-safe.
|
may not be thread-safe.
|
||||||
*/
|
*/
|
||||||
|
#ifndef ZLIB_PM3_TUNED
|
||||||
local void fixedtables(state)
|
local void fixedtables(state)
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
{
|
{
|
||||||
|
@ -361,7 +366,7 @@ void makefixed()
|
||||||
puts("\n };");
|
puts("\n };");
|
||||||
}
|
}
|
||||||
#endif /* MAKEFIXED */
|
#endif /* MAKEFIXED */
|
||||||
|
#endif /* ZLIB_PM3_TUNED */
|
||||||
/*
|
/*
|
||||||
Update the window with the last wsize (normally 32K) bytes written before
|
Update the window with the last wsize (normally 32K) bytes written before
|
||||||
returning. If window does not exist yet, create it. This is only called
|
returning. If window does not exist yet, create it. This is only called
|
||||||
|
@ -841,6 +846,10 @@ int flush;
|
||||||
state->mode = STORED;
|
state->mode = STORED;
|
||||||
break;
|
break;
|
||||||
case 1: /* fixed block */
|
case 1: /* fixed block */
|
||||||
|
#ifdef ZLIB_PM3_TUNED
|
||||||
|
Dbprintf("FATAL error. Compressed FPGA files with fixed code blocks are not supported!");
|
||||||
|
for(;;);
|
||||||
|
#else
|
||||||
fixedtables(state);
|
fixedtables(state);
|
||||||
Tracev((stderr, "inflate: fixed codes block%s\n",
|
Tracev((stderr, "inflate: fixed codes block%s\n",
|
||||||
state->last ? " (last)" : ""));
|
state->last ? " (last)" : ""));
|
||||||
|
@ -849,6 +858,7 @@ int flush;
|
||||||
DROPBITS(2);
|
DROPBITS(2);
|
||||||
goto inf_leave;
|
goto inf_leave;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 2: /* dynamic block */
|
case 2: /* dynamic block */
|
||||||
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue