summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-10-08 23:26:14 +0000
committerwdenk <wdenk>2003-10-08 23:26:14 +0000
commit4a5517094dd30bb1f271403b62e23053301668e6 (patch)
tree55bd5e64828e7645caa5506302e27715cfecdbda /examples
parent54387ac931fa7cc92cd45c53798379af1f9adc44 (diff)
* Patch by Scott McNutt, 04 Oct 2003:
- add support for Altera Nios-32 CPU - add support for Nios Cyclone Development Kit (DK-1C20) * Patch by Steven Scholz, 29 Sep 2003: - A second parameter for bootm overwrites the load address for "Standalone Application" images. - bootm sets environment variable "filesize" to the resulting (uncompressed) data length for "Standalone Application" images when autostart is set to "no". Now you can do something like if bootm $fpgadata $some_free_ram ; then fpga load 0 $some_free_ram $filesize fi * Patch by Denis Peter, 25 Sept 2003: add support for the MIP405 Rev. C board
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile4
-rw-r--r--examples/nios.lds61
-rw-r--r--examples/stubs.c17
3 files changed, 82 insertions, 0 deletions
diff --git a/examples/Makefile b/examples/Makefile
index febc501e9f6..90d26550b03 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -37,6 +37,10 @@ ifeq ($(ARCH),mips)
LOAD_ADDR = 0x80200000 -T mips.lds
endif
+ifeq ($(ARCH),nios)
+LOAD_ADDR = 0x01000000 -L $(gcclibdir)/m32 -T nios.lds
+endif
+
include $(TOPDIR)/config.mk
SREC = hello_world.srec
diff --git a/examples/nios.lds b/examples/nios.lds
new file mode 100644
index 00000000000..105999f5489
--- /dev/null
+++ b/examples/nios.lds
@@ -0,0 +1,61 @@
+/*
+ * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
+ * Scott McNutt <smcnutt@psyent.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+
+OUTPUT_FORMAT("elf32-nios")
+OUTPUT_ARCH(nios)
+ENTRY(_start)
+
+SECTIONS
+{
+ .text :
+ {
+ *(.text)
+ }
+ __text_end = .;
+
+ . = ALIGN(4);
+ .rodata :
+ {
+ *(.rodata)
+ }
+ __rodata_end = .;
+
+ . = ALIGN(4);
+ .data :
+ {
+ *(.data)
+ }
+ . = ALIGN(4);
+ __data_end = .;
+
+ __bss_start = .;
+ . = ALIGN(4);
+ .bss :
+ {
+ *(.bss)
+ }
+ . = ALIGN(4);
+ __bss_end = .;
+}
+
diff --git a/examples/stubs.c b/examples/stubs.c
index 9c4c51b0e4f..6ca6d78694f 100644
--- a/examples/stubs.c
+++ b/examples/stubs.c
@@ -61,6 +61,23 @@ gd_t *global_data;
" lw $25, %1($25)\n" \
" jr $25\n" \
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "t9");
+#elif defined(CONFIG_NIOS)
+/*
+ * %g7 holds the pointer to the global_data. %g0 is call clobbered.
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile ( \
+" .globl " #x "\n" \
+#x ":\n" \
+" pfx %%hi(%0)\n" \
+" movi %%g0, %%lo(%0)\n" \
+" add %%g0, %%g7\n" \
+" ld %%g0, [%%g0]\n" \
+" pfx %1\n" \
+" ld %%g0, [%%g0]\n" \
+" jmp %%g0\n" \
+" nop \n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x) : "r0");
#else
#error stubs definition missing for this architecture
#endif