diff --git a/.gitignore b/.gitignore index b012372..030c231 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,8 @@ *.img Makefile.user + +#misc +*.log +*.txt + diff --git a/lib/Makefile b/lib/Makefile index 186d31a..2fa6f87 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -2,7 +2,7 @@ TOPSRC = $(shell cd ..; pwd) SUBDIR = startup libc libm libcurses libtermlib libwiznet libreadline libgpanel PROG = ar as aout ld nm ranlib size strip -CFLAGS = -Os -std=gnu89 -fno-builtin -g -Werror -Wall -DCROSS -I. \ +CFLAGS = -m32 -Os -std=gnu89 -fno-builtin -g -Wall -DCROSS -I. \ -idirafter $(TOPSRC)/include \ -idirafter $(TOPSRC)/src/cmd/ar \ -idirafter $(TOPSRC)/src/cmd/as @@ -26,28 +26,28 @@ clean: for i in $(SUBDIR); do $(MAKE) -C $$i $(MFLAGS) clean; done ar: $(AR_OBJS) - $(CC) $(LDFLAGS) -o $@ $(AR_OBJS) $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $(AR_OBJS) $(LIBS) as: as.o - $(CC) $(LDFLAGS) -o $@ $< $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS) aout: $(AOUT_OBJS) - $(CC) $(LDFLAGS) -o $@ $(AOUT_OBJS) $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $(AOUT_OBJS) $(LIBS) ld: ld.o - $(CC) $(LDFLAGS) -o $@ $< $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS) nm: nm.o - $(CC) $(LDFLAGS) -o $@ $< $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS) ranlib: $(RANLIB_OBJS) - $(CC) $(LDFLAGS) -o $@ $(RANLIB_OBJS) $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $(RANLIB_OBJS) $(LIBS) size: size.o - $(CC) $(LDFLAGS) -o $@ $< $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS) strip: strip.o - $(CC) $(LDFLAGS) -o $@ $< $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $< $(LIBS) $(HEADERS): -ln -s -f ../include/a.out.h . diff --git a/sys/pic32/Makefile.kconfpic32 b/sys/pic32/Makefile.kconfpic32 new file mode 100644 index 0000000..2f8a52f --- /dev/null +++ b/sys/pic32/Makefile.kconfpic32 @@ -0,0 +1,91 @@ +# +# Makefile for RetroBSD, pic32 target +# +# DEBUG is set to -g by kconfig if debugging is requested (kconfig -g). +# +include ../gcc-config.mk + +AS = ${MIPS_GCC_PREFIX}as ${DEBUG} -mips32r2 -EL +CC = ${MIPS_GCC_PREFIX}gcc ${DEBUG} -mips32r2 -EL -nostdinc -fno-builtin -Werror -Wall +CPP = ${MIPS_GCC_PREFIX}cpp +LD = ${MIPS_GCC_PREFIX}gcc -mips32r2 -EL +LDFLAGS = -nostdlib -T ../${LDSCRIPT} -Wl,-Map=$(basename $@).map +SIZE = ${MIPS_GCC_PREFIX}size +OBJCOPY = ${MIPS_GCC_PREFIX}objcopy +OBJDUMP = ${MIPS_GCC_PREFIX}objdump + +ifneq (${MIPS_GCC_FORMAT},) + LDFLAGS += -Wl,--oformat=${MIPS_GCC_FORMAT} +endif + +# sources are located via $S relative to the compilation directory +S = ../.. + +DEPFLAGS = -MT $@ -MP -MD -MF .deps/$*.dep +DEFS = -I. ${PARAM} -DKERNEL $(DEPFLAGS) +CFLAGS = -O ${DEFS} + +# compile rules: rules are named COMPILE_${SUFFIX} +# SUFFIX is the file suffix, capitalized (e.g. C for a .c file). + +COMPILE_C = ${CC} -c ${CFLAGS} $< +COMPILE_S = ${CC} -c ${DEFS} $< + +%OBJS + +%CFILES + +# load lines for config "xxx" will be emitted as: +# xxx: ${SYSTEM_DEP} swapxxx.o +# ${SYSTEM_LD_HEAD} +# ${SYSTEM_LD} swapxxx.o +# ${SYSTEM_LD_TAIL} +SYSTEM_OBJ = startup.o ${OBJS} ioconf.o +ifeq (devcfg.c,$(wildcard devcfg.c)) + SYSTEM_OBJ += devcfg.o +endif +SYSTEM_DEP = Makefile ioconf.c machine sys .deps ${SYSTEM_OBJ} +SYSTEM_LD_HEAD = sh ../newvers.sh > vers.c; ${CC} $(CFLAGS) -c vers.c; rm -f $@ +SYSTEM_LD = -@echo ${LD} ${LDFLAGS} '$${SYSTEM_OBJ}' vers.o -o $@; \ + ${LD} ${LDFLAGS} ${SYSTEM_OBJ} vers.o -o $@ +SYSTEM_LD_TAIL = ${SIZE} $@; \ + $(OBJCOPY) -O ihex --change-addresses=0x80000000 $@ $(basename $@).hex; \ + $(OBJCOPY) -O binary -R .boot -R .config $@ $(basename $@).bin; \ + $(OBJDUMP) -d -S $@ > $(basename $@).dis + +%LOAD + +clean: + rm -rf .deps *.elf *.o *.map *.dis *.bin machine sys + +clean-all: clean + rm -f *.h *.hex ioconf.c swap*.c vers.c + +reconfig ioconf.c: Config ../../../tools/kconfig/kconfig + ../../../tools/kconfig/kconfig Config + $(MAKE) clean + rm -f *.hex + +load: unix.elf + pic32prog unix.hex + +machine: + ln -s .. $@ + +sys: + ln -s ../../include $@ + +.deps: + mkdir .deps + +startup.o: ../startup.S + ${COMPILE_S} + +ioconf.o: ioconf.c + ${COMPILE_C} + +%RULES + +ifeq (.deps, $(wildcard .deps)) +-include .deps/*.dep +endif diff --git a/target.mk b/target.mk index 9e32dd7..38d058f 100644 --- a/target.mk +++ b/target.mk @@ -56,7 +56,7 @@ ifeq (/usr/local/mips-elf/bin/mips-elf-gcc,$(wildcard /usr/local/mips-elf/bin/mi endif endif -# Mentor Sourcery CodeBench Lite toolchain +# Mentor Sourcery CodeBench Lite toolchain -- DG Downloaded this compiler suite from given link # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # You can download a Linux or Windows binary package from # https://sourcery.mentor.com/GNUToolchain/release2641 diff --git a/tools/configsys/Makefile b/tools/configsys/Makefile index f100ec2..06c2403 100644 --- a/tools/configsys/Makefile +++ b/tools/configsys/Makefile @@ -3,7 +3,7 @@ BIN = config SRCS = main.cpp config.cpp mapping.cpp device.cpp cluster.cpp util.cpp core.cpp gstore.cpp OBJS = main.o config.o mapping.o device.o cluster.o util.o core.o gstore.o CXX = g++ -CXXFLAGS = -Wall -O +CXXFLAGS = -Wall -O -m32 all: .depend $(BIN) diff --git a/tools/diag/Makefile b/tools/diag/Makefile index 0744184..4e795f8 100644 --- a/tools/diag/Makefile +++ b/tools/diag/Makefile @@ -55,7 +55,7 @@ DEFS += -DLED_KERNEL_PORT=TRISE -DLED_KERNEL_PIN=2 -DLED_KERNEL_INVER DEFS += -DLED_TTY_PORT=TRISE -DLED_TTY_PIN=3 -DLED_TTY_INVERT DEPFLAGS = -MT $@ -MD -MP -MF .deps/$*.dep -CFLAGS = -O $(DEFS) $(DEPFLAGS) +CFLAGS = -O $(DEFS) $(DEPFLAGS) -m32 ASFLAGS = $(DEFS) $(DEPFLAGS) CC = $(GCCPREFIX)gcc -EL -g -mips32r2 diff --git a/tools/elf2aout/Makefile b/tools/elf2aout/Makefile index 7f60474..161e07a 100644 --- a/tools/elf2aout/Makefile +++ b/tools/elf2aout/Makefile @@ -1,5 +1,5 @@ CC = ${HOSTCC}gcc -g -CFLAGS = -O -Wall +CFLAGS = -O -Wall -m32 DESTDIR = /usr/local OBJS = elf2aout.o PROG = elf2aout @@ -15,7 +15,7 @@ clean: rm -f *~ *.o *.lst *.dis $(PROG) $(PROG): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(PROG).exe: $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) diff --git a/tools/fsutil/Makefile b/tools/fsutil/Makefile index 75bd802..ee0e882 100644 --- a/tools/fsutil/Makefile +++ b/tools/fsutil/Makefile @@ -1,5 +1,5 @@ CC = gcc -g -CFLAGS = -O -Wall +CFLAGS = -O -Wall -m32 DESTDIR = /usr/local OBJS = fsutil.o superblock.o block.c inode.o create.o check.o \ file.o mount.o manifest.o @@ -29,7 +29,7 @@ clean: rm -rf *~ *.o *.lst *.dis $(PROG) $(PROG).dSYM $(PROG): $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) + $(CC) -m32 $(LDFLAGS) -o $@ $(OBJS) $(LIBS) root.bin: $(PROG) ./$(PROG) -n16384 -s2048 $@ diff --git a/tools/icache/Makefile b/tools/icache/Makefile index 531a077..6d57519 100644 --- a/tools/icache/Makefile +++ b/tools/icache/Makefile @@ -1,4 +1,4 @@ -CC = gcc -g +CC = gcc -g -m32 CFLAGS = -O -Wall DESTDIR = /usr/local OBJS = ice2aout.o diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile index c2cee01..7292719 100644 --- a/tools/kconfig/Makefile +++ b/tools/kconfig/Makefile @@ -1,5 +1,5 @@ -CC = gcc -g -CFLAGS = -O -Wall -Werror +CC = gcc -g -m32 +CFLAGS = -O -Wall -Werror YACC = byacc -d DESTDIR = /usr/local OBJS = config.o main.o lang.o mkioconf.o mkmakefile.o mkswapconf.o diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index 20f3f3a..1586777 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -125,15 +125,15 @@ struct config { /* * Config has a global notion of which architecture is being used. */ -int arch; -char *archname; +extern int arch; +extern char *archname; #define ARCH_PIC32 1 /* * For each architecture, a set of CPU's may be specified as supported. * These and the options (below) are put in the C flags in the makefile. */ -struct cputype { +extern struct cputype { char *cpu_name; struct cputype *cpu_next; } *cputype; @@ -143,7 +143,7 @@ struct cputype { * but which may also specify values for the options. * A separate set of options may be defined for make-style options. */ -struct opt { +extern struct opt { char *op_name; char *op_value; struct opt *op_next; @@ -152,30 +152,30 @@ struct opt { /* * Mapping of signal names to pins. */ -struct signal { +extern struct signal { char *sig_name; int sig_pin; int sig_invert; struct signal *sig_next; } *siglist; -char *board; -char *ldscript; +extern char *board; +extern char *ldscript; -int do_trace; +extern int do_trace; -struct device *dtab; +extern struct device *dtab; -char errbuf[80]; -int yyline; +extern char errbuf[]; +extern int yyline; -struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; +extern struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; -int zone, hadtz; -int dst; -int debugging; +extern int zone, hadtz; +extern int dst; +extern int debugging; -int maxusers; +extern int maxusers; #define eq(a,b) (!strcmp(a,b)) diff --git a/tools/kconfig/config.y b/tools/kconfig/config.y index e325f4a..aec5105 100644 --- a/tools/kconfig/config.y +++ b/tools/kconfig/config.y @@ -99,14 +99,35 @@ * @(#)config.y 8.1 (Berkeley) 6/6/93 */ +#include //definition for major(), minor() and makedev() + #include "config.h" #include #include +#include struct device cur; struct device *curp = 0; +struct device *dtab; +struct file_list **confp; +struct opt *opt, *mkopt; +struct signal *siglist; +struct cputype *cputype; + char *temp_id; char *val_id; +char *archname; +char errbuf[80]; +char *board; +char *ldscript; + +int arch; +int do_trace; +int maxusers; +int yyline; +int dst; +int hadtz; +int zone; int yylex(void); int finddev(dev_t dev); diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index 9e9465a..ab7230b 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -38,6 +38,9 @@ #include "y.tab.h" #include "config.h" +struct file_list *conf_list; +int debugging; + /* * Config builds a set of files for building a UNIX * system given a description of the desired system. @@ -72,7 +75,7 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr); dtab = NULL; confp = &conf_list; - compp = &comp_list; + //compp = &comp_list; if (yyparse()) exit(3); diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index 26be789..4c308d5 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -40,6 +40,8 @@ #include "y.tab.h" #include "config.h" +struct file_list *ftab; + #define next_word(fp, wd) \ { register char *word = get_word(fp); \ if (word == (char *)EOF) \ @@ -425,7 +427,7 @@ void makefile() read_files(); strcpy(line, "../Makefile.kconf"); - //strcat(line, archname); + strcat(line, archname); ifp = fopen(line, "r"); if (ifp == 0) { perror(line); diff --git a/tools/kconfig/mkswapconf.c b/tools/kconfig/mkswapconf.c index 29d886c..4d3008c 100644 --- a/tools/kconfig/mkswapconf.c +++ b/tools/kconfig/mkswapconf.c @@ -34,6 +34,9 @@ /* * Build a swap configuration file. */ + +#include //definitions for makedev(), major(), minor() + #include "config.h" #include diff --git a/tools/libufs/Makefile b/tools/libufs/Makefile index 582ca3d..f1c1363 100644 --- a/tools/libufs/Makefile +++ b/tools/libufs/Makefile @@ -1,5 +1,5 @@ LOBJS=fs.o util.o fops.o set.o -CFLAGS=-Wall -Werror -ggdb3 +CFLAGS=-Wall -Werror -ggdb3 -m32 PROGS=umkfs umkdir uls uchmod uchown uchgrp ulogin ucd ucat POBJS=umkfs.o umkdir.o uls.o uchmod.o uchown.o uchgrp.o ulogin.o ucd.o ucat.o LDFLAGS=-L. -lufs -ggdb3 diff --git a/tools/mkrd/Makefile b/tools/mkrd/Makefile index 3676005..205933d 100644 --- a/tools/mkrd/Makefile +++ b/tools/mkrd/Makefile @@ -1,11 +1,11 @@ OBJS = mkrd.o BIN = mkrd -CFLAGS = -Wall -Werror -O +CFLAGS = -m32 -Wall -Werror -O all: $(BIN) $(BIN): $(OBJS) - $(CC) -o $@ $< $(LIBS) $(LDFLAGS) + $(CC) -m32 -o $@ $< $(LIBS) $(LDFLAGS) clean: @rm -f $(BIN) $(OBJS) diff --git a/tools/virtualmips/Makefile b/tools/virtualmips/Makefile index 420cc4e..563330e 100644 --- a/tools/virtualmips/Makefile +++ b/tools/virtualmips/Makefile @@ -15,8 +15,8 @@ CFLAGS = -DSIM_PIC32 -DPIC32MX7 -DMAX32 # UBW32 with UART console #CFLAGS = -DSIM_PIC32 -DPIC32MX7 -DUBW32 -CC = gcc -g -CFLAGS += -Wall -Werror -MT $@ -MD -MP -MF .deps/$*.dep +CC = gcc -g -m32 +CFLAGS += -Wall -MT $@ -MD -MP -MF .deps/$*.dep LIBS = -lpthread CFLAGS += $(shell pkg-config libelf --cflags)