pic32 port of newlib
This commit is contained in:
parent
6ea20cbe87
commit
c3e4aed4e5
10 changed files with 1831 additions and 2468 deletions
6
.gitattributes
vendored
6
.gitattributes
vendored
|
@ -836,9 +836,11 @@ newlib/libgloss/pic32mx/Makefile.in -text
|
||||||
newlib/libgloss/pic32mx/aclocal.m4 -text
|
newlib/libgloss/pic32mx/aclocal.m4 -text
|
||||||
newlib/libgloss/pic32mx/configure -text
|
newlib/libgloss/pic32mx/configure -text
|
||||||
newlib/libgloss/pic32mx/configure.in -text
|
newlib/libgloss/pic32mx/configure.in -text
|
||||||
|
newlib/libgloss/pic32mx/exceptions.c -text
|
||||||
|
newlib/libgloss/pic32mx/read.c -text
|
||||||
newlib/libgloss/pic32mx/regs.S -text
|
newlib/libgloss/pic32mx/regs.S -text
|
||||||
newlib/libgloss/pic32mx/syscalls.c -text
|
newlib/libgloss/pic32mx/sbrk.c -text
|
||||||
newlib/libgloss/pic32mx/test.c -text
|
newlib/libgloss/pic32mx/write.c -text
|
||||||
newlib/libgloss/print.c -text
|
newlib/libgloss/print.c -text
|
||||||
newlib/libgloss/putnum.c -text
|
newlib/libgloss/putnum.c -text
|
||||||
newlib/libgloss/read.c -text
|
newlib/libgloss/read.c -text
|
||||||
|
|
4030
newlib/libgloss/configure
vendored
4030
newlib/libgloss/configure
vendored
File diff suppressed because it is too large
Load diff
|
@ -65,9 +65,14 @@ OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
|
||||||
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
|
||||||
|
|
||||||
CRT0 = @crt0@
|
CRT0 = @crt0@
|
||||||
GENOBJS = syscalls.o fstat.o getpid.o isatty.o kill.o \
|
|
||||||
lseek.o print.o putnum.o stat.o unlink.o
|
LIBPIC32_BSP = libpic32.a
|
||||||
GENOBJS2 = open.o close.o read.o write.o
|
LIBPIC32_OBJS = sbrk.o close.o fstat.o getpid.o isatty.o kill.o \
|
||||||
|
lseek.o open.o print.o stat.o unlink.o write.o read.o
|
||||||
|
|
||||||
|
|
||||||
|
LIBE_BSP = libe.a
|
||||||
|
LIBE_OBJS = exceptions.o
|
||||||
|
|
||||||
CFLAGS = -g
|
CFLAGS = -g
|
||||||
|
|
||||||
|
@ -75,7 +80,7 @@ GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \
|
||||||
then echo -L${objroot}/../gcc ; fi`
|
then echo -L${objroot}/../gcc ; fi`
|
||||||
|
|
||||||
SCRIPTS = @script_list@
|
SCRIPTS = @script_list@
|
||||||
BSP = @bsp_list@
|
BSP = @bsp_list@ $(LIBPIC32_BSP) $(LIBE_BSP)
|
||||||
|
|
||||||
PART_SPECIFIC_DEFINES = @part_specific_defines@
|
PART_SPECIFIC_DEFINES = @part_specific_defines@
|
||||||
|
|
||||||
|
@ -87,7 +92,7 @@ PART_SPECIFIC_DEFINES = @part_specific_defines@
|
||||||
# it to link is a good test, so we ignore all the errors for now.
|
# it to link is a good test, so we ignore all the errors for now.
|
||||||
#
|
#
|
||||||
|
|
||||||
all: ${CRT0} test.o ${BSP}
|
all: ${CRT0} $(LIBPIC32_BSP) ${BSP}
|
||||||
|
|
||||||
#
|
#
|
||||||
# here's where we build the board support packages for each target
|
# here's where we build the board support packages for each target
|
||||||
|
@ -119,12 +124,49 @@ info:
|
||||||
install-info:
|
install-info:
|
||||||
clean-info:
|
clean-info:
|
||||||
|
|
||||||
test.o: ${srcdir}/test.c
|
|
||||||
|
|
||||||
# these are for the BSPs
|
# these are for the BSPs
|
||||||
crt0.o: ${srcdir}/crt0.S
|
crt0.o: ${srcdir}/crt0.S
|
||||||
|
|
||||||
syscalls.o: ${srcdir}/syscalls.c
|
sbrk.o: ${srcdir}/sbrk.c
|
||||||
|
|
||||||
|
syscalls.o: $(srcdir)/syscalls.c
|
||||||
|
|
||||||
|
close.o: $(srcdir)/../close.c
|
||||||
|
|
||||||
|
fstat.o: $(srcdir)/../fstat.c
|
||||||
|
|
||||||
|
getpid.o: $(srcdir)/../getpid.c
|
||||||
|
|
||||||
|
isatty.o: $(srcdir)/../isatty.c
|
||||||
|
|
||||||
|
kill.o: $(srcdir)/../kill.c
|
||||||
|
|
||||||
|
lseek.o: $(srcdir)/../lseek.c
|
||||||
|
|
||||||
|
open.o: $(srcdir)/../open.c
|
||||||
|
|
||||||
|
print.o: $(srcdir)/../print.c
|
||||||
|
|
||||||
|
putnum.o: $(srcdir)/../putnum.c
|
||||||
|
|
||||||
|
stat.o: $(srcdir)/../stat.c
|
||||||
|
|
||||||
|
unlink.o: $(srcdir)/../unlink.c
|
||||||
|
|
||||||
|
write.o: $(srcdir)/write.c
|
||||||
|
|
||||||
|
read.o: $(srcdir)/read.c
|
||||||
|
|
||||||
|
|
||||||
|
exceptions.o: ${srcdir}/exceptions.c
|
||||||
|
|
||||||
|
$(LIBPIC32_BSP): $(LIBPIC32_OBJS)
|
||||||
|
${AR} ${ARFLAGS} $@ $^
|
||||||
|
${RANLIB} $@
|
||||||
|
|
||||||
|
$(LIBE_BSP): $(LIBE_OBJS)
|
||||||
|
${AR} ${ARFLAGS} $@ $^
|
||||||
|
${RANLIB} $@
|
||||||
|
|
||||||
# target specific makefile fragment comes in here.
|
# target specific makefile fragment comes in here.
|
||||||
@target_makefile_frag@
|
@target_makefile_frag@
|
||||||
|
|
53
newlib/libgloss/pic32mx/exceptions.c
Normal file
53
newlib/libgloss/pic32mx/exceptions.c
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
extern void _on_reset() __attribute__((weak));
|
||||||
|
|
||||||
|
extern void _nmi_handler() __attribute__((weak)) __attribute__((nomips16));
|
||||||
|
|
||||||
|
extern void _on_bootstrap() __attribute__((weak));
|
||||||
|
|
||||||
|
extern void _bootstrap_exception_handler() __attribute__((weak)) __attribute__((nomips16));
|
||||||
|
|
||||||
|
extern void _general_exception_handler(unsigned cause, unsigned status) __attribute__((weak)); /* should have nomips16 here as well */
|
||||||
|
|
||||||
|
void _on_reset() {
|
||||||
|
/* nothing */
|
||||||
|
__asm__ __volatile__ ("%(nop%)" : :);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _nmi_handler() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void _on_bootstrap() {
|
||||||
|
/* nothing */
|
||||||
|
__asm__ __volatile__ ("%(nop%)" : :);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _bootstrap_exception_handler() {
|
||||||
|
while (1) {
|
||||||
|
__asm__ __volatile__ ("%(nop%)" : :);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void _general_exception_context() {
|
||||||
|
/* The provided implementation
|
||||||
|
* of this function saves context, calls an application handler function, restores context
|
||||||
|
* and performs a return from exception instruction. The context saved is the hi and lo
|
||||||
|
* registers and all general purpose registers except s0-s8, which are defined to be
|
||||||
|
* preserved by all called functions and so are not necessary to actively save again here.
|
||||||
|
* The values of the Cause and Status registers are passed to the application handler
|
||||||
|
* function (_general_exception_handler())
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* XXX TODO: write this function */
|
||||||
|
_general_exception_handler(0,0);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void _general_exception_handler(unsigned cause, unsigned status) {
|
||||||
|
while (1) {
|
||||||
|
__asm__ __volatile__ ("%(nop%)" : :);
|
||||||
|
}
|
||||||
|
};
|
20
newlib/libgloss/pic32mx/read.c
Normal file
20
newlib/libgloss/pic32mx/read.c
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Stub version of read.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <_ansi.h>
|
||||||
|
#include <_syslist.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int
|
||||||
|
_DEFUN (read, (file, ptr, len),
|
||||||
|
int file _AND
|
||||||
|
char *ptr _AND
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
main()
|
|
||||||
{
|
|
||||||
outbyte ('&');
|
|
||||||
outbyte ('@');
|
|
||||||
outbyte ('$');
|
|
||||||
outbyte ('%');
|
|
||||||
|
|
||||||
/* whew, we made it */
|
|
||||||
|
|
||||||
print ("\r\nDone...");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
21
newlib/libgloss/pic32mx/write.c
Normal file
21
newlib/libgloss/pic32mx/write.c
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/*
|
||||||
|
* Stub version of write.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <_ansi.h>
|
||||||
|
#include <_syslist.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int
|
||||||
|
_DEFUN (write, (file, ptr, len),
|
||||||
|
int file _AND
|
||||||
|
char *ptr _AND
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -678,6 +678,9 @@ case "${host}" in
|
||||||
mn10?00-*-*)
|
mn10?00-*-*)
|
||||||
syscall_dir=syscalls
|
syscall_dir=syscalls
|
||||||
;;
|
;;
|
||||||
|
pic32mx-*)
|
||||||
|
newlib_cflags="${newlib_cflags} -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
|
||||||
|
;;
|
||||||
powerpc*-*-eabialtivec*)
|
powerpc*-*-eabialtivec*)
|
||||||
default_newlib_io_long_long="yes"
|
default_newlib_io_long_long="yes"
|
||||||
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
|
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
|
||||||
|
|
|
@ -95,8 +95,17 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__mips__) && !defined(__rtems__)
|
#if defined(__mips__) && !defined(__rtems__)
|
||||||
|
#if defined(__PIC32MX__) && defined(__section__)
|
||||||
|
/* Microchip attribs.h defines a __section__ which interfers with our IMPURE define, so this should work around it for now */
|
||||||
|
#define __ATTRIBUTE_IMPURE_PTR__ __section__(".sdata")
|
||||||
|
#else
|
||||||
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
|
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__PIC32MX__)
|
||||||
|
#define _REENT_SMALL
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __xstormy16__
|
#ifdef __xstormy16__
|
||||||
#define __SMALL_BITFIELDS
|
#define __SMALL_BITFIELDS
|
||||||
|
|
Reference in a new issue