diff options
Diffstat (limited to 'firmware/decompressor/decompressor.c')
-rw-r--r-- | firmware/decompressor/decompressor.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/firmware/decompressor/decompressor.c b/firmware/decompressor/decompressor.c index 9cd7d5998e..d368c79538 100644 --- a/firmware/decompressor/decompressor.c +++ b/firmware/decompressor/decompressor.c | |||
@@ -21,13 +21,13 @@ | |||
21 | * | 21 | * |
22 | ****************************************************************************/ | 22 | ****************************************************************************/ |
23 | 23 | ||
24 | #include "uclimage.h" | ||
25 | |||
24 | #define ICODE_ATTR __attribute__ ((section (".icode"))) | 26 | #define ICODE_ATTR __attribute__ ((section (".icode"))) |
25 | #define UCL_HEADER 26 /* size of the header generated by uclpack */ | ||
26 | 27 | ||
27 | /* Symbols defined in the linker script */ | 28 | /* Symbols defined in the linker script */ |
28 | extern char iramcopy[], iramstart[], iramend[]; | 29 | extern char iramcopy[], iramstart[], iramend[]; |
29 | extern char stackend[]; | 30 | extern char stackend[]; |
30 | extern char imgstart[], imgend[]; | ||
31 | extern char loadaddress[], dramend[]; | 31 | extern char loadaddress[], dramend[]; |
32 | 32 | ||
33 | /* Prototypes */ | 33 | /* Prototypes */ |
@@ -113,20 +113,19 @@ int ucl_nrv2e_decompress_8(const unsigned char *src, unsigned char *dst, | |||
113 | return ilen; | 113 | return ilen; |
114 | } | 114 | } |
115 | 115 | ||
116 | #define ALIGNED_IMG_SIZE ((sizeof(image) + 3) & ~3) | ||
116 | /* This will never return */ | 117 | /* This will never return */ |
117 | void main(void) | 118 | void main(void) |
118 | { | 119 | { |
119 | unsigned long dst_len; /* dummy */ | 120 | unsigned long dst_len; /* dummy */ |
120 | unsigned long img_len = (unsigned long)(imgend - imgstart); | 121 | unsigned long *src = (unsigned long *)image; |
121 | unsigned long *src = (unsigned long *)imgstart; | 122 | unsigned long *dst = (unsigned long *)(dramend - ALIGNED_IMG_SIZE); |
122 | unsigned long *dst = (unsigned long *)(dramend - img_len); | ||
123 | 123 | ||
124 | do | 124 | do |
125 | *dst++ = *src++; | 125 | *dst++ = *src++; |
126 | while (dst < (unsigned long *)dramend); | 126 | while (dst < (unsigned long *)dramend); |
127 | 127 | ||
128 | ucl_nrv2e_decompress_8(dramend - img_len + UCL_HEADER, | 128 | ucl_nrv2e_decompress_8(dramend - ALIGNED_IMG_SIZE, loadaddress, &dst_len); |
129 | loadaddress, &dst_len); | ||
130 | 129 | ||
131 | asm( | 130 | asm( |
132 | "mov.l @%0+,r0 \n" | 131 | "mov.l @%0+,r0 \n" |