From b98de3368efd0fb33f293804573171cc2a139fab Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Thu, 24 Apr 2014 21:06:37 -0700 Subject: [PATCH] *.mk configuration files modified for compatibility with latest version of Mentor Sourcery CodeBench Lite toolchain (https://sourcery.mentor.com/GNUToolchain/release2641). All detected issues fixed. --- src/cmd/as/as.c | 18 ++++++- src/cmd/as/mips-instruction-set.txt | 2 +- src/cmd/basic/basic.c | 2 +- src/elf32-mips.ld | 2 +- src/games/battlestar/Makefile | 2 +- src/games/sail/Makefile | 2 +- src/games/sail/sync.c | 2 +- src/games/trek/Makefile | 2 +- src/games/trek/main.c | 11 ----- sys/kernel/rdisk.c | 19 ++++---- sys/pic32/gcc-config.mk | 9 ++++ sys/pic32/spi_bus.c | 76 ++++++++++++++--------------- target.mk | 10 ++++ tools/elf2aout/elf2aout.c | 9 ++-- 14 files changed, 95 insertions(+), 71 deletions(-) diff --git a/src/cmd/as/as.c b/src/cmd/as/as.c index 0df415c..a82e7f3 100644 --- a/src/cmd/as/as.c +++ b/src/cmd/as/as.c @@ -83,6 +83,7 @@ enum { LIDENT, /* .ident */ LWEAK, /* .weak */ LLOCAL, /* .local */ + LNAN, /* .nan */ }; /* @@ -731,6 +732,9 @@ int lookacmd () case 'm': if (! strcmp (".mask", name)) return (LMASK); break; + case 'n': + if (! strcmp (".nan", name)) return (LNAN); + break; case 'p': if (! strcmp (".previous", name)) return (LPREVIOUS); break; @@ -2212,6 +2216,12 @@ void pass1 () uerror ("bad parameter of .end"); cval = lookname(); break; + case LNAN: + /* .nan name */ + clex = getlex (&cval); + if (clex != LNAME) + uerror ("bad parameter of .nan"); + break; case LTYPE: /* .type name,type */ if (getlex (&cval) != LNAME) @@ -2661,8 +2671,12 @@ int main (argc, argv) break; case 'I': /* include dir */ // TODO - while (*++cp); - --cp; + if (cp[1] == 0) { + i++; + } else { + while (*++cp); + --cp; + } break; case 'O': /* optimization level */ // TODO diff --git a/src/cmd/as/mips-instruction-set.txt b/src/cmd/as/mips-instruction-set.txt index 669dd78..6cd4c80 100644 --- a/src/cmd/as/mips-instruction-set.txt +++ b/src/cmd/as/mips-instruction-set.txt @@ -226,7 +226,7 @@ RDHWR Read Hardware Register Allows unprivileged acce RDPGPR Read GPR from Previous Shadow Set Rt = SGPR[SRSCtl.PSS, Rd] RESTORE Restore registers and deallocate stack See Architecture Reference Manual - frame (MIPS16eŠ only) + frame (MIPS16e only) ROTR Rotate Word Right Rd = Rt[sa-1..0] || Rt[31..sa] diff --git a/src/cmd/basic/basic.c b/src/cmd/basic/basic.c index 956ea43..4131760 100644 --- a/src/cmd/basic/basic.c +++ b/src/cmd/basic/basic.c @@ -1534,7 +1534,7 @@ int get_value() value = get_num(); else { ++cmdptr; - switch (c) { + switch ((int)c) { case '(': /* nesting */ value = eval_sub(); break; diff --git a/src/elf32-mips.ld b/src/elf32-mips.ld index 31b362b..8cf668f 100644 --- a/src/elf32-mips.ld +++ b/src/elf32-mips.ld @@ -92,7 +92,7 @@ SECTIONS *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } - .eh_frame_hdr : { *(.eh_frame_hdr) } + .eh_frame_hdr : { *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) } .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } /* Adjust the address for the data segment. */ diff --git a/src/games/battlestar/Makefile b/src/games/battlestar/Makefile index 015edfa..95b526d 100644 --- a/src/games/battlestar/Makefile +++ b/src/games/battlestar/Makefile @@ -13,7 +13,7 @@ OBJS = battlestar.o cmd1.o cmd2.o cmd3.o cmd4.o cmd5.o cmd6.o cmd7.o init.o cypher.o getcom.o parse.o room.o save.o fly.o misc.o \ _globals.o _dayfile.o _nightfile.o dayobjs.o nightobjs.o words.o \ curses.o doprnt.o -LIBS = +LIBS = -lc MAN = battlestar.0 MANSRC = battlestar.6 diff --git a/src/games/sail/Makefile b/src/games/sail/Makefile index ef28867..0602efb 100644 --- a/src/games/sail/Makefile +++ b/src/games/sail/Makefile @@ -12,7 +12,7 @@ CFLAGS += -Os -mips16 -Werror -Wall OBJS = main.o pl_main.o pl_1.o pl_2.o pl_3.o pl_4.o pl_5.o pl_6.o pl_7.o \ dr_main.o dr_1.o dr_2.o dr_3.o dr_4.o dr_5.o lo_main.o \ assorted.o game.o globals.o misc.o parties.o sync.o version.o doprnt.o -LIBS = -lcurses -ltermcap +LIBS = -lcurses -ltermcap -lc MAN = sail.0 MANSRC = sail.6 diff --git a/src/games/sail/sync.c b/src/games/sail/sync.c index 2522f47..426575b 100644 --- a/src/games/sail/sync.c +++ b/src/games/sail/sync.c @@ -357,7 +357,7 @@ Sync() switch (*p++ = getc(sync_fp)) { case '\n': p--; - case EOF: + case (char)EOF: break; default: if (p >= buf + sizeof buf) diff --git a/src/games/trek/Makefile b/src/games/trek/Makefile index 2c2993a..90902a5 100644 --- a/src/games/trek/Makefile +++ b/src/games/trek/Makefile @@ -17,7 +17,7 @@ OBJS = abandon.o attack.o autover.o capture.o check_out.o checkcond.o ranf.o rest.o schedule.o score.o setup.o setwarp.o shell.o \ shield.o snova.o srscan.o systemname.o torped.o utility.o \ visual.o warp.o win.o -LIBS = -lm +LIBS = -lm -lc MAN = trek.0 MANSRC = trek.6 diff --git a/src/games/trek/main.c b/src/games/trek/main.c index b9bec06..d1a0c14 100644 --- a/src/games/trek/main.c +++ b/src/games/trek/main.c @@ -120,8 +120,6 @@ main(argc, argv) char **argv; { long vect; - /* extern FILE *f_log; */ - register char opencode; int prio; register int ac; register char **av; @@ -132,7 +130,6 @@ main(argc, argv) av++; time(&vect); srand(vect); - opencode = 'w'; prio = PRIO; if (ioctl(1, TIOCGETP, &argp) == 0) { @@ -143,10 +140,6 @@ main(argc, argv) { switch (av[0][1]) { - case 'a': /* append to log file */ - opencode = 'a'; - break; - case 'f': /* set fast mode */ Etc.fast++; break; @@ -179,10 +172,6 @@ main(argc, argv) } if (ac > 2) syserr(0, "arg count"); - /* - if (ac > 1) - f_log = fopen(av[0], opencode); - */ printf("\n * * * S T A R T R E K * * *\n\nPress return to continue.\n"); diff --git a/sys/kernel/rdisk.c b/sys/kernel/rdisk.c index dea62b0..5a91f93 100644 --- a/sys/kernel/rdisk.c +++ b/sys/kernel/rdisk.c @@ -15,7 +15,7 @@ extern struct buf *getnewbuf(); /* * Variable naming conventions - * + * * root - this is the number of the device entry in the disks[] array * part - the minor number of a device entry, which represents the partition * number, or 0 for the whole disk @@ -75,7 +75,7 @@ const struct diskentry disks[] = { #ifdef SDRAMP_ENABLED {sdramp_preinit, no_init, no_deinit, sdramp_open, sdramp_size, sdramp_read, sdramp_write, 0, RD_PREPART}, -#endif +#endif #ifdef FLASH_ENABLED {flash_init, no_init, no_deinit, flash_open, flash_size, flash_read, flash_write, 0, RD_READONLY}, @@ -164,8 +164,9 @@ static inline int init_device(int root,int flag) for(i=0; i<4; i++) { - dflags[root].start[i] = mbr->partitions[i].lbastart>>1; - dflags[root].len[i] = mbr->partitions[i].lbalength>>1; + struct partition part = mbr->partitions[i]; + dflags[root].start[i] = part.lbastart >> 1; + dflags[root].len[i] = part.lbalength >> 1; } dflags[root].blocks = disks[root].size(unit); brelse(bp); @@ -320,7 +321,7 @@ void rdstrategy(register struct buf *bp) void update_mbr(int unit) { - + } int rdioctl (dev_t dev, register u_int cmd, caddr_t addr, int flag) @@ -337,7 +338,7 @@ int rdioctl (dev_t dev, register u_int cmd, caddr_t addr, int flag) { bflush(major(dev)); init_device(major(dev),S_SILENT); - + } return 0; } @@ -432,7 +433,7 @@ dev_t get_boot_device() rdclose(makedev(i,0),0,0); } } - + return bd; #endif } @@ -610,7 +611,7 @@ struct buf *prepartition_device(char *devname) dev[pos] = 0; p++; } - + if((*p) == ':') { p++; @@ -670,7 +671,7 @@ struct buf *prepartition_device(char *devname) p++; } } - + if(pnum > 0) { mbr->bootsig = 0xAA55; diff --git a/sys/pic32/gcc-config.mk b/sys/pic32/gcc-config.mk index ba76531..714b1c4 100644 --- a/sys/pic32/gcc-config.mk +++ b/sys/pic32/gcc-config.mk @@ -28,6 +28,15 @@ ifndef GCCPREFIX LDFLAGS = endif +# Mentor Sourcery CodeBench Lite toolchain +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# You can download a Linux or Windows binary package from +# https://sourcery.mentor.com/GNUToolchain/release2641 +ifndef GCCPREFIX + GCCPREFIX = /usr/local/mips-2013.11/bin/mips-sde-elf- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips +endif + # chipKIT MPIDE on Mac OS X ifneq (,$(wildcard /Applications/Mpide.app/Contents/Resources/Java/hardware/tools/avr)) AVRDUDE = /Applications/Mpide.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude \ diff --git a/sys/pic32/spi_bus.c b/sys/pic32/spi_bus.c index 3966197..130478c 100644 --- a/sys/pic32/spi_bus.c +++ b/sys/pic32/spi_bus.c @@ -103,7 +103,7 @@ void spi_close(int dno) if(spi_devices[dno].bus==NULL) return; - + if (spi_devices[dno].cs_tris != NULL) { // Revert the CS pin to input. TRIS_CLR(*spi_devices[dno].cs_tris) = 1<= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - if (spi_devices[dno].cs_tris == NULL) + if (spi_devices[dno].cs_tris == NULL) return; spi_devices[dno].bus->brg = spi_devices[dno].baud; @@ -139,11 +139,11 @@ void spi_deselect(int dno) { if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - if (spi_devices[dno].cs_tris == NULL) + if (spi_devices[dno].cs_tris == NULL) return; LAT_SET(*spi_devices[dno].cs_tris) = 1<= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + spi_devices[dno].mode |= set; } @@ -168,10 +168,10 @@ void spi_clr(int dno, unsigned int set) { if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + spi_devices[dno].mode &= ~set; } @@ -181,10 +181,10 @@ unsigned int spi_status(int dno) { if(dno >= MAXSPIDEV) return 0; - + if(spi_devices[dno].bus==NULL) return 0; - + return spi_devices[dno].bus->stat; } @@ -199,7 +199,7 @@ unsigned char spi_transfer(int dno, unsigned char data) if(dno >= MAXSPIDEV) return 0xF0; - + if(spi_devices[dno].bus==NULL) return 0xF1; @@ -229,10 +229,10 @@ void spi_bulk_write_32_be(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + nread = 0; nwritten = words; @@ -245,7 +245,7 @@ void spi_bulk_write_32_be(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { (void) spi_devices[dno].bus->buf; nread++; @@ -263,10 +263,10 @@ void spi_bulk_write_32(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + nread = 0; nwritten = words; @@ -279,7 +279,7 @@ void spi_bulk_write_32(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { (void) spi_devices[dno].bus->buf; nread++; @@ -297,10 +297,10 @@ void spi_bulk_write_16(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; - + nread = 0; nwritten = words; @@ -313,7 +313,7 @@ void spi_bulk_write_16(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { (void) spi_devices[dno].bus->buf; nread++; @@ -326,18 +326,18 @@ void spi_bulk_write(int dno, unsigned int len, unsigned char *data) { unsigned char *data8 = data; unsigned int i; - unsigned char in,out; + unsigned char out; if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; for(i=0; i= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -371,7 +371,7 @@ void spi_bulk_read_32_be(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *data32++ = mips_bswap(spi_devices[dno].bus->buf); nread++; @@ -389,7 +389,7 @@ void spi_bulk_read_32(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -405,7 +405,7 @@ void spi_bulk_read_32(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *data32++ = spi_devices[dno].bus->buf; nread++; @@ -423,7 +423,7 @@ void spi_bulk_read_16(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -439,7 +439,7 @@ void spi_bulk_read_16(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *data16++ = mips_bswap(spi_devices[dno].bus->buf); nread++; @@ -456,7 +456,7 @@ void spi_bulk_read(int dno, unsigned int len, unsigned char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -479,7 +479,7 @@ void spi_bulk_rw_32_be(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -495,7 +495,7 @@ void spi_bulk_rw_32_be(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *read32++ = mips_bswap(spi_devices[dno].bus->buf); nread++; @@ -514,7 +514,7 @@ void spi_bulk_rw_32(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -530,7 +530,7 @@ void spi_bulk_rw_32(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *read32++ = spi_devices[dno].bus->buf; nread++; @@ -549,7 +549,7 @@ void spi_bulk_rw_16(int dno, unsigned int len, char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; @@ -565,7 +565,7 @@ void spi_bulk_rw_16(int dno, unsigned int len, char *data) nwritten--; } - if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) + if(!(spi_devices[dno].bus->stat & PIC32_SPISTAT_SPIRBE)) { *read16++ = mips_bswap(spi_devices[dno].bus->buf); nread++; @@ -582,7 +582,7 @@ void spi_bulk_rw(int dno, unsigned int len, unsigned char *data) if(dno >= MAXSPIDEV) return; - + if(spi_devices[dno].bus==NULL) return; diff --git a/target.mk b/target.mk index a8baf0c..268f694 100644 --- a/target.mk +++ b/target.mk @@ -37,6 +37,16 @@ ifndef GCCPREFIX INCLUDES = endif +# Mentor Sourcery CodeBench Lite toolchain +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# You can download a Linux or Windows binary package from +# https://sourcery.mentor.com/GNUToolchain/release2641 +ifndef GCCPREFIX + GCCPREFIX = /usr/local/mips-2013.11/bin/mips-sde-elf- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips + INCLUDES = +endif + CC = $(GCCPREFIX)gcc -mips32r2 -EL -msoft-float -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) CXX = $(GCCPREFIX)g++ -mips32r2 -EL -msoft-float -nostdinc -fshort-double -I$(TOPSRC)/include $(INCLUDES) LD = $(GCCPREFIX)ld diff --git a/tools/elf2aout/elf2aout.c b/tools/elf2aout/elf2aout.c index 453254e..0860eb1 100644 --- a/tools/elf2aout/elf2aout.c +++ b/tools/elf2aout/elf2aout.c @@ -361,15 +361,16 @@ usage: fprintf(stderr, for (i = 0; i < ex.e_phnum; i++) { /* Section types we can ignore... */ if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE || - ph[i].p_type == PT_PHDR || ph[i].p_type == PT_MIPS_REGINFO) + ph[i].p_type == PT_PHDR || ph[i].p_type == PT_MIPS_REGINFO || + ph[i].p_type == PT_GNU_EH_FRAME) continue; - /* Section types we can't handle... */ - if (ph[i].p_type != PT_LOAD) - errx(1, "Program header %d type %d can't be converted.", i, ph[i].p_type); if (verbose) printf ("Section type=%x flags=%x vaddr=%x filesz=%x\n", ph[i].p_type, ph[i].p_flags, ph[i].p_vaddr, ph[i].p_filesz); + /* Section types we can't handle... */ + if (ph[i].p_type != PT_LOAD && ph[i].p_type != PT_GNU_EH_FRAME) + errx(1, "Program header %d type %x can't be converted.", i, ph[i].p_type); /* Writable (data) segment? */ if (ph[i].p_flags & PF_W) {