Merged in masayuki2009/nuttx.nuttx/lc823450_protected_build (pull request #689)
lc823450 protected build * arch/arm/src/lc823450: Add support for mpu and userspace Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> * configs/lc823450-xgevk: Add support for userspace Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> * configs/lc823450-xgevk: Add kostest Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> * configs/lc823450-xgevk: Add knsh Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
parent
7d96a2bea6
commit
9ea6d9aec5
@ -63,6 +63,14 @@ ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
|
||||
CMN_CSRCS += up_ramvec_initialize.c up_ramvec_attach.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||
CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
CMN_CSRCS += up_signal_dispatch.c
|
||||
CMN_UASRCS += up_signal_handler.S
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_MEMCPY),y)
|
||||
CMN_ASRCS += memcpy-armv7m.S
|
||||
endif
|
||||
@ -77,7 +85,7 @@ endif
|
||||
|
||||
CHIP_ASRCS =
|
||||
|
||||
CHIP_CSRCS = lc823450_start.c lc823450_irq.c lc823450_timer.c
|
||||
CHIP_CSRCS = lc823450_allocateheap2.c lc823450_start.c lc823450_irq.c lc823450_timer.c
|
||||
CHIP_CSRCS += lc823450_lowputc.c lc823450_serial.c lc823450_clockconfig.c
|
||||
CHIP_CSRCS += lc823450_syscontrol.c lc823450_gpio.c
|
||||
|
||||
@ -112,10 +120,6 @@ ifeq ($(CONFIG_SPI), y)
|
||||
CHIP_CSRCS += lc823450_spi.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_MPU),y)
|
||||
CMN_CSRCS += up_mpu.c lc823450_mpuinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_DMA), y)
|
||||
CMN_CSRCS += lc823450_dma.c
|
||||
endif
|
||||
@ -154,13 +158,6 @@ CHIP_CSRCS += lc823450_pminitialize.c
|
||||
CHIP_CSRCS += lc823450_sleep.c
|
||||
endif
|
||||
|
||||
#CHIP_CSRCS += lc823450_allocateheap.c
|
||||
|
||||
ifeq ($(CONFIG_MM_MULTIHEAP), y)
|
||||
CHIP_CSRCS += lc823450_mm.c
|
||||
CHIP_CSRCS += lc823450_sram.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LC823450_SPIFI_RAMFAT), y)
|
||||
CHIP_CSRCS += lc823450_ramfat.c
|
||||
endif
|
||||
@ -185,3 +182,8 @@ endif
|
||||
ifeq ($(CONFIG_LC823450_I2S0),y)
|
||||
CHIP_CSRCS += lc823450_i2s.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||
CHIP_CSRCS += lc823450_userspace.c
|
||||
CHIP_CSRCS += lc823450_mpuinit2.c
|
||||
endif
|
||||
|
235
arch/arm/src/lc823450/lc823450_allocateheap2.c
Normal file
235
arch/arm/src/lc823450/lc823450_allocateheap2.c
Normal file
@ -0,0 +1,235 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/lc823450/lc823450_allocateheap2.c
|
||||
*
|
||||
* Copyright 2018 Sony Video & Sound Products Inc.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* Based on arch/arm/src/stm32/stm32_allocateheap.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/userspace.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "mpu.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "lc823450_mpuinit2.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define SRAM1_END CONFIG_RAM_END
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_heap_color
|
||||
*
|
||||
* Description:
|
||||
* Set heap memory to a known, non-zero state to checking heap usage.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_HEAP_COLORATION
|
||||
static inline void up_heap_color(FAR void *start, size_t size)
|
||||
{
|
||||
memset(start, HEAP_COLOR, size);
|
||||
}
|
||||
#else
|
||||
# define up_heap_color(start,size)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_allocate_heap
|
||||
*
|
||||
* Description:
|
||||
* This function will be called to dynamically set aside the heap region.
|
||||
*
|
||||
* For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
|
||||
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
|
||||
* size of the unprotected, user-space heap.
|
||||
*
|
||||
* If a protected kernel-space heap is provided, the kernel heap must be
|
||||
* allocated (and protected) by an analogous up_allocate_kheap().
|
||||
*
|
||||
* The following memory map is assumed for the flat build:
|
||||
*
|
||||
* .data region. Size determined at link time.
|
||||
* .bss region Size determined at link time.
|
||||
* IDLE thread stack. Size determined by CONFIG_IDLETHREAD_STACKSIZE.
|
||||
* Heap. Extends to the end of SRAM.
|
||||
*
|
||||
* The following memory map is assumed for the kernel build:
|
||||
*
|
||||
* Kernel .data region. Size determined at link time.
|
||||
* Kernel .bss region Size determined at link time.
|
||||
* Kernel IDLE thread stack. Size determined by CONFIG_IDLETHREAD_STACKSIZE.
|
||||
* Padding for alignment
|
||||
* User .data region. Size determined at link time.
|
||||
* User .bss region Size determined at link time.
|
||||
* Kernel heap. Size determined by CONFIG_MM_KERNEL_HEAPSIZE.
|
||||
* User heap. Extends to the end of SRAM.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
|
||||
{
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
/* Get the unaligned size and position of the user-space heap.
|
||||
* This heap begins after the user-space .bss section at an offset
|
||||
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
|
||||
*/
|
||||
|
||||
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
|
||||
size_t usize = SRAM1_END - ubase;
|
||||
int log2;
|
||||
|
||||
DEBUGASSERT(ubase < (uintptr_t)SRAM1_END);
|
||||
|
||||
/* Adjust that size to account for MPU alignment requirements.
|
||||
* NOTE that there is an implicit assumption that the SRAM1_END
|
||||
* is aligned to the MPU requirement.
|
||||
*/
|
||||
|
||||
log2 = (int)mpu_log2regionfloor(usize);
|
||||
DEBUGASSERT((SRAM1_END & ((1 << log2) - 1)) == 0);
|
||||
|
||||
usize = (1 << log2);
|
||||
ubase = SRAM1_END - usize;
|
||||
|
||||
/* Return the user-space heap settings */
|
||||
|
||||
*heap_start = (FAR void *)ubase;
|
||||
*heap_size = usize;
|
||||
|
||||
/* Colorize the heap for debug */
|
||||
|
||||
up_heap_color((FAR void *)ubase, usize);
|
||||
|
||||
/* Allow user-mode access to the user heap memory */
|
||||
|
||||
lc823450_mpu_uheap((uintptr_t)ubase, usize);
|
||||
#else
|
||||
|
||||
/* Return the heap settings */
|
||||
|
||||
*heap_start = (FAR void *)g_idle_topstack;
|
||||
*heap_size = SRAM1_END - g_idle_topstack;
|
||||
|
||||
/* Colorize the heap for debug */
|
||||
|
||||
up_heap_color(*heap_start, *heap_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_allocate_kheap
|
||||
*
|
||||
* Description:
|
||||
* For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
|
||||
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
|
||||
* (and protects) the kernel-space heap.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
|
||||
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
|
||||
{
|
||||
/* Get the unaligned size and position of the user-space heap.
|
||||
* This heap begins after the user-space .bss section at an offset
|
||||
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
|
||||
*/
|
||||
|
||||
uintptr_t ubase = (uintptr_t)USERSPACE->us_bssend + CONFIG_MM_KERNEL_HEAPSIZE;
|
||||
size_t usize = SRAM1_END - ubase;
|
||||
int log2;
|
||||
|
||||
DEBUGASSERT(ubase < (uintptr_t)SRAM1_END);
|
||||
|
||||
/* Adjust that size to account for MPU alignment requirements.
|
||||
* NOTE that there is an implicit assumption that the SRAM1_END
|
||||
* is aligned to the MPU requirement.
|
||||
*/
|
||||
|
||||
log2 = (int)mpu_log2regionfloor(usize);
|
||||
DEBUGASSERT((SRAM1_END & ((1 << log2) - 1)) == 0);
|
||||
|
||||
usize = (1 << log2);
|
||||
ubase = SRAM1_END - usize;
|
||||
|
||||
/* Return the kernel heap settings (i.e., the part of the heap region
|
||||
* that was not dedicated to the user heap).
|
||||
*/
|
||||
|
||||
*heap_start = (FAR void *)USERSPACE->us_bssend;
|
||||
*heap_size = ubase - (uintptr_t)USERSPACE->us_bssend;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_addregion
|
||||
*
|
||||
* Description:
|
||||
* Memory may be added in non-contiguous chunks. Additional chunks are
|
||||
* added by calling this function.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_MM_REGIONS > 1
|
||||
void up_addregion(void)
|
||||
{
|
||||
# error "TODO"
|
||||
}
|
||||
#endif
|
126
arch/arm/src/lc823450/lc823450_mpuinit2.c
Normal file
126
arch/arm/src/lc823450/lc823450_mpuinit2.c
Normal file
@ -0,0 +1,126 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/lc823450/lc823450_mpuinit2.c
|
||||
*
|
||||
* Copyright 2018 Sony Video & Sound Products Inc.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* Based on arch/arm/src/stm32/stm32_mpuinit.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/userspace.h>
|
||||
|
||||
#include "mpu.h"
|
||||
#include "lc823450_mpuinit2.h"
|
||||
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARM_MPU)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a,b) a > b ? a : b
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(a,b) a < b ? a : b
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lc823450_mpuinitialize
|
||||
*
|
||||
* Description:
|
||||
* Configure the MPU to permit user-space access to only restricted SAM3U
|
||||
* resources.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lc823450_mpuinitialize(void)
|
||||
{
|
||||
uintptr_t datastart = MIN(USERSPACE->us_datastart, USERSPACE->us_bssstart);
|
||||
uintptr_t dataend = MAX(USERSPACE->us_dataend, USERSPACE->us_bssend);
|
||||
|
||||
DEBUGASSERT(USERSPACE->us_textend >= USERSPACE->us_textstart &&
|
||||
dataend >= datastart);
|
||||
|
||||
/* Show MPU information */
|
||||
|
||||
mpu_showtype();
|
||||
|
||||
/* Configure user flash and SRAM space */
|
||||
|
||||
mpu_user_flash(USERSPACE->us_textstart,
|
||||
USERSPACE->us_textend - USERSPACE->us_textstart);
|
||||
|
||||
mpu_user_intsram(datastart, dataend - datastart);
|
||||
|
||||
/* Then enable the MPU */
|
||||
|
||||
mpu_control(true, false, true);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lc823450_mpu_uheap
|
||||
*
|
||||
* Description:
|
||||
* Map the user-heap region.
|
||||
*
|
||||
* This logic may need an extension to handle external SDRAM).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lc823450_mpu_uheap(uintptr_t start, size_t size)
|
||||
{
|
||||
mpu_user_intsram(start, size);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARM_MPU */
|
||||
|
92
arch/arm/src/lc823450/lc823450_mpuinit2.h
Normal file
92
arch/arm/src/lc823450/lc823450_mpuinit2.h
Normal file
@ -0,0 +1,92 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/lc823450/lc823450_mpuinit2.h
|
||||
*
|
||||
* Copyright 2018 Sony Video & Sound Products Inc.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* Based on arch/arm/src/stm32/stm32_mpuinit.h
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_LC823450_LC823450_MPUINIT2_H
|
||||
#define __ARCH_ARM_SRC_LC823450_LC823450_MPUINIT2_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lc823450_mpuinitialize
|
||||
*
|
||||
* Description:
|
||||
* Configure the MPU to permit user-space access to only unrestricted MCU
|
||||
* resources.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BUILD_PROTECTED
|
||||
void lc823450_mpuinitialize(void);
|
||||
#else
|
||||
# define lc823450_mpuinitialize()
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lc823450_mpu_uheap
|
||||
*
|
||||
* Description:
|
||||
* Map the user heap region.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BUILD_PROTECTED
|
||||
void lc823450_mpu_uheap(uintptr_t start, size_t size);
|
||||
#else
|
||||
# define lc823450_mpu_uheap(start,size)
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_LC823450_LC823450_MPUINIT2_H */
|
@ -67,8 +67,8 @@
|
||||
#include "lc823450_clockconfig.h"
|
||||
#include "lc823450_syscontrol.h"
|
||||
|
||||
#ifdef CONFIG_ARMV7M_MPU
|
||||
# include "lc823450_mpuinit.h"
|
||||
#ifdef CONFIG_BUILD_PROTECTED
|
||||
# include "lc823450_userspace.h"
|
||||
#endif
|
||||
|
||||
#include "lc823450_gpio.h"
|
||||
@ -349,10 +349,10 @@ void __start(void)
|
||||
* segments.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ARMV7M_MPU
|
||||
lc823450_mpuinitialize();
|
||||
showprogress('E');
|
||||
#ifdef CONFIG_BUILD_PROTECTED
|
||||
lc823450_userspace();
|
||||
#endif
|
||||
showprogress('E');
|
||||
|
||||
#ifdef CONFIG_MM_MULTIHEAP
|
||||
lc823450_sram_initialize();
|
||||
|
121
arch/arm/src/lc823450/lc823450_userspace.c
Normal file
121
arch/arm/src/lc823450/lc823450_userspace.c
Normal file
@ -0,0 +1,121 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/lc823450/lc823450_userspace.c
|
||||
*
|
||||
* Copyright 2018 Sony Video & Sound Products Inc.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* Based on arch/arm/src/stm32/stm32_usespace.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/userspace.h>
|
||||
|
||||
#include "lc823450_mpuinit2.h"
|
||||
#include "lc823450_userspace.h"
|
||||
|
||||
#ifdef CONFIG_BUILD_PROTECTED
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lc823450_userspace
|
||||
*
|
||||
* Description:
|
||||
* For the case of the separate user-/kernel-space build, perform whatever
|
||||
* platform specific initialization of the user memory is required.
|
||||
* Normally this just means initializing the user space .data and .bss
|
||||
* segments.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void lc823450_userspace(void)
|
||||
{
|
||||
uint8_t *src;
|
||||
uint8_t *dest;
|
||||
uint8_t *end;
|
||||
|
||||
/* Clear all of user-space .bss */
|
||||
|
||||
DEBUGASSERT(USERSPACE->us_bssstart != 0 && USERSPACE->us_bssend != 0 &&
|
||||
USERSPACE->us_bssstart <= USERSPACE->us_bssend);
|
||||
|
||||
dest = (uint8_t *)USERSPACE->us_bssstart;
|
||||
end = (uint8_t *)USERSPACE->us_bssend;
|
||||
|
||||
while (dest != end)
|
||||
{
|
||||
*dest++ = 0;
|
||||
}
|
||||
|
||||
/* Initialize all of user-space .data */
|
||||
|
||||
DEBUGASSERT(USERSPACE->us_datasource != 0 &&
|
||||
USERSPACE->us_datastart != 0 && USERSPACE->us_dataend != 0 &&
|
||||
USERSPACE->us_datastart <= USERSPACE->us_dataend);
|
||||
|
||||
src = (uint8_t *)USERSPACE->us_datasource;
|
||||
dest = (uint8_t *)USERSPACE->us_datastart;
|
||||
end = (uint8_t *)USERSPACE->us_dataend;
|
||||
|
||||
while (dest != end)
|
||||
{
|
||||
*dest++ = *src++;
|
||||
}
|
||||
|
||||
/* Configure the MPU to permit user-space access to its FLASH and RAM */
|
||||
|
||||
lc823450_mpuinitialize();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BUILD_PROTECTED */
|
||||
|
78
arch/arm/src/lc823450/lc823450_userspace.h
Normal file
78
arch/arm/src/lc823450/lc823450_userspace.h
Normal file
@ -0,0 +1,78 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/lc823450/lc823450_userspace.h
|
||||
*
|
||||
* Copyright 2018 Sony Video & Sound Products Inc.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* Based on arch/arm/src/stm32/stm32_usespace.h
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_LC823450_LC823450_USERSPACE_H
|
||||
#define __ARCH_ARM_SRC_LC823450_LC823450_USERSPACE_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lc823450_userspace
|
||||
*
|
||||
* Description:
|
||||
* For the case of the separate user-/kernel-space build, perform whatever
|
||||
* platform specific initialization of the user memory is required.
|
||||
* Normally this just means initializing the user space .data and .bss
|
||||
* segments.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BUILD_PROTECTED
|
||||
void lc823450_userspace(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_LC823450_LC823450_USERSPACE_H */
|
2
configs/lc823450-xgevk/kernel/.gitignore
vendored
Normal file
2
configs/lc823450-xgevk/kernel/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/nuttx_user.elf
|
||||
|
124
configs/lc823450-xgevk/kernel/Makefile
Normal file
124
configs/lc823450-xgevk/kernel/Makefile
Normal file
@ -0,0 +1,124 @@
|
||||
############################################################################
|
||||
# configs/lc823450-xgevk/kernel/Makefile
|
||||
#
|
||||
# Copyright 2018 Sony Video & Sound Products Inc.
|
||||
# Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
#
|
||||
# Based on configs/stm32f4discovery/kernel/Makefile
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
# This is the directory for the board-specific header files
|
||||
|
||||
BOARD_INCLUDE = $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)include
|
||||
|
||||
# The entry point name (if none is provided in the .config file)
|
||||
|
||||
CONFIG_USER_ENTRYPOINT ?= user_start
|
||||
ENTRYPT = $(patsubst "%",%,$(CONFIG_USER_ENTRYPOINT))
|
||||
|
||||
# Get the paths to the libraries and the links script path in format that
|
||||
# is appropriate for the host OS
|
||||
|
||||
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)memory.ld}"
|
||||
USER_LDSCRIPT += -T "${shell cygpath -w $(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld}"
|
||||
USER_HEXFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.hex}"
|
||||
USER_SRECFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.srec}"
|
||||
USER_BINFILE += "${shell cygpath -w $(TOPDIR)$(DELIM)nuttx_user.bin}"
|
||||
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)memory.ld
|
||||
USER_LDSCRIPT += -T$(TOPDIR)$(DELIM)configs$(DELIM)$(CONFIG_ARCH_BOARD)$(DELIM)scripts$(DELIM)user-space.ld
|
||||
USER_HEXFILE += "$(TOPDIR)$(DELIM)nuttx_user.hex"
|
||||
USER_SRECFILE += "$(TOPDIR)$(DELIM)nuttx_user.srec"
|
||||
USER_BINFILE += "$(TOPDIR)$(DELIM)nuttx_user.bin"
|
||||
endif
|
||||
|
||||
USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT)
|
||||
USER_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(USERLIBS))))
|
||||
USER_LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
|
||||
|
||||
# Source files
|
||||
|
||||
CSRCS = lc823450_userspace.c
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
OBJS = $(COBJS)
|
||||
|
||||
# Targets:
|
||||
|
||||
all: $(TOPDIR)$(DELIM)nuttx_user.elf $(TOPDIR)$(DELIM)User.map
|
||||
.PHONY: nuttx_user.elf depend clean distclean
|
||||
|
||||
$(COBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
# Create the nuttx_user.elf file containing all of the user-mode code
|
||||
|
||||
nuttx_user.elf: $(OBJS)
|
||||
$(Q) $(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) $(OBJS) --start-group $(USER_LDLIBS) --end-group $(USER_LIBGCC)
|
||||
|
||||
$(TOPDIR)$(DELIM)nuttx_user.elf: nuttx_user.elf
|
||||
@echo "LD: nuttx_user.elf"
|
||||
$(Q) cp -a nuttx_user.elf $(TOPDIR)$(DELIM)nuttx_user.elf
|
||||
ifeq ($(CONFIG_INTELHEX_BINARY),y)
|
||||
@echo "CP: nuttx_user.hex"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex nuttx_user.elf $(USER_HEXFILE)
|
||||
endif
|
||||
ifeq ($(CONFIG_MOTOROLA_SREC),y)
|
||||
@echo "CP: nuttx_user.srec"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec nuttx_user.elf $(USER_SRECFILE)
|
||||
endif
|
||||
ifeq ($(CONFIG_RAW_BINARY),y)
|
||||
@echo "CP: nuttx_user.bin"
|
||||
$(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx_user.elf $(USER_BINFILE)
|
||||
endif
|
||||
|
||||
$(TOPDIR)$(DELIM)User.map: nuttx_user.elf
|
||||
@echo "MK: User.map"
|
||||
$(Q) $(NM) nuttx_user.elf >$(TOPDIR)$(DELIM)User.map
|
||||
$(Q) $(CROSSDEV)size nuttx_user.elf
|
||||
|
||||
.depend:
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
$(call DELFILE, nuttx_user.elf)
|
||||
$(call DELFILE, "$(TOPDIR)$(DELIM)nuttx_user.*")
|
||||
$(call DELFILE, "$(TOPDIR)$(DELIM)User.map")
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
135
configs/lc823450-xgevk/kernel/lc823450_userspace.c
Normal file
135
configs/lc823450-xgevk/kernel/lc823450_userspace.c
Normal file
@ -0,0 +1,135 @@
|
||||
/****************************************************************************
|
||||
* configs/lc823450-xgevk/kernel/lc823450_userspace.c
|
||||
*
|
||||
* Copyright 2018 Sony Video & Sound Products Inc.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* Based on configs/stm32f4discovery/kernel/stm32_userspace.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/mm/mm.h>
|
||||
#include <nuttx/wqueue.h>
|
||||
#include <nuttx/userspace.h>
|
||||
|
||||
#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_NUTTX_USERSPACE
|
||||
# error "CONFIG_NUTTX_USERSPACE not defined"
|
||||
#endif
|
||||
|
||||
#if CONFIG_NUTTX_USERSPACE != 0x05020000
|
||||
# error "CONFIG_NUTTX_USERSPACE must be 0x05020000 to match memory.ld"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* These 'addresses' of these values are setup by the linker script. They are
|
||||
* not actual uint32_t storage locations! They are only used meaningfully in the
|
||||
* following way:
|
||||
*
|
||||
* - The linker script defines, for example, the symbol_sdata.
|
||||
* - The declaration extern uint32_t _sdata; makes C happy. C will believe
|
||||
* that the value _sdata is the address of a uint32_t variable _data (it is
|
||||
* not!).
|
||||
* - We can recover the linker value then by simply taking the address of
|
||||
* of _data. like: uint32_t *pdata = &_sdata;
|
||||
*/
|
||||
|
||||
extern uint32_t _stext; /* Start of .text */
|
||||
extern uint32_t _etext; /* End_1 of .text + .rodata */
|
||||
extern const uint32_t _eronly; /* End+1 of read only section (.text + .rodata) */
|
||||
extern uint32_t _sdata; /* Start of .data */
|
||||
extern uint32_t _edata; /* End+1 of .data */
|
||||
extern uint32_t _sbss; /* Start of .bss */
|
||||
extern uint32_t _ebss; /* End+1 of .bss */
|
||||
|
||||
/* This is the user space entry point */
|
||||
|
||||
int CONFIG_USER_ENTRYPOINT(int argc, char *argv[]);
|
||||
|
||||
const struct userspace_s userspace __attribute__ ((section (".userspace"))) =
|
||||
{
|
||||
/* General memory map */
|
||||
|
||||
.us_entrypoint = (main_t)CONFIG_USER_ENTRYPOINT,
|
||||
.us_textstart = (uintptr_t)&_stext,
|
||||
.us_textend = (uintptr_t)&_etext,
|
||||
.us_datasource = (uintptr_t)&_eronly,
|
||||
.us_datastart = (uintptr_t)&_sdata,
|
||||
.us_dataend = (uintptr_t)&_edata,
|
||||
.us_bssstart = (uintptr_t)&_sbss,
|
||||
.us_bssend = (uintptr_t)&_ebss,
|
||||
|
||||
/* Memory manager heap structure */
|
||||
|
||||
.us_heap = &g_mmheap,
|
||||
|
||||
/* Task/thread startup routines */
|
||||
|
||||
.task_startup = task_startup,
|
||||
#ifndef CONFIG_DISABLE_PTHREAD
|
||||
.pthread_startup = pthread_startup,
|
||||
#endif
|
||||
|
||||
/* Signal handler trampoline */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
.signal_handler = up_signal_handler,
|
||||
#endif
|
||||
|
||||
/* User-space work queue support (declared in include/nuttx/wqueue.h) */
|
||||
|
||||
#ifdef CONFIG_LIB_USRWORK
|
||||
.work_usrstart = work_usrstart,
|
||||
#endif
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */
|
119
configs/lc823450-xgevk/knsh/defconfig
Normal file
119
configs/lc823450-xgevk/knsh/defconfig
Normal file
@ -0,0 +1,119 @@
|
||||
# CONFIG_LC823450_SDIF is not set
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NX_DISABLE_1BPP is not set
|
||||
# CONFIG_SPI_EXCHANGE is not set
|
||||
CONFIG_ADC=y
|
||||
CONFIG_ANALOG=y
|
||||
CONFIG_AQM_1248A=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="lc823450-xgevk"
|
||||
CONFIG_ARCH_BOARD_LC823450_XGEVK=y
|
||||
CONFIG_ARCH_CHIP_LC823450=y
|
||||
CONFIG_ARCH_FLOAT_H=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STDARG_H=y
|
||||
CONFIG_ARM_MPU=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=12061
|
||||
CONFIG_BUILD_PROTECTED=y
|
||||
CONFIG_C99_BOOL8=y
|
||||
CONFIG_CODECS_HASH_MD5=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_DISABLE_POSIX_TIMERS=y
|
||||
CONFIG_EXAMPLES_NSH=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_WRITABLE=y
|
||||
CONFIG_HRT_TIMER=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2CTOOL_MAXBUS=1
|
||||
CONFIG_I2C_RESET=y
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LC823450_I2C0=y
|
||||
CONFIG_LC823450_I2C1=y
|
||||
CONFIG_LC823450_MTM0_TICK=y
|
||||
CONFIG_LC823450_SPIFI=y
|
||||
CONFIG_LC823450_SPI_DMA=y
|
||||
CONFIG_LC823450_UART0=y
|
||||
CONFIG_LC823450_WDT=y
|
||||
CONFIG_LCD=y
|
||||
CONFIG_LCD_ST7565=y
|
||||
CONFIG_LIBM=y
|
||||
CONFIG_LIB_KBDCODEC=y
|
||||
CONFIG_MAX_TASKS=64
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_MEMSET_OPTSPEED=y
|
||||
CONFIG_MQ_MAXMSGSIZE=64
|
||||
CONFIG_NAME_MAX=765
|
||||
CONFIG_NETUTILS_CODECS=y
|
||||
CONFIG_NFILE_DESCRIPTORS=45
|
||||
CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_DISABLE_BASENAME=y
|
||||
CONFIG_NSH_DISABLE_CP=y
|
||||
CONFIG_NSH_DISABLE_DD=y
|
||||
CONFIG_NSH_DISABLE_DIRNAME=y
|
||||
CONFIG_NSH_DISABLE_EXEC=y
|
||||
CONFIG_NSH_DISABLE_GET=y
|
||||
CONFIG_NSH_DISABLE_HEXDUMP=y
|
||||
CONFIG_NSH_DISABLE_IFCONFIG=y
|
||||
CONFIG_NSH_DISABLE_LOSETUP=y
|
||||
CONFIG_NSH_DISABLE_MB=y
|
||||
CONFIG_NSH_DISABLE_MD5=y
|
||||
CONFIG_NSH_DISABLE_MH=y
|
||||
CONFIG_NSH_DISABLE_MKDIR=y
|
||||
CONFIG_NSH_DISABLE_MKFIFO=y
|
||||
CONFIG_NSH_DISABLE_MKRD=y
|
||||
CONFIG_NSH_DISABLE_MV=y
|
||||
CONFIG_NSH_DISABLE_PUT=y
|
||||
CONFIG_NSH_DISABLE_RM=y
|
||||
CONFIG_NSH_DISABLE_RMDIR=y
|
||||
CONFIG_NSH_DISABLE_SH=y
|
||||
CONFIG_NSH_DISABLE_WGET=y
|
||||
CONFIG_NSH_DISABLE_XD=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_MAXARGUMENTS=10
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NUTTX_USERSPACE=0x05020000
|
||||
CONFIG_NX=y
|
||||
CONFIG_NXFONT_MONO5X8=y
|
||||
CONFIG_NX_BLOCKING=y
|
||||
CONFIG_PASS1_BUILDIR="configs/lc823450-xgevk/kernel"
|
||||
CONFIG_PIPES=y
|
||||
CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048
|
||||
CONFIG_PREALLOC_MQ_MSGS=4
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PREALLOC_WDOGS=16
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=3072
|
||||
CONFIG_RAM_SIZE=1044480
|
||||
CONFIG_RAM_START=0x02001000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_READLINE_CMD_HISTORY=y
|
||||
CONFIG_RTC=y
|
||||
CONFIG_RTC_DATETIME=y
|
||||
CONFIG_SCHED_ATEXIT=y
|
||||
CONFIG_SCHED_CHILD_STATUS=y
|
||||
CONFIG_SCHED_HAVE_PARENT=y
|
||||
CONFIG_SCHED_INSTRUMENTATION=y
|
||||
CONFIG_SCHED_INSTRUMENTATION_BUFFER=y
|
||||
CONFIG_SCHED_ONEXIT=y
|
||||
CONFIG_SCHED_ONEXIT_MAX=32
|
||||
CONFIG_SCHED_STARTHOOK=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SERIAL_TERMIOS=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_START_DAY=3
|
||||
CONFIG_START_MONTH=10
|
||||
CONFIG_START_YEAR=2013
|
||||
CONFIG_SYSTEM_I2CTOOL=y
|
||||
CONFIG_SYSTEM_TIME64=y
|
||||
CONFIG_SYS_RESERVED=8
|
||||
CONFIG_TASK_NAME_SIZE=24
|
||||
CONFIG_UART0_RXBUFSIZE=512
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_UART0_TXBUFSIZE=2048
|
||||
CONFIG_USERMAIN_STACKSIZE=3072
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
51
configs/lc823450-xgevk/kostest/defconfig
Normal file
51
configs/lc823450-xgevk/kostest/defconfig
Normal file
@ -0,0 +1,51 @@
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="lc823450-xgevk"
|
||||
CONFIG_ARCH_BOARD_LC823450_XGEVK=y
|
||||
CONFIG_ARCH_CHIP_LC823450=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_STDARG_H=y
|
||||
CONFIG_ARM_MPU=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=12061
|
||||
CONFIG_BUILD_PROTECTED=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEBUG_WARN=y
|
||||
CONFIG_DISABLE_ENVIRON=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_DISABLE_POLL=y
|
||||
CONFIG_EXAMPLES_OSTEST=y
|
||||
CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3
|
||||
CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LC823450_MTM0_TICK=y
|
||||
CONFIG_LC823450_UART0=y
|
||||
CONFIG_LC823450_SPIFI=y
|
||||
CONFIG_MAX_TASKS=16
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_NFILE_DESCRIPTORS=8
|
||||
CONFIG_NFILE_STREAMS=8
|
||||
CONFIG_NUTTX_USERSPACE=0x05020000
|
||||
CONFIG_PASS1_BUILDIR="configs/lc823450-xgevk/kernel"
|
||||
CONFIG_PREALLOC_MQ_MSGS=4
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PREALLOC_WDOGS=8
|
||||
CONFIG_RAM_SIZE=1044480
|
||||
CONFIG_RAM_START=0x02001000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_RTC=y
|
||||
CONFIG_RTC_DATETIME=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_START_DAY=3
|
||||
CONFIG_START_MONTH=10
|
||||
CONFIG_START_YEAR=2013
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_TIME64=y
|
||||
CONFIG_SYS_RESERVED=8
|
||||
CONFIG_UART0_RXBUFSIZE=512
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_UART0_TXBUFSIZE=2048
|
||||
CONFIG_USERMAIN_STACKSIZE=3072
|
||||
CONFIG_USER_ENTRYPOINT="ostest_main"
|
||||
CONFIG_WDOG_INTRESERVE=2
|
51
configs/lc823450-xgevk/scripts/memory.ld
Normal file
51
configs/lc823450-xgevk/scripts/memory.ld
Normal file
@ -0,0 +1,51 @@
|
||||
/****************************************************************************
|
||||
* configs/lc823450-xgevk/scripts/memory.ld
|
||||
*
|
||||
* Copyright 2018 Sony Video & Sound Products Inc.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* Based on configs/stm32f4discovery/scripts/memory.ld
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
/* 1024Kb FLASH (tentative) */
|
||||
|
||||
kflash (rx) : ORIGIN = 0x05000000, LENGTH = 128K
|
||||
uflash (rx) : ORIGIN = 0x05020000, LENGTH = 128K
|
||||
xflash (rx) : ORIGIN = 0x05040000, LENGTH = 768K
|
||||
|
||||
/* 256Kb SRAM (tentative) */
|
||||
|
||||
ksram (rwx) : ORIGIN = 0x020c0000, LENGTH = 32K
|
||||
usram (rwx) : ORIGIN = 0x020c4000, LENGTH = 32K
|
||||
xsram (rwx) : ORIGIN = 0x020c8000, LENGTH = 192K
|
||||
}
|
113
configs/lc823450-xgevk/scripts/user-space.ld
Normal file
113
configs/lc823450-xgevk/scripts/user-space.ld
Normal file
@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
* configs/lc823450-xgevk/scripts/user-space.ld
|
||||
*
|
||||
* Copyright 2018 Sony Video & Sound Products Inc.
|
||||
* Author: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
|
||||
*
|
||||
* Based on configs/stm32f4discovery/scripts/user-space.ld
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* NOTE: This depends on the memory.ld script having been included prior to
|
||||
* this script.
|
||||
*/
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
SECTIONS
|
||||
{
|
||||
.userspace : {
|
||||
*(.userspace)
|
||||
} > uflash
|
||||
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.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(.);
|
||||
} > usram AT > uflash
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > usram
|
||||
|
||||
/* 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) }
|
||||
}
|
Loading…
Reference in New Issue
Block a user