summaryrefslogtreecommitdiff
path: root/firmware/decompressor/decompressor.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-11-30 00:05:40 +0000
committerJens Arnold <amiconn@rockbox.org>2005-11-30 00:05:40 +0000
commit4c385148ac4a2f4959ec39841c20eaeb42ace668 (patch)
tree09f7e37c89a0a187fc1573efbfa9f2bd8cd60ec2 /firmware/decompressor/decompressor.c
parent8b022749a7c29ce5f7254fc153ca78b087e53e04 (diff)
downloadrockbox-4c385148ac4a2f4959ec39841c20eaeb42ace668.zip
rockbox-4c385148ac4a2f4959ec39841c20eaeb42ace668.tar.gz
rockbox-4c385148ac4a2f4959ec39841c20eaeb42ace668.tar.bz2
rockbox-4c385148ac4a2f4959ec39841c20eaeb42ace668.tar.xz
Self-extracting loader: Cleaner method for inclusion of the UCL-compressed image. The input image is now checked for correctness and converted to C source. The Makefile still needs fixing...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8109 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/decompressor/decompressor.c')
-rw-r--r--firmware/decompressor/decompressor.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/firmware/decompressor/decompressor.c b/firmware/decompressor/decompressor.c
index 9cd7d59..d368c79 100644
--- a/firmware/decompressor/decompressor.c
+++ b/firmware/decompressor/decompressor.c
@@ -21,13 +21,13 @@
*
****************************************************************************/
+#include "uclimage.h"
+
#define ICODE_ATTR __attribute__ ((section (".icode")))
-#define UCL_HEADER 26 /* size of the header generated by uclpack */
/* Symbols defined in the linker script */
extern char iramcopy[], iramstart[], iramend[];
extern char stackend[];
-extern char imgstart[], imgend[];
extern char loadaddress[], dramend[];
/* Prototypes */
@@ -113,20 +113,19 @@ int ucl_nrv2e_decompress_8(const unsigned char *src, unsigned char *dst,
return ilen;
}
+#define ALIGNED_IMG_SIZE ((sizeof(image) + 3) & ~3)
/* This will never return */
void main(void)
{
unsigned long dst_len; /* dummy */
- unsigned long img_len = (unsigned long)(imgend - imgstart);
- unsigned long *src = (unsigned long *)imgstart;
- unsigned long *dst = (unsigned long *)(dramend - img_len);
+ unsigned long *src = (unsigned long *)image;
+ unsigned long *dst = (unsigned long *)(dramend - ALIGNED_IMG_SIZE);
do
*dst++ = *src++;
while (dst < (unsigned long *)dramend);
- ucl_nrv2e_decompress_8(dramend - img_len + UCL_HEADER,
- loadaddress, &dst_len);
+ ucl_nrv2e_decompress_8(dramend - ALIGNED_IMG_SIZE, loadaddress, &dst_len);
asm(
"mov.l @%0+,r0 \n"