Use the asm optimised UCL decompressor for the flash bootloader as well. Verified working on Player, Recorder v1, Ondio SP and Ondio FM.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18928 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2008-10-30 00:17:45 +00:00
parent c91d7873c7
commit e13e318c37
5 changed files with 10 additions and 73 deletions

View file

@ -46,7 +46,7 @@ endif
SRC := $(wildcard *.c)
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/sh_nrv2e_d8.o
ifdef NO_ROM
LINKFILE = $(OBJDIR)/no_rom.lds
@ -65,8 +65,11 @@ ifndef NO_ROM
endif
$(OBJDIR)/$(TARGET).elf : $(OBJS)
$(CC) -Os -nostdlib -o $(OBJDIR)/$(TARGET).elf -L$(OBJDIR) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$(TARGET).map
$(CC) -Os -nostdlib -o $@ $(OBJS) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$(TARGET).map
# cross-reference, saves code duplication
$(OBJDIR)/sh_nrv2e_d8.o : ../../firmware/decompressor/sh_nrv2e_d8.S
$(CC) $(CFLAGS) -c $< -o $@
clean:
-rm -f \

View file

@ -29,7 +29,6 @@
// prototypes
static void PlatformInit(void);
static int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
static void DecompressStart(tImage* pImage);
#ifdef USE_ADC
static int ReadADC(int channel);
@ -188,72 +187,6 @@ static void PlatformInit(void)
}
/* Thinned out version of the UCL 2e decompression sourcecode
* Original (C) Markus F.X.J Oberhumer under GNU GPL license */
#define GETBIT(bb, src, ilen) \
(((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1)
static int ucl_nrv2e_decompress_8(
const UINT8 *src, UINT8 *dst, UINT32* dst_len)
{
UINT32 bb = 0;
unsigned ilen = 0, olen = 0, last_m_off = 1;
for (;;)
{
unsigned m_off, m_len;
while (GETBIT(bb,src,ilen))
{
dst[olen++] = src[ilen++];
}
m_off = 1;
for (;;)
{
m_off = m_off*2 + GETBIT(bb,src,ilen);
if (GETBIT(bb,src,ilen)) break;
m_off = (m_off-1)*2 + GETBIT(bb,src,ilen);
}
if (m_off == 2)
{
m_off = last_m_off;
m_len = GETBIT(bb,src,ilen);
}
else
{
m_off = (m_off-3)*256 + src[ilen++];
if (m_off == 0xffffffff)
break;
m_len = (m_off ^ 0xffffffff) & 1;
m_off >>= 1;
last_m_off = ++m_off;
}
if (m_len)
m_len = 1 + GETBIT(bb,src,ilen);
else if (GETBIT(bb,src,ilen))
m_len = 3 + GETBIT(bb,src,ilen);
else
{
m_len++;
do {
m_len = m_len*2 + GETBIT(bb,src,ilen);
} while (!GETBIT(bb,src,ilen));
m_len += 3;
}
m_len += (m_off > 0x500);
{
const UINT8 *m_pos;
m_pos = dst + olen - m_off;
dst[olen++] = *m_pos++;
do dst[olen++] = *m_pos++; while (--m_len > 0);
}
}
*dst_len = olen;
return ilen;
}
/* move the image into place and start it */
static void DecompressStart(tImage* pImage)
{

View file

@ -77,6 +77,7 @@ typedef struct
#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
// prototypes
int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
void _main(void) __attribute__ ((section (".startup")));
int main(void);

View file

@ -1,5 +1,4 @@
OUTPUT_FORMAT(elf32-sh)
INPUT(bootloader.o)
MEMORY
{
@ -19,6 +18,7 @@ SECTIONS
.text :
{
*(.text)
*(.icode)
. = ALIGN(0x4);
} > IRAM

View file

@ -2,7 +2,6 @@
where the flash ROM is mirrored to address zero */
OUTPUT_FORMAT(elf32-sh)
INPUT(bootloader.o)
MEMORY
{
@ -29,6 +28,7 @@ SECTIONS
{
_begin_text = .;
*(.text)
*(.icode)
. = ALIGN(0x4);
_end_text = .;
} > IRAM