summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-11-03 18:42:50 -0500
committerSolomon Peachy <pizza@shaftnet.org>2020-11-03 23:43:32 +0000
commit090bd9592df1e05e289e658c2530ae277a205318 (patch)
treef6be20462fa97d0d20a2e2b3fbe6e43e06cd1b42
parent066d471ae6dd34eda370c5f610adaefa1029bab9 (diff)
downloadrockbox-090bd9592df1e05e289e658c2530ae277a205318.tar.gz
rockbox-090bd9592df1e05e289e658c2530ae277a205318.zip
Remove the firmware decompressor and a few more other SH-stragglers.
Change-Id: Ic568755afcccc6db1b6e791b1ed0d2588b90356f
-rw-r--r--apps/plugins/chessbox/chessbox.make5
-rw-r--r--firmware/decompressor/Makefile52
-rw-r--r--firmware/decompressor/decompressor.c73
-rw-r--r--firmware/decompressor/link.lds71
-rw-r--r--firmware/decompressor/sh_nrv2e_d8.S149
-rw-r--r--firmware/decompressor/startup.S59
-rw-r--r--gdb/linker.cfg3
-rw-r--r--gdb/start.s41
-rwxr-xr-xtools/configure4
9 files changed, 2 insertions, 455 deletions
diff --git a/apps/plugins/chessbox/chessbox.make b/apps/plugins/chessbox/chessbox.make
index ee4940de8b..87f0a6ecc0 100644
--- a/apps/plugins/chessbox/chessbox.make
+++ b/apps/plugins/chessbox/chessbox.make
@@ -24,12 +24,7 @@ else
24 ROCKS += $(CHESSBOX_OBJDIR)/chessbox.rock 24 ROCKS += $(CHESSBOX_OBJDIR)/chessbox.rock
25endif 25endif
26 26
27ifeq ($(CPU),sh)
28# sh need to retain its' -Os
29CHESSBOXFLAGS = $(PLUGINFLAGS)
30else
31CHESSBOXFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O2 27CHESSBOXFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O2
32endif
33 28
34$(CHESSBOX_OBJDIR)/chessbox.rock: $(CHESSBOX_OBJ) 29$(CHESSBOX_OBJDIR)/chessbox.rock: $(CHESSBOX_OBJ)
35 30
diff --git a/firmware/decompressor/Makefile b/firmware/decompressor/Makefile
deleted file mode 100644
index 30bb04e480..0000000000
--- a/firmware/decompressor/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10ifndef V
11SILENT=@
12endif
13PRINTS=$(SILENT)$(call info,$(1))
14
15LDS := link.lds
16LINKFILE = $(OBJDIR)/linkage.lds
17OBJS := $(OBJDIR)/decompressor.o $(OBJDIR)/uclimage.o \
18 $(OBJDIR)/sh_nrv2e_d8.o $(OBJDIR)/startup.o
19CFLAGS = $(GCCOPTS)
20
21all: $(OBJDIR)/compressed.bin
22
23$(OBJDIR)/compressed.bin : $(OBJDIR)/compressed.elf
24 $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@
25
26$(OBJDIR)/compressed.elf : $(OBJS) $(LINKFILE)
27 $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/compressed.map
28
29$(LINKFILE): $(LDS)
30 $(SILENT)mkdir -p $(dir $@)
31 $(call PRINTS,Build LDS file)cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@
32
33$(OBJDIR)/decompressor.o : decompressor.c $(OBJDIR)/uclimage.c
34 $(SILENT)mkdir -p $(dir $@)
35 $(call PRINTS,CC $<)$(CC) $(CFLAGS) -I$(OBJDIR) -c $< -o $@
36
37$(OBJDIR)/startup.o : startup.S
38 $(SILENT)mkdir -p $(dir $@)
39 $(call PRINTS,AS $<)$(CC) $(CFLAGS) -c $< -o $@
40
41$(OBJDIR)/sh_nrv2e_d8.o : sh_nrv2e_d8.S
42 $(SILENT)mkdir -p $(dir $@)
43 $(call PRINTS,AS $<)$(CC) $(CFLAGS) -c $< -o $@
44
45$(OBJDIR)/uclimage.o : $(OBJDIR)/uclimage.c
46 $(SILENT)mkdir -p $(dir $@)
47 $(call PRINTS,CC $(<F))$(CC) $(CFLAGS) -c $< -o $@
48
49$(OBJDIR)/uclimage.c : $(FLASHFILE) $(TOOLSDIR)/ucl2src.pl
50 $(SILENT)mkdir -p $(dir $@)
51 $(call PRINTS,UCL2SRC $(<F))perl -s $(TOOLSDIR)/ucl2src.pl -p=$(OBJDIR)/uclimage $<
52
diff --git a/firmware/decompressor/decompressor.c b/firmware/decompressor/decompressor.c
deleted file mode 100644
index 11888ef272..0000000000
--- a/firmware/decompressor/decompressor.c
+++ /dev/null
@@ -1,73 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Jens Arnold
11 *
12 * Self-extracting firmware loader to work around the 200KB size limit
13 * for archos player and recorder v1
14 * Decompresses a built-in UCL-compressed image (method 2e) and executes it.
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
20 *
21 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 * KIND, either express or implied.
23 *
24 ****************************************************************************/
25
26#include "uclimage.h"
27
28#define ICODE_ATTR __attribute__ ((section (".icode")))
29
30/* Symbols defined in the linker script */
31extern char iramcopy[], iramstart[], iramend[];
32extern char stackend[];
33extern char loadaddress[], dramend[];
34
35/* Prototypes */
36extern void start(void);
37
38void main(void) ICODE_ATTR;
39int ucl_nrv2e_decompress_8(const unsigned char *src, unsigned char *dst,
40 unsigned long *dst_len) ICODE_ATTR;
41
42/* Vector table */
43void (*vbr[]) (void) __attribute__ ((section (".vectors"))) =
44{
45 start, (void *)stackend,
46 start, (void *)stackend,
47 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,
48 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,
49};
50
51/** All subsequent functions are executed from IRAM **/
52
53#define ALIGNED_IMG_SIZE ((sizeof(image) + 3) & ~3)
54/* This will never return */
55void main(void)
56{
57 unsigned long dst_len; /* dummy */
58 unsigned long *src = (unsigned long *)image;
59 unsigned long *dst = (unsigned long *)(dramend - ALIGNED_IMG_SIZE);
60
61 do
62 *dst++ = *src++;
63 while (dst < (unsigned long *)dramend);
64
65 ucl_nrv2e_decompress_8(dramend - ALIGNED_IMG_SIZE, loadaddress, &dst_len);
66
67 asm(
68 "mov.l @%0+,r0 \n"
69 "jmp @r0 \n"
70 "mov.l @%0+,r15 \n"
71 : : "r"(loadaddress) : "r0"
72 );
73}
diff --git a/firmware/decompressor/link.lds b/firmware/decompressor/link.lds
deleted file mode 100644
index 51c0460d42..0000000000
--- a/firmware/decompressor/link.lds
+++ /dev/null
@@ -1,71 +0,0 @@
1OUTPUT_FORMAT(elf32-sh)
2
3#define DRAMORIG 0x09000000
4#define DRAMSIZE (MEMORYSIZE * 0x00100000)
5#define IRAMORIG 0x0f000000
6#define IRAMSIZE 0x00001000
7
8MEMORY
9{
10 IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
11 DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
12}
13
14SECTIONS
15{
16 .vectors :
17 {
18 _loadaddress = .;
19 _dramend = . + DRAMSIZE;
20 KEEP(*(.vectors))
21 . = ALIGN(0x200);
22 } > DRAM
23
24 .text :
25 {
26 *(.start)
27 *(.text)
28 . = ALIGN(0x4);
29 } > DRAM
30
31 .rodata :
32 {
33 *(.rodata*)
34 *(.rodata.str1.1)
35 *(.rodata.str1.4)
36 . = ALIGN(0x4);
37 } > DRAM
38
39 .data :
40 {
41 *(.data)
42 . = ALIGN(0x4);
43 _iramcopy = .;
44 } > DRAM
45
46 .iram IRAMORIG : AT ( _iramcopy )
47 {
48 _iramstart = .;
49 *(.icode)
50 *(.idata)
51 . = ALIGN(0x4);
52 _iramend = .;
53 } > IRAM
54
55 .stack :
56 {
57 _stackbegin = .;
58 *(.stack)
59 . += 0x0800;
60 _stackend = .;
61 } > IRAM
62
63 .bss :
64 {
65 _edata = .;
66 *(.bss)
67 *(COMMON)
68 . = ALIGN(0x4);
69 _end = .;
70 } > DRAM
71}
diff --git a/firmware/decompressor/sh_nrv2e_d8.S b/firmware/decompressor/sh_nrv2e_d8.S
deleted file mode 100644
index cf333e9c97..0000000000
--- a/firmware/decompressor/sh_nrv2e_d8.S
+++ /dev/null
@@ -1,149 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Jens Arnold
11 *
12 * based on arm_nrv2e_d8.S -- ARM decompressor for NRV2E
13 * Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
14 * Copyright (C) 1996-2008 Laszlo Molnar
15 * Copyright (C) 2000-2008 John F. Reiser
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
21 *
22 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
23 * KIND, either express or implied.
24 *
25 ****************************************************************************/
26
27#define src r4
28#define dst r5
29#define len r6 /* overlaps 'cnt' */
30#define cnt r6 /* overlaps 'len' while reading an offset */
31#define tmp r7
32
33#define off r0 /* must be r0 because of indexed addressing */
34#define bits r1
35#define bitmask r2
36#define wrnk r3 /* -0x500 -M2_MAX_OFFSET before "wrinkle" */
37
38
39#define GETBIT \
40 tst bits, bitmask; \
41 bf 1f; \
42 bsr get1_n2e; \
431: \
44 shll bits /* using the delay slot on purpose */
45
46#define getnextb(reg) GETBIT; rotcl reg
47#define jnextb0 GETBIT; bf
48#define jnextb1 GETBIT; bt
49
50 .section .icode,"ax",@progbits
51 .align 2
52 .global _ucl_nrv2e_decompress_8
53 .type _ucl_nrv2e_decompress_8,@function
54
55/* src_len = ucl_nrv2e_decompress_8(const unsigned char *src,
56 * unsigned char *dst,
57 * unsigned long *dst_len)
58 */
59
60_ucl_nrv2e_decompress_8:
61 sts.l pr, @-r15
62 mov #-1, off ! off = -1 initial condition
63 mov.l r6, @-r15
64 mov #-5, wrnk
65 mov.l r5, @-r15
66 shll8 wrnk ! nrv2e -M2_MAX_OFFSET
67 mov.l r4, @-r15
68 mov #-1, bitmask
69 shlr bitmask ! 0x7fffffff for testing before shifting
70 bra top_n2e
71 not bitmask, bits ! refill next time (MSB must be set)
72
73eof_n2e:
74 mov.l @r15+, r0 ! r0 = orig_src
75 mov.l @r15+, r1 ! r1 = orig_dst
76 sub r0, src
77 mov.l @r15+, r2 ! r2 = plen_dst
78 sub r1, dst
79 mov.l dst, @r2
80 lds.l @r15+, pr
81 rts
82 mov src, r0
83
84lit_n2e:
85 mov.b @src, tmp
86 add #1, src ! Need to fill the pipeline latency anyway
87 mov.b tmp, @dst
88 add #1, dst
89top_n2e:
90 jnextb1 lit_n2e
91 bra getoff_n2e
92 mov #1, cnt
93
94off_n2e:
95 add #-1, cnt
96 getnextb(cnt)
97getoff_n2e:
98 getnextb(cnt)
99 jnextb0 off_n2e
100
101 mov #-4, tmp ! T=1 on entry, so this does
102 addc cnt, tmp ! tmp = cnt - 3, T = (cnt >= 3)
103 mov #0, len ! cnt and len share a reg!
104 bf offprev_n2e ! cnt was 2
105 mov.b @src+, off ! low 7+1 bits
106 shll8 tmp
107 extu.b off, off
108 or tmp, off
109 not off, off ! off = ~off
110 tst off, off
111 bt eof_n2e
112 shar off
113 bt lenlast_n2e
114 bf lenmore_n2e ! always taken if the preceding bt isn't
115
116offprev_n2e:
117 jnextb1 lenlast_n2e
118lenmore_n2e:
119 mov #1, len
120 jnextb1 lenlast_n2e
121len_n2e:
122 getnextb(len)
123 jnextb0 len_n2e
124 bra gotlen_n2e
125 mov #6-2, tmp
126
127get1_n2e: ! in: T bit set
128 mov.b @src+, bits ! SH1 sign-extends on load
129 rotcl bits ! LSB = T, T = MSB
130 shll16 bits
131 rts
132 shll8 bits
133
134lenlast_n2e:
135 getnextb(len) ! 0,1,2,3
136 mov #2, tmp
137gotlen_n2e:
138 cmp/gt off, wrnk ! too far away, so minimum match length is 3
139 addc tmp, len
140copy_n2e:
141 add #-1, len
142 mov.b @(off,dst), tmp
143 tst len, len
144 mov.b tmp, @dst
145 add #1, dst
146 bf copy_n2e
147 bt top_n2e ! always taken if the preceding bf isn't
148
149 .size _ucl_nrv2e_decompress_8, .-_ucl_nrv2e_decompress_8
diff --git a/firmware/decompressor/startup.S b/firmware/decompressor/startup.S
deleted file mode 100644
index 1e5d6fa1ee..0000000000
--- a/firmware/decompressor/startup.S
+++ /dev/null
@@ -1,59 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2005 by Jens Arnold
11 * based on crt0.S by Linus Nielsen Feltzing
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22 .section .start,"ax",@progbits
23 .global _start
24_start:
25 /* copy the .iram section */
26 mov.l .iramcopy_k,r0
27 mov.l .iram_k,r1
28 mov.l .iramend_k,r2
29 /* Note: We cannot put a PC relative load into the delay slot of a 'bra'
30 instruction (the offset would be wrong), but there is nothing else to
31 do before the loop, so the delay slot would be 'nop'. The cmp / bf
32 sequence is the same length, but more efficient. */
33 cmp/hi r1,r2
34 bf .noiramcopy
35.iramloop:
36 mov.l @r0+,r3
37 mov.l r3,@r1
38 add #4,r1
39 cmp/hi r1,r2
40 bt .iramloop
41.noiramcopy:
42
43 /* call the mainline */
44 mov.l .main_k,r0
45 mov.l .stackend_k,r15
46 jmp @r0
47 nop
48
49 .align 2
50.iramcopy_k:
51 .long _iramcopy
52.iram_k:
53 .long _iramstart
54.iramend_k:
55 .long _iramend
56.stackend_k:
57 .long _stackend
58.main_k:
59 .long _main
diff --git a/gdb/linker.cfg b/gdb/linker.cfg
index af604e0379..826aee31f9 100644
--- a/gdb/linker.cfg
+++ b/gdb/linker.cfg
@@ -5,8 +5,7 @@ ENTRY(start)
5STARTUP(crt0.o) 5STARTUP(crt0.o)
6OUTPUT_FORMAT(elf32-littlearm) 6OUTPUT_FORMAT(elf32-littlearm)
7#else 7#else
8ENTRY(_start) 8#error "Unsupported CPU!"
9OUTPUT_FORMAT(elf32-sh)
10#endif 9#endif
11 10
12#ifdef IRIVER_IFP7XX_SERIES 11#ifdef IRIVER_IFP7XX_SERIES
diff --git a/gdb/start.s b/gdb/start.s
deleted file mode 100644
index e902db7ad6..0000000000
--- a/gdb/start.s
+++ /dev/null
@@ -1,41 +0,0 @@
1!***************************************************************************
2! __________ __ ___.
3! Open \______ \ ____ ____ | | _\_ |__ _______ ___
4! Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5! Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6! Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7! \/ \/ \/ \/ \/
8! $Id$
9!
10! Copyright (C) 2002 by Linus Nielsen Feltzing
11!
12! All files in this archive are subject to the GNU General Public License.
13! See the file COPYING in the source tree root for full license agreement.
14!
15! This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16! KIND, either express or implied.
17!
18!***************************************************************************
19! note: sh-1 has a "delay cycle" after every branch where you can
20! execute another instruction "for free".
21
22 .file "start.s"
23 .section .text
24 .extern _INIT
25 .extern _vectable
26 .extern _stack
27 .global _start
28 .align 2
29
30_start:
31 mov.l 1f, r1
32 mov.l 3f, r3
33 mov.l 2f, r15
34 jmp @r3
35 ldc r1, vbr
36 nop
37
381: .long _vectable
392: .long _stack
403: .long _INIT
41 .type _start,@function
diff --git a/tools/configure b/tools/configure
index 63d26e6b68..b8e495a908 100755
--- a/tools/configure
+++ b/tools/configure
@@ -4550,9 +4550,7 @@ HOSTAR=${HOSTAR:-${AR}}
4550 4550
4551if [ -z "$arch" ]; then 4551if [ -z "$arch" ]; then
4552 cpp_defines=$(echo "" | $CPP $GCCOPTS -dD) 4552 cpp_defines=$(echo "" | $CPP $GCCOPTS -dD)
4553 if [ -n "$(echo $cpp_defines | grep -w __sh__)" ]; then 4553 if [ -n "$(echo $cpp_defines | grep -w __m68k__)" ]; then
4554 arch="sh"
4555 elif [ -n "$(echo $cpp_defines | grep -w __m68k__)" ]; then
4556 arch="m68k" 4554 arch="m68k"
4557 elif [ -n "$(echo $cpp_defines | grep -w __arm__)" ]; then 4555 elif [ -n "$(echo $cpp_defines | grep -w __arm__)" ]; then
4558 arch="arm" 4556 arch="arm"