diff -urN dcload-ip-1.0.4.orig/example-src/asm.h dcload-ip-1.0.4/example-src/asm.h --- dcload-ip-1.0.4.orig/example-src/asm.h 2003-06-04 07:42:56.000000000 +0300 +++ dcload-ip-1.0.4/example-src/asm.h 2005-08-13 03:14:39.761431668 +0300 @@ -9,7 +9,7 @@ .text; .align 2; .globl name; name: #define ENTRY(name) \ - _ENTRY(_C_LABEL(name)) + _ENTRY(_ASM_LABEL(name)) #if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) diff -urN dcload-ip-1.0.4.orig/example-src/crt0.S dcload-ip-1.0.4/example-src/crt0.S --- dcload-ip-1.0.4.orig/example-src/crt0.S 2003-06-04 07:42:56.000000000 +0300 +++ dcload-ip-1.0.4/example-src/crt0.S 2005-08-13 03:14:39.763431381 +0300 @@ -1,6 +1,6 @@ .section .text .global start - .global ___exit + .global __exit .global _atexit start: mov.l setup_cache_k,r0 @@ -58,7 +58,7 @@ jsr @r0 or r0,r0 -___exit: +__exit: mov.l old_pr_k,r14 mov.l @r14,r15 lds r15,pr @@ -74,7 +74,7 @@ .align 4 #if defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(__SH4_SINGLE_ONLY__) set_fpscr_k: - .long ___set_fpscr + .long __set_fpscr #endif /* defined (__SH3E__) || defined(__SH4_SINGLE__) || defined(__SH4__) || defined(SH4_SINGLE_ONLY) */ stack_k: .long _stack @@ -83,9 +83,9 @@ end_k: .long _end main_k: - .long _main + .long main exit_k: - .long _exit + .long exit old_stack_k: .long _old_stack diff -urN dcload-ip-1.0.4.orig/example-src/dcload-syscall.s dcload-ip-1.0.4/example-src/dcload-syscall.s --- dcload-ip-1.0.4.orig/example-src/dcload-syscall.s 2003-06-04 07:42:56.000000000 +0300 +++ dcload-ip-1.0.4/example-src/dcload-syscall.s 2005-08-13 03:14:39.766430951 +0300 @@ -1,6 +1,6 @@ .section .text - .global _dcloadsyscall -_dcloadsyscall: + .global dcloadsyscall +dcloadsyscall: mov.l dcloadsyscall_k,r0 mov.l @r0,r0 jmp @r0 diff -urN dcload-ip-1.0.4.orig/example-src/dc.x dcload-ip-1.0.4/example-src/dc.x --- dcload-ip-1.0.4.orig/example-src/dc.x 2003-06-04 07:42:56.000000000 +0300 +++ dcload-ip-1.0.4/example-src/dc.x 2005-08-13 03:14:39.765431095 +0300 @@ -1,7 +1,7 @@ /* Sega Dreamcast linker script */ -OUTPUT_FORMAT("elf32-shl", "elf32-shl", - "elf32-shl") +OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", + "elf32-sh-linux") OUTPUT_ARCH(sh) ENTRY(start) SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); diff -urN dcload-ip-1.0.4.orig/host-src/tool/dc-tool.c dcload-ip-1.0.4/host-src/tool/dc-tool.c --- dcload-ip-1.0.4.orig/host-src/tool/dc-tool.c 2003-07-27 21:12:26.000000000 +0300 +++ dcload-ip-1.0.4/host-src/tool/dc-tool.c 2005-08-13 03:17:43.406119093 +0300 @@ -24,8 +24,8 @@ #include #include #include -#ifdef _WIN32 #include +#ifdef _WIN32 #include #include #include @@ -443,13 +443,13 @@ if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_LOAD)) { printf("Section %s, ",section->name); printf("lma 0x%x, ",section->lma); - printf("size %d\n",section->_raw_size); - if (section->_raw_size) { - size += section->_raw_size; - inbuf = malloc(section->_raw_size); - bfd_get_section_contents(somebfd, section, inbuf, 0, section->_raw_size); + printf("size %d\n",section->rawsize); + if (section->rawsize) { + size += section->rawsize; + inbuf = malloc(section->rawsize); + bfd_get_section_contents(somebfd, section, inbuf, 0, section->rawsize); - send_data(inbuf, section->lma, section->_raw_size); + send_data(inbuf, section->lma, section->rawsize); free(inbuf); } diff -urN dcload-ip-1.0.4.orig/Makefile.cfg dcload-ip-1.0.4/Makefile.cfg --- dcload-ip-1.0.4.orig/Makefile.cfg 2003-08-16 04:08:21.000000000 +0300 +++ dcload-ip-1.0.4/Makefile.cfg 2005-08-13 03:22:31.870787932 +0300 @@ -4,12 +4,21 @@ # cygwin may need this #HOSTCFLAGS = -O2 -D_WIN32 +# +# Cross paths and prefixes +# +CROSS_PREFIX = /opt/tc/sh4-linux-uclibc +CROSS_LIBDIR = $(CROSS_PREFIX)/lib +CROSS_INCDIR = $(CROSS_PREFIX)/include +CROSS_BINDIR = $(CROSS_PREFIX)/bin +CROSS_COMPILE = sh4-unknown-linux-gnu- + # you may have to change the paths for BFDLIB and BFDINCLUDE to # the ones in your system # these must point to your sh-elf bfd, not the system one -BFDLIB = -L/usr/local/dcdev/lib -lbfd -liberty -BFDINCLUDE = /usr/local/dcdev/include +BFDLIB = -L$(CROSS_LIBDIR) -lbfd -liberty +BFDINCLUDE = $(CROSS_INCDIR) # cygwin # these must point to your sh-elf bfd, not the system one @@ -17,10 +26,10 @@ #BFDINCLUDE = /usr/local/include # sh-elf-stuff -TARGETCC = sh-elf-gcc +TARGETCC = $(CROSS_COMPILE)gcc TARGETCFLAGS = -O2 -ml -m4 -TARGETOBJCOPY = sh-elf-objcopy -TARGETLD = sh-elf-ld +TARGETOBJCOPY = $(CROSS_COMPILE)objcopy +TARGETLD = $(CROSS_COMPILE)ld # you generally shouldn't change this unless you are making forked # versions (or test versions) @@ -34,7 +43,7 @@ #DREAMCAST_IP = 10.0.0.32 # dir to install dc-tool in -TOOLINSTALLDIR = /usr/local/dcdev/bin +TOOLINSTALLDIR = /usr/bin #TOOLINSTALLDIR = /usr/local/dc/bin # uncomment this for cygwin diff -urN dcload-ip-1.0.4.orig/target-src/1st_read/1st_read.c dcload-ip-1.0.4/target-src/1st_read/1st_read.c --- dcload-ip-1.0.4.orig/target-src/1st_read/1st_read.c 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/1st_read/1st_read.c 2005-08-13 03:14:39.768430665 +0300 @@ -24,15 +24,15 @@ extern void disable_cache(void); -extern unsigned int binary_dcload_bin_start; -extern unsigned int binary_dcload_bin_size; -extern unsigned int binary_exception_bin_start; -extern unsigned int binary_exception_bin_size; +extern unsigned int _binary_dcload_bin_start; +extern unsigned int _binary_dcload_bin_size; +extern unsigned int _binary_exception_bin_start; +extern unsigned int _binary_exception_bin_size; int main(void) { - memcpy(TARGET1, &binary_dcload_bin_start, &binary_dcload_bin_size); - memcpy(TARGET2, &binary_exception_bin_start, &binary_exception_bin_size); + memcpy(TARGET1, &_binary_dcload_bin_start, &_binary_dcload_bin_size); + memcpy(TARGET2, &_binary_exception_bin_start, &_binary_exception_bin_size); disable_cache(); (*(void (*)()) 0x8c004000) (); diff -urN dcload-ip-1.0.4.orig/target-src/1st_read/asm.h dcload-ip-1.0.4/target-src/1st_read/asm.h --- dcload-ip-1.0.4.orig/target-src/1st_read/asm.h 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/1st_read/asm.h 2005-08-13 03:14:39.778429232 +0300 @@ -9,7 +9,7 @@ .text; .align 2; .globl name; name: #define ENTRY(name) \ - _ENTRY(_C_LABEL(name)) + _ENTRY(_ASM_LABEL(name)) #if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) diff -urN dcload-ip-1.0.4.orig/target-src/1st_read/crt0.S dcload-ip-1.0.4/target-src/1st_read/crt0.S --- dcload-ip-1.0.4.orig/target-src/1st_read/crt0.S 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/1st_read/crt0.S 2005-08-13 03:14:39.781428803 +0300 @@ -61,7 +61,7 @@ .align 4 set_fpscr_k: - .long ___set_fpscr + .long __set_fpscr stack_k: .long _stack edata_k: @@ -69,14 +69,14 @@ end_k: .long _end main_k: - .long _main + .long main old_stack_k: - .long _old_stack + .long old_stack old_pr_k: - .long _old_pr -_old_stack: + .long old_pr +old_stack: .long 0 -_old_pr: +old_pr: .long 0 setup_cache_k: .long setup_cache diff -urN dcload-ip-1.0.4.orig/target-src/1st_read/dc.x dcload-ip-1.0.4/target-src/1st_read/dc.x --- dcload-ip-1.0.4.orig/target-src/1st_read/dc.x 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/1st_read/dc.x 2005-08-13 03:14:39.783428516 +0300 @@ -1,7 +1,7 @@ /* Sega Dreamcast linker script */ -OUTPUT_FORMAT("elf32-shl", "elf32-shl", - "elf32-shl") +OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", + "elf32-sh-linux") OUTPUT_ARCH(sh) ENTRY(start) SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); diff -urN dcload-ip-1.0.4.orig/target-src/1st_read/disable.s dcload-ip-1.0.4/target-src/1st_read/disable.s --- dcload-ip-1.0.4.orig/target-src/1st_read/disable.s 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/1st_read/disable.s 2005-08-13 03:14:39.784428373 +0300 @@ -1,13 +1,13 @@ .section .text - .global _disable_cache + .global disable_cache -_disable_cache: +disable_cache: mov.l disable_cache_k,r0 mov.l p2_mask,r1 or r1,r0 jmp @r0 nop -disable_cache: +_disable_cache: mov.l ccr_addr,r0 mov.l ccr_data_k,r1 mov.l @r1,r1 @@ -26,7 +26,7 @@ .align 4 disable_cache_k: - .long disable_cache + .long _disable_cache p2_mask: .long 0xa0000000 ccr_addr: diff -urN dcload-ip-1.0.4.orig/target-src/1st_read/Makefile dcload-ip-1.0.4/target-src/1st_read/Makefile --- dcload-ip-1.0.4.orig/target-src/1st_read/Makefile 2003-07-10 05:42:27.000000000 +0300 +++ dcload-ip-1.0.4/target-src/1st_read/Makefile 2005-08-13 03:16:49.477845925 +0300 @@ -3,6 +3,7 @@ CC = $(TARGETCC) CFLAGS = $(TARGETCFLAGS) INCLUDE = -I../../target-inc +LD = $(TARGETLD) OBJCOPY = $(TARGETOBJCOPY) LD = $(TARGETLD) @@ -26,10 +27,10 @@ cp $< $@ dcload.o: dcload.bin - $(LD) -A sh -b binary --oformat elf32-shl $< -o $@ -r -EL --no-warn-mismatch + $(LD) -A sh -b binary --oformat elf32-sh-linux $< -o $@ -r -EL --no-warn-mismatch exception.o: exception.bin - $(LD) -A sh -b binary --oformat elf32-shl $< -o $@ -r -EL --no-warn-mismatch + $(LD) -A sh -b binary --oformat elf32-sh-linux $< -o $@ -r -EL --no-warn-mismatch 1st_read.bin: 1st_read $(OBJCOPY) -O binary $<$(EXECUTABLEEXTENSION) $@ diff -urN dcload-ip-1.0.4.orig/target-src/dcload/asm.h dcload-ip-1.0.4/target-src/dcload/asm.h --- dcload-ip-1.0.4.orig/target-src/dcload/asm.h 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/dcload/asm.h 2005-08-13 03:14:39.786428086 +0300 @@ -9,7 +9,7 @@ .text; .align 2; .globl name; name: #define ENTRY(name) \ - _ENTRY(_C_LABEL(name)) + _ENTRY(_ASM_LABEL(name)) #if (defined (__sh2__) || defined (__sh3__) || defined (__SH3E__) \ || defined (__SH4_SINGLE__) || defined (__SH4__)) || defined(__SH4_SINGLE_ONLY__) diff -urN dcload-ip-1.0.4.orig/target-src/dcload/bswap.s dcload-ip-1.0.4/target-src/dcload/bswap.s --- dcload-ip-1.0.4.orig/target-src/dcload/bswap.s 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/dcload/bswap.s 2005-08-13 03:14:39.788427800 +0300 @@ -1,14 +1,14 @@ - .globl _bswap16, _bswap32 + .globl bswap16, bswap32 .text ! r4 = dest -_bswap16: +bswap16: rts swap.b r4,r0 -_bswap32: +bswap32: swap.b r4,r0 swap.w r0,r4 rts diff -urN dcload-ip-1.0.4.orig/target-src/dcload/cdfs_redir.s dcload-ip-1.0.4/target-src/dcload/cdfs_redir.s --- dcload-ip-1.0.4.orig/target-src/dcload/cdfs_redir.s 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/dcload/cdfs_redir.s 2005-08-13 03:14:39.790427513 +0300 @@ -1,10 +1,10 @@ .section .text - .global _cdfs_redir_enable - .global _cdfs_redir_disable - .global _cdfs_redir_save + .global cdfs_redir_enable + .global cdfs_redir_disable + .global cdfs_redir_save .align 2 -_cdfs_redir_save: +cdfs_redir_save: mov.l cdfs_saved_k, r0 mov.l @r0, r0 tst r0,r0 @@ -17,7 +17,7 @@ rts nop -_cdfs_redir_disable: +cdfs_redir_disable: mov.l cdfs_saved_k, r0 mov.l @r0, r0 mov.l cdfs_entry_k, r1 @@ -25,7 +25,7 @@ rts nop -_cdfs_redir_enable: +cdfs_redir_enable: mov.l cdfs_entry_k, r0 mov.l cdfs_redir_k, r1 mov.l r1, @r0 @@ -58,17 +58,17 @@ nop gd_first_k: - .long gdGdcReqCmd -gdGdcReqCmd: .long _gdGdcReqCmd +_gdGdcReqCmd: + .long gdGdcReqCmd gdGdcGetCmdStat: - .long _gdGdcGetCmdStat + .long gdGdcGetCmdStat gdGdcExecServer: - .long _gdGdcExecServer + .long gdGdcExecServer gdGdcInitSystem: - .long _gdGdcInitSystem + .long gdGdcInitSystem gdGdcGetDrvStat: - .long _gdGdcGetDrvStat + .long gdGdcGetDrvStat gdGdcG1DmaEnd: .long badsyscall gdGdcReqDmaTrans: @@ -80,4 +80,4 @@ gdGdcReset: .long badsyscall gdGdcChangeDataType: - .long _gdGdcChangeDataType + .long gdGdcChangeDataType diff -urN dcload-ip-1.0.4.orig/target-src/dcload/dcload-crt0.s dcload-ip-1.0.4/target-src/dcload/dcload-crt0.s --- dcload-ip-1.0.4.orig/target-src/dcload/dcload-crt0.s 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/dcload/dcload-crt0.s 2005-08-13 03:14:39.807425078 +0300 @@ -2,8 +2,8 @@ .section .text .global start - .global _atexit - .global _dcloadsyscall + .global atexit + .global dcloadsyscall start: bra realstart nop @@ -16,20 +16,20 @@ ! normal programs use this call dcloadsyscall_k: - .long _dcloadsyscall + .long dcloadsyscall ! exception handler uses these calls setup_video_k: - .long _setup_video + .long setup_video clrscr_k: - .long _clrscr + .long clrscr draw_string_k: - .long _draw_string + .long draw_string uint_to_string_k: - .long _uint_to_string + .long uint_to_string exc_to_string_k: - .long _exception_code_to_string + .long exception_code_to_string realstart: stc sr,r0 @@ -84,7 +84,7 @@ bra realstart nop -_atexit: +atexit: rts nop @@ -93,15 +93,15 @@ sr_mask: .long 0xefff7fff set_fpscr_k: - .long ___set_fpscr + .long __set_fpscr stack_k: .long _stack edata_k: - .long _edata + .long edata end_k: - .long _end + .long end main_k: - .long _main + .long main setup_cache_k: .long setup_cache start_2_k: @@ -113,7 +113,7 @@ ccr_data: .word 0x090b -_dcloadsyscall: +dcloadsyscall: mov.l dcloadmagic_k,r1 mov.l @r1,r1 mov.l correctmagic,r0 @@ -148,42 +148,42 @@ first_syscall: .long read_k read_k: - .long _read + .long read write_k: - .long _write + .long write open_k: - .long _open + .long open close_k: - .long _close + .long close creat_k: - .long _creat + .long creat link_k: - .long _link + .long link unlink_k: - .long _unlink + .long unlink chdir_k: - .long _chdir + .long chdir chmod_k: - .long _chmod + .long chmod lseek_k: - .long _lseek + .long lseek fstat_k: - .long _fstat + .long fstat time_k: - .long _time + .long time stat_k: - .long _stat + .long stat utime_k: - .long _utime + .long utime assign_wrkmem_k: .long badsyscall exit_k: - .long _dcexit + .long dcexit opendir_k: - .long _opendir + .long opendir closedir_k: - .long _closedir + .long closedir readdir_k: - .long _readdir + .long readdir hostinfo_k: - .long _gethostinfo + .long gethostinfo diff -urN dcload-ip-1.0.4.orig/target-src/dcload/dcload.x dcload-ip-1.0.4/target-src/dcload/dcload.x --- dcload-ip-1.0.4.orig/target-src/dcload/dcload.x 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/dcload/dcload.x 2005-08-13 03:14:39.809424791 +0300 @@ -1,7 +1,7 @@ /* Sega Dreamcast linker script */ -OUTPUT_FORMAT("elf32-shl", "elf32-shl", - "elf32-shl") +OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", + "elf32-sh-linux") OUTPUT_ARCH(sh) ENTRY(start) SEARCH_DIR(/usr/local/dcdev/sh-elf/lib); diff -urN dcload-ip-1.0.4.orig/target-src/dcload/disable.s dcload-ip-1.0.4/target-src/dcload/disable.s --- dcload-ip-1.0.4.orig/target-src/dcload/disable.s 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/dcload/disable.s 2005-08-13 03:14:39.811424505 +0300 @@ -1,13 +1,13 @@ .section .text - .global _disable_cache + .global disable_cache -_disable_cache: +disable_cache: mov.l disable_cache_k,r0 mov.l p2_mask,r1 or r1,r0 jmp @r0 nop -disable_cache: +_disable_cache: mov.l ccr_addr,r0 mov.l ccr_data_k,r1 mov.l @r1,r1 @@ -26,7 +26,7 @@ .align 4 disable_cache_k: - .long disable_cache + .long _disable_cache p2_mask: .long 0xa0000000 ccr_addr: diff -urN dcload-ip-1.0.4.orig/target-src/dcload/go.s dcload-ip-1.0.4/target-src/dcload/go.s --- dcload-ip-1.0.4.orig/target-src/dcload/go.s 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/dcload/go.s 2005-08-13 03:14:39.813424218 +0300 @@ -1,7 +1,7 @@ .section .text - .global _go + .global go -_go: +go: mov.l stack_addr_k,r0 mov.l @r0,r15 mov.l entry_addr_k,r0 @@ -54,4 +54,4 @@ .long fpscr_data fpscr_data: .long 0x40001 - \ No newline at end of file + diff -urN dcload-ip-1.0.4.orig/target-src/dcload/video.s dcload-ip-1.0.4/target-src/dcload/video.s --- dcload-ip-1.0.4.orig/target-src/dcload/video.s 2003-06-04 07:42:57.000000000 +0300 +++ dcload-ip-1.0.4/target-src/dcload/video.s 2005-08-13 03:14:39.815423932 +0300 @@ -2,8 +2,8 @@ ! Video routines from Vide example ! - .globl _draw_string, _clrscr, _init_video, _check_cable - .globl _get_font_address + .globl draw_string, clrscr, init_video, check_cable + .globl get_font_address .text @@ -16,7 +16,7 @@ ! r5 = y ! r6 = string ! r7 = colour -_draw_string: +draw_string: mov.l r14,@-r15 sts pr,r14 mov.l r13,@-r15 @@ -59,7 +59,7 @@ draw_char12: ! First get the address of the ROM font sts pr,r3 - bsr _get_font_address + bsr get_font_address nop lds r3,pr mov r0,r2 @@ -166,7 +166,7 @@ ! Assumes a 640*480 screen with RGB555 or RGB565 pixels ! r4 = pixel colour -_clrscr: +clrscr: mov.l vrambase,r0 mov.l clrcount,r1 clrloop: @@ -196,7 +196,7 @@ ! r4 = cabletype (0=VGA, 2=RGB, 3=Composite) ! r5 = pixel mode (0=RGB555, 1=RGB565, 3=RGB888) -_init_video: +init_video: ! Look up bytes per pixel as shift value mov #3,r1 and r5,r1 @@ -305,7 +305,7 @@ ! 2 = RGB ! 3 = Composite -_check_cable: +check_cable: ! set PORT8 and PORT9 to input mov.l porta,r0 mov.l pctra_clr,r2 @@ -332,7 +332,7 @@ ! Return base address of ROM font ! -_get_font_address: +get_font_address: mov.l syscall_b4,r0 mov.l @r0,r0 jmp @r0