From d89dc4f97199b2b37abd5a45b98d833ec14b20e8 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 14 Mar 2013 14:42:52 +0000 Subject: [PATCH] Rename g_heapbase to g_idle_topstack; Fix kernel build heap allocation which cannot use g_heapbase git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5739 42af7a65-404d-4744-a932-0658087f49c3 --- configs/open1788/kernel/Makefile | 6 +- configs/open1788/knsh/Make.defs | 26 ++-- configs/open1788/scripts/kernel-space.ld | 32 +--- configs/open1788/scripts/memory.ld | 77 ++++++++++ configs/open1788/scripts/user-space.ld | 37 +---- configs/sam3u-ek/kernel/Makefile | 6 +- configs/sam3u-ek/knsh/Make.defs | 28 ++-- configs/sam3u-ek/scripts/kernel-space.ld | 29 +--- configs/sam3u-ek/scripts/memory.ld | 152 +++++++++++++++++++ configs/sam3u-ek/scripts/user-space.ld | 33 +--- configs/zkit-arm-1769/include/board.h | 1 + configs/zkit-arm-1769/src/Makefile | 2 +- configs/zkit-arm-1769/src/zkitarm_internal.h | 7 +- 13 files changed, 288 insertions(+), 148 deletions(-) create mode 100644 configs/open1788/scripts/memory.ld create mode 100644 configs/sam3u-ek/scripts/memory.ld diff --git a/configs/open1788/kernel/Makefile b/configs/open1788/kernel/Makefile index 16731a24d1f..fb6850f36df 100644 --- a/configs/open1788/kernel/Makefile +++ b/configs/open1788/kernel/Makefile @@ -50,11 +50,13 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT)) ifeq ($(WINTOOL),y) # Windows-native toolchains USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done} - USER_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld}" + USER_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld}" + USER_LDSCRIPT += -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld}" else # Linux/Cygwin-native toolchain USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) - USER_LDSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld + USER_LDSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld + USER_LDSCRIPT += -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld endif USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT) diff --git a/configs/open1788/knsh/Make.defs b/configs/open1788/knsh/Make.defs index bf507383289..4ec863d1beb 100644 --- a/configs/open1788/knsh/Make.defs +++ b/configs/open1788/knsh/Make.defs @@ -35,23 +35,25 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk -include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs +include ${TOPDIR}$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)armv7-m$(DELIM)Toolchain.defs ifeq ($(WINTOOL),y) # Windows-native toolchains - DIRLINK = $(TOPDIR)/tools/copydir.sh - DIRUNLINK = $(TOPDIR)/tools/unlink.sh - MKDEP = $(TOPDIR)/tools/mknulldeps.sh - ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" - ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" - ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/kernel-space.ld}" + DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh + DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh + MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include$(DELIM)cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld}" + ARCHSCRIPT += -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)kernel-space.ld}" MAXOPTIMIZATION = -O2 else # Linux/Cygwin-native toolchain - MKDEP = $(TOPDIR)/tools/mkdeps.sh - ARCHINCLUDES = -I. -isystem $(TOPDIR)/include - ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx - ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/kernel-space.ld + MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include -isystem $(TOPDIR)$(DELIM)include$(DELIM)cxx + ARCHSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld + ARCHSCRIPT += -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)kernel-space.ld endif CC = $(CROSSDEV)gcc @@ -87,7 +89,7 @@ CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) AFLAGS = $(CFLAGS) -D__ASSEMBLY__ NXFLATLDFLAGS1 = -r -d -warn-common -NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld -no-check-sections LDNXFLATFLAGS = -e main -s 2048 OBJEXT = .o diff --git a/configs/open1788/scripts/kernel-space.ld b/configs/open1788/scripts/kernel-space.ld index 84cf9212c86..e80fa7d110c 100755 --- a/configs/open1788/scripts/kernel-space.ld +++ b/configs/open1788/scripts/kernel-space.ld @@ -1,7 +1,7 @@ /**************************************************************************** * configs/open1788/scripts/kernel-space.ld * - * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,36 +33,10 @@ * ****************************************************************************/ -/* The LPC1788 has 512Kb of FLASH beginning at address 0x0000:0000 and - * 96Kb of total SRAM: 64Kb of SRAM in the CPU block beginning at address - * 0x10000000 and 32Kb of Peripheral SRAM in two banks, 8Kb at addresses - * 0x20000000 bank0 first and 8kb at 0x20002000 at bank0 second. And 16Kb - * at 0x20004000 on bank1. - * - * For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of - * FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See - * also configs/open1788/scripts/kernel-space.ld). +/* NOTE: This depends on the memory.ld script having been included prior to + * this script. */ -MEMORY -{ - /* 256Kb FLASH */ - - kflash (rx) : ORIGIN = 0x00000000, LENGTH = 64K - uflash (rx) : ORIGIN = 0x00010000, LENGTH = 448K - - /* 64Kb of SRAM in the CPU block */ - - ksram (rwx) : ORIGIN = 0x10000000, LENGTH = 4K - usram (rwx) : ORIGIN = 0x10001000, LENGTH = 60K - - /* Other peripheral memory (free, nothing is linked here) */ - - ahbram8_b0a(rwx) : ORIGIN = 0x20000000, LENGTH = 8K - ahbram8_b0b(rwx) : ORIGIN = 0x20002000, LENGTH = 8K - ahbram16(rwx) : ORIGIN = 0x20004000, LENGTH = 16K -} - OUTPUT_ARCH(arm) ENTRY(_stext) SECTIONS diff --git a/configs/open1788/scripts/memory.ld b/configs/open1788/scripts/memory.ld new file mode 100644 index 00000000000..d1ae3aa6ebf --- /dev/null +++ b/configs/open1788/scripts/memory.ld @@ -0,0 +1,77 @@ +/**************************************************************************** + * configs/open1788/knsh/memory.ld + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of 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 NuttX 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 HOLDERS 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 OWNER 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. + * + ****************************************************************************/ + +/* The LPC1788 has 512Kb of FLASH beginning at address 0x0000:0000 and + * 96Kb of total SRAM: 64Kb of SRAM in the CPU block beginning at address + * 0x10000000 and 32Kb of Peripheral SRAM in two banks, 8Kb at addresses + * 0x20000000 bank0 first and 8kb at 0x20002000 at bank0 second. And 16Kb + * at 0x20004000 on bank1. + * + * For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of + * FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See + * also configs/open1788/scripts/kernel-space.ld). A detailed memory map + * for the CPU SRAM region is as follows: + * + * 0x10000 0000: Kernel .data region. Typical size: 0.1KB + * ------- ---- Kernel .bss region. Typical size: 1.8KB + * 0x10000 0800: Kernel IDLE thread stack (approximate). Size is + * determined by CONFIG_IDLETHREAD_STACKSIZE and + * adjustments for alignment. Typical is 1KB. + * ------- ---- Padded to 4KB + * 0x10000 1000: User .data region. Size is variable. + * ------- ---- User .bss region Size is variable. + * ------- ---- Beginning of kernel heap + * 0x10000 8000: Beginning of user heap. Can vary with other settings. + * 0x10001 0000: End+1 of CPU RAM + */ + +MEMORY +{ + /* 256Kb FLASH */ + + kflash (rx) : ORIGIN = 0x00000000, LENGTH = 64K + uflash (rx) : ORIGIN = 0x00010000, LENGTH = 448K + + /* 64Kb of SRAM in the CPU block */ + + ksram (rwx) : ORIGIN = 0x10000000, LENGTH = 4K + usram (rwx) : ORIGIN = 0x10001000, LENGTH = 60K + + /* Other peripheral memory (free, nothing is linked here) */ + + ahbram8_b0a(rwx) : ORIGIN = 0x20000000, LENGTH = 8K + ahbram8_b0b(rwx) : ORIGIN = 0x20002000, LENGTH = 8K + ahbram16(rwx) : ORIGIN = 0x20004000, LENGTH = 16K +} diff --git a/configs/open1788/scripts/user-space.ld b/configs/open1788/scripts/user-space.ld index 149be92f133..e2979e4a3b0 100644 --- a/configs/open1788/scripts/user-space.ld +++ b/configs/open1788/scripts/user-space.ld @@ -1,7 +1,7 @@ /**************************************************************************** * configs/open1788/scripts/user-space.ld * - * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,39 +33,13 @@ * ****************************************************************************/ -/* The LPC1788 has 512Kb of FLASH beginning at address 0x0000:0000 and - * 96Kb of total SRAM: 64Kb of SRAM in the CPU block beginning at address - * 0x10000000 and 32Kb of Peripheral SRAM in two banks, 8Kb at addresses - * 0x20000000 bank0 first and 8kb at 0x20002000 at bank0 second. And 16Kb - * at 0x20004000 on bank1. - * - * For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of - * FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See - * also configs/open1788/scripts/kernel-space.ld). +/* NOTE: This depends on the memory.ld script having been included prior to + * this script. */ -MEMORY -{ - /* 256Kb FLASH */ - - kflash (rx) : ORIGIN = 0x00000000, LENGTH = 64K - uflash (rx) : ORIGIN = 0x00010000, LENGTH = 448K - - /* 64Kb of SRAM in the CPU block */ - - ksram (rwx) : ORIGIN = 0x10000000, LENGTH = 4K - usram (rwx) : ORIGIN = 0x10001000, LENGTH = 60K - - /* Other peripheral memory (free, nothing is linked here) */ - - ahbram8_b0a(rwx) : ORIGIN = 0x20000000, LENGTH = 8K - ahbram8_b0b(rwx) : ORIGIN = 0x20002000, LENGTH = 8K - ahbram16(rwx) : ORIGIN = 0x20004000, LENGTH = 16K -} - /* Make sure that the critical memory management functions are in user-space. - * Currently, the plan is that the memory manager will reside in user-space - * but be usable both by kernel- and user-space code + * the user heap memory manager will reside in user-space but be usable both + * by kernel- and user-space code */ EXTERN(umm_initialize) @@ -79,7 +53,6 @@ EXTERN(zalloc) EXTERN(free) OUTPUT_ARCH(arm) - SECTIONS { .userspace : { diff --git a/configs/sam3u-ek/kernel/Makefile b/configs/sam3u-ek/kernel/Makefile index da4510a006d..a4cff79877e 100644 --- a/configs/sam3u-ek/kernel/Makefile +++ b/configs/sam3u-ek/kernel/Makefile @@ -50,11 +50,13 @@ ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT)) ifeq ($(WINTOOL),y) # Windows-native toolchains USER_LIBPATHS = ${shell for path in $(USERLIBS); do dir=`dirname $(TOPDIR)$(DELIM)$$path`;echo "-L\"`cygpath -w $$dir`\"";done} - USER_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld}" + USER_LDSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld}" + USER_LDSCRIPT += -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld}" else # Linux/Cygwin-native toolchain USER_LIBPATHS = $(addprefix -L$(TOPDIR)$(DELIM),$(dir $(USERLIBS))) - USER_LDSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld + USER_LDSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld + USER_LDSCRIPT += -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld endif USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT) diff --git a/configs/sam3u-ek/knsh/Make.defs b/configs/sam3u-ek/knsh/Make.defs index ac74d2fdbb0..9b06e7ec696 100644 --- a/configs/sam3u-ek/knsh/Make.defs +++ b/configs/sam3u-ek/knsh/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # configs/sam3u-ek/knsh/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,23 +35,25 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk -include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs +include ${TOPDIR}$(DELIM)arch$(DELIM)arm$(DELIM)src$(DELIM)armv7-m$(DELIM)Toolchain.defs ifeq ($(WINTOOL),y) # Windows-native toolchains - DIRLINK = $(TOPDIR)/tools/copydir.sh - DIRUNLINK = $(TOPDIR)/tools/unlink.sh - MKDEP = $(TOPDIR)/tools/mknulldeps.sh - ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" - ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" - ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/kernel-space.ld}" + DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh + DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh + MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include}" -isystem "${shell cygpath -w $(TOPDIR)$(DELIM)include$(DELIM)cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld}" + ARCHSCRIPT += -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)kernel-space.ld}" MAXOPTIMIZATION = -O2 else # Linux/Cygwin-native toolchain - MKDEP = $(TOPDIR)/tools/mkdeps.sh - ARCHINCLUDES = -I. -isystem $(TOPDIR)/include - ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx - ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/kernel-space.ld + MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)$(DELIM)include -isystem $(TOPDIR)$(DELIM)include$(DELIM)cxx + ARCHSCRIPT = -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)memory.ld + ARCHSCRIPT += -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)kernel-space.ld endif CC = $(CROSSDEV)gcc @@ -87,7 +89,7 @@ CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) AFLAGS = $(CFLAGS) -D__ASSEMBLY__ NXFLATLDFLAGS1 = -r -d -warn-common -NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld -no-check-sections LDNXFLATFLAGS = -e main -s 2048 OBJEXT = .o diff --git a/configs/sam3u-ek/scripts/kernel-space.ld b/configs/sam3u-ek/scripts/kernel-space.ld index 8a6f1a34449..75fef5ca8b2 100755 --- a/configs/sam3u-ek/scripts/kernel-space.ld +++ b/configs/sam3u-ek/scripts/kernel-space.ld @@ -33,35 +33,10 @@ * ****************************************************************************/ -/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000, - * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning - * at address 0x2008:000 (used only for heap). When booting from FLASH, - * FLASH memory is aliased to address 0x0000:0000 where the code expects to - * begin execution by jumping to the entry point in the 0x0800:0000 address - * range. - * - * For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of - * FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See - * also configs/sam3u-ek/scripts/user-space.ld). +/* NOTE: This depends on the memory.ld script having been included prior to + * this script. */ -MEMORY -{ - /* 256Kb FLASH */ - - kflash (rx) : ORIGIN = 0x00080000, LENGTH = 64K - uflash (rx) : ORIGIN = 0x00090000, LENGTH = 192K - - /* 32Kb SRAM */ - - ksram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 4K - usram1 (rwx) : ORIGIN = 0x20001000, LENGTH = 28K - - /* 16Kb SRAM */ - - sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K -} - OUTPUT_ARCH(arm) ENTRY(_stext) SECTIONS diff --git a/configs/sam3u-ek/scripts/memory.ld b/configs/sam3u-ek/scripts/memory.ld new file mode 100644 index 00000000000..d187ed40c87 --- /dev/null +++ b/configs/sam3u-ek/scripts/memory.ld @@ -0,0 +1,152 @@ +/**************************************************************************** + * configs/sam3u-ek/scripts/user-space.ld + * + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of 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 NuttX 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 HOLDERS 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 OWNER 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. + * + ****************************************************************************/ + +/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000, + * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning + * at address 0x2008:000 (used only for heap). When booting from FLASH, + * FLASH memory is aliased to address 0x0000:0000 where the code expects to + * begin execution by jumping to the entry point in the 0x0800:0000 address + * range. + * + * For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of + * FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See + * also configs/sam3u-ek/scripts/kernel-space.ld). + */ + +MEMORY +{ + /* 256Kb FLASH */ + + kflash (rx) : ORIGIN = 0x00080000, LENGTH = 64K + uflash (rx) : ORIGIN = 0x00090000, LENGTH = 192K + + /* 32Kb SRAM */ + + ksram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 4K + usram1 (rwx) : ORIGIN = 0x20001000, LENGTH = 28K + + /* 16Kb SRAM */ + + sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K +} + +/* Make sure that the critical memory management functions are in user-space. + * Currently, the plan is that the memory manager will reside in user-space + * but be usable both by kernel- and user-space code + */ + +EXTERN(umm_initialize) +EXTERN(umm_addregion) +EXTERN(umm_trysemaphore) +EXTERN(umm_givesemaphore) + +EXTERN(malloc) +EXTERN(realloc) +EXTERN(zalloc) +EXTERN(free) + +OUTPUT_ARCH(arm) + +SECTIONS +{ + .userspace : { + *(.userspace) + } > uflash + + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > uflash + + .init_section : { + _sinit = ABSOLUTE(.); + *(.init_array .init_array.*) + _einit = ABSOLUTE(.); + } > uflash + + .ARM.extab : { + *(.ARM.extab*) + } > uflash + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : { + *(.ARM.exidx*) + } > uflash + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > usram1 AT > uflash + + .bss : { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > usram1 + + /* Stabs debugging sections. */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/configs/sam3u-ek/scripts/user-space.ld b/configs/sam3u-ek/scripts/user-space.ld index d187ed40c87..53b402257ad 100644 --- a/configs/sam3u-ek/scripts/user-space.ld +++ b/configs/sam3u-ek/scripts/user-space.ld @@ -33,38 +33,13 @@ * ****************************************************************************/ -/* The AT91SAM3U-4 has 256Kb of FLASH beginning at address 0x0008:0000, - * 32Kb of SRAM beginning at address 0x2000:0000, and 16Kb of SRAM beginning - * at address 0x2008:000 (used only for heap). When booting from FLASH, - * FLASH memory is aliased to address 0x0000:0000 where the code expects to - * begin execution by jumping to the entry point in the 0x0800:0000 address - * range. - * - * For MPU support, the kernel-mode NuttX section is assumed to be 64Kb of - * FLASH and 4Kb of SRAM. That, of course, can be optimized as needed (See - * also configs/sam3u-ek/scripts/kernel-space.ld). +/* NOTE: This depends on the memory.ld script having been included prior to + * this script. */ -MEMORY -{ - /* 256Kb FLASH */ - - kflash (rx) : ORIGIN = 0x00080000, LENGTH = 64K - uflash (rx) : ORIGIN = 0x00090000, LENGTH = 192K - - /* 32Kb SRAM */ - - ksram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 4K - usram1 (rwx) : ORIGIN = 0x20001000, LENGTH = 28K - - /* 16Kb SRAM */ - - sram2 (rwx) : ORIGIN = 0x20080000, LENGTH = 16K -} - /* Make sure that the critical memory management functions are in user-space. - * Currently, the plan is that the memory manager will reside in user-space - * but be usable both by kernel- and user-space code + * the user heap memory manager will reside in user-space but be usable both + * by kernel- and user-space code */ EXTERN(umm_initialize) diff --git a/configs/zkit-arm-1769/include/board.h b/configs/zkit-arm-1769/include/board.h index d18e6b1a2c3..e6d486bf2d7 100644 --- a/configs/zkit-arm-1769/include/board.h +++ b/configs/zkit-arm-1769/include/board.h @@ -189,6 +189,7 @@ #define BOARD_BUTTON_4 3 #define BOARD_BUTTON_5 4 #define BOARD_NUM_BUTTONS 5 + #define BOARD_BUTTON_BUTTON1_BIT (1 << BOARD_BUTTON_1) #define BOARD_BUTTON_BUTTON2_BIT (1 << BOARD_BUTTON_2) #define BOARD_BUTTON_BUTTON3_BIT (1 << BOARD_BUTTON_3) diff --git a/configs/zkit-arm-1769/src/Makefile b/configs/zkit-arm-1769/src/Makefile index 856705614bc..491e364f429 100644 --- a/configs/zkit-arm-1769/src/Makefile +++ b/configs/zkit-arm-1769/src/Makefile @@ -41,7 +41,7 @@ -include $(TOPDIR)/Make.defs ASRCS = -CSRCS = up_boot.c up_leds.c up_ssp.c +CSRCS = up_boot.c up_leds.c up_ssp.c up_buttons.c ifeq ($(CONFIG_NSH_ARCHINIT),y) CSRCS += up_nsh.c diff --git a/configs/zkit-arm-1769/src/zkitarm_internal.h b/configs/zkit-arm-1769/src/zkitarm_internal.h index 19eb5b4389d..919cefcdfe7 100644 --- a/configs/zkit-arm-1769/src/zkitarm_internal.h +++ b/configs/zkit-arm-1769/src/zkitarm_internal.h @@ -139,8 +139,13 @@ #define ZKITARM_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN19) #define ZKITARM_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21) -#define ZKITARM_KEY5 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN13) +#define ZKITARM_KEY1 (GPIO_INPUT | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN19) +#define ZKITARM_KEY2 (GPIO_INPUT | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN27) +#define ZKITARM_KEY3 (GPIO_INPUT | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN28) +#define ZKITARM_KEY4 (GPIO_INPUT | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN31) +#define ZKITARM_KEY5 (GPIO_INPUT | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN13) +#define ZKITARM_INT_KEY5 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN13) #define ZKITARM_KEY5_IRQ LPC17_IRQ_P2p13 /* SD Slot