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
This commit is contained in:
patacongo 2013-03-14 14:42:52 +00:00
parent 0fcb93a9f4
commit d89dc4f971
13 changed files with 288 additions and 148 deletions

View File

@ -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)

View File

@ -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

View File

@ -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 <gnutt@nuttx.org>
*
* 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

View File

@ -0,0 +1,77 @@
/****************************************************************************
* configs/open1788/knsh/memory.ld
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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
}

View File

@ -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 <gnutt@nuttx.org>
*
* 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 : {

View File

@ -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)

View File

@ -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 <gnutt@nuttx.org>
#
# 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

View File

@ -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

View File

@ -0,0 +1,152 @@
/****************************************************************************
* configs/sam3u-ek/scripts/user-space.ld
*
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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) }
}

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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