$(SIZE) $@
clean:
- rm -f *.o *.elf *.s19 *.b *.a rom.tar.bz2 romsrc.c crctab.h m68hc11-gdb gencrctab
+ rm -f *.o *.elf *.s19 *.b *.a rom.tar.bz2 romsrc.s crctab.h m68hc11-gdb gencrctab
#
# Some useful rules
$(SIZE) $<
rom.tar.bz2:
- rm -f romsrc.c crctab.h
+ rm -f romsrc.s crctab.h
tar cjf rom.tar.bz2 README Makefile gdbsimrc *.pl *.c *.h *.s *.x
-romsrc.c: rom.tar.bz2
- perl -w src2c.pl < $< > $@
+romsrc.s: rom.tar.bz2 src2asm.pl
+ perl -w src2asm.pl < $< > $@
xmodem.c: crctab.h
.elf.b:
$(OBJCOPY) --output-target=binary --gap-fill=255 \
$(OBJCOPY_FLAGS) $< $*.b
+ @perl -e '$$sum = 0;while(read STDIN, $$a, 1){$$sum += ord($$a); $$sum = $$sum&0xffff;} printf "Checksum is \%x\n", $$sum' < $@
m68hc11-gdb: /usr/bin/m68hc11-gdb
sed -e 's|m68hc11eepr/reg 0xb000 512|m68hc11eepr/reg 0x4000 1 |' < $< > $@
send_string("Writing to serial port (maybe). Size is 0x");
send_string(u82hex(_rom_src_len >> 8));
send_string(u82hex(_rom_src_len & 0xff));
+ send_string("@0x");
+ send_string(u82hex((u16)(&_rom_src_data) >> 8));
+ send_string(u82hex((u16)(&_rom_src_data) & 0xff));
send_string(" with signature ");
s[0] = _rom_src_data[0];
s[1] = _rom_src_data[1];
send_string(CRLF " Type YES to download rom.tar.bz2 via XMODEM: ");
msg_clr();
while (!sci_have_packet); /* spin */
- if (!my_strncmp("YES", (char*)sci_rx_buf, 3)) return;
+ if (!my_strncmp("YES", (char*)sci_rx_buf, 3)) {
+ send_string(CRLF "Transfer cancelled." CRLF);
+ return;
+ }
sci_init();
sci_doing_xmodem = 1;
char *end = (char*)_rom_src_data+_rom_src_len;
bool aborted = 0;
while (1) {
- if (!xmodem_send_packet((char*)p, 128)) {
- aborted = 1;
- break;
- }
- p += 128;
if (p + 128 > end) {
/* send partial packet */
if (!xmodem_send_packet((char*)p, end-p)) aborted = 1;
break;
+ } if ((u16)p == 0xb600) {
+ /* we have an eeprom here. skip it. */
+ p += 0x0200;
+ continue;
+ } else if (!xmodem_send_packet((char*)p, 128)) {
+ aborted = 1;
+ break;
}
+ p += 128;
}
xmodem_finish_xfer();
MEMORY
-{
- /* we squeeze both page0 and data into the internal 256 bytes of RAM */
+{ /* we squeeze both page0 and data into the internal 256 bytes of RAM */
page0 (rwx) : ORIGIN = 0x0000, LENGTH = 0x0080
data (rw) : ORIGIN = 0x0080, LENGTH = 0x0080
text (rx) : ORIGIN = 0x8000, LENGTH = 0x8000
- eeprom(rwx) : ORIGIN = 0x4000, LENGTH = 0x0200
+ eeprom(rwx) : ORIGIN = 0xb600, LENGTH = 0x0020
}
/* Setup the stack on the top of the data internal ram (not used). */
--- /dev/null
+#!/usr/bin/perl -w
+
+$origin = 0x9800; # must match address of .romsrc in memory.x
+$hole_start = 0xb600;
+$hole_size = 0x0200;
+
+print <<EOT;
+.sect .rodata
+.global _rom_src_data
+.global _rom_src_len
+
+.align 7 ; for a 128-bit boundary
+_rom_src_data:
+EOT
+my $size = 0;
+my $a;
+while (read STDIN,$a,1) {
+ if ($origin+$size == $hole_start) {
+ for($i = 0; $i < $hole_size; $i++) {
+ print "\t.byte 0xff\n";
+ }
+ $size += $hole_size;
+ }
+ printf "\t.byte 0x%04x\n", ord($a);
+ $size++;
+}
+print <<EOT;
+
+ .align 2
+_rom_src_len:
+ .word $size
+EOT
+++ /dev/null
-#!/usr/bin/perl -w
-
-print "#include \"types.h\"\n";
-print "const char _rom_src_data[] = {\n\t";
-my $size = 0;
-my $a;
-while (read STDIN,$a,1) {
- printf "0x%02x,", ord($a);
- $size++;
- if ($size%8 == 0) { print "\n\t"; }
-}
-print <<EOT;
-};
-
-const u16 _rom_src_len = $size;
-
-EOT