Remove the firmware decompressor and a few more other SH-stragglers.

Change-Id: Ic568755afcccc6db1b6e791b1ed0d2588b90356f
This commit is contained in:
Solomon Peachy 2020-11-03 18:42:50 -05:00
parent 066d471ae6
commit 090bd9592d
9 changed files with 2 additions and 455 deletions

View file

@ -24,12 +24,7 @@ else
ROCKS += $(CHESSBOX_OBJDIR)/chessbox.rock
endif
ifeq ($(CPU),sh)
# sh need to retain its' -Os
CHESSBOXFLAGS = $(PLUGINFLAGS)
else
CHESSBOXFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O2
endif
$(CHESSBOX_OBJDIR)/chessbox.rock: $(CHESSBOX_OBJ)

View file

@ -1,52 +0,0 @@
# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# $Id$
#
ifndef V
SILENT=@
endif
PRINTS=$(SILENT)$(call info,$(1))
LDS := link.lds
LINKFILE = $(OBJDIR)/linkage.lds
OBJS := $(OBJDIR)/decompressor.o $(OBJDIR)/uclimage.o \
$(OBJDIR)/sh_nrv2e_d8.o $(OBJDIR)/startup.o
CFLAGS = $(GCCOPTS)
all: $(OBJDIR)/compressed.bin
$(OBJDIR)/compressed.bin : $(OBJDIR)/compressed.elf
$(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
$(OBJDIR)/compressed.elf : $(OBJS) $(LINKFILE)
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/compressed.map
$(LINKFILE): $(LDS)
$(SILENT)mkdir -p $(dir $@)
$(call PRINTS,Build LDS file)cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
$(OBJDIR)/decompressor.o : decompressor.c $(OBJDIR)/uclimage.c
$(SILENT)mkdir -p $(dir $@)
$(call PRINTS,CC $<)$(CC) $(CFLAGS) -I$(OBJDIR) -c $< -o $@
$(OBJDIR)/startup.o : startup.S
$(SILENT)mkdir -p $(dir $@)
$(call PRINTS,AS $<)$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/sh_nrv2e_d8.o : sh_nrv2e_d8.S
$(SILENT)mkdir -p $(dir $@)
$(call PRINTS,AS $<)$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/uclimage.o : $(OBJDIR)/uclimage.c
$(SILENT)mkdir -p $(dir $@)
$(call PRINTS,CC $(<F))$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/uclimage.c : $(FLASHFILE) $(TOOLSDIR)/ucl2src.pl
$(SILENT)mkdir -p $(dir $@)
$(call PRINTS,UCL2SRC $(<F))perl -s $(TOOLSDIR)/ucl2src.pl -p=$(OBJDIR)/uclimage $<

View file

@ -1,73 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 by Jens Arnold
*
* Self-extracting firmware loader to work around the 200KB size limit
* for archos player and recorder v1
* Decompresses a built-in UCL-compressed image (method 2e) and executes it.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "uclimage.h"
#define ICODE_ATTR __attribute__ ((section (".icode")))
/* Symbols defined in the linker script */
extern char iramcopy[], iramstart[], iramend[];
extern char stackend[];
extern char loadaddress[], dramend[];
/* Prototypes */
extern void start(void);
void main(void) ICODE_ATTR;
int ucl_nrv2e_decompress_8(const unsigned char *src, unsigned char *dst,
unsigned long *dst_len) ICODE_ATTR;
/* Vector table */
void (*vbr[]) (void) __attribute__ ((section (".vectors"))) =
{
start, (void *)stackend,
start, (void *)stackend,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
/** All subsequent functions are executed from IRAM **/
#define ALIGNED_IMG_SIZE ((sizeof(image) + 3) & ~3)
/* This will never return */
void main(void)
{
unsigned long dst_len; /* dummy */
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 - ALIGNED_IMG_SIZE, loadaddress, &dst_len);
asm(
"mov.l @%0+,r0 \n"
"jmp @r0 \n"
"mov.l @%0+,r15 \n"
: : "r"(loadaddress) : "r0"
);
}

View file

@ -1,71 +0,0 @@
OUTPUT_FORMAT(elf32-sh)
#define DRAMORIG 0x09000000
#define DRAMSIZE (MEMORYSIZE * 0x00100000)
#define IRAMORIG 0x0f000000
#define IRAMSIZE 0x00001000
MEMORY
{
IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
}
SECTIONS
{
.vectors :
{
_loadaddress = .;
_dramend = . + DRAMSIZE;
KEEP(*(.vectors))
. = ALIGN(0x200);
} > DRAM
.text :
{
*(.start)
*(.text)
. = ALIGN(0x4);
} > DRAM
.rodata :
{
*(.rodata*)
*(.rodata.str1.1)
*(.rodata.str1.4)
. = ALIGN(0x4);
} > DRAM
.data :
{
*(.data)
. = ALIGN(0x4);
_iramcopy = .;
} > DRAM
.iram IRAMORIG : AT ( _iramcopy )
{
_iramstart = .;
*(.icode)
*(.idata)
. = ALIGN(0x4);
_iramend = .;
} > IRAM
.stack :
{
_stackbegin = .;
*(.stack)
. += 0x0800;
_stackend = .;
} > IRAM
.bss :
{
_edata = .;
*(.bss)
*(COMMON)
. = ALIGN(0x4);
_end = .;
} > DRAM
}

View file

@ -1,149 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Jens Arnold
*
* based on arm_nrv2e_d8.S -- ARM decompressor for NRV2E
* Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
* Copyright (C) 1996-2008 Laszlo Molnar
* Copyright (C) 2000-2008 John F. Reiser
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#define src r4
#define dst r5
#define len r6 /* overlaps 'cnt' */
#define cnt r6 /* overlaps 'len' while reading an offset */
#define tmp r7
#define off r0 /* must be r0 because of indexed addressing */
#define bits r1
#define bitmask r2
#define wrnk r3 /* -0x500 -M2_MAX_OFFSET before "wrinkle" */
#define GETBIT \
tst bits, bitmask; \
bf 1f; \
bsr get1_n2e; \
1: \
shll bits /* using the delay slot on purpose */
#define getnextb(reg) GETBIT; rotcl reg
#define jnextb0 GETBIT; bf
#define jnextb1 GETBIT; bt
.section .icode,"ax",@progbits
.align 2
.global _ucl_nrv2e_decompress_8
.type _ucl_nrv2e_decompress_8,@function
/* src_len = ucl_nrv2e_decompress_8(const unsigned char *src,
* unsigned char *dst,
* unsigned long *dst_len)
*/
_ucl_nrv2e_decompress_8:
sts.l pr, @-r15
mov #-1, off ! off = -1 initial condition
mov.l r6, @-r15
mov #-5, wrnk
mov.l r5, @-r15
shll8 wrnk ! nrv2e -M2_MAX_OFFSET
mov.l r4, @-r15
mov #-1, bitmask
shlr bitmask ! 0x7fffffff for testing before shifting
bra top_n2e
not bitmask, bits ! refill next time (MSB must be set)
eof_n2e:
mov.l @r15+, r0 ! r0 = orig_src
mov.l @r15+, r1 ! r1 = orig_dst
sub r0, src
mov.l @r15+, r2 ! r2 = plen_dst
sub r1, dst
mov.l dst, @r2
lds.l @r15+, pr
rts
mov src, r0
lit_n2e:
mov.b @src, tmp
add #1, src ! Need to fill the pipeline latency anyway
mov.b tmp, @dst
add #1, dst
top_n2e:
jnextb1 lit_n2e
bra getoff_n2e
mov #1, cnt
off_n2e:
add #-1, cnt
getnextb(cnt)
getoff_n2e:
getnextb(cnt)
jnextb0 off_n2e
mov #-4, tmp ! T=1 on entry, so this does
addc cnt, tmp ! tmp = cnt - 3, T = (cnt >= 3)
mov #0, len ! cnt and len share a reg!
bf offprev_n2e ! cnt was 2
mov.b @src+, off ! low 7+1 bits
shll8 tmp
extu.b off, off
or tmp, off
not off, off ! off = ~off
tst off, off
bt eof_n2e
shar off
bt lenlast_n2e
bf lenmore_n2e ! always taken if the preceding bt isn't
offprev_n2e:
jnextb1 lenlast_n2e
lenmore_n2e:
mov #1, len
jnextb1 lenlast_n2e
len_n2e:
getnextb(len)
jnextb0 len_n2e
bra gotlen_n2e
mov #6-2, tmp
get1_n2e: ! in: T bit set
mov.b @src+, bits ! SH1 sign-extends on load
rotcl bits ! LSB = T, T = MSB
shll16 bits
rts
shll8 bits
lenlast_n2e:
getnextb(len) ! 0,1,2,3
mov #2, tmp
gotlen_n2e:
cmp/gt off, wrnk ! too far away, so minimum match length is 3
addc tmp, len
copy_n2e:
add #-1, len
mov.b @(off,dst), tmp
tst len, len
mov.b tmp, @dst
add #1, dst
bf copy_n2e
bt top_n2e ! always taken if the preceding bf isn't
.size _ucl_nrv2e_decompress_8, .-_ucl_nrv2e_decompress_8

View file

@ -1,59 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 by Jens Arnold
* based on crt0.S by Linus Nielsen Feltzing
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
.section .start,"ax",@progbits
.global _start
_start:
/* copy the .iram section */
mov.l .iramcopy_k,r0
mov.l .iram_k,r1
mov.l .iramend_k,r2
/* Note: We cannot put a PC relative load into the delay slot of a 'bra'
instruction (the offset would be wrong), but there is nothing else to
do before the loop, so the delay slot would be 'nop'. The cmp / bf
sequence is the same length, but more efficient. */
cmp/hi r1,r2
bf .noiramcopy
.iramloop:
mov.l @r0+,r3
mov.l r3,@r1
add #4,r1
cmp/hi r1,r2
bt .iramloop
.noiramcopy:
/* call the mainline */
mov.l .main_k,r0
mov.l .stackend_k,r15
jmp @r0
nop
.align 2
.iramcopy_k:
.long _iramcopy
.iram_k:
.long _iramstart
.iramend_k:
.long _iramend
.stackend_k:
.long _stackend
.main_k:
.long _main

View file

@ -5,8 +5,7 @@ ENTRY(start)
STARTUP(crt0.o)
OUTPUT_FORMAT(elf32-littlearm)
#else
ENTRY(_start)
OUTPUT_FORMAT(elf32-sh)
#error "Unsupported CPU!"
#endif
#ifdef IRIVER_IFP7XX_SERIES

View file

@ -1,41 +0,0 @@
!***************************************************************************
! __________ __ ___.
! Open \______ \ ____ ____ | | _\_ |__ _______ ___
! Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
! Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
! Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
! \/ \/ \/ \/ \/
! $Id$
!
! Copyright (C) 2002 by Linus Nielsen Feltzing
!
! All files in this archive are subject to the GNU General Public License.
! See the file COPYING in the source tree root for full license agreement.
!
! This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
! KIND, either express or implied.
!
!***************************************************************************
! note: sh-1 has a "delay cycle" after every branch where you can
! execute another instruction "for free".
.file "start.s"
.section .text
.extern _INIT
.extern _vectable
.extern _stack
.global _start
.align 2
_start:
mov.l 1f, r1
mov.l 3f, r3
mov.l 2f, r15
jmp @r3
ldc r1, vbr
nop
1: .long _vectable
2: .long _stack
3: .long _INIT
.type _start,@function

4
tools/configure vendored
View file

@ -4550,9 +4550,7 @@ HOSTAR=${HOSTAR:-${AR}}
if [ -z "$arch" ]; then
cpp_defines=$(echo "" | $CPP $GCCOPTS -dD)
if [ -n "$(echo $cpp_defines | grep -w __sh__)" ]; then
arch="sh"
elif [ -n "$(echo $cpp_defines | grep -w __m68k__)" ]; then
if [ -n "$(echo $cpp_defines | grep -w __m68k__)" ]; then
arch="m68k"
elif [ -n "$(echo $cpp_defines | grep -w __arm__)" ]; then
arch="arm"