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:
parent
c91d7873c7
commit
e13e318c37
5 changed files with 10 additions and 73 deletions
|
@ -46,7 +46,7 @@ endif
|
||||||
|
|
||||||
SRC := $(wildcard *.c)
|
SRC := $(wildcard *.c)
|
||||||
|
|
||||||
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
|
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(OBJDIR)/sh_nrv2e_d8.o
|
||||||
|
|
||||||
ifdef NO_ROM
|
ifdef NO_ROM
|
||||||
LINKFILE = $(OBJDIR)/no_rom.lds
|
LINKFILE = $(OBJDIR)/no_rom.lds
|
||||||
|
@ -65,8 +65,11 @@ ifndef NO_ROM
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(OBJDIR)/$(TARGET).elf : $(OBJS)
|
$(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:
|
clean:
|
||||||
-rm -f \
|
-rm -f \
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
// prototypes
|
// prototypes
|
||||||
static void PlatformInit(void);
|
static void PlatformInit(void);
|
||||||
static int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
|
|
||||||
static void DecompressStart(tImage* pImage);
|
static void DecompressStart(tImage* pImage);
|
||||||
#ifdef USE_ADC
|
#ifdef USE_ADC
|
||||||
static int ReadADC(int channel);
|
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 */
|
/* move the image into place and start it */
|
||||||
static void DecompressStart(tImage* pImage)
|
static void DecompressStart(tImage* pImage)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,6 +77,7 @@ typedef struct
|
||||||
#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
|
#define FW_VERSION *(unsigned short*)(FLASH_BASE + 0xFE) // firmware version
|
||||||
|
|
||||||
// prototypes
|
// prototypes
|
||||||
|
int ucl_nrv2e_decompress_8(const UINT8 *src, UINT8 *dst, UINT32* dst_len);
|
||||||
void _main(void) __attribute__ ((section (".startup")));
|
void _main(void) __attribute__ ((section (".startup")));
|
||||||
int main(void);
|
int main(void);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
OUTPUT_FORMAT(elf32-sh)
|
OUTPUT_FORMAT(elf32-sh)
|
||||||
INPUT(bootloader.o)
|
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
|
@ -19,6 +18,7 @@ SECTIONS
|
||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
*(.text)
|
*(.text)
|
||||||
|
*(.icode)
|
||||||
. = ALIGN(0x4);
|
. = ALIGN(0x4);
|
||||||
} > IRAM
|
} > IRAM
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
where the flash ROM is mirrored to address zero */
|
where the flash ROM is mirrored to address zero */
|
||||||
|
|
||||||
OUTPUT_FORMAT(elf32-sh)
|
OUTPUT_FORMAT(elf32-sh)
|
||||||
INPUT(bootloader.o)
|
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
|
@ -29,6 +28,7 @@ SECTIONS
|
||||||
{
|
{
|
||||||
_begin_text = .;
|
_begin_text = .;
|
||||||
*(.text)
|
*(.text)
|
||||||
|
*(.icode)
|
||||||
. = ALIGN(0x4);
|
. = ALIGN(0x4);
|
||||||
_end_text = .;
|
_end_text = .;
|
||||||
} > IRAM
|
} > IRAM
|
||||||
|
|
Loading…
Reference in a new issue