diff options
Diffstat (limited to 'meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib')
14 files changed, 2580 insertions, 0 deletions
diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch new file mode 100644 index 000000000..950e0b30d --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch @@ -0,0 +1,91 @@ +From 4926aec8897dc574d442e5a87b2576ab80046b10 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:27:25 +0530 +Subject: [PATCH 01/11] [Patch, microblaze]: Add config/microblaze.mt for + target_makefile_frag Mirror MIPS method of creating copy of default.mt which + drops the compilation of generic sbrk.c to instead continue using the + microblaze provided version. + +[Libgloss] + +Changelog + +2013-07-15 David Holsgrove <david.holsgrove@xilinx.com> + + * config/microblaze.mt: New file. + * microblaze/configure.in: Switch default.mt to microblaze.mt. + * microblaze/configure: Likewise. + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + libgloss/config/microblaze.mt | 30 ++++++++++++++++++++++++++++++ + libgloss/microblaze/configure | 2 +- + libgloss/microblaze/configure.in | 2 +- + 3 files changed, 32 insertions(+), 2 deletions(-) + create mode 100644 libgloss/config/microblaze.mt + +diff --git a/libgloss/config/microblaze.mt b/libgloss/config/microblaze.mt +new file mode 100644 +index 0000000..e8fb922 +--- /dev/null ++++ b/libgloss/config/microblaze.mt +@@ -0,0 +1,30 @@ ++# ++# Match default.mt to compile generic objects but continue building ++# MicroBlaze specific sbrk.c ++# ++close.o: ${srcdir}/../close.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++fstat.o: ${srcdir}/../fstat.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++getpid.o: ${srcdir}/../getpid.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++isatty.o: ${srcdir}/../isatty.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++kill.o: ${srcdir}/../kill.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++lseek.o: ${srcdir}/../lseek.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++open.o: ${srcdir}/../open.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++print.o: ${srcdir}/../print.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++putnum.o: ${srcdir}/../putnum.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++read.o: ${srcdir}/../read.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++stat.o: ${srcdir}/../stat.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++unlink.o: ${srcdir}/../unlink.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? ++write.o: ${srcdir}/../write.c ++ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +diff --git a/libgloss/microblaze/configure b/libgloss/microblaze/configure +index 9b2bc7a..01f0fb2 100644 +--- a/libgloss/microblaze/configure ++++ b/libgloss/microblaze/configure +@@ -2020,7 +2020,7 @@ LIB_AM_PROG_AS + + + host_makefile_frag=${srcdir}/../config/default.mh +-target_makefile_frag=${srcdir}/../config/default.mt ++target_makefile_frag=${srcdir}/../config/microblaze.mt + + host_makefile_frag_path=$host_makefile_frag + +diff --git a/libgloss/microblaze/configure.in b/libgloss/microblaze/configure.in +index 77aa769..5d179fd 100644 +--- a/libgloss/microblaze/configure.in ++++ b/libgloss/microblaze/configure.in +@@ -35,7 +35,7 @@ LIB_AM_PROG_AS + AC_SUBST(bsp_prefix) + + host_makefile_frag=${srcdir}/../config/default.mh +-target_makefile_frag=${srcdir}/../config/default.mt ++target_makefile_frag=${srcdir}/../config/microblaze.mt + + dnl We have to assign the same value to other variables because autoconf + dnl doesn't provide a mechanism to substitute a replacement keyword with +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch new file mode 100644 index 000000000..51785d9a0 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0002-Patch-microblaze-Modified-_exceptional_handler.patch @@ -0,0 +1,25 @@ +From ee559eb522edcb793e4df62f61849748445a056e Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:30:02 +0530 +Subject: [PATCH 02/11] [Patch, microblaze]: Modified _exceptional_handler + Modified the _exceptional_handler to support the changes made in GCC related + to Superviosry call + +Signed-off-by:Nagaraju Mekala<nmekala@xilix.com> +--- + libgloss/microblaze/_exception_handler.S | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/libgloss/microblaze/_exception_handler.S b/libgloss/microblaze/_exception_handler.S +index 59385ad..7a91a78 100644 +--- a/libgloss/microblaze/_exception_handler.S ++++ b/libgloss/microblaze/_exception_handler.S +@@ -36,5 +36,4 @@ + .type _exception_handler, @function + + _exception_handler: +- addi r11,r11,8 + bra r11 +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch new file mode 100644 index 000000000..21c558009 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch @@ -0,0 +1,28 @@ +From 829dcc7967bd2a99b583fba1129ae71dbe8335ff Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:39:45 +0530 +Subject: [PATCH 03/11] [LOCAL]: Add missing declarations for xil_printf to + stdio.h for inclusion in toolchain and use in c++ apps + +Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com> +--- + newlib/libc/include/stdio.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h +index 164d95b..7bb729c 100644 +--- a/newlib/libc/include/stdio.h ++++ b/newlib/libc/include/stdio.h +@@ -245,6 +245,9 @@ int sprintf (char *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); + int remove (const char *); + int rename (const char *, const char *); ++void xil_printf (const char*, ...); ++void putnum (unsigned int ); ++void print (const char* ); + #ifdef _COMPILING_NEWLIB + int _rename (const char *, const char *); + #endif +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch new file mode 100644 index 000000000..f56f61876 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch @@ -0,0 +1,304 @@ +From 379f231f0afb5e10cd82bc6346e4a6776df3e21e Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:42:11 +0530 +Subject: [PATCH 04/11] [Local]: deleting the xil_printf.c file as now it part + of BSP + +--- + libgloss/microblaze/xil_printf.c | 284 --------------------------------------- + 1 file changed, 284 deletions(-) + delete mode 100644 libgloss/microblaze/xil_printf.c + +diff --git a/libgloss/microblaze/xil_printf.c b/libgloss/microblaze/xil_printf.c +deleted file mode 100644 +index f18ee84..0000000 +--- a/libgloss/microblaze/xil_printf.c ++++ /dev/null +@@ -1,284 +0,0 @@ +-/* Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are +- * met: +- * +- * 1. Redistributions source code must retain the above copyright notice, +- * this list of conditions and the following disclaimer. +- * +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * +- * 3. Neither the name of Xilinx nor the names of its contributors may be +- * used to endorse or promote products derived from this software without +- * specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS +- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +- * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +- +-#include <ctype.h> +-#include <string.h> +-#include <stdarg.h> +- +-extern void outbyte (char); +- +-/*----------------------------------------------------*/ +-/* Use the following parameter passing structure to */ +-/* make xil_printf re-entrant. */ +-/*----------------------------------------------------*/ +-typedef struct params_s { +- int len; +- int num1; +- int num2; +- char pad_character; +- int do_padding; +- int left_flag; +-} params_t; +- +-/*---------------------------------------------------*/ +-/* The purpose of this routine is to output data the */ +-/* same as the standard printf function without the */ +-/* overhead most run-time libraries involve. Usually */ +-/* the printf brings in many kilobytes of code and */ +-/* that is unacceptable in most embedded systems. */ +-/*---------------------------------------------------*/ +- +-typedef char* charptr; +-typedef int (*func_ptr)(int c); +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine puts pad characters into the output */ +-/* buffer. */ +-/* */ +-static void padding( const int l_flag, params_t *par) +-{ +- int i; +- +- if (par->do_padding && l_flag && (par->len < par->num1)) +- for (i=par->len; i<par->num1; i++) +- outbyte( par->pad_character); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine moves a string to the output buffer */ +-/* as directed by the padding and positioning flags. */ +-/* */ +-static void outs( charptr lp, params_t *par) +-{ +- /* pad on left if needed */ +- par->len = strlen( lp); +- padding( !(par->left_flag), par); +- +- /* Move string to the buffer */ +- while (*lp && (par->num2)--) +- outbyte( *lp++); +- +- /* Pad on right if needed */ +- /* CR 439175 - elided next stmt. Seemed bogus. */ +- /* par->len = strlen( lp); */ +- padding( par->left_flag, par); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine moves a number to the output buffer */ +-/* as directed by the padding and positioning flags. */ +-/* */ +- +-static void outnum( const long n, const long base, params_t *par) +-{ +- charptr cp; +- int negative; +- char outbuf[32]; +- const char digits[] = "0123456789ABCDEF"; +- unsigned long num; +- +- /* Check if number is negative */ +- if (base == 10 && n < 0L) { +- negative = 1; +- num = -(n); +- } +- else{ +- num = (n); +- negative = 0; +- } +- +- /* Build number (backwards) in outbuf */ +- cp = outbuf; +- do { +- *cp++ = digits[(int)(num % base)]; +- } while ((num /= base) > 0); +- if (negative) +- *cp++ = '-'; +- *cp-- = 0; +- +- /* Move the converted number to the buffer and */ +- /* add in the padding where needed. */ +- par->len = strlen(outbuf); +- padding( !(par->left_flag), par); +- while (cp >= outbuf) +- outbyte( *cp--); +- padding( par->left_flag, par); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine gets a number from the format */ +-/* string. */ +-/* */ +-static int getnum( charptr* linep) +-{ +- int n; +- charptr cp; +- +- n = 0; +- cp = *linep; +- while (isdigit(*cp)) +- n = n*10 + ((*cp++) - '0'); +- *linep = cp; +- return(n); +-} +- +-/*---------------------------------------------------*/ +-/* */ +-/* This routine operates just like a printf/sprintf */ +-/* routine. It outputs a set of data under the */ +-/* control of a formatting string. Not all of the */ +-/* standard C format control are supported. The ones */ +-/* provided are primarily those needed for embedded */ +-/* systems work. Primarily the floaing point */ +-/* routines are omitted. Other formats could be */ +-/* added easily by following the examples shown for */ +-/* the supported formats. */ +-/* */ +- +-/* void esp_printf( const func_ptr f_ptr, +- const charptr ctrl1, ...) */ +-void xil_printf( const charptr ctrl1, ...) +-{ +- +- int long_flag; +- int dot_flag; +- +- params_t par; +- +- char ch; +- va_list argp; +- charptr ctrl = ctrl1; +- +- va_start( argp, ctrl1); +- +- for ( ; *ctrl; ctrl++) { +- +- /* move format string chars to buffer until a */ +- /* format control is found. */ +- if (*ctrl != '%') { +- outbyte(*ctrl); +- continue; +- } +- +- /* initialize all the flags for this format. */ +- dot_flag = long_flag = par.left_flag = par.do_padding = 0; +- par.pad_character = ' '; +- par.num2=32767; +- +- try_next: +- ch = *(++ctrl); +- +- if (isdigit(ch)) { +- if (dot_flag) +- par.num2 = getnum(&ctrl); +- else { +- if (ch == '0') +- par.pad_character = '0'; +- +- par.num1 = getnum(&ctrl); +- par.do_padding = 1; +- } +- ctrl--; +- goto try_next; +- } +- +- switch (tolower(ch)) { +- case '%': +- outbyte( '%'); +- continue; +- +- case '-': +- par.left_flag = 1; +- break; +- +- case '.': +- dot_flag = 1; +- break; +- +- case 'l': +- long_flag = 1; +- break; +- +- case 'd': +- if (long_flag || ch == 'D') { +- outnum( va_arg(argp, long), 10L, &par); +- continue; +- } +- else { +- outnum( va_arg(argp, int), 10L, &par); +- continue; +- } +- case 'x': +- outnum((long)va_arg(argp, int), 16L, &par); +- continue; +- +- case 's': +- outs( va_arg( argp, charptr), &par); +- continue; +- +- case 'c': +- outbyte( va_arg( argp, int)); +- continue; +- +- case '\\': +- switch (*ctrl) { +- case 'a': +- outbyte( 0x07); +- break; +- case 'h': +- outbyte( 0x08); +- break; +- case 'r': +- outbyte( 0x0D); +- break; +- case 'n': +- outbyte( 0x0D); +- outbyte( 0x0A); +- break; +- default: +- outbyte( *ctrl); +- break; +- } +- ctrl++; +- break; +- +- default: +- continue; +- } +- goto try_next; +- } +- va_end( argp); +-} +- +-/*---------------------------------------------------*/ +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch new file mode 100644 index 000000000..6e32e1775 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch @@ -0,0 +1,25 @@ +From 96e6a596356fa605bbe00f7f69afb52f80329eb6 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Mon, 23 Jan 2017 15:44:17 +0530 +Subject: [PATCH 05/11] [Local]: deleting the xil_printf.o from MAKEFILE + +--- + libgloss/microblaze/Makefile.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libgloss/microblaze/Makefile.in b/libgloss/microblaze/Makefile.in +index fe04a08..32aafda 100644 +--- a/libgloss/microblaze/Makefile.in ++++ b/libgloss/microblaze/Makefile.in +@@ -81,7 +81,7 @@ GENOBJS = fstat.o getpid.o isatty.o kill.o lseek.o print.o putnum.o stat.o unlin + open.o close.o read.o write.o + OBJS = ${GENOBJS} sbrk.o timer.o _exception_handler.o _hw_exception_handler.o \ + _interrupt_handler.o _program_clean.o _program_init.o \ +- xil_malloc.o xil_sbrk.o xil_printf.o ++ xil_malloc.o xil_sbrk.o + SCRIPTS = xilinx.ld + + # Tiny Linux BSP. +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0006-MB-X-intial-commit.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0006-MB-X-intial-commit.patch new file mode 100644 index 000000000..18b78f090 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0006-MB-X-intial-commit.patch @@ -0,0 +1,194 @@ +From bb9e95aa1da6c1f8974702685db9b8486210ac5c Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Fri, 27 Jul 2018 16:10:36 +0530 +Subject: [PATCH 06/11] MB-X intial commit + +--- + libgloss/microblaze/crt0.S | 2 +- + libgloss/microblaze/crt1.S | 2 +- + libgloss/microblaze/crt2.S | 2 +- + libgloss/microblaze/crt3.S | 2 +- + libgloss/microblaze/crt4.S | 2 +- + libgloss/microblaze/crtinit.S | 4 ++-- + libgloss/microblaze/pgcrtinit.S | 4 ++-- + libgloss/microblaze/sim-crtinit.S | 4 ++-- + libgloss/microblaze/sim-pgcrtinit.S | 4 ++-- + newlib/libc/machine/microblaze/strcmp.c | 8 ++++---- + 10 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index b39ea90..865a8c2 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -84,7 +84,7 @@ _vector_hw_exception: + _start1: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index 20323ff..a8bf749 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -75,7 +75,7 @@ _vector_hw_exception: + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index e3fb15b..34d9f95 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -73,7 +73,7 @@ _vector_hw_exception: + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index 452ea52..ebcf207 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -59,7 +59,7 @@ + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 475acec..4cf0b01 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -59,7 +59,7 @@ + _start: + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-16 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crtinit.S b/libgloss/microblaze/crtinit.S +index 78eb76d..86c6dfc 100644 +--- a/libgloss/microblaze/crtinit.S ++++ b/libgloss/microblaze/crtinit.S +@@ -33,7 +33,7 @@ + .ent _crtinit + .type _crtinit, @function + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + addi r6, r0, __sbss_start /* clear SBSS */ +@@ -82,6 +82,6 @@ _crtinit: + + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/pgcrtinit.S b/libgloss/microblaze/pgcrtinit.S +index fca1bc4..2593082 100644 +--- a/libgloss/microblaze/pgcrtinit.S ++++ b/libgloss/microblaze/pgcrtinit.S +@@ -33,7 +33,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + addi r6, r0, __sbss_start /* clear SBSS */ +@@ -87,6 +87,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/sim-crtinit.S b/libgloss/microblaze/sim-crtinit.S +index d2f59fe..74586d9 100644 +--- a/libgloss/microblaze/sim-crtinit.S ++++ b/libgloss/microblaze/sim-crtinit.S +@@ -39,7 +39,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + brlid r15, _program_init /* Initialize the program */ +@@ -64,6 +64,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/libgloss/microblaze/sim-pgcrtinit.S b/libgloss/microblaze/sim-pgcrtinit.S +index 3c6ba83..82ebcca 100644 +--- a/libgloss/microblaze/sim-pgcrtinit.S ++++ b/libgloss/microblaze/sim-pgcrtinit.S +@@ -39,7 +39,7 @@ + .ent _crtinit + + _crtinit: +- addi r1, r1, -20 /* Save Link register */ ++ addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + + brlid r15, _program_init /* Initialize the program */ +@@ -67,6 +67,6 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + rtsd r15, 8 +- addi r1, r1, 20 ++ addi r1, r1, 40 + .end _crtinit + +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index 434195e..3119d82 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -96,15 +96,15 @@ strcmp (const char *s1, + + return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #else +- unsigned long *a1; +- unsigned long *a2; ++ unsigned int *a1; ++ unsigned int *a2; + + /* If s1 or s2 are unaligned, then compare bytes. */ + if (!UNALIGNED (s1, s2)) + { + /* If s1 and s2 are word-aligned, compare them a word at a time. */ +- a1 = (unsigned long*)s1; +- a2 = (unsigned long*)s2; ++ a1 = (unsigned int*)s1; ++ a2 = (unsigned int*)s2; + while (*a1 == *a2) + { + /* To get here, *a1 == *a2, thus if we find a null in *a1, +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch new file mode 100644 index 000000000..c62a9919a --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch @@ -0,0 +1,1137 @@ +From eab8d664224d134b2c4d638d9c6bebb84ae777ad Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Tue, 11 Sep 2018 14:32:20 +0530 +Subject: [PATCH 07/11] [Patch, Microblaze]: newlib port for microblaze m64 + flag... + +Conflicts: + libgloss/microblaze/_hw_exception_handler.S + libgloss/microblaze/_interrupt_handler.S +--- + libgloss/microblaze/_exception_handler.S | 6 +- + libgloss/microblaze/_hw_exception_handler.S | 7 +- + libgloss/microblaze/_interrupt_handler.S | 7 +- + libgloss/microblaze/_program_clean.S | 6 +- + libgloss/microblaze/_program_init.S | 6 +- + libgloss/microblaze/crt0.S | 53 ++++++++++-- + libgloss/microblaze/crt1.S | 54 +++++++++++-- + libgloss/microblaze/crt2.S | 52 ++++++++++-- + libgloss/microblaze/crt3.S | 32 +++++++- + libgloss/microblaze/crt4.S | 37 +++++++-- + libgloss/microblaze/crtinit.S | 120 ++++++++++++++++++++-------- + libgloss/microblaze/linux-crt0.S | 60 +++++++++++--- + libgloss/microblaze/linux-syscalls.S | 15 +++- + libgloss/microblaze/pgcrtinit.S | 59 +++++++++++++- + libgloss/microblaze/sim-crtinit.S | 31 +++++++ + libgloss/microblaze/sim-pgcrtinit.S | 31 +++++++ + newlib/libc/machine/microblaze/longjmp.S | 45 +++++++++-- + newlib/libc/machine/microblaze/setjmp.S | 33 +++++++- + 18 files changed, 563 insertions(+), 91 deletions(-) + +diff --git a/libgloss/microblaze/_exception_handler.S b/libgloss/microblaze/_exception_handler.S +index 7a91a78..0fdff3f 100644 +--- a/libgloss/microblaze/_exception_handler.S ++++ b/libgloss/microblaze/_exception_handler.S +@@ -30,7 +30,11 @@ + */ + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .weakext _exception_handler + .ent _exception_handler + .type _exception_handler, @function +diff --git a/libgloss/microblaze/_hw_exception_handler.S b/libgloss/microblaze/_hw_exception_handler.S +index 47df945..b951a63 100644 +--- a/libgloss/microblaze/_hw_exception_handler.S ++++ b/libgloss/microblaze/_hw_exception_handler.S +@@ -32,8 +32,11 @@ + .text + .weakext _hw_exception_handler # HW Exception Handler Label + .type _hw_exception_handler, %function +- .align 2 +- ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + _hw_exception_handler: + rted r17, 0 + nop +diff --git a/libgloss/microblaze/_interrupt_handler.S b/libgloss/microblaze/_interrupt_handler.S +index 5bb7329..a0ef92d 100644 +--- a/libgloss/microblaze/_interrupt_handler.S ++++ b/libgloss/microblaze/_interrupt_handler.S +@@ -32,8 +32,11 @@ + .text + .weakext _interrupt_handler # Interrupt Handler Label + .type _interrupt_handler, %function +- .align 2 +- ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + _interrupt_handler: + rtid r14, 0 + nop +diff --git a/libgloss/microblaze/_program_clean.S b/libgloss/microblaze/_program_clean.S +index c460594..0d55d8a 100644 +--- a/libgloss/microblaze/_program_clean.S ++++ b/libgloss/microblaze/_program_clean.S +@@ -33,7 +33,11 @@ + # + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .globl _program_clean + .ent _program_clean + _program_clean: +diff --git a/libgloss/microblaze/_program_init.S b/libgloss/microblaze/_program_init.S +index 0daa42e..862ef78 100644 +--- a/libgloss/microblaze/_program_init.S ++++ b/libgloss/microblaze/_program_init.S +@@ -32,7 +32,11 @@ + # Dummy file to be replaced by LibGen + + .text +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .globl _program_init + .ent _program_init + _program_init: +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index 865a8c2..e4df73b 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -54,7 +54,11 @@ + + .globl _start + .section .vectors.reset, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _start + .type _start, @function + _start: +@@ -62,36 +66,64 @@ _start: + .end _start + + .section .vectors.sw_exception, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start1 ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + .ent _start1 + .type _start1, @function + _start1: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 ++ brealid r15, _crtinit ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +- + brlid r15, _crtinit /* Initialize BSS and run program */ + nop + +- brlid r15, exit /* Call exit with the return value of main */ +- addik r5, r3, 0 +- ++ brlid r15, exit /* Call exit with the return value of main */ ++ addik r5, r3, 0 ++#endif + /* Control does not reach here */ + .end _start1 + +@@ -101,9 +133,18 @@ _start1: + Our simple _exit + */ + .globl _exit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif ++ + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index a8bf749..b24eeb5 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -53,36 +53,67 @@ + + + .section .vectors.sw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ +- la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brlid r15, _crtinit /* Initialize BSS and run program */ + nop + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + .end _start + +@@ -92,11 +123,18 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: ++#ifdef __arch64__ ++ addl r3, r0, r5 ++#else + add r3, r0, r5 ++#endif + brki r16, 0x4 /* Return to hook in XMDSTUB */ + .end _exit +- +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index 34d9f95..ae4c89e 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -51,26 +51,56 @@ + */ + + .section .vectors.sw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_sw_exception: + brai _exception_handler + + .section .vectors.interrupt, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_interrupt: + brai _interrupt_handler + + .section .vectors.hw_exception, "ax" +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + _vector_hw_exception: + brai _hw_exception_handler + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -80,7 +110,7 @@ _start: + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + + .end _start +@@ -90,9 +120,17 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index ebcf207..a8bc783 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -53,10 +53,26 @@ + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ ++ addlik r5, r3, 0 ++ brealid r15, exit /* Call exit with the return value of main */ ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -66,7 +82,7 @@ _start: + + brlid r15, exit /* Call exit with the return value of main */ + addik r5, r3, 0 +- ++#endif + /* Control does not reach here */ + .end _start + +@@ -76,9 +92,17 @@ _start: + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- bri 0 ++#ifdef __arch64__ ++ breai 0 ++#else ++ bri 0 ++#endif + .end _exit +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 4cf0b01..54ba473 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -53,10 +53,27 @@ + + .section .text + .globl _start +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif ++ + .ent _start + .type _start, @function + _start: ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ lli r2, r0, _SDA2_BASE_ ++ lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ ++ brealid r15, _crtinit /* Initialize BSS and run program */ ++ nop ++ ++ addlik r5, r3, 0 ++ brealid r15, exit /* Call exit with the return value of main */ ++ nop ++#else + la r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ + la r2, r0, _SDA2_BASE_ + la r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ +@@ -68,19 +85,27 @@ _start: + addik r5, r3, 0 + + /* Control does not reach here */ +- ++#endif + .end _start + +- + /* + _exit + Our simple _exit + */ + .globl _exit +- .align 2 ++#ifdef __arch64__ ++ .align 3 ++#else ++ .align 2 ++#endif + .ent _exit + .type _exit, @function + _exit: +- brlid r15,elf_process_exit +- nop ++#ifdef __arch64__ ++ brealid r15,elf_process_exit ++ nop ++#else ++ brlid r15,elf_process_exit ++ nop ++#endif + .end _exit +diff --git a/libgloss/microblaze/crtinit.S b/libgloss/microblaze/crtinit.S +index 86c6dfc..8541175 100644 +--- a/libgloss/microblaze/crtinit.S ++++ b/libgloss/microblaze/crtinit.S +@@ -29,59 +29,115 @@ + */ + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + .type _crtinit, @function + _crtinit: +- addi r1, r1, -40 /* Save Link register */ +- swi r15, r1, 0 ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 + +- addi r6, r0, __sbss_start /* clear SBSS */ +- addi r7, r0, __sbss_end +- rsub r18, r6, r7 +- blei r18, .Lendsbss ++ addli r6, r0, __sbss_start /* clear SBSS */ ++ addli r7, r0, __sbss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendsbss + + .Lloopsbss: +- swi r0, r6, 0 +- addi r6, r6, 4 +- rsub r18, r6, r7 +- bgti r18, .Lloopsbss ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopsbss + .Lendsbss: +- +- addi r6, r0, __bss_start /* clear BSS */ +- addi r7, r0, __bss_end +- rsub r18, r6, r7 +- blei r18, .Lendbss ++ addli r6, r0, __bss_start /* clear BSS */ ++ addli r7, r0, __bss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendbss + .Lloopbss: +- swi r0, r6, 0 +- addi r6, r6, 4 +- rsub r18, r6, r7 +- bgti r18, .Lloopbss ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopbss + .Lendbss: + +- brlid r15, _program_init /* Initialize the program */ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ + nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ++ ll r15, r1, r0 /* Return back to CRT */ ++ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else ++ addi r1, r1, -40 /* Save Link register */ ++ swi r15, r1, 0 ++ ++ addi r6, r0, __sbss_start /* clear SBSS */ ++ addi r7, r0, __sbss_end ++ rsub r18, r6, r7 ++ blei r18, .Lendsbss ++ ++.Lloopsbss: ++ swi r0, r6, 0 ++ addi r6, r6, 4 ++ rsub r18, r6, r7 ++ bgti r18, .Lloopsbss ++.Lendsbss: ++ ++ addi r6, r0, __bss_start /* clear BSS */ ++ addi r7, r0, __bss_end ++ rsub r18, r6, r7 ++ blei r18, .Lendbss ++.Lloopbss: ++ swi r0, r6, 0 ++ addi r6, r6, 4 ++ rsub r18, r6, r7 ++ bgti r18, .Lloopbss ++.Lendbss: ++ ++ brlid r15, _program_init /* Initialize the program */ ++ nop + + brlid r15, __init /* Invoke language initialization functions */ + nop +- +- addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ +- addi r7, r0, 0 +- brlid r15, main /* Execute the program */ +- addi r5, r0, 0 ++ ++ addi r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addi r7, r0, 0 ++ brlid r15, main /* Execute the program */ ++ addi r5, r0, 0 + + addik r19, r3, 0 /* Save return value */ +- ++ + brlid r15, __fini /* Invoke language cleanup functions */ + nop +- +- brlid r15, _program_clean /* Cleanup the program */ +- nop + +- lw r15, r1, r0 /* Return back to CRT */ ++ brlid r15, _program_clean /* Cleanup the program */ ++ nop ++ ++ lw r15, r1, r0 /* Return back to CRT */ + + addik r3, r19, 0 /* Restore return value */ +- rtsd r15, 8 +- addi r1, r1, 40 ++ rtsd r15, 8 ++ addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/linux-crt0.S b/libgloss/microblaze/linux-crt0.S +index 8650bb5..503439b 100644 +--- a/libgloss/microblaze/linux-crt0.S ++++ b/libgloss/microblaze/linux-crt0.S +@@ -18,26 +18,50 @@ + .ent _start + .type _start, @function + _start: +- la r13, r0, _SDA_BASE_ +- la r2, r0, _SDA2_BASE_ ++#ifdef __arch64__ ++ lli r13, r0, _SDA_BASE_ ++ lli r2, r0, _SDA2_BASE_ + +- brlid r15, __init ++ brealid r15, __init + nop + +- lwi r5, r1, 0 +- addik r6, r1, 4 ++ lli r5, r1, 0 ++ addlik r6, r1, 4 + + # Add argc * 4. +- addk r7, r5, r5 +- addk r7, r7, r7 ++ addlk r7, r5, r5 ++ addlk r7, r7, r7 + +- brlid r15, main + # Now add 4 + r1 (i.e r6) in the delayslot. +- addk r7, r7, r6 ++ addlk r7, r7, r6 ++ brealid r15, main ++ nop ++ addlik r5, r3, 0 ++ brealid r15, exit ++ nop ++ .size _start, . - _start ++#else ++ la r13, r0, _SDA_BASE_ ++ la r2, r0, _SDA2_BASE_ ++ ++ brlid r15, __init ++ nop ++ ++ lwi r5, r1, 0 ++ addik r6, r1, 4 + +- brlid r15, exit ++ # Add argc * 4. ++ addk r7, r5, r5 ++ addk r7, r7, r7 ++ ++ brlid r15, main ++ # Now add 4 + r1 (i.e r6) in the delayslot. ++ addk r7, r7, r6 ++ ++ brlid r15, exit + addik r5, r3, 0 +- .size _start, . - _start ++ .size _start, . - _start ++#endif + .end _start + + /* Replacement for the GCC provided crti.S. This one avoids the +@@ -45,14 +69,28 @@ _start: + insn exceptions when running in user-space). */ + .section .init, "ax" + .global __init ++#ifdef __arch64__ ++ .align 3 ++__init: ++ addlik r1, r1, -8 ++ sl r15, r0, r1 ++#else + .align 2 + __init: + addik r1, r1, -8 + sw r15, r0, r1 + ++#endif + .section .fini, "ax" + .global __fini ++#ifdef __arch64__ ++ .align 3 ++__fini: ++ addlik r1, r1, -8 ++ sl r15, r0, r1 ++#else + .align 2 + __fini: + addik r1, r1, -8 + sw r15, r0, r1 ++#endif +diff --git a/libgloss/microblaze/linux-syscalls.S b/libgloss/microblaze/linux-syscalls.S +index 506de78..8594f13 100644 +--- a/libgloss/microblaze/linux-syscalls.S ++++ b/libgloss/microblaze/linux-syscalls.S +@@ -20,8 +20,9 @@ + #define GLOBAL(name) .global name; FUNC(name) + #define SIZE(name) .size name, .-name + ++#ifdef __arch64__ + # define SYSCALL_BODY(name) \ +- addik r12, r0, SYS_ ## name; \ ++ addlik r12, r0, SYS_ ## name; \ + brki r14, 8; \ + rtsd r15, 8; \ + nop; +@@ -31,6 +32,18 @@ + SYSCALL_BODY(name); \ + SIZE(_ ## name) + ++#else ++# define SYSCALL_BODY(name) \ ++ addik r12, r0, SYS_ ## name; \ ++ brki r14, 8; \ ++ rtsd r15, 8; \ ++ nop; ++ ++# define SYSCALL(name) \ ++ GLOBAL(_ ## name); \ ++ SYSCALL_BODY(name); \ ++ SIZE(_ ## name) ++#endif + SYSCALL(brk) + SYSCALL(exit) + SYSCALL(read) +diff --git a/libgloss/microblaze/pgcrtinit.S b/libgloss/microblaze/pgcrtinit.S +index 2593082..638dbd3 100644 +--- a/libgloss/microblaze/pgcrtinit.S ++++ b/libgloss/microblaze/pgcrtinit.S +@@ -29,10 +29,66 @@ + + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ addli r6, r0, __sbss_start /* clear SBSS */ ++ addli r7, r0, __sbss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendsbss ++.Lloopsbss: ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopsbss ++.Lendsbss: ++ ++ addli r6, r0, __bss_start /* clear BSS */ ++ addli r7, r0, __bss_end ++ rsubl r18, r6, r7 ++ bealei r18, .Lendbss ++.Lloopbss: ++ sli r0, r6, 0 ++ addli r6, r6, 4 ++ rsubl r18, r6, r7 ++ beagti r18, .Lloopbss ++.Lendbss: ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, _profile_init /* Initialize profiling library */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _profile_clean /* Cleanup profiling library */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -86,7 +142,8 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ +- rtsd r15, 8 ++ rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/sim-crtinit.S b/libgloss/microblaze/sim-crtinit.S +index 74586d9..9892cb0 100644 +--- a/libgloss/microblaze/sim-crtinit.S ++++ b/libgloss/microblaze/sim-crtinit.S +@@ -35,10 +35,39 @@ + # + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ addlik r19, r3, 0 /* Save return value */ ++ ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addlik r3, r19, 0 /* Restore return value */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -63,7 +92,9 @@ _crtinit: + + lw r15, r1, r0 /* Return back to CRT */ + addik r3, r19, 0 /* Restore return value */ ++ + rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/libgloss/microblaze/sim-pgcrtinit.S b/libgloss/microblaze/sim-pgcrtinit.S +index 82ebcca..939f537 100644 +--- a/libgloss/microblaze/sim-pgcrtinit.S ++++ b/libgloss/microblaze/sim-pgcrtinit.S +@@ -35,10 +35,40 @@ + # + + .globl _crtinit ++#ifdef __arch64__ ++ .align 3 ++#else + .align 2 ++#endif + .ent _crtinit + + _crtinit: ++#ifdef __arch64__ ++ addli r1, r1, -40 /* Save Link register */ ++ sli r15, r1, 0 ++ ++ brealid r15, _program_init /* Initialize the program */ ++ nop ++ brealid r15, _profile_init /* Initialize profiling library */ ++ nop ++ brealid r15, __init /* Invoke language initialization functions */ ++ nop ++ addli r6, r0, 0 /* Initialize argc = 1 and argv = NULL and envp = NULL */ ++ addli r7, r0, 0 ++ addli r5, r0, 0 ++ brealid r15, main /* Execute the program */ ++ nop ++ brealid r15, __fini /* Invoke language cleanup functions */ ++ nop ++ brealid r15, _profile_clean /* Cleanup profiling library */ ++ nop ++ brealid r15, _program_clean /* Cleanup the program */ ++ nop ++ ll r15, r1, r0 /* Return back to CRT */ ++ addli r1, r1, 40 ++ rtsd r15, 8 ++ nop ++#else + addi r1, r1, -40 /* Save Link register */ + swi r15, r1, 0 + +@@ -68,5 +98,6 @@ _crtinit: + lw r15, r1, r0 /* Return back to CRT */ + rtsd r15, 8 + addi r1, r1, 40 ++#endif + .end _crtinit + +diff --git a/newlib/libc/machine/microblaze/longjmp.S b/newlib/libc/machine/microblaze/longjmp.S +index f972bbd..5ed1c26 100644 +--- a/newlib/libc/machine/microblaze/longjmp.S ++++ b/newlib/libc/machine/microblaze/longjmp.S +@@ -51,16 +51,46 @@ + + .globl longjmp + .section .text +-.align 2 ++#ifdef __arch64__ ++.align 3 ++#else ++.align 2 ++#endif + .ent longjmp + longjmp: ++#ifdef __arch64__ ++ lli r1, r5, 0 ++ lli r13, r5, 4 ++ lli r14, r5, 8 ++ lli r15, r5, 12 ++ lli r16, r5, 16 ++ lli r17, r5, 20 ++ lli r18, r5, 24 ++ lli r19, r5, 28 ++ lli r20, r5, 32 ++ lli r21, r5, 36 ++ lli r22, r5, 40 ++ lli r23, r5, 44 ++ lli r24, r5, 48 ++ lli r25, r5, 52 ++ lli r26, r5, 56 ++ lli r27, r5, 60 ++ lli r28, r5, 64 ++ lli r29, r5, 68 ++ lli r30, r5, 72 ++ lli r31, r5, 76 ++ ++ or r3, r0, r6 ++ rtsd r15, 8 ++ nop ++#else + lwi r1, r5, 0 + lwi r13, r5, 4 + lwi r14, r5, 8 +- lwi r15, r5, 12 ++ lwi r15, r5, 12 + lwi r16, r5, 16 + lwi r17, r5, 20 +- lwi r18, r5, 24 ++ lwi r18, r5, 24 + lwi r19, r5, 28 + lwi r20, r5, 32 + lwi r21, r5, 36 +@@ -69,12 +99,13 @@ longjmp: + lwi r24, r5, 48 + lwi r25, r5, 52 + lwi r26, r5, 56 +- lwi r27, r5, 60 +- lwi r28, r5, 64 +- lwi r29, r5, 68 ++ lwi r27, r5, 60 ++ lwi r28, r5, 64 ++ lwi r29, r5, 68 + lwi r30, r5, 72 +- lwi r31, r5, 76 ++ lwi r31, r5, 76 + + rtsd r15, 8 + or r3, r0, r6 ++#endif + .end longjmp +diff --git a/newlib/libc/machine/microblaze/setjmp.S b/newlib/libc/machine/microblaze/setjmp.S +index cdd87c7..971862b 100644 +--- a/newlib/libc/machine/microblaze/setjmp.S ++++ b/newlib/libc/machine/microblaze/setjmp.S +@@ -50,9 +50,39 @@ + + .globl setjmp + .section .text +-.align 2 ++#ifdef __arch64__ ++.align 3 ++#else ++.align 2 ++#endif + .ent setjmp + setjmp: ++#ifdef __arch64__ ++ sli r1, r5, 0 ++ sli r13, r5, 4 ++ sli r14, r5, 8 ++ sli r15, r5, 12 ++ sli r16, r5, 16 ++ sli r17, r5, 20 ++ sli r18, r5, 24 ++ sli r19, r5, 28 ++ sli r20, r5, 32 ++ sli r21, r5, 36 ++ sli r22, r5, 40 ++ sli r23, r5, 44 ++ sli r24, r5, 48 ++ sli r25, r5, 52 ++ sli r26, r5, 56 ++ sli r27, r5, 60 ++ sli r28, r5, 64 ++ sli r29, r5, 68 ++ sli r30, r5, 72 ++ sli r31, r5, 76 ++ ++ or r3, r0, r0 ++ rtsd r15, 8 ++ nop ++#else + swi r1, r5, 0 + swi r13, r5, 4 + swi r14, r5, 8 +@@ -76,4 +106,5 @@ setjmp: + + rtsd r15, 8 + or r3, r0, r0 ++#endif + .end setjmp +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch new file mode 100644 index 000000000..9f27cd60c --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch @@ -0,0 +1,102 @@ +From 1c7a9150b63089baf3f63c64bf3dbb4d73c814f5 Mon Sep 17 00:00:00 2001 +From: Nagaraju Mekala <nmekala@xilix.com> +Date: Fri, 28 Sep 2018 12:07:43 +0530 +Subject: [PATCH 08/11] fixing the bug in crt files, added addlik instead of + lli insn + +--- + libgloss/microblaze/crt0.S | 6 +++--- + libgloss/microblaze/crt1.S | 6 +++--- + libgloss/microblaze/crt2.S | 6 +++--- + libgloss/microblaze/crt3.S | 6 +++--- + libgloss/microblaze/crt4.S | 6 +++--- + 5 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/libgloss/microblaze/crt0.S b/libgloss/microblaze/crt0.S +index e4df73b..25e7c4a 100644 +--- a/libgloss/microblaze/crt0.S ++++ b/libgloss/microblaze/crt0.S +@@ -106,9 +106,9 @@ _vector_hw_exception: + .type _start1, @function + _start1: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 ++ addlik r13, r0, _SDA_BASE_ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 + brealid r15, _crtinit + nop + addlik r5, r3, 0 +diff --git a/libgloss/microblaze/crt1.S b/libgloss/microblaze/crt1.S +index b24eeb5..38440c9 100644 +--- a/libgloss/microblaze/crt1.S ++++ b/libgloss/microblaze/crt1.S +@@ -94,9 +94,9 @@ _vector_hw_exception: + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt2.S b/libgloss/microblaze/crt2.S +index ae4c89e..352927d 100644 +--- a/libgloss/microblaze/crt2.S ++++ b/libgloss/microblaze/crt2.S +@@ -92,9 +92,9 @@ _vector_hw_exception: + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + brealid r15, _crtinit /* Initialize BSS and run program */ + nop + addlik r5, r3, 0 +diff --git a/libgloss/microblaze/crt3.S b/libgloss/microblaze/crt3.S +index a8bc783..bc32cda 100644 +--- a/libgloss/microblaze/crt3.S ++++ b/libgloss/microblaze/crt3.S +@@ -62,9 +62,9 @@ + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +diff --git a/libgloss/microblaze/crt4.S b/libgloss/microblaze/crt4.S +index 54ba473..a25c847 100644 +--- a/libgloss/microblaze/crt4.S ++++ b/libgloss/microblaze/crt4.S +@@ -63,9 +63,9 @@ + .type _start, @function + _start: + #ifdef __arch64__ +- lli r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ +- lli r2, r0, _SDA2_BASE_ +- lli r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ ++ addlik r13, r0, _SDA_BASE_ /* Set the Small Data Anchors and the stack pointer */ ++ addlik r2, r0, _SDA2_BASE_ ++ addlik r1, r0, _stack-32 /* 16 bytes (4 words are needed by crtinit for args and link reg */ + + brealid r15, _crtinit /* Initialize BSS and run program */ + nop +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0009-Added-MB-64-support-to-strcmp-strcpy-strlen-files.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0009-Added-MB-64-support-to-strcmp-strcpy-strlen-files.patch new file mode 100644 index 000000000..38508b550 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0009-Added-MB-64-support-to-strcmp-strcpy-strlen-files.patch @@ -0,0 +1,227 @@ +From 19d7b2a34f3c69d62f570ac9d0f6bc3cd584b496 Mon Sep 17 00:00:00 2001 +From: Nagaraju <nmekala@xilinx.com> +Date: Thu, 14 Mar 2019 18:16:32 +0530 +Subject: [PATCH 09/11] Added MB-64 support to strcmp/strcpy/strlen files + +--- + newlib/libc/machine/microblaze/strcmp.c | 61 ++++++++++++++++++++++++++++++++- + newlib/libc/machine/microblaze/strcpy.c | 57 ++++++++++++++++++++++++++++++ + newlib/libc/machine/microblaze/strlen.c | 38 ++++++++++++++++++++ + 3 files changed, 155 insertions(+), 1 deletion(-) + +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index 3119d82..dac64da 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -133,6 +133,65 @@ strcmp (const char *s1, + + #include "mb_endian.h" + ++#ifdef __arch64__ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */\n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ andli r4, r6, 3 \n\ ++ beanei r3, try_align_args \n\ ++ beanei r4, regular_strcmp /* At this point we don't have a choice */ \n\ ++cmp_loop: \n" ++ LOAD4BYTES("r3", "r5", "r9") ++ LOAD4BYTES("r4", "r6", "r9") ++" \n\ ++ pcmplbf r7, r3, r0 /* See if there is Null byte */ \n\ ++ beanei r7, end_cmp_loop /* IF yes (r7 > 0) use byte compares in end_cmp_loop */ \n\ ++ cmplu r7, r4, r3 /* ELSE compare whole word */ \n\ ++ beanei r7, end_cmp \n\ ++ addlik r9, r9, 4 /* delay slot */ \n\ ++ breaid cmp_loop \n\ ++ nop /* delay slot */ \n\ ++end_cmp_loop: \n\ ++ lbu r3, r5, r9 /* byte compare loop */ \n\ ++ lbu r4, r6, r9 \n\ ++ cmplu r7, r4, r3 /* Compare bytes */ \n\ ++ beanei r7, end_cmp_early \n\ ++ addlik r9, r9, 1 /* delay slot */ \n\ ++ beaneid r3, end_cmp_loop /* If reached null on one string, terminate */ \n\ ++ nop \n\ ++end_cmp_early: \n\ ++ or r3, r0, r7 /* delay slot */ \n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++try_align_args: \n\ ++ xorl r7, r4, r3 \n\ ++ beanei r7, regular_strcmp /* cannot align args */ \n\ ++ rsublik r10, r3, 4 /* Number of initial bytes to align */ \n\ ++align_loop: \n\ ++ lbu r3, r5, r9 \n\ ++ lbu r4, r6, r9 \n\ ++ cmpu r7, r4, r3 \n\ ++ beanei r7, end_cmp \n\ ++ beaeqi r3, end_cmp \n\ ++ addlik r10, r10, -1 \n\ ++ addlik r9, r9, 1 \n\ ++ beaeqid r10, cmp_loop \n\ ++ nop \n\ ++ breai align_loop \n\ ++regular_strcmp: \n\ ++ lbu r3, r5, r9 \n\ ++ lbu r4, r6, r9 \n\ ++ cmplu r7, r4, r3 \n\ ++ beanei r7, end_cmp \n\ ++ beaeqi r3, end_cmp \n\ ++ breaid regular_strcmp \n\ ++ addlik r9, r9, 1 \n\ ++end_cmp: \n\ ++ or r3, r0, r7 \n\ ++ rtsd r15, 8 \n\ ++ nop /* Return strcmp result */"); ++#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */\n\ + check_alignment: \n\ +@@ -181,11 +240,11 @@ regular_strcmp: + bnei r7, end_cmp \n\ + beqi r3, end_cmp \n\ + brid regular_strcmp \n\ +- addik r9, r9, 1 \n\ + end_cmp: \n\ + rtsd r15, 8 \n\ + or r3, r0, r7 /* Return strcmp result */"); + ++#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c +index 62072fa..6dbc60d 100644 +--- a/newlib/libc/machine/microblaze/strcpy.c ++++ b/newlib/libc/machine/microblaze/strcpy.c +@@ -125,6 +125,62 @@ strcpy (char *__restrict dst0, + #else + + #include "mb_endian.h" ++#ifdef __arch64__ ++ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */ \n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ andli r4, r6, 3 \n\ ++ beanei r3, try_align_args \n\ ++ beanei r4, regular_strcpy /* At this point we dont have a choice */ \n\ ++cpy_loop: \n" ++ LOAD4BYTES("r3", "r6", "r9") ++" \n\ ++ pcmplbf r4, r0, r3 \n\ ++ beanei r4, cpy_bytes /* If r4 != 0, then null present within string */\n" ++ STORE4BYTES("r3", "r5", "r9") ++" \n\ ++ addlik r9, r9, 4 \n\ ++ breaid cpy_loop \n\ ++ nop \n\ ++cpy_bytes: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r4, r4, -1 \n\ ++ addlik r9, r9, 1 /* delay slot */\n\ ++ beaneid r4, cpy_bytes \n\ ++ nop \n\ ++cpy_null: \n\ ++ orl r3, r0, r5 /* Return strcpy result */\n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++try_align_args: \n\ ++ xorl r7, r4, r3 \n\ ++ beanei r7, regular_strcpy /* cannot align args */\n\ ++ rsublik r10, r3, 4 /* Number of initial bytes to align */\n\ ++align_loop: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r10, r10, -1 \n\ ++ beaeqid r3, end_cpy /* Break if we have seen null character */\n\ ++ nop \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r10, align_loop \n\ ++ nop \n\ ++ breai cpy_loop \n\ ++regular_strcpy: \n\ ++ lbu r3, r6, r9 \n\ ++ sb r3, r5, r9 \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r3, regular_strcpy \n\ ++ nop \n\ ++end_cpy: \n\ ++ orl r3, r0, r5 \n\ ++ rtsd r15, 8 \n\ ++ nop /* Return strcpy result */"); ++ ++#else + + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ +@@ -171,6 +227,7 @@ regular_strcpy: \n\ + end_cpy: \n\ + rtsd r15, 8 \n\ + or r3, r0, r5 /* Return strcpy result */"); ++#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c +index acb4464..c04fa4f 100644 +--- a/newlib/libc/machine/microblaze/strlen.c ++++ b/newlib/libc/machine/microblaze/strlen.c +@@ -116,6 +116,43 @@ strlen (const char *str) + + #include "mb_endian.h" + ++#ifdef __arch64__ ++ asm volatile (" \n\ ++ orl r9, r0, r0 /* Index register */ \n\ ++check_alignment: \n\ ++ andli r3, r5, 3 \n\ ++ beanei r3, align_arg \n\ ++len_loop: \n" ++ LOAD4BYTES("r3", "r5", "r9") ++" \n\ ++ pcmplbf r4, r3, r0 \n\ ++ beanei r4, end_len \n\ ++ addik r9, r9, 4 \n\ ++ breaid len_loop \n\ ++ nop \n\ ++end_len: \n\ ++ lbu r3, r5, r9 \n\ ++ beaeqi r3, done_len \n\ ++ addik r9, r9, 1 \n\ ++ breaid end_len \n\ ++ nop \n\ ++done_len: \n\ ++ orl r3, r0, r9 /* Return len */ \n\ ++ rtsd r15, 8 \n\ ++ nop \n\ ++align_arg: \n\ ++ rsublik r10, r3, 4 \n\ ++align_loop: \n\ ++ lbu r3, r5, r9 \n\ ++ addlik r10, r10, -1 \n\ ++ beaeqid r3, done_len \n\ ++ nop \n\ ++ addlik r9, r9, 1 \n\ ++ beaneid r10, align_loop \n\ ++ nop \n\ ++ breai len_loop"); ++ ++#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -146,5 +183,6 @@ align_loop: \n\ + addik r9, r9, 1 \n\ + bri len_loop"); + ++#endif + #endif /* ! HAVE_HW_PCMP */ + } +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0010-Patch-MicroBlaze-typos-in-string-functions-microblaz.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0010-Patch-MicroBlaze-typos-in-string-functions-microblaz.patch new file mode 100644 index 000000000..d1f19a74f --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0010-Patch-MicroBlaze-typos-in-string-functions-microblaz.patch @@ -0,0 +1,87 @@ +From 70281e45fa433ec854f60b43fef019ebc8ca0649 Mon Sep 17 00:00:00 2001 +From: Mahesh Bodapati <mbodapat@xilinx.com> +Date: Wed, 3 Apr 2019 11:52:50 +0530 +Subject: [PATCH 10/11] [Patch,MicroBlaze] : typos in string functions + microblaze 64 bit port.fixed the issues. + +--- + newlib/libc/machine/microblaze/strcmp.c | 12 +++++++----- + newlib/libc/machine/microblaze/strlen.c | 4 ++-- + 2 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index dac64da..acfe4cd 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -135,7 +135,7 @@ strcmp (const char *s1, + + #ifdef __arch64__ + asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */\n\ ++ orl r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ + andli r3, r5, 3 \n\ + andli r4, r6, 3 \n\ +@@ -161,7 +161,7 @@ end_cmp_loop: + beaneid r3, end_cmp_loop /* If reached null on one string, terminate */ \n\ + nop \n\ + end_cmp_early: \n\ +- or r3, r0, r7 /* delay slot */ \n\ ++ orl r3, r0, r7 /* delay slot */ \n\ + rtsd r15, 8 \n\ + nop \n\ + try_align_args: \n\ +@@ -171,7 +171,7 @@ try_align_args: + align_loop: \n\ + lbu r3, r5, r9 \n\ + lbu r4, r6, r9 \n\ +- cmpu r7, r4, r3 \n\ ++ cmplu r7, r4, r3 \n\ + beanei r7, end_cmp \n\ + beaeqi r3, end_cmp \n\ + addlik r10, r10, -1 \n\ +@@ -185,10 +185,11 @@ regular_strcmp: + cmplu r7, r4, r3 \n\ + beanei r7, end_cmp \n\ + beaeqi r3, end_cmp \n\ +- breaid regular_strcmp \n\ + addlik r9, r9, 1 \n\ ++ breaid regular_strcmp \n\ ++ nop \n\ + end_cmp: \n\ +- or r3, r0, r7 \n\ ++ orl r3, r0, r7 \n\ + rtsd r15, 8 \n\ + nop /* Return strcmp result */"); + #else +@@ -240,6 +241,7 @@ regular_strcmp: + bnei r7, end_cmp \n\ + beqi r3, end_cmp \n\ + brid regular_strcmp \n\ ++ addik r9, r9, 1 \n\ + end_cmp: \n\ + rtsd r15, 8 \n\ + or r3, r0, r7 /* Return strcmp result */"); +diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c +index c04fa4f..b6f2d3c 100644 +--- a/newlib/libc/machine/microblaze/strlen.c ++++ b/newlib/libc/machine/microblaze/strlen.c +@@ -127,13 +127,13 @@ len_loop: \n" + " \n\ + pcmplbf r4, r3, r0 \n\ + beanei r4, end_len \n\ +- addik r9, r9, 4 \n\ ++ addlik r9, r9, 4 \n\ + breaid len_loop \n\ + nop \n\ + end_len: \n\ + lbu r3, r5, r9 \n\ + beaeqi r3, done_len \n\ +- addik r9, r9, 1 \n\ ++ addlik r9, r9, 1 \n\ + breaid end_len \n\ + nop \n\ + done_len: \n\ +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0011-Removing-the-Assembly-implementation-of-64bit-string.patch b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0011-Removing-the-Assembly-implementation-of-64bit-string.patch new file mode 100644 index 000000000..c8d13af00 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/files/0011-Removing-the-Assembly-implementation-of-64bit-string.patch @@ -0,0 +1,332 @@ +From b35b582ef3f6575447097585174302fde1761078 Mon Sep 17 00:00:00 2001 +From: Nagaraju <nmekala@xilinx.com> +Date: Wed, 24 Apr 2019 23:29:21 +0530 +Subject: [PATCH 11/11] Removing the Assembly implementation of 64bit string + function. Revisit in next release and fix it + +--- + newlib/libc/machine/microblaze/mb_endian.h | 4 ++ + newlib/libc/machine/microblaze/strcmp.c | 93 ++++++++++-------------------- + newlib/libc/machine/microblaze/strcpy.c | 82 ++++++++------------------ + newlib/libc/machine/microblaze/strlen.c | 59 +++++++------------ + 4 files changed, 81 insertions(+), 157 deletions(-) + +diff --git a/newlib/libc/machine/microblaze/mb_endian.h b/newlib/libc/machine/microblaze/mb_endian.h +index fb217ec..17772c8 100644 +--- a/newlib/libc/machine/microblaze/mb_endian.h ++++ b/newlib/libc/machine/microblaze/mb_endian.h +@@ -8,8 +8,12 @@ + #ifdef __LITTLE_ENDIAN__ + #define LOAD4BYTES(rD,rA,rB) "\tlwr\t" rD ", " rA ", " rB "\n" + #define STORE4BYTES(rD,rA,rB) "\tswr\t" rD ", " rA ", " rB "\n" ++#define LOAD8BYTES(rD,rA,rB) "\tllr\t" rD ", " rA ", " rB "\n" ++#define STORE8BYTES(rD,rA,rB) "\tslr\t" rD ", " rA ", " rB "\n" + #else + #define LOAD4BYTES(rD,rA,rB) "\tlw\t" rD ", " rA ", " rB "\n" + #define STORE4BYTES(rD,rA,rB) "\tsw\t" rD ", " rA ", " rB "\n" ++#define LOAD8BYTES(rD,rA,rB) "\tll\t" rD ", " rA ", " rB "\n" ++#define STORE8BYTES(rD,rA,rB) "\tsl\t" rD ", " rA ", " rB "\n" + #endif + #endif +diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c +index acfe4cd..e34c64a 100644 +--- a/newlib/libc/machine/microblaze/strcmp.c ++++ b/newlib/libc/machine/microblaze/strcmp.c +@@ -129,70 +129,42 @@ strcmp (const char *s1, + return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #endif /* not PREFER_SIZE_OVER_SPEED */ + ++#elif __arch64__ ++ unsigned int *a1; ++ unsigned int *a2; ++ ++ /* If s1 or s2 are unaligned, then compare bytes. */ ++ if (!UNALIGNED (s1, s2)) ++ { ++ /* If s1 and s2 are word-aligned, compare them a word at a time. */ ++ a1 = (unsigned int*)s1; ++ a2 = (unsigned int*)s2; ++ while (*a1 == *a2) ++ { ++ /* To get here, *a1 == *a2, thus if we find a null in *a1, ++ then the strings must be equal, so return zero. */ ++ if (DETECTNULL (*a1)) ++ return 0; ++ ++ a1++; ++ a2++; ++ } ++ ++ /* A difference was detected in last few bytes of s1, so search bytewise */ ++ s1 = (char*)a1; ++ s2 = (char*)a2; ++ } ++ ++ while (*s1 != '\0' && *s1 == *s2) ++ { ++ s1++; ++ s2++; ++ } ++ return (*(unsigned char *) s1) - (*(unsigned char *) s2); + #else + + #include "mb_endian.h" + +-#ifdef __arch64__ +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- andli r4, r6, 3 \n\ +- beanei r3, try_align_args \n\ +- beanei r4, regular_strcmp /* At this point we don't have a choice */ \n\ +-cmp_loop: \n" +- LOAD4BYTES("r3", "r5", "r9") +- LOAD4BYTES("r4", "r6", "r9") +-" \n\ +- pcmplbf r7, r3, r0 /* See if there is Null byte */ \n\ +- beanei r7, end_cmp_loop /* IF yes (r7 > 0) use byte compares in end_cmp_loop */ \n\ +- cmplu r7, r4, r3 /* ELSE compare whole word */ \n\ +- beanei r7, end_cmp \n\ +- addlik r9, r9, 4 /* delay slot */ \n\ +- breaid cmp_loop \n\ +- nop /* delay slot */ \n\ +-end_cmp_loop: \n\ +- lbu r3, r5, r9 /* byte compare loop */ \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 /* Compare bytes */ \n\ +- beanei r7, end_cmp_early \n\ +- addlik r9, r9, 1 /* delay slot */ \n\ +- beaneid r3, end_cmp_loop /* If reached null on one string, terminate */ \n\ +- nop \n\ +-end_cmp_early: \n\ +- orl r3, r0, r7 /* delay slot */ \n\ +- rtsd r15, 8 \n\ +- nop \n\ +-try_align_args: \n\ +- xorl r7, r4, r3 \n\ +- beanei r7, regular_strcmp /* cannot align args */ \n\ +- rsublik r10, r3, 4 /* Number of initial bytes to align */ \n\ +-align_loop: \n\ +- lbu r3, r5, r9 \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 \n\ +- beanei r7, end_cmp \n\ +- beaeqi r3, end_cmp \n\ +- addlik r10, r10, -1 \n\ +- addlik r9, r9, 1 \n\ +- beaeqid r10, cmp_loop \n\ +- nop \n\ +- breai align_loop \n\ +-regular_strcmp: \n\ +- lbu r3, r5, r9 \n\ +- lbu r4, r6, r9 \n\ +- cmplu r7, r4, r3 \n\ +- beanei r7, end_cmp \n\ +- beaeqi r3, end_cmp \n\ +- addlik r9, r9, 1 \n\ +- breaid regular_strcmp \n\ +- nop \n\ +-end_cmp: \n\ +- orl r3, r0, r7 \n\ +- rtsd r15, 8 \n\ +- nop /* Return strcmp result */"); +-#else + asm volatile (" \n\ + or r9, r0, r0 /* Index register */\n\ + check_alignment: \n\ +@@ -246,7 +218,6 @@ end_cmp: + rtsd r15, 8 \n\ + or r3, r0, r7 /* Return strcmp result */"); + +-#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c +index 6dbc60d..ddb6922 100644 +--- a/newlib/libc/machine/microblaze/strcpy.c ++++ b/newlib/libc/machine/microblaze/strcpy.c +@@ -121,67 +121,36 @@ strcpy (char *__restrict dst0, + ; + return dst0; + #endif /* not PREFER_SIZE_OVER_SPEED */ ++#elif __arch64__ ++ char *dst = dst0; ++ const char *src = src0; ++ long *aligned_dst; ++ const long *aligned_src; + +-#else ++ /* If SRC or DEST is unaligned, then copy bytes. */ ++ if (!UNALIGNED (src, dst)) ++ { ++ aligned_dst = (long*)dst; ++ aligned_src = (long*)src; + +-#include "mb_endian.h" +-#ifdef __arch64__ ++ /* SRC and DEST are both "long int" aligned, try to do "long int" ++ sized copies. */ ++ while (!DETECTNULL(*aligned_src)) ++ { ++ *aligned_dst++ = *aligned_src++; ++ } + +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- andli r4, r6, 3 \n\ +- beanei r3, try_align_args \n\ +- beanei r4, regular_strcpy /* At this point we dont have a choice */ \n\ +-cpy_loop: \n" +- LOAD4BYTES("r3", "r6", "r9") +-" \n\ +- pcmplbf r4, r0, r3 \n\ +- beanei r4, cpy_bytes /* If r4 != 0, then null present within string */\n" +- STORE4BYTES("r3", "r5", "r9") +-" \n\ +- addlik r9, r9, 4 \n\ +- breaid cpy_loop \n\ +- nop \n\ +-cpy_bytes: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r4, r4, -1 \n\ +- addlik r9, r9, 1 /* delay slot */\n\ +- beaneid r4, cpy_bytes \n\ +- nop \n\ +-cpy_null: \n\ +- orl r3, r0, r5 /* Return strcpy result */\n\ +- rtsd r15, 8 \n\ +- nop \n\ +-try_align_args: \n\ +- xorl r7, r4, r3 \n\ +- beanei r7, regular_strcpy /* cannot align args */\n\ +- rsublik r10, r3, 4 /* Number of initial bytes to align */\n\ +-align_loop: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r10, r10, -1 \n\ +- beaeqid r3, end_cpy /* Break if we have seen null character */\n\ +- nop \n\ +- addlik r9, r9, 1 \n\ +- beaneid r10, align_loop \n\ +- nop \n\ +- breai cpy_loop \n\ +-regular_strcpy: \n\ +- lbu r3, r6, r9 \n\ +- sb r3, r5, r9 \n\ +- addlik r9, r9, 1 \n\ +- beaneid r3, regular_strcpy \n\ +- nop \n\ +-end_cpy: \n\ +- orl r3, r0, r5 \n\ +- rtsd r15, 8 \n\ +- nop /* Return strcpy result */"); ++ dst = (char*)aligned_dst; ++ src = (char*)aligned_src; ++ } + +-#else ++ while (*dst++ = *src++) ++ ; ++ return dst0; ++ ++#else + ++#include "mb_endian.h" + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -227,7 +196,6 @@ regular_strcpy: \n\ + end_cpy: \n\ + rtsd r15, 8 \n\ + or r3, r0, r5 /* Return strcpy result */"); +-#endif + #endif /* ! HAVE_HW_PCMP */ + } + +diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c +index b6f2d3c..9407539 100644 +--- a/newlib/libc/machine/microblaze/strlen.c ++++ b/newlib/libc/machine/microblaze/strlen.c +@@ -112,47 +112,29 @@ strlen (const char *str) + return str - start; + #endif /* not PREFER_SIZE_OVER_SPEED */ + +-#else +- +-#include "mb_endian.h" ++#elif __arch64__ ++ const char *start = str; ++ unsigned long *aligned_addr; + +-#ifdef __arch64__ +- asm volatile (" \n\ +- orl r9, r0, r0 /* Index register */ \n\ +-check_alignment: \n\ +- andli r3, r5, 3 \n\ +- beanei r3, align_arg \n\ +-len_loop: \n" +- LOAD4BYTES("r3", "r5", "r9") +-" \n\ +- pcmplbf r4, r3, r0 \n\ +- beanei r4, end_len \n\ +- addlik r9, r9, 4 \n\ +- breaid len_loop \n\ +- nop \n\ +-end_len: \n\ +- lbu r3, r5, r9 \n\ +- beaeqi r3, done_len \n\ +- addlik r9, r9, 1 \n\ +- breaid end_len \n\ +- nop \n\ +-done_len: \n\ +- orl r3, r0, r9 /* Return len */ \n\ +- rtsd r15, 8 \n\ +- nop \n\ +-align_arg: \n\ +- rsublik r10, r3, 4 \n\ +-align_loop: \n\ +- lbu r3, r5, r9 \n\ +- addlik r10, r10, -1 \n\ +- beaeqid r3, done_len \n\ +- nop \n\ +- addlik r9, r9, 1 \n\ +- beaneid r10, align_loop \n\ +- nop \n\ +- breai len_loop"); ++ if (!UNALIGNED (str)) ++ { ++ /* If the string is word-aligned, we can check for the presence of ++ a null in each word-sized block. */ ++ aligned_addr = (unsigned long*)str; ++ while (!DETECTNULL (*aligned_addr)) ++ aligned_addr++; + ++ /* Once a null is detected, we check each byte in that block for a ++ precise position of the null. */ ++ str = (char*)aligned_addr; ++ } ++ ++ while (*str) ++ str++; ++ return str - start; + #else ++ ++#include "mb_endian.h" + asm volatile (" \n\ + or r9, r0, r0 /* Index register */ \n\ + check_alignment: \n\ +@@ -183,6 +165,5 @@ align_loop: \n\ + addik r9, r9, 1 \n\ + bri len_loop"); + +-#endif + #endif /* ! HAVE_HW_PCMP */ + } +-- +2.7.4 + diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/libgloss_3.3.%.bbappend b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/libgloss_3.3.%.bbappend new file mode 100644 index 000000000..3dee0f06c --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/libgloss_3.3.%.bbappend @@ -0,0 +1,6 @@ +require microblaze-newlib.inc + +do_configure_prepend_microblaze() { + # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) + export CC="${CC} -L${S}/libgloss/microblaze" +} diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/microblaze-newlib.inc b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/microblaze-newlib.inc new file mode 100644 index 000000000..c3b6acdc2 --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/microblaze-newlib.inc @@ -0,0 +1,15 @@ +# Add MicroBlaze Patches +FILESEXTRAPATHS_append_microblaze := ":${THISDIR}/files" +SRC_URI_append_microblaze = " \ + file://0001-Patch-microblaze-Add-config-microblaze.mt-for-target.patch \ + file://0002-Patch-microblaze-Modified-_exceptional_handler.patch \ + file://0003-LOCAL-Add-missing-declarations-for-xil_printf-to-std.patch \ + file://0004-Local-deleting-the-xil_printf.c-file-as-now-it-part-.patch \ + file://0005-Local-deleting-the-xil_printf.o-from-MAKEFILE.patch \ + file://0006-MB-X-intial-commit.patch \ + file://0007-Patch-Microblaze-newlib-port-for-microblaze-m64-flag.patch \ + file://0008-fixing-the-bug-in-crt-files-added-addlik-instead-of-.patch \ + file://0009-Added-MB-64-support-to-strcmp-strcpy-strlen-files.patch \ + file://0010-Patch-MicroBlaze-typos-in-string-functions-microblaz.patch \ + file://0011-Removing-the-Assembly-implementation-of-64bit-string.patch \ + " diff --git a/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/newlib_3.3.%.bbappend b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/newlib_3.3.%.bbappend new file mode 100644 index 000000000..d459bf19a --- /dev/null +++ b/meta-xilinx/meta-xilinx-bsp/recipes-microblaze/newlib/newlib_3.3.%.bbappend @@ -0,0 +1,7 @@ +require microblaze-newlib.inc + +do_configure_prepend_microblaze() { + # hack for microblaze, which needs xilinx.ld to literally do any linking (its hard coded in its LINK_SPEC) + export CC="${CC} -L${S}/libgloss/microblaze" +} + |