summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2008-10-19 19:51:42 +0000
committerDominik Wenger <domonoky@googlemail.com>2008-10-19 19:51:42 +0000
commit415c46ed548f6f75e638ad5e30829f10aec176f9 (patch)
tree9a5678895db8ae157203b8b5bf3051e15f4561bc
parent184d0dab7446d5b02c80e92552e71d17cb8db337 (diff)
downloadrockbox-415c46ed548f6f75e638ad5e30829f10aec176f9.tar.gz
rockbox-415c46ed548f6f75e638ad5e30829f10aec176f9.zip
add sansa m200v2 support to mkamsboot.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18840 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/lcd-ssd1815.c1
-rw-r--r--rbutil/mkamsboot/Makefile30
-rw-r--r--rbutil/mkamsboot/dualboot.S21
-rw-r--r--rbutil/mkamsboot/mkamsboot.c12
4 files changed, 53 insertions, 11 deletions
diff --git a/firmware/target/arm/lcd-ssd1815.c b/firmware/target/arm/lcd-ssd1815.c
index fc3db940ba..2acfa791cb 100644
--- a/firmware/target/arm/lcd-ssd1815.c
+++ b/firmware/target/arm/lcd-ssd1815.c
@@ -139,6 +139,7 @@ void lcd_init_device(void)
139 lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER|0x7); 139 lcd_write_command(LCD_SET_POWER_CONTROL_REGISTER|0x7);
140 lcd_write_command(LCD_SET_DISPLAY_ON); 140 lcd_write_command(LCD_SET_DISPLAY_ON);
141 lcd_write_command(LCD_SET_DISPLAY_START_LINE); 141 lcd_write_command(LCD_SET_DISPLAY_START_LINE);
142 lcd_write_command(LCD_SET_NORMAL_DISPLAY);
142} 143}
143 144
144 145
diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile
index e3d98f03f0..c5f8dd5e51 100644
--- a/rbutil/mkamsboot/Makefile
+++ b/rbutil/mkamsboot/Makefile
@@ -10,8 +10,8 @@ LIBUCL=../../tools/ucl/src/libucl.a
10# 10#
11# If anyone reading this wants to improve this makefile, please do! 11# If anyone reading this wants to improve this makefile, please do!
12 12
13BOOTIMAGES = bootimg_clip.o bootimg_e200v2.o 13BOOTIMAGES = bootimg_clip.o bootimg_e200v2.o bootimg_m200v2.o
14BOOTHEADERS = bootimg_clip.h bootimg_e200v2.h 14BOOTHEADERS = bootimg_clip.h bootimg_e200v2.h bootimg_m200v2.h
15 15
16CLIPFILES = dualboot-clip.o dualboot-clip.elf dualboot-clip.o \ 16CLIPFILES = dualboot-clip.o dualboot-clip.elf dualboot-clip.o \
17 dualboot-clip.bin bootimg_clip.c bootimg_clip.h 17 dualboot-clip.bin bootimg_clip.c bootimg_clip.h
@@ -19,6 +19,9 @@ CLIPFILES = dualboot-clip.o dualboot-clip.elf dualboot-clip.o \
19E200V2FILES = dualboot-e200v2.o dualboot-e200v2.elf dualboot-e200v2.o \ 19E200V2FILES = dualboot-e200v2.o dualboot-e200v2.elf dualboot-e200v2.o \
20 dualboot-e200v2.bin bootimg_e200v2.c bootimg_e200v2.h 20 dualboot-e200v2.bin bootimg_e200v2.c bootimg_e200v2.h
21 21
22M200V2FILES = dualboot-m200v2.o dualboot-m200v2.elf dualboot-m200v2.o \
23 dualboot-m200v2.bin bootimg_m200v2.c bootimg_m200v2.h
24
22all: mkamsboot 25all: mkamsboot
23 26
24$(LIBUCL): 27$(LIBUCL):
@@ -64,9 +67,26 @@ dualboot-e200v2.bin: dualboot-e200v2.elf
64bootimg_e200v2.c bootimg_e200v2.h: dualboot-e200v2.bin bin2c 67bootimg_e200v2.c bootimg_e200v2.h: dualboot-e200v2.bin bin2c
65 ./bin2c dualboot-e200v2.bin bootimg_e200v2 68 ./bin2c dualboot-e200v2.bin bootimg_e200v2
66 69
67bootimg_e200v2.o: bootimg_e200v2.c 70# M200V2
68 gcc -c -o bootimg_e200v2.o bootimg_e200v2.c 71
72bootimg_m200v2.o: bootimg_m200v2.c
73 gcc -c -o bootimg_m200v2.o bootimg_m200v2.c
69 74
75dualboot-m200v2.o: dualboot.S
76 arm-elf-gcc -DSANSA_M200V2 -c -o dualboot-m200v2.o dualboot.S
77
78dualboot-m200v2.elf: dualboot-m200v2.o
79 arm-elf-ld -e 0 -Ttext=0 -o dualboot-m200v2.elf dualboot-m200v2.o
80
81dualboot-m200v2.bin: dualboot-m200v2.elf
82 arm-elf-objcopy -O binary dualboot-m200v2.elf dualboot-m200v2.bin
83
84bootimg_m200v2.c bootimg_m200v2.h: dualboot-m200v2.bin bin2c
85 ./bin2c dualboot-m200v2.bin bootimg_m200v2
86
87bootimg_m200v2.o: bootimg_m200v2.c
88 gcc -c -o bootimg_m200v2.o bootimg_m200v2.c
89
70# Rules for the ucl unpack function 90# Rules for the ucl unpack function
71nrv2e_d8.o: nrv2e_d8.S 91nrv2e_d8.o: nrv2e_d8.S
72 arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.o nrv2e_d8.S 92 arm-elf-gcc -DPURE_THUMB -c -o nrv2e_d8.o nrv2e_d8.S
@@ -91,4 +111,4 @@ bin2c: bin2c.c
91clean: 111clean:
92 rm -f mkamsboot mkamsboot.o nrv2e_d8.o nrv2e_d8.elf nrv2e_d8.bin *~ \ 112 rm -f mkamsboot mkamsboot.o nrv2e_d8.o nrv2e_d8.elf nrv2e_d8.bin *~ \
93 bin2c uclimg.c uclimg.h uclimg.o \ 113 bin2c uclimg.c uclimg.h uclimg.o \
94 $(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) 114 $(BOOTIMAGES) $(CLIPFILES) $(E200V2FILES) $(M200V2FILES)
diff --git a/rbutil/mkamsboot/dualboot.S b/rbutil/mkamsboot/dualboot.S
index 8a1caa6f63..1713017060 100644
--- a/rbutil/mkamsboot/dualboot.S
+++ b/rbutil/mkamsboot/dualboot.S
@@ -5,7 +5,7 @@
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id:$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2008 Rafaël Carré 10 * Copyright (C) 2008 Rafaël Carré
11 * 11 *
@@ -77,6 +77,8 @@ uclcopy:
77 orr r1, r1, #(1<<16) 77 orr r1, r1, #(1<<16)
78 str r1, [r0] 78 str r1, [r0]
79 79
80
81#ifndef SANSA_M200V2 /* this doesnt work for m200 */
80 /* we check A3 unconditionally of the model because it seems to be */ 82 /* we check A3 unconditionally of the model because it seems to be */
81 /* either hold, either usb on every model */ 83 /* either hold, either usb on every model */
82 84
@@ -87,6 +89,7 @@ uclcopy:
87 89
88 cmp r1, #0 90 cmp r1, #0
89 bne boot_of 91 bne boot_of
92#endif
90 93
91 /* here are model specific tests, for dual boot without a computer */ 94 /* here are model specific tests, for dual boot without a computer */
92 95
@@ -108,6 +111,22 @@ uclcopy:
108 111
109 cmp r1, #0 /* C6 = #0 means button pressed */ 112 cmp r1, #0 /* C6 = #0 means button pressed */
110 beq boot_of 113 beq boot_of
114#elif defined(SANSA_M200V2)
115.set row, (1<<5) /* 4 or <<5 or <<6 */
116 /* enable output on A3-A5 */
117 /* set keyscan row A0-A3 */
118 ldr r0, =GPIOA
119 mov r1, #row
120 str r1, [r0, #0x400]
121 str r1, [r0, #(4*row)]
122
123.set col, (1<<0) /* 0 or 1, 2, 3 */
124 /* read keyscan column A0-A3 */
125 ldr r2, [r0, #(4*col)]
126
127 /* check value read (compare to 0!) */
128 cmp r2, #0
129 beq boot_of /* for beginning we jump if button select is not pressed */
111#else 130#else
112 #error No target-specific key check defined! 131 #error No target-specific key check defined!
113#endif 132#endif
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c
index cfa9e37746..e4b6e09782 100644
--- a/rbutil/mkamsboot/mkamsboot.c
+++ b/rbutil/mkamsboot/mkamsboot.c
@@ -89,6 +89,7 @@ execution to the uncompressed firmware.
89#include "uclimg.h" 89#include "uclimg.h"
90#include "bootimg_clip.h" 90#include "bootimg_clip.h"
91#include "bootimg_e200v2.h" 91#include "bootimg_e200v2.h"
92#include "bootimg_m200v2.h"
92 93
93/* Win32 compatibility */ 94/* Win32 compatibility */
94#ifndef O_BINARY 95#ifndef O_BINARY
@@ -126,7 +127,7 @@ static const unsigned char* bootloaders[] =
126 bootimg_clip, 127 bootimg_clip,
127 NULL, 128 NULL,
128 bootimg_e200v2, 129 bootimg_e200v2,
129 NULL, 130 bootimg_m200v2,
130 NULL 131 NULL
131}; 132};
132 133
@@ -136,7 +137,7 @@ static const int bootloader_sizes[] =
136 sizeof(bootimg_clip), 137 sizeof(bootimg_clip),
137 0, 138 0,
138 sizeof(bootimg_e200v2), 139 sizeof(bootimg_e200v2),
139 0, 140 sizeof(bootimg_m200v2),
140 0 141 0
141}; 142};
142 143
@@ -373,6 +374,7 @@ int main(int argc, char* argv[])
373 int fw_version; 374 int fw_version;
374 int totalsize; 375 int totalsize;
375 unsigned char* p; 376 unsigned char* p;
377 uint32_t checksum;
376 378
377 fprintf(stderr,"mkamsboot v" VERSION " - (C) Dave Chapman and Rafaël Carré 2008\n"); 379 fprintf(stderr,"mkamsboot v" VERSION " - (C) Dave Chapman and Rafaël Carré 2008\n");
378 fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n"); 380 fprintf(stderr,"This is free software; see the source for copying conditions. There is NO\n");
@@ -395,9 +397,10 @@ int main(int argc, char* argv[])
395 return 1; 397 return 1;
396 } 398 }
397 399
398 /* TODO: Do some more sanity checks on the OF image */ 400 /* TODO: Do some more sanity checks on the OF image. Some images (like m200v2) dont have a checksum at the end, only padding (0xdeadbeef). */
401 checksum = get_uint32le(buf + len - 4);
402 if (checksum != 0xefbeadde && checksum != calc_checksum(buf, len - 4)) {
399 403
400 if (get_uint32le(buf + len - 4) != calc_checksum(buf, len - 4)) {
401 fprintf(stderr,"[ERR] Whole file checksum failed - %s\n",infile); 404 fprintf(stderr,"[ERR] Whole file checksum failed - %s\n",infile);
402 return 1; 405 return 1;
403 } 406 }
@@ -420,7 +423,6 @@ int main(int argc, char* argv[])
420 if (bootloaders[model] == NULL) { 423 if (bootloaders[model] == NULL) {
421 fprintf(stderr,"[ERR] Unsupported model - \"%s\"\n",model_names[model]); 424 fprintf(stderr,"[ERR] Unsupported model - \"%s\"\n",model_names[model]);
422 free(buf); 425 free(buf);
423 free(rb_unpacked);
424 return 1; 426 return 1;
425 } 427 }
426 428