summaryrefslogtreecommitdiff
path: root/utils/hwstub/stmp/Makefile
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-06-13 02:02:53 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-06-13 02:25:15 +0200
commitc5357940ab0108b4102442d07825c44d5be0d22f (patch)
treeddfdd9744b1f0ac037fed1c802329cb4542f376b /utils/hwstub/stmp/Makefile
parent934e1e15af6f2b7bcfdd9dbe8a3a6393ffe5a4a1 (diff)
downloadrockbox-c5357940ab0108b4102442d07825c44d5be0d22f.tar.gz
rockbox-c5357940ab0108b4102442d07825c44d5be0d22f.zip
hwstub: major improvement in the stub and the tools
Fix the stub in many way to correctly detect the STMP family and act upon that. Drop some unused commands and bump version. Rewrite the tool to allows scripting in lua and load the register description from an XML file using the regtools. Introduce a new tool to load and run code using the hwstub (either binary format or Rockbox additive scramble format). Also switch to an optimise version of the memcpy/move/set functions to correctly handle alignement issue (like writing a full word/half-word when possible for registers which is crucial) Change-Id: Id1d5cfe0b1b47e8b43900d32c5cd6eafae6414f6
Diffstat (limited to 'utils/hwstub/stmp/Makefile')
-rw-r--r--utils/hwstub/stmp/Makefile87
1 files changed, 34 insertions, 53 deletions
diff --git a/utils/hwstub/stmp/Makefile b/utils/hwstub/stmp/Makefile
index ca61fe392d..7fd33c3d9e 100644
--- a/utils/hwstub/stmp/Makefile
+++ b/utils/hwstub/stmp/Makefile
@@ -1,58 +1,51 @@
1PREFIX?=arm-elf-eabi- 1#
2CC=$(PREFIX)gcc 2# common
3LD=$(PREFIX)gcc 3#
4AS=$(PREFIX)gcc 4CC=arm-elf-eabi-gcc
5OC=$(PREFIX)objcopy 5LD=arm-elf-eabi-gcc
6SBTOOLS=../../sbtools/ 6AS=arm-elf-eabi-gcc
7OC=arm-elf-eabi-objcopy
7CFLAGS=-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes -pipe -std=gnu99 -mcpu=arm926ej-s -fomit-frame-pointer -Wno-pointer-sign -Wno-override-init -ffunction-sections 8CFLAGS=-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes -pipe -std=gnu99 -mcpu=arm926ej-s -fomit-frame-pointer -Wno-pointer-sign -Wno-override-init -ffunction-sections
8CFLAGS_3700=$(CFLAGS) -DHAVE_STMP3700
9ASFLAGS=$(CFLAGS) -D__ASSEMBLER__ 9ASFLAGS=$(CFLAGS) -D__ASSEMBLER__
10ASFLAGS_3700=$(CFLAGS_3700) -D__ASSEMBLER__
11OCFLAGS= 10OCFLAGS=
12LINKER_FILE=hwemul.lds 11LINKER_FILE=hwstub.lds
13LDFLAGS=-lgcc -Os -nostdlib -Tlink.lds -Wl,-Map,hwemul.map 12TMP_LDS=link.lds
14LDFLAGS_3700=-lgcc -Os -nostdlib -Tlink.lds -Wl,-Map,hwemul3700.map 13TMP_MAP=hwstub.map
14LDFLAGS=-lgcc -Os -nostdlib -T$(TMP_LDS) -Wl,-Map,$(TMP_MAP)
15SRC_C=$(wildcard *.c) 15SRC_C=$(wildcard *.c)
16SRC_S=$(wildcard *.S) 16SRC_S=$(wildcard *.S)
17OBJ_C=$(SRC_C:.c=.o) 17OBJ_C=$(SRC_C:.c=.o)
18OBJ_S=$(SRC_S:.S=.o) 18OBJ_S=$(SRC_S:.S=.o)
19OBJ_C_3700=$(SRC_C:.c=.3700.o)
20OBJ_S_3700=$(SRC_S:.S=.3700.o)
21OBJ=$(OBJ_C) $(OBJ_S) 19OBJ=$(OBJ_C) $(OBJ_S)
22OBJ_3700=$(OBJ_C_3700) $(OBJ_S_3700)
23OBJ_EXCEPT_CRT0=$(filter-out crt0.o,$(OBJ)) 20OBJ_EXCEPT_CRT0=$(filter-out crt0.o,$(OBJ))
24OBJ_EXCEPT_CRT0_3700=$(filter-out crt0.3700.o,$(OBJ_3700))
25DEPS=$(OBJ:.o=.d) 21DEPS=$(OBJ:.o=.d)
26EXEC_ELF=hwemul.elf 22EXEC_ELF=hwstub.elf
27EXEC_SB=hwemul.sb
28EXEC_ELF_3700=hwemul3700.elf
29EXEC_SB_3700=hwemul3700.sb
30 23
24#
25# image production
26#
27TOOLS=../../../tools
28SBTOOLS=../../imxtools/sbtools
29
30# sb (stmp37xx)
31EXEC_SB=hwstub.sb
31ELF2SB=$(SBTOOLS)/elftosb -d 32ELF2SB=$(SBTOOLS)/elftosb -d
32ELF2SB_CMD=-c hwemul.db 33ELF2SB_CMD=-c hwstub.db
33ELF2SB_KEY=-z 34ELF2SB_KEY?=-z
34SBLOADER=$(SBTOOLS)/sbloader
35SBLOADER_CMD=0 $(EXEC_SB)
36SBLOADER_CMD_3700=0 $(EXEC_SB_3700)
37 35
38TOOLS=../../../../tools/ 36# sb1 (stmp36xx)
39SCRAMBLE=$(TOOLS)/scramble 37EXEC_SB1=hwstub.sb1
38ELF2SB1_CMD=-loadjump $(EXEC_ELF)
39ELF2SB1_KEY?=
40ELF2SB1=$(SBTOOLS)/elftosb1 -d
40 41
41EXEC=$(EXEC_SB) $(EXEC_SB_3700) $(EXEC_ELF) $(EXEC_ELF_3700) 42EXEC=$(EXEC_ELF) $(EXEC_SB) $(EXEC_SB1)
42 43
43all: $(EXEC) 44all: $(EXEC)
44 45
45# pull in dependency info for *existing* .o files 46# pull in dependency info for *existing* .o files
46-include $(DEPS) 47-include $(DEPS)
47 48
48%.3700.o: %.c
49 $(CC) $(CFLAGS_3700) -c -o $@ $<
50 $(CC) -MM $(CFLAGS_3700) $*.c > $*.d
51 @cp -f $*.d $*.d.tmp
52 @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
53 sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
54 @rm -f $*.d.tmp
55
56%.o: %.c 49%.o: %.c
57 $(CC) $(CFLAGS) -c -o $@ $< 50 $(CC) $(CFLAGS) -c -o $@ $<
58 $(CC) -MM $(CFLAGS) $*.c > $*.d 51 $(CC) -MM $(CFLAGS) $*.c > $*.d
@@ -61,32 +54,20 @@ all: $(EXEC)
61 sed -e 's/^ *//' -e 's/$$/:/' >> $*.d 54 sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
62 @rm -f $*.d.tmp 55 @rm -f $*.d.tmp
63 56
64%.3700.o: %.S
65 $(AS) $(ASFLAGS_3700) -c -o $@ $<
66
67%.o: %.S 57%.o: %.S
68 $(AS) $(ASFLAGS) -c -o $@ $< 58 $(AS) $(ASFLAGS) -c -o $@ $<
69 59
70link.lds: $(LINKER_FILE) 60$(TMP_LDS): $(LINKER_FILE)
71 $(CC) -E -x c - < $< | sed '/#/d' > $@ 61 $(CC) -E -x c - < $< | sed '/#/d' > $@
72 62
73$(EXEC_ELF): $(OBJ) link.lds 63$(EXEC_ELF): $(OBJ) $(TMP_LDS)
74 $(LD) $(LDFLAGS) -o $@ $(OBJ_EXCEPT_CRT0) 64 $(LD) $(LDFLAGS) -o $@ $(OBJ_EXCEPT_CRT0)
75 65
76$(EXEC_SB): $(EXEC_ELF) 66$(EXEC_SB): $(EXEC_ELF)
77 $(ELF2SB) $(ELF2SB_CMD) $(ELF2SB_KEY) -o $@ 67 $(ELF2SB) $(ELF2SB_CMD) $(ELF2SB_KEY) -o $@
78 68
79$(EXEC_ELF_3700): $(OBJ_3700) link.lds 69$(EXEC_SB1): $(EXEC_ELF)
80 $(LD) $(LDFLAGS_3700) -o $@ $(OBJ_EXCEPT_CRT0_3700) 70 $(ELF2SB1) $(ELF2SB1_CMD) $(ELF2SB1_KEY) -o $@
81
82$(EXEC_SB_3700): $(EXEC_ELF_3700)
83 $(ELF2SB) $(ELF2SB_CMD) $(ELF2SB_KEY) -o $@
84
85sbload: $(EXEC_SB)
86 $(SBLOADER) $(SBLOADER_CMD)
87
88sbload3700: $(EXEC_SB_3700)
89 $(SBLOADER) $(SBLOADER_CMD_3700)
90 71
91clean: 72clean:
92 rm -rf $(OBJ) $(OBJ_3700) $(DEPS) $(EXEC) *.map 73 rm -rf $(OBJ) $(DEPS) $(EXEC) $(TMP_LDS) $(TMP_MAP) \ No newline at end of file