diff --git a/src/cmd/ranlib/ranlib.c b/src/cmd/ranlib/ranlib.c index 8d0d668..77fc43e 100644 --- a/src/cmd/ranlib/ranlib.c +++ b/src/cmd/ranlib/ranlib.c @@ -262,7 +262,7 @@ bad1: (void)lseek(rfd, (off_t)r_off, SEEK_SET); void symobj() { register RLIB *rp; - char hb[sizeof(struct ar_hdr) + 1]; + char hb[sizeof(struct ar_hdr) + 1 + 64]; long ransize, baseoff; /* Rewind the archive, leaving the magic number. */ diff --git a/src/elf32-mips.ld b/src/elf32-mips.ld index 8cf668f..8c6b6e9 100644 --- a/src/elf32-mips.ld +++ b/src/elf32-mips.ld @@ -3,18 +3,19 @@ */ OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") -OUTPUT_ARCH(mips) +OUTPUT_ARCH(pic32mx) ENTRY(_start) /* Required by Microchip C32 linker */ -/*MEMORY +MEMORY { - kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x80000 - kseg0_boot_mem : ORIGIN = 0x9FC00490, LENGTH = 0x970 - exception_mem : ORIGIN = 0x9FC01000, LENGTH = 0x1000 - kseg1_boot_mem : ORIGIN = 0xBFC00000, LENGTH = 0x490 + kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 512K + exception_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x1000 + kseg0_boot_mem (rx) : ORIGIN = 0x9FC00000, LENGTH = 12K-16 + kseg1_boot_mem (rx) : ORIGIN = 0xBFC00000, LENGTH = 0x490 kseg1_data_mem (w!x) : ORIGIN = 0xA0000000, LENGTH = 0x20000 -}*/ +} +_min_heap_size = 0; SECTIONS { diff --git a/sys/pic32/32mxsdram/bootloader.ld b/sys/pic32/32mxsdram/bootloader.ld index b9da665..6ad8937 100644 --- a/sys/pic32/32mxsdram/bootloader.ld +++ b/sys/pic32/32mxsdram/bootloader.ld @@ -5,7 +5,7 @@ */ OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") -OUTPUT_ARCH(mips) +OUTPUT_ARCH(pic32mx) ENTRY(_reset_vector_) MEMORY { diff --git a/sys/pic32/baremetal/script.ld b/sys/pic32/baremetal/script.ld index 69bab8d..d008865 100644 --- a/sys/pic32/baremetal/script.ld +++ b/sys/pic32/baremetal/script.ld @@ -3,7 +3,7 @@ */ OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") -OUTPUT_ARCH(mips) +OUTPUT_ARCH(pic32mx) ENTRY(_reset_vector_) MEMORY { diff --git a/sys/pic32/gcc-config.mk b/sys/pic32/gcc-config.mk index 0806fc2..01443eb 100644 --- a/sys/pic32/gcc-config.mk +++ b/sys/pic32/gcc-config.mk @@ -1,77 +1,8 @@ -# chipKIT PIC32 compiler from UECIDE -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# PIC32 compiler from UECIDE # Use UECIDE package from http://uecide.org/download ifndef MIPS_GCC_PREFIX - ifdef UECIDE - ifeq ($(UECIDE)/compilers/pic32-tools-452/bin/pic32-gcc,$(wildcard $(UECIDE)/compilers/pic32-tools-452/bin/pic32-gcc)) - MIPS_GCC_PREFIX = $(UECIDE)/compilers/pic32-tools-452/bin/pic32- - MIPS_GCC_FORMAT = elf32-tradlittlemips - endif - endif -endif - -# chipKIT PIC32 compiler on Linux -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Download from https://github.com/jasonkajita/chipKIT-cxx/downloads -# and unzip to /usr/local. -# Need to copy pic32-tools/pic32mx/include/stdarg.h -# to pic32-tools/lib/gcc/pic32mx/4.5.1/include. -# MPLABX C32 compiler doesn't support some functionality -# we need, so use chipKIT compiler by default. -ifndef MIPS_GCC_PREFIX - ifeq (/usr/local/pic32-tools/bin/pic32-gcc,$(wildcard /usr/local/pic32-tools/bin/pic32-gcc)) - MIPS_GCC_PREFIX = /usr/local/pic32-tools/bin/pic32- - MIPS_GCC_FORMAT = elf32-tradlittlemips - endif -endif - -# Generic MIPS toolchain -# ~~~~~~~~~~~~~~~~~~~~~~ -# You can build it from sources, as described on page -# http://retrobsd.org/wiki/doku.php/doc/toolchain-mips -ifndef MIPS_GCC_PREFIX - ifeq (/usr/local/mips-gcc-4.8.1/bin/mips-elf-gcc,$(wildcard /usr/local/mips-gcc-4.8.1/bin/mips-elf-gcc)) - MIPS_GCC_PREFIX = /usr/local/mips-gcc-4.8.1/bin/mips-elf- - endif -endif - -# Generic MIPS toolchain on *BSD -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# You can build it from sources, as described on page -# http://retrobsd.org/wiki/doku.php/doc/toolchain-mips -# Maybe you can install it from packages one day too. -ifndef MIPS_GCC_PREFIX - ifeq (/usr/local/mips-elf/bin/mips-elf-gcc,$(wildcard /usr/local/mips-elf/bin/mips-elf-gcc)) - MIPS_GCC_PREFIX = /usr/local/mips-elf/bin/mips-elf- - endif -endif - -# Mentor Sourcery CodeBench Lite toolchain -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -ifndef MIPS_GCC_PREFIX - # Download a Linux binary package from - # https://sourcery.mentor.com/GNUToolchain/release2641 - ifeq (/usr/local/mips-2013.11/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2013.11/bin/mips-sde-elf-gcc)) - MIPS_GCC_PREFIX = /usr/local/mips-2013.11/bin/mips-sde-elf- - MIPS_GCC_FORMAT = elf32-tradlittlemips - endif -endif -ifndef MIPS_GCC_PREFIX - # Download a Linux binary package from - # https://sourcery.mentor.com/GNUToolchain/release2774 - ifeq (/usr/local/mips-2014.05/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2014.05/bin/mips-sde-elf-gcc)) - MIPS_GCC_PREFIX = /usr/local/mips-2014.05/bin/mips-sde-elf- - MIPS_GCC_FORMAT = elf32-tradlittlemips - endif -endif - -# Imagination Codescape MIPS SDK Essentials -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Download a Linux binary package from: -# http://community.imgtec.com/developers/mips/tools/codescape-mips-sdk/download-codescape-mips-sdk-essentials/ -ifndef MIPS_GCC_ROOT - ifeq (/opt/imgtec/Toolchains/mips-mti-elf/2015.01-7,$(wildcard /opt/imgtec/Toolchains/mips-mti-elf/2015.01-7)) - MIPS_GCC_ROOT = /opt/imgtec/Toolchains/mips-mti-elf/2015.01-7 + ifeq ($(HOME)/.uecide/compilers/pic32-tools/bin/pic32-gcc,$(wildcard $(HOME)/.uecide/compilers/pic32-tools/bin/pic32-gcc)) + MIPS_GCC_PREFIX = $(HOME)/.uecide/compilers/pic32-tools/bin/pic32- MIPS_GCC_FORMAT = elf32-tradlittlemips endif endif diff --git a/sys/pic32/max32/bootloader.ld b/sys/pic32/max32/bootloader.ld index a5ce399..23b6fce 100644 --- a/sys/pic32/max32/bootloader.ld +++ b/sys/pic32/max32/bootloader.ld @@ -5,7 +5,7 @@ */ OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") -OUTPUT_ARCH(mips) +OUTPUT_ARCH(pic32mx) ENTRY(_reset_vector_) MEMORY { diff --git a/sys/pic32/maximite-color/bootloader.ld b/sys/pic32/maximite-color/bootloader.ld index 62f0934..0e687f1 100644 --- a/sys/pic32/maximite-color/bootloader.ld +++ b/sys/pic32/maximite-color/bootloader.ld @@ -5,7 +5,7 @@ */ OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") -OUTPUT_ARCH(mips) +OUTPUT_ARCH(pic32mx) ENTRY(_reset_vector_) MEMORY { diff --git a/sys/pic32/maximite/bootloader.ld b/sys/pic32/maximite/bootloader.ld index 8ec7152..b500503 100644 --- a/sys/pic32/maximite/bootloader.ld +++ b/sys/pic32/maximite/bootloader.ld @@ -5,7 +5,7 @@ */ OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") -OUTPUT_ARCH(mips) +OUTPUT_ARCH(pic32mx) ENTRY(_reset_vector_) MEMORY { diff --git a/sys/pic32/mmb-mx7/bootloader.ld b/sys/pic32/mmb-mx7/bootloader.ld index e21057f..13ca5aa 100644 --- a/sys/pic32/mmb-mx7/bootloader.ld +++ b/sys/pic32/mmb-mx7/bootloader.ld @@ -5,7 +5,7 @@ */ OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") -OUTPUT_ARCH(mips) +OUTPUT_ARCH(pic32mx) ENTRY(_reset_vector_) MEMORY { diff --git a/sys/pic32/ubw32/bootloader.ld b/sys/pic32/ubw32/bootloader.ld index 5b856fe..22e88e2 100644 --- a/sys/pic32/ubw32/bootloader.ld +++ b/sys/pic32/ubw32/bootloader.ld @@ -5,7 +5,7 @@ */ OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", "elf32-littlemips") -OUTPUT_ARCH(mips) +OUTPUT_ARCH(pic32mx) ENTRY(_reset_vector_) MEMORY { diff --git a/target.mk b/target.mk index 9e32dd7..5450204 100644 --- a/target.mk +++ b/target.mk @@ -4,75 +4,14 @@ RELEASE = 0.0 BUILD = $(shell git rev-list HEAD --count) VERSION = $(RELEASE)-$(BUILD) -# chipKIT PIC32 compiler from UECIDE -ifdef UECIDE +# PIC32 compiler from UECIDE +# Use UECIDE package from http://uecide.org/download ifndef GCCPREFIX - ifeq ($(UECIDE)/compilers/pic32-tools-452/bin/pic32-gcc,$(wildcard $(UECIDE)/compilers/pic32-tools-452/bin/pic32-gcc)) - GCCPREFIX = ${UECIDE}/compilers/pic32-tools-452/bin/pic32- - LDFLAGS = -Wl,--oformat=elf32-tradlittlemips - INCLUDES = -I${UECIDE}/compilers/pic32-tools-452/lib/gcc/pic32mx/4.5.2/include - endif -endif -endif - -# chipKIT PIC32 compiler on Linux -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Download from https://github.com/jasonkajita/chipKIT-cxx/downloads -# and unzip to /usr/local. -# Need to copy pic32-tools/pic32mx/include/stdarg.h -# to pic32-tools/lib/gcc/pic32mx/4.5.1/include. -# MPLABX C32 compiler doesn't support some functionality -# we need, so use chipKIT compiler by default. -ifndef GCCPREFIX -ifeq (/usr/local/pic32-tools/bin/pic32-gcc,$(wildcard /usr/local/pic32-tools/bin/pic32-gcc)) - GCCPREFIX = /usr/local/pic32-tools/bin/pic32- - LDFLAGS = -Wl,--oformat=elf32-tradlittlemips - INCLUDES = -I/usr/local/pic32-tools/lib/gcc/pic32mx/4.5.1/include -endif -endif - -# Generic MIPS toolchain -# ~~~~~~~~~~~~~~~~~~~~~~ -# You can build it from sources, as described on page -# http://retrobsd.org/wiki/doku.php/doc/toolchain-mips -ifndef GCCPREFIX -ifeq (/usr/local/mips-gcc-4.8.1/bin/mips-elf-gcc,$(wildcard /usr/local/mips-gcc-4.8.1/bin/mips-elf-gcc)) - GCCPREFIX = /usr/local/mips-gcc-4.8.1/bin/mips-elf- - LDFLAGS = - INCLUDES = -endif -endif - -# Generic MIPS toolchain on *BSD -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# You can build it from sources, as described on page -# http://retrobsd.org/wiki/doku.php/doc/toolchain-mips -# Maybe you can install it from packages one day too. -ifndef GCCPREFIX -ifeq (/usr/local/mips-elf/bin/mips-elf-gcc,$(wildcard /usr/local/mips-elf/bin/mips-elf-gcc)) - GCCPREFIX = /usr/local/mips-elf/bin/mips-elf- - LDFLAGS = - INCLUDES = -endif -endif - -# Mentor Sourcery CodeBench Lite toolchain -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# You can download a Linux or Windows binary package from -# https://sourcery.mentor.com/GNUToolchain/release2641 -ifndef GCCPREFIX -ifeq (/usr/local/mips-2013.11/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2013.11/bin/mips-sde-elf-gcc)) - GCCPREFIX = /usr/local/mips-2013.11/bin/mips-sde-elf- - LDFLAGS = -Wl,--oformat=elf32-tradlittlemips - INCLUDES = -endif -endif -ifndef GCCPREFIX -ifeq (/usr/local/mips-2014.05/bin/mips-sde-elf-gcc,$(wildcard /usr/local/mips-2014.05/bin/mips-sde-elf-gcc)) - GCCPREFIX = /usr/local/mips-2014.05/bin/mips-sde-elf- - LDFLAGS = -Wl,--oformat=elf32-tradlittlemips - INCLUDES = -endif + ifeq ($(HOME)/.uecide/compilers/pic32-tools/bin/pic32-gcc,$(wildcard $(HOME)/.uecide/compilers/pic32-tools/bin/pic32-gcc)) + GCCPREFIX = $(HOME)/.uecide/compilers/pic32-tools/bin/pic32- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips + INCLUDES = -I$(HOME)/.uecide/compilers/pic32-tools/lib/gcc/pic32mx/4.5.2/include + endif endif ifndef GCCPREFIX diff --git a/tools/fsutil/mount.c b/tools/fsutil/mount.c index 489e84d..e30fb28 100644 --- a/tools/fsutil/mount.c +++ b/tools/fsutil/mount.c @@ -27,6 +27,7 @@ #include #include #include +#include #define FUSE_USE_VERSION 26 #include diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index 20f3f3a..108c2cc 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[80]; +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..300584d 100644 --- a/tools/kconfig/config.y +++ b/tools/kconfig/config.y @@ -102,6 +102,7 @@ #include "config.h" #include #include +#include struct device cur; struct device *curp = 0; diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index 9e9465a..cd27a4e 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -38,6 +38,23 @@ #include "y.tab.h" #include "config.h" +int arch; +char *archname; +struct cputype *cputype; +struct opt *opt, *mkopt; +struct signal *siglist; +char *board; +char *ldscript; +int do_trace; +struct device *dtab; +char errbuf[80]; +int yyline; +struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; +int zone, hadtz; +int dst; +int debugging; +int maxusers; + /* * Config builds a set of files for building a UNIX * system given a description of the desired system. diff --git a/tools/kconfig/mkswapconf.c b/tools/kconfig/mkswapconf.c index 29d886c..9d403a7 100644 --- a/tools/kconfig/mkswapconf.c +++ b/tools/kconfig/mkswapconf.c @@ -38,6 +38,7 @@ #include #include +#include void swapconf() { diff --git a/tools/virtualmips/dev_nand_flash_1g.c b/tools/virtualmips/dev_nand_flash_1g.c index 784367a..b08a19a 100644 --- a/tools/virtualmips/dev_nand_flash_1g.c +++ b/tools/virtualmips/dev_nand_flash_1g.c @@ -373,7 +373,7 @@ static int load_nand_flash_file (nand_flash_1g_data_t * d) int i, j = 0; struct dirent *ent = NULL; DIR *p_dir; - char file_path[64]; + char file_path[1024]; char *file_name; char block_number[16]; int fd;