From c107bf29a234bf80a7762e838628ac613456f838 Mon Sep 17 00:00:00 2001 From: Bernard Blackham Date: Wed, 23 Jun 2004 15:21:48 +0000 Subject: [PATCH] A different way of storing the ROM image. --- ROM2/Makefile | 9 +++++---- ROM2/main_basic.c | 21 +++++++++++++++------ ROM2/memory.x | 5 ++--- ROM2/src2asm.pl | 32 ++++++++++++++++++++++++++++++++ ROM2/src2c.pl | 17 ----------------- 5 files changed, 54 insertions(+), 30 deletions(-) create mode 100644 ROM2/src2asm.pl delete mode 100644 ROM2/src2c.pl diff --git a/ROM2/Makefile b/ROM2/Makefile index ac77ee3..38780bf 100644 --- a/ROM2/Makefile +++ b/ROM2/Makefile @@ -41,7 +41,7 @@ rom2.elf: $(OBJS) memory.x $(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 @@ -53,11 +53,11 @@ size: rom2.s19 $(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 @@ -82,6 +82,7 @@ crctab.h: gencrctab .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 |' < $< > $@ diff --git a/ROM2/main_basic.c b/ROM2/main_basic.c index 1165326..8d86585 100644 --- a/ROM2/main_basic.c +++ b/ROM2/main_basic.c @@ -324,6 +324,9 @@ void getrom() { 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]; @@ -333,7 +336,10 @@ void getrom() { 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; @@ -346,16 +352,19 @@ void getrom() { 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(); diff --git a/ROM2/memory.x b/ROM2/memory.x index 6b3abc6..f1127cf 100644 --- a/ROM2/memory.x +++ b/ROM2/memory.x @@ -1,10 +1,9 @@ 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). */ diff --git a/ROM2/src2asm.pl b/ROM2/src2asm.pl new file mode 100644 index 0000000..e382f24 --- /dev/null +++ b/ROM2/src2asm.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl -w + +$origin = 0x9800; # must match address of .romsrc in memory.x +$hole_start = 0xb600; +$hole_size = 0x0200; + +print <