S32K3XX MR-CANHUBK3 Add protected knsh support
This commit is contained in:
parent
9eea82a61d
commit
b5fd0b2381
@ -76,6 +76,14 @@ ifeq ($(CONFIG_S32K3XX_QSPI),y)
|
|||||||
CHIP_CSRCS += s32k3xx_qspi.c
|
CHIP_CSRCS += s32k3xx_qspi.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||||
|
CHIP_CSRCS += s32k3xx_userspace.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARM_MPU),y)
|
||||||
|
CHIP_CSRCS += s32k3xx_mpuinit.c
|
||||||
|
endif
|
||||||
|
|
||||||
# Make sure that the S32K3 common directory in included in the VPATH
|
# Make sure that the S32K3 common directory in included in the VPATH
|
||||||
|
|
||||||
VPATH += chip/common
|
VPATH += chip/common
|
||||||
|
243
arch/arm/src/s32k3xx/s32k3xx_mpuinit.c
Normal file
243
arch/arm/src/s32k3xx/s32k3xx_mpuinit.c
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/s32k3xx/s32k3xx_mpuinit.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <nuttx/userspace.h>
|
||||||
|
|
||||||
|
#include "mpu.h"
|
||||||
|
#include "barriers.h"
|
||||||
|
#include "s32k3xx_mpuinit.h"
|
||||||
|
#include "arm_internal.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* 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
|
||||||
|
|
||||||
|
#ifndef CONFIG_ARMV7M_DCACHE
|
||||||
|
/* With Dcache off:
|
||||||
|
* Cacheable (MPU_RASR_C) and Bufferable (MPU_RASR_B) needs to be off
|
||||||
|
*/
|
||||||
|
# undef MPU_RASR_B
|
||||||
|
# define MPU_RASR_B 0
|
||||||
|
# define RASR_B_VALUE 0
|
||||||
|
# define RASR_C_VALUE 0
|
||||||
|
#else
|
||||||
|
# ifndef CONFIG_ARMV7M_DCACHE_WRITETHROUGH
|
||||||
|
/* With Dcache on:
|
||||||
|
* Cacheable (MPU_RASR_C) and Bufferable (MPU_RASR_B) needs to be on
|
||||||
|
*/
|
||||||
|
# define RASR_B_VALUE MPU_RASR_B
|
||||||
|
# define RASR_C_VALUE MPU_RASR_C
|
||||||
|
|
||||||
|
# else
|
||||||
|
/* With Dcache in WRITETHROUGH Bufferable (MPU_RASR_B)
|
||||||
|
* needs to be off, except for FLASH for alignment leniency
|
||||||
|
*/
|
||||||
|
# define RASR_B_VALUE 0
|
||||||
|
# define RASR_C_VALUE MPU_RASR_C
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
extern uint8_t SRAM_BASE_ADDR[];
|
||||||
|
extern uint8_t SRAM_INIT_END_ADDR[];
|
||||||
|
extern uint8_t ITCM_BASE_ADDR[];
|
||||||
|
extern uint8_t ITCM_END_ADDR[];
|
||||||
|
extern uint8_t DTCM_BASE_ADDR[];
|
||||||
|
extern uint8_t DTCM_END_ADDR[];
|
||||||
|
extern uint8_t FLASH_BASE_ADDR[];
|
||||||
|
extern uint8_t FLASH_END_ADDR[];
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpuinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the MPU to permit user-space access to only restricted SAM3U
|
||||||
|
* resources.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_USE_MPU)
|
||||||
|
void s32k3xx_mpuinitialize(void)
|
||||||
|
{
|
||||||
|
uint32_t regval;
|
||||||
|
uint32_t region;
|
||||||
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
|
uintptr_t datastart;
|
||||||
|
uintptr_t dataend;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Show MPU information */
|
||||||
|
|
||||||
|
mpu_showtype();
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARMV7M_DCACHE
|
||||||
|
/* Memory barrier */
|
||||||
|
|
||||||
|
ARM_DMB();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Reset MPU if enabled */
|
||||||
|
|
||||||
|
mpu_reset();
|
||||||
|
|
||||||
|
/* ARM errata 1013783-B Workaround */
|
||||||
|
|
||||||
|
region = mpu_allocregion();
|
||||||
|
DEBUGASSERT(region == 0);
|
||||||
|
|
||||||
|
/* Select the region */
|
||||||
|
|
||||||
|
putreg32(region, MPU_RNR);
|
||||||
|
|
||||||
|
/* Select the region base address */
|
||||||
|
|
||||||
|
putreg32(region | MPU_RBAR_VALID, MPU_RBAR);
|
||||||
|
|
||||||
|
/* The configure the region */
|
||||||
|
|
||||||
|
regval = MPU_RASR_ENABLE | /* Enable region */
|
||||||
|
MPU_RASR_SIZE_LOG2(32) | /* entire memory */
|
||||||
|
MPU_RASR_TEX_SO | /* Strongly ordered */
|
||||||
|
MPU_RASR_AP_RWRW | /* P:RW U:RW */
|
||||||
|
MPU_RASR_XN; /* Execute-never to prevent instruction fetch */
|
||||||
|
putreg32(regval, MPU_RASR);
|
||||||
|
|
||||||
|
mpu_configure_region((uintptr_t)FLASH_BASE_ADDR,
|
||||||
|
FLASH_END_ADDR - FLASH_BASE_ADDR,
|
||||||
|
MPU_RASR_TEX_SO | /* Strongly ordered */
|
||||||
|
RASR_C_VALUE | /* Cacheable */
|
||||||
|
MPU_RASR_B | /* Bufferable
|
||||||
|
* Not Shareable */
|
||||||
|
MPU_RASR_AP_RORO); /* P:RO U:RO
|
||||||
|
* Instruction access */
|
||||||
|
|
||||||
|
mpu_configure_region((uintptr_t)SRAM_BASE_ADDR,
|
||||||
|
SRAM_INIT_END_ADDR - SRAM_BASE_ADDR,
|
||||||
|
MPU_RASR_TEX_SO | /* Strongly ordered */
|
||||||
|
RASR_C_VALUE | /* Cacheable */
|
||||||
|
RASR_B_VALUE | /* Bufferable
|
||||||
|
* Not Shareable */
|
||||||
|
MPU_RASR_AP_RWRW); /* P:RW U:RW
|
||||||
|
* Instruction access */
|
||||||
|
|
||||||
|
mpu_configure_region((uintptr_t)ITCM_BASE_ADDR,
|
||||||
|
ITCM_END_ADDR - ITCM_BASE_ADDR,
|
||||||
|
MPU_RASR_TEX_SO | /* Strongly ordered */
|
||||||
|
RASR_C_VALUE | /* Cacheable */
|
||||||
|
RASR_B_VALUE | /* Bufferable
|
||||||
|
* Not Shareable */
|
||||||
|
MPU_RASR_AP_RWRW); /* P:RW U:RW
|
||||||
|
* Instruction access */
|
||||||
|
|
||||||
|
mpu_configure_region((uintptr_t)DTCM_BASE_ADDR,
|
||||||
|
DTCM_END_ADDR - DTCM_BASE_ADDR,
|
||||||
|
MPU_RASR_TEX_SO | /* Strongly ordered */
|
||||||
|
RASR_C_VALUE | /* Cacheable */
|
||||||
|
RASR_B_VALUE | /* Bufferable
|
||||||
|
* Not Shareable */
|
||||||
|
MPU_RASR_AP_RWRW); /* P:RW U:RW
|
||||||
|
* Instruction access */
|
||||||
|
|
||||||
|
mpu_configure_region(0x40000000, 3 * 2048 * 1024,
|
||||||
|
MPU_RASR_TEX_DEV | /* Device
|
||||||
|
* Not Cacheable
|
||||||
|
* Not Bufferable
|
||||||
|
* Not Shareable */
|
||||||
|
MPU_RASR_AP_RWRW); /* P:RW U:RW
|
||||||
|
* Instruction access */
|
||||||
|
|
||||||
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
|
/* Configure user flash and SRAM space */
|
||||||
|
|
||||||
|
DEBUGASSERT(USERSPACE->us_textend >= USERSPACE->us_textstart);
|
||||||
|
|
||||||
|
mpu_user_flash(USERSPACE->us_textstart,
|
||||||
|
USERSPACE->us_textend - USERSPACE->us_textstart);
|
||||||
|
|
||||||
|
datastart = MIN(USERSPACE->us_datastart, USERSPACE->us_bssstart);
|
||||||
|
dataend = MAX(USERSPACE->us_dataend, USERSPACE->us_bssend);
|
||||||
|
|
||||||
|
DEBUGASSERT(dataend >= datastart);
|
||||||
|
|
||||||
|
mpu_user_intsram(datastart, dataend - datastart);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Then enable the MPU */
|
||||||
|
|
||||||
|
mpu_control(true, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARM_MPU)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpu_uheap
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Map the user-heap region.
|
||||||
|
*
|
||||||
|
* This logic may need an extension to handle external SDRAM).
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void s32k3xx_mpu_uheap(uintptr_t start, size_t size)
|
||||||
|
{
|
||||||
|
/* Configure the user SRAM space
|
||||||
|
* Ordered
|
||||||
|
* Cacheable
|
||||||
|
* Not Bufferable
|
||||||
|
* Not Shareable
|
||||||
|
* P:RW U:RW
|
||||||
|
* Instruction access
|
||||||
|
*/
|
||||||
|
|
||||||
|
mpu_configure_region(start, size,
|
||||||
|
MPU_RASR_TEX_SO |
|
||||||
|
MPU_RASR_C |
|
||||||
|
MPU_RASR_AP_RWRW
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARM_MPU */
|
102
arch/arm/src/s32k3xx/s32k3xx_mpuinit.h
Normal file
102
arch/arm/src/s32k3xx/s32k3xx_mpuinit.h
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/s32k3xx/s32k3xx_mpuinit.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ARCH_ARM_SRC_S32K3XX_MPUINIT_H
|
||||||
|
#define __ARCH_ARM_SRC_S32K3XX_MPUINIT_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpuinitialize
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpuinitialize
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpuinitialize
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpuinitialize
|
||||||
|
* Inline Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpuinitialize
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpuinitialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Configure the MPU to permit user-space access to only unrestricted
|
||||||
|
* S32K3XX resources.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_USE_MPU
|
||||||
|
void s32k3xx_mpuinitialize(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_mpu_uheap
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Map the user heap region.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
|
void s32k3xx_mpu_uheap(uintptr_t start, size_t size);
|
||||||
|
#else
|
||||||
|
# define s32k3xx_mpu_uheap(start,size)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __ARCH_ARM_SRC_S32K3XX_MPUINIT_H */
|
@ -36,7 +36,6 @@
|
|||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
|
|
||||||
#include "arm_internal.h"
|
#include "arm_internal.h"
|
||||||
#include "barriers.h"
|
|
||||||
#include "nvic.h"
|
#include "nvic.h"
|
||||||
|
|
||||||
#ifdef CONFIG_BUILD_PROTECTED
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
@ -51,7 +50,7 @@
|
|||||||
#include "s32k3xx_swt.h"
|
#include "s32k3xx_swt.h"
|
||||||
#include "s32k3xx_start.h"
|
#include "s32k3xx_start.h"
|
||||||
#if defined(CONFIG_ARCH_USE_MPU)
|
#if defined(CONFIG_ARCH_USE_MPU)
|
||||||
#include "mpu.h"
|
#include "s32k3xx_mpuinit.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_S32K3XX_PROGMEM
|
#ifdef CONFIG_S32K3XX_PROGMEM
|
||||||
@ -95,31 +94,6 @@
|
|||||||
|
|
||||||
#define STARTUP_ECC_INITVALUE 0
|
#define STARTUP_ECC_INITVALUE 0
|
||||||
|
|
||||||
#ifndef CONFIG_ARMV7M_DCACHE
|
|
||||||
/* With Dcache off:
|
|
||||||
* Cacheable (MPU_RASR_C) and Bufferable (MPU_RASR_B) needs to be off
|
|
||||||
*/
|
|
||||||
# undef MPU_RASR_B
|
|
||||||
# define MPU_RASR_B 0
|
|
||||||
# define RASR_B_VALUE 0
|
|
||||||
# define RASR_C_VALUE 0
|
|
||||||
#else
|
|
||||||
# ifndef CONFIG_ARMV7M_DCACHE_WRITETHROUGH
|
|
||||||
/* With Dcache on:
|
|
||||||
* Cacheable (MPU_RASR_C) and Bufferable (MPU_RASR_B) needs to be on
|
|
||||||
*/
|
|
||||||
# define RASR_B_VALUE MPU_RASR_B
|
|
||||||
# define RASR_C_VALUE MPU_RASR_C
|
|
||||||
|
|
||||||
# else
|
|
||||||
/* With Dcache in WRITETHROUGH Bufferable (MPU_RASR_B)
|
|
||||||
* needs to be off, except for FLASH for alignment leniency
|
|
||||||
*/
|
|
||||||
# define RASR_B_VALUE 0
|
|
||||||
# define RASR_C_VALUE MPU_RASR_C
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: showprogress
|
* Name: showprogress
|
||||||
*
|
*
|
||||||
@ -147,110 +121,6 @@ extern uint8_t DTCM_END_ADDR[];
|
|||||||
extern uint8_t FLASH_BASE_ADDR[];
|
extern uint8_t FLASH_BASE_ADDR[];
|
||||||
extern uint8_t FLASH_END_ADDR[];
|
extern uint8_t FLASH_END_ADDR[];
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: s32k3xx_mpu_config
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Enable all bus masters.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_USE_MPU)
|
|
||||||
static inline void s32k3xx_mpu_config(void)
|
|
||||||
{
|
|
||||||
uint32_t regval;
|
|
||||||
uint32_t region;
|
|
||||||
|
|
||||||
/* Show MPU information */
|
|
||||||
|
|
||||||
mpu_showtype();
|
|
||||||
|
|
||||||
#ifdef CONFIG_ARMV7M_DCACHE
|
|
||||||
/* Memory barrier */
|
|
||||||
|
|
||||||
ARM_DMB();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Reset MPU if enabled */
|
|
||||||
|
|
||||||
mpu_reset();
|
|
||||||
|
|
||||||
/* ARM errata 1013783-B Workaround */
|
|
||||||
|
|
||||||
region = mpu_allocregion();
|
|
||||||
DEBUGASSERT(region == 0);
|
|
||||||
|
|
||||||
/* Select the region */
|
|
||||||
|
|
||||||
putreg32(region, MPU_RNR);
|
|
||||||
|
|
||||||
/* Select the region base address */
|
|
||||||
|
|
||||||
putreg32(region | MPU_RBAR_VALID, MPU_RBAR);
|
|
||||||
|
|
||||||
/* The configure the region */
|
|
||||||
|
|
||||||
regval = MPU_RASR_ENABLE | /* Enable region */
|
|
||||||
MPU_RASR_SIZE_LOG2(32) | /* entire memory */
|
|
||||||
MPU_RASR_TEX_SO | /* Strongly ordered */
|
|
||||||
MPU_RASR_AP_RWRW | /* P:RW U:RW */
|
|
||||||
MPU_RASR_XN; /* Execute-never to prevent instruction fetch */
|
|
||||||
putreg32(regval, MPU_RASR);
|
|
||||||
|
|
||||||
mpu_configure_region((uintptr_t)FLASH_BASE_ADDR,
|
|
||||||
FLASH_END_ADDR - FLASH_BASE_ADDR,
|
|
||||||
MPU_RASR_TEX_SO | /* Strongly ordered */
|
|
||||||
RASR_C_VALUE | /* Cacheable */
|
|
||||||
MPU_RASR_B | /* Bufferable
|
|
||||||
* Not Shareable */
|
|
||||||
MPU_RASR_AP_RORO); /* P:RO U:RO
|
|
||||||
* Instruction access */
|
|
||||||
|
|
||||||
mpu_configure_region((uintptr_t)SRAM_BASE_ADDR,
|
|
||||||
SRAM_INIT_END_ADDR - SRAM_BASE_ADDR,
|
|
||||||
MPU_RASR_TEX_SO | /* Strongly ordered */
|
|
||||||
RASR_C_VALUE | /* Cacheable */
|
|
||||||
RASR_B_VALUE | /* Bufferable
|
|
||||||
* Not Shareable */
|
|
||||||
MPU_RASR_AP_RWRW); /* P:RW U:RW
|
|
||||||
* Instruction access */
|
|
||||||
|
|
||||||
mpu_configure_region((uintptr_t)ITCM_BASE_ADDR,
|
|
||||||
ITCM_END_ADDR - ITCM_BASE_ADDR,
|
|
||||||
MPU_RASR_TEX_SO | /* Strongly ordered */
|
|
||||||
RASR_C_VALUE | /* Cacheable */
|
|
||||||
RASR_B_VALUE | /* Bufferable
|
|
||||||
* Not Shareable */
|
|
||||||
MPU_RASR_AP_RWRW); /* P:RW U:RW
|
|
||||||
* Instruction access */
|
|
||||||
|
|
||||||
mpu_configure_region((uintptr_t)DTCM_BASE_ADDR,
|
|
||||||
DTCM_END_ADDR - DTCM_BASE_ADDR,
|
|
||||||
MPU_RASR_TEX_SO | /* Strongly ordered */
|
|
||||||
RASR_C_VALUE | /* Cacheable */
|
|
||||||
RASR_B_VALUE | /* Bufferable
|
|
||||||
* Not Shareable */
|
|
||||||
MPU_RASR_AP_RWRW); /* P:RW U:RW
|
|
||||||
* Instruction access */
|
|
||||||
|
|
||||||
mpu_configure_region(0x40000000, 3 * 2048 * 1024,
|
|
||||||
MPU_RASR_TEX_DEV | /* Device
|
|
||||||
* Not Cacheable
|
|
||||||
* Not Bufferable
|
|
||||||
* Not Shareable */
|
|
||||||
MPU_RASR_AP_RWRW); /* P:RW U:RW
|
|
||||||
* Instruction access */
|
|
||||||
|
|
||||||
/* Then enable the MPU */
|
|
||||||
|
|
||||||
mpu_control(true, false, true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -348,11 +218,23 @@ void s32k3xx_start(void)
|
|||||||
|
|
||||||
arm_fpuconfig();
|
arm_fpuconfig();
|
||||||
|
|
||||||
#if defined(CONFIG_ARCH_USE_MPU)
|
#ifdef CONFIG_ARM_MPU
|
||||||
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Config MPU regions */
|
s32k3xx_userspace();
|
||||||
|
#endif
|
||||||
|
|
||||||
s32k3xx_mpu_config();
|
/* Configure the MPU to permit user-space access to its FLASH and RAM (for
|
||||||
|
* CONFIG_BUILD_PROTECTED) or to manage cache properties in external
|
||||||
|
* memory regions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
s32k3xx_mpuinitialize();
|
||||||
showprogress('D');
|
showprogress('D');
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -378,17 +260,6 @@ void s32k3xx_start(void)
|
|||||||
s32k3xx_eeeprom_init();
|
s32k3xx_eeeprom_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 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
|
|
||||||
s32k3xx_userspace();
|
|
||||||
showprogress('F');
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Initialize on-board resources */
|
/* Initialize on-board resources */
|
||||||
|
|
||||||
showprogress('G');
|
showprogress('G');
|
||||||
|
87
arch/arm/src/s32k3xx/s32k3xx_userspace.c
Normal file
87
arch/arm/src/s32k3xx/s32k3xx_userspace.c
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/s32k3xx/s32k3xx_userspace.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <nuttx/userspace.h>
|
||||||
|
|
||||||
|
#include "s32k3xx_userspace.h"
|
||||||
|
#include "mpu.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_BUILD_PROTECTED
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_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 s32k3xx_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++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_BUILD_PROTECTED */
|
90
arch/arm/src/s32k3xx/s32k3xx_userspace.h
Normal file
90
arch/arm/src/s32k3xx/s32k3xx_userspace.h
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/s32k3xx/s32k3xx_userspace.h
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ARCH_ARM_SRC_S32K3XX_USERSPACE_H
|
||||||
|
#define __ARCH_ARM_SRC_S32K3XX_USERSPACE_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <nuttx/compiler.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "arm_internal.h"
|
||||||
|
#include "chip.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Types
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Inline Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ASSEMBLY__
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Function Prototypes
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: s32k3xx_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 s32k3xx_userspace(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef EXTERN
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __ASSEMBLY__ */
|
||||||
|
#endif /* __ARCH_ARM_SRC_S32K3XX_USERSPACE_H */
|
49
boards/arm/s32k3xx/mr-canhubk3/configs/knsh/Make.defs
Normal file
49
boards/arm/s32k3xx/mr-canhubk3/configs/knsh/Make.defs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/arm/s32k3xx/mr-canhubk3/configs/knsh/Make.defs
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/.config
|
||||||
|
include $(TOPDIR)/tools/Config.mk
|
||||||
|
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
|
||||||
|
|
||||||
|
LDSCRIPT1 = memory.ld
|
||||||
|
LDSCRIPT2 = kernel-space.ld
|
||||||
|
|
||||||
|
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT1)
|
||||||
|
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT2)
|
||||||
|
|
||||||
|
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||||
|
|
||||||
|
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||||
|
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||||
|
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||||
|
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||||
|
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||||
|
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||||
|
|
||||||
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||||
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||||
|
LDNXFLATFLAGS = -e main -s 2048
|
||||||
|
|
||||||
|
# Loadable module definitions
|
||||||
|
|
||||||
|
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||||
|
|
||||||
|
LDMODULEFLAGS = -r -e module_initialize
|
||||||
|
LDMODULEFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/modlib/gnu-elf.ld)
|
119
boards/arm/s32k3xx/mr-canhubk3/configs/knsh/defconfig
Normal file
119
boards/arm/s32k3xx/mr-canhubk3/configs/knsh/defconfig
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
#
|
||||||
|
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||||
|
#
|
||||||
|
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||||
|
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||||
|
# modifications.
|
||||||
|
#
|
||||||
|
# CONFIG_ARCH_FPU is not set
|
||||||
|
# CONFIG_NSH_ARGCAT is not set
|
||||||
|
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||||
|
# CONFIG_NSH_CMDPARMS is not set
|
||||||
|
# CONFIG_NSH_DISABLE_DATE is not set
|
||||||
|
CONFIG_ALLOW_GPL_COMPONENTS=y
|
||||||
|
CONFIG_ARCH="arm"
|
||||||
|
CONFIG_ARCH_BOARD="mr-canhubk3"
|
||||||
|
CONFIG_ARCH_BOARD_MR_CANHUBK3=y
|
||||||
|
CONFIG_ARCH_BUTTONS=y
|
||||||
|
CONFIG_ARCH_CHIP="s32k3xx"
|
||||||
|
CONFIG_ARCH_CHIP_S32K344=y
|
||||||
|
CONFIG_ARCH_CHIP_S32K3XX=y
|
||||||
|
CONFIG_ARCH_IRQBUTTONS=y
|
||||||
|
CONFIG_ARCH_STACKDUMP=y
|
||||||
|
CONFIG_ARMV7M_DCACHE=y
|
||||||
|
CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y
|
||||||
|
CONFIG_ARMV7M_DTCM=y
|
||||||
|
CONFIG_ARMV7M_ICACHE=y
|
||||||
|
CONFIG_BOARD_LOOPSPERMSEC=14539
|
||||||
|
CONFIG_BUILD_PROTECTED=y
|
||||||
|
CONFIG_BUILTIN=y
|
||||||
|
CONFIG_CANUTILS_CANDUMP=y
|
||||||
|
CONFIG_CANUTILS_CANSEND=y
|
||||||
|
CONFIG_EXAMPLES_BUTTONS=y
|
||||||
|
CONFIG_EXAMPLES_HELLO=y
|
||||||
|
CONFIG_FLEXCAN0_ARBI_BITRATE=500000
|
||||||
|
CONFIG_FLEXCAN0_DATA_BITRATE=2000000
|
||||||
|
CONFIG_FLEXCAN1_ARBI_BITRATE=500000
|
||||||
|
CONFIG_FLEXCAN1_DATA_BITRATE=2000000
|
||||||
|
CONFIG_FLEXCAN2_ARBI_BITRATE=500000
|
||||||
|
CONFIG_FLEXCAN2_DATA_BITRATE=2000000
|
||||||
|
CONFIG_FLEXCAN3_ARBI_BITRATE=500000
|
||||||
|
CONFIG_FLEXCAN3_DATA_BITRATE=2000000
|
||||||
|
CONFIG_FLEXCAN4_ARBI_BITRATE=500000
|
||||||
|
CONFIG_FLEXCAN4_DATA_BITRATE=2000000
|
||||||
|
CONFIG_FLEXCAN5_ARBI_BITRATE=500000
|
||||||
|
CONFIG_FLEXCAN5_DATA_BITRATE=2000000
|
||||||
|
CONFIG_FS_LITTLEFS=y
|
||||||
|
CONFIG_FS_PROCFS=y
|
||||||
|
CONFIG_HAVE_CXX=y
|
||||||
|
CONFIG_HAVE_CXXINITIALIZE=y
|
||||||
|
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||||
|
CONFIG_INPUT=y
|
||||||
|
CONFIG_INPUT_BUTTONS=y
|
||||||
|
CONFIG_INPUT_BUTTONS_LOWER=y
|
||||||
|
CONFIG_IOB_HEADSIZE=196
|
||||||
|
CONFIG_IOB_NOTIFIER=y
|
||||||
|
CONFIG_IOB_THROTTLE=12
|
||||||
|
CONFIG_LPUART2_SERIAL_CONSOLE=y
|
||||||
|
CONFIG_MM_KERNEL_HEAPSIZE=131072
|
||||||
|
CONFIG_MM_REGIONS=2
|
||||||
|
CONFIG_MTD=y
|
||||||
|
CONFIG_MTD_MX25RXX=y
|
||||||
|
CONFIG_MX25RXX_LXX=y
|
||||||
|
CONFIG_NET=y
|
||||||
|
CONFIG_NETDB_DNSCLIENT=y
|
||||||
|
CONFIG_NETDEV_IFINDEX=y
|
||||||
|
CONFIG_NETDEV_LATEINIT=y
|
||||||
|
CONFIG_NETUTILS_PING=y
|
||||||
|
CONFIG_NET_CAN=y
|
||||||
|
CONFIG_NET_CAN_EXTID=y
|
||||||
|
CONFIG_NET_CAN_NOTIFIER=y
|
||||||
|
CONFIG_NET_CAN_SOCK_OPTS=y
|
||||||
|
CONFIG_NET_ICMP=y
|
||||||
|
CONFIG_NET_TCP=y
|
||||||
|
CONFIG_NET_TIMESTAMP=y
|
||||||
|
CONFIG_NET_UDP=y
|
||||||
|
CONFIG_NSH_ARCHINIT=y
|
||||||
|
CONFIG_NSH_BUILTIN_APPS=y
|
||||||
|
CONFIG_NSH_FILEIOSIZE=512
|
||||||
|
CONFIG_NSH_READLINE=y
|
||||||
|
CONFIG_NUTTX_USERSPACE=0x00501000
|
||||||
|
CONFIG_PASS1_BUILDIR="boards/arm/s32k3xx/mr-canhubk3/kernel"
|
||||||
|
CONFIG_PREALLOC_TIMERS=4
|
||||||
|
CONFIG_RAM_SIZE=272000
|
||||||
|
CONFIG_RAM_START=0x20400000
|
||||||
|
CONFIG_RAW_BINARY=y
|
||||||
|
CONFIG_RR_INTERVAL=200
|
||||||
|
CONFIG_S32K3XX_DTCM_HEAP=y
|
||||||
|
CONFIG_S32K3XX_EIRQINTS=y
|
||||||
|
CONFIG_S32K3XX_ENET=y
|
||||||
|
CONFIG_S32K3XX_FLEXCAN0=y
|
||||||
|
CONFIG_S32K3XX_FLEXCAN1=y
|
||||||
|
CONFIG_S32K3XX_FLEXCAN2=y
|
||||||
|
CONFIG_S32K3XX_FLEXCAN3=y
|
||||||
|
CONFIG_S32K3XX_FLEXCAN4=y
|
||||||
|
CONFIG_S32K3XX_FLEXCAN5=y
|
||||||
|
CONFIG_S32K3XX_FS26=y
|
||||||
|
CONFIG_S32K3XX_GPIOIRQ=y
|
||||||
|
CONFIG_S32K3XX_LPI2C0=y
|
||||||
|
CONFIG_S32K3XX_LPI2C1=y
|
||||||
|
CONFIG_S32K3XX_LPSPI3=y
|
||||||
|
CONFIG_S32K3XX_LPSPI3_PINCFG=3
|
||||||
|
CONFIG_S32K3XX_LPUART0=y
|
||||||
|
CONFIG_S32K3XX_LPUART10=y
|
||||||
|
CONFIG_S32K3XX_LPUART13=y
|
||||||
|
CONFIG_S32K3XX_LPUART14=y
|
||||||
|
CONFIG_S32K3XX_LPUART1=y
|
||||||
|
CONFIG_S32K3XX_LPUART2=y
|
||||||
|
CONFIG_S32K3XX_LPUART9=y
|
||||||
|
CONFIG_S32K3XX_QSPI=y
|
||||||
|
CONFIG_S32K3XX_TJA1153=y
|
||||||
|
CONFIG_SCHED_LPWORK=y
|
||||||
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SPI_DRIVER=y
|
||||||
|
CONFIG_START_DAY=30
|
||||||
|
CONFIG_START_MONTH=5
|
||||||
|
CONFIG_START_YEAR=2022
|
||||||
|
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||||
|
CONFIG_SYSTEM_NSH=y
|
||||||
|
CONFIG_TIMER=y
|
92
boards/arm/s32k3xx/mr-canhubk3/kernel/Makefile
Normal file
92
boards/arm/s32k3xx/mr-canhubk3/kernel/Makefile
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
############################################################################
|
||||||
|
# boards/arm/s32k3xx/mr-canhubk3/kernel/Makefile
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership. The
|
||||||
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance with the
|
||||||
|
# License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
|
# The entry point name (if none is provided in the .config file)
|
||||||
|
|
||||||
|
CONFIG_INIT_ENTRYPOINT ?= user_start
|
||||||
|
ENTRYPT = $(patsubst "%",%,$(CONFIG_INIT_ENTRYPOINT))
|
||||||
|
|
||||||
|
# Get the paths to the libraries and the links script path in format that
|
||||||
|
# is appropriate for the host OS
|
||||||
|
|
||||||
|
USER_LIBPATHS = $(addprefix -L,$(call CONVERT_PATH,$(addprefix $(TOPDIR)$(DELIM),$(dir $(USERLIBS)))))
|
||||||
|
USER_LDSCRIPT = -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld)
|
||||||
|
USER_LDSCRIPT += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld)
|
||||||
|
USER_HEXFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.hex)
|
||||||
|
USER_SRECFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.srec)
|
||||||
|
USER_BINFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.bin)
|
||||||
|
|
||||||
|
USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT) --print-memory-usage
|
||||||
|
USER_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(USERLIBS))))
|
||||||
|
USER_LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}"
|
||||||
|
|
||||||
|
# Source files
|
||||||
|
|
||||||
|
CSRCS = s32k3xx_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
|
99
boards/arm/s32k3xx/mr-canhubk3/kernel/s32k3xx_userspace.c
Normal file
99
boards/arm/s32k3xx/mr-canhubk3/kernel/s32k3xx_userspace.c
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* boards/arm/s32k3xx/mr-canhubk3/kernel/s32k3xx_userspace.c
|
||||||
|
*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership. The
|
||||||
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the
|
||||||
|
* License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <nuttx/userspace.h>
|
||||||
|
#include <nuttx/wqueue.h>
|
||||||
|
#include <nuttx/mm/mm.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 != 0x00501000
|
||||||
|
# error "CONFIG_NUTTX_USERSPACE must be 0x00501000 to match user-space.ld"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* These 'addresses' of these values are setup by the linker script. */
|
||||||
|
|
||||||
|
extern uint8_t _stext[]; /* Start of .text */
|
||||||
|
extern uint8_t _etext[]; /* End_1 of .text + .rodata */
|
||||||
|
extern const uint8_t _eronly[]; /* End+1 of read only section (.text + .rodata) */
|
||||||
|
extern uint8_t _sdata[]; /* Start of .data */
|
||||||
|
extern uint8_t _edata[]; /* End+1 of .data */
|
||||||
|
extern uint8_t _sbss[]; /* Start of .bss */
|
||||||
|
extern uint8_t _ebss[]; /* End+1 of .bss */
|
||||||
|
|
||||||
|
const struct userspace_s userspace locate_data(".userspace") =
|
||||||
|
{
|
||||||
|
/* General memory map */
|
||||||
|
|
||||||
|
.us_entrypoint = CONFIG_INIT_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 = nxtask_startup,
|
||||||
|
|
||||||
|
/* Signal handler trampoline */
|
||||||
|
|
||||||
|
.signal_handler = up_signal_handler,
|
||||||
|
|
||||||
|
/* User-space work queue support (declared in include/nuttx/wqueue.h) */
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIBC_USRWORK
|
||||||
|
.work_usrstart = work_usrstart,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */
|
@ -47,3 +47,10 @@ AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
|||||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||||
LDNXFLATFLAGS = -e main -s 2048
|
LDNXFLATFLAGS = -e main -s 2048
|
||||||
|
|
||||||
|
# Loadable module definitions
|
||||||
|
|
||||||
|
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||||
|
|
||||||
|
LDMODULEFLAGS = -r -e module_initialize
|
||||||
|
LDMODULEFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/modlib/gnu-elf.ld)
|
||||||
|
153
boards/arm/s32k3xx/mr-canhubk3/scripts/kernel-space.ld
Normal file
153
boards/arm/s32k3xx/mr-canhubk3/scripts/kernel-space.ld
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* kernel-space.ld
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* NOTE: This depends on the memory.ld script having been included prior to
|
||||||
|
* this script.
|
||||||
|
*/
|
||||||
|
|
||||||
|
OUTPUT_ARCH(arm)
|
||||||
|
EXTERN(_vectors)
|
||||||
|
EXTERN(boot_header)
|
||||||
|
ENTRY(_stext)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ensure that abort() is present in the final object. The exception handling
|
||||||
|
* code pulled in by libgcc.a requires it (and that code cannot be easily avoided).
|
||||||
|
*/
|
||||||
|
EXTERN(abort)
|
||||||
|
EXTERN(_bootdelay_signature)
|
||||||
|
/*
|
||||||
|
* TODO: Fill in the signature location into TOC from user-space elf
|
||||||
|
EXTERN(_main_toc)
|
||||||
|
*/
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
|
||||||
|
.boot_header :
|
||||||
|
{
|
||||||
|
KEEP(*(.boot_header))
|
||||||
|
} > BOOT_HEADER
|
||||||
|
|
||||||
|
.text : {
|
||||||
|
_stext = ABSOLUTE(.);
|
||||||
|
*(.vectors)
|
||||||
|
. = ALIGN(32);
|
||||||
|
/*
|
||||||
|
This signature provides the bootloader with a way to delay booting
|
||||||
|
*/
|
||||||
|
_bootdelay_signature = ABSOLUTE(.);
|
||||||
|
FILL(0xffecc2925d7d05c5)
|
||||||
|
. += 8;
|
||||||
|
/*
|
||||||
|
*(.main_toc)
|
||||||
|
*/
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.fixup)
|
||||||
|
*(.gnu.warning)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
*(.gnu.linkonce.t.*)
|
||||||
|
*(.glue_7)
|
||||||
|
*(.glue_7t)
|
||||||
|
*(.got)
|
||||||
|
*(.gcc_except_table)
|
||||||
|
*(.gnu.linkonce.r.*)
|
||||||
|
_etext = ABSOLUTE(.);
|
||||||
|
} > kflash
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Init functions (static constructors and the like)
|
||||||
|
*/
|
||||||
|
.init_section : {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
KEEP(*(.init_array .init_array.*))
|
||||||
|
_einit = ABSOLUTE(.);
|
||||||
|
} > kflash
|
||||||
|
|
||||||
|
|
||||||
|
.ARM.extab : {
|
||||||
|
*(.ARM.extab*)
|
||||||
|
} > kflash
|
||||||
|
|
||||||
|
__exidx_start = ABSOLUTE(.);
|
||||||
|
.ARM.exidx : {
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
} > kflash
|
||||||
|
|
||||||
|
__exidx_end = ABSOLUTE(.);
|
||||||
|
|
||||||
|
_eronly = ABSOLUTE(.);
|
||||||
|
|
||||||
|
.data : {
|
||||||
|
_sdata = ABSOLUTE(.);
|
||||||
|
*(.data .data.*)
|
||||||
|
*(.gnu.linkonce.d.*)
|
||||||
|
CONSTRUCTORS
|
||||||
|
_edata = ABSOLUTE(.);
|
||||||
|
} > ksram AT > kflash
|
||||||
|
|
||||||
|
.bss : {
|
||||||
|
_sbss = ABSOLUTE(.);
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(.gnu.linkonce.b.*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = ABSOLUTE(.);
|
||||||
|
} > ksram
|
||||||
|
|
||||||
|
/* 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) }
|
||||||
|
|
||||||
|
.ramfunc : {
|
||||||
|
_sramfuncs = .;
|
||||||
|
*(.ramfunc .ramfunc.*)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_eramfuncs = .;
|
||||||
|
} > ksram AT > kflash
|
||||||
|
|
||||||
|
_framfuncs = LOADADDR(.ramfunc);
|
||||||
|
}
|
88
boards/arm/s32k3xx/mr-canhubk3/scripts/memory.ld
Normal file
88
boards/arm/s32k3xx/mr-canhubk3/scripts/memory.ld
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* scripts/memory.ld
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* 0x00400000 - 0x007fffff 4194304 Program Flash (last 64K sBAF)
|
||||||
|
* 0x10000000 - 0x1003ffff 262144 Data Flash (last 32K HSE_NVM)
|
||||||
|
* 0x20400000 - 0x20408000 32768 Standby RAM_0 (32K)
|
||||||
|
* 0x20400000 - 0x20427fff 163840 SRAM_0
|
||||||
|
* 0x20428000 - 0x2044ffff 163840 SRAM_1
|
||||||
|
*
|
||||||
|
* Last 48 KB of SRAM_1 reserved by HSE Firmware
|
||||||
|
* Last 128 KB of CODE_FLASH_3 reserved by HSE Firmware
|
||||||
|
* Last 128 KB of DATA_FLASH reserved by HSE Firmware (not supported in this linker file)
|
||||||
|
*
|
||||||
|
* Note Standby RAM and SRAM overlaps in NuttX since we dont use the Standby functionality
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
/* 4096KB FLASH*/
|
||||||
|
|
||||||
|
BOOT_HEADER (R) : ORIGIN = 0x00400000, LENGTH = 0x00001000 /* 0x00400000 - 0x00400fff */
|
||||||
|
flash (rx) : ORIGIN = 0x00401000, LENGTH = 0x003cffff
|
||||||
|
kflash (rx) : ORIGIN = 0x00401000, LENGTH = 1024K
|
||||||
|
uflash (rx) : ORIGIN = 0x00401000+1024K, LENGTH = 0x003cffff-1024K
|
||||||
|
|
||||||
|
/* ITCM RAM */
|
||||||
|
|
||||||
|
itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 64K
|
||||||
|
|
||||||
|
/* DTCM SRAM */
|
||||||
|
|
||||||
|
dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
|
||||||
|
|
||||||
|
/* SRAM */
|
||||||
|
sram0_stdby (rwx) : ORIGIN = 0x20400000, LENGTH = 32K
|
||||||
|
sram (rwx) : ORIGIN = 0x20400000, LENGTH = 272K
|
||||||
|
ksram (rwx) : ORIGIN = 0x20400000, LENGTH = 128K
|
||||||
|
usram (rwx) : ORIGIN = 0x20400000+128K, LENGTH = 272K-128K
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CM7_0_START_ADDRESS = ORIGIN(flash);
|
||||||
|
SRAM_BASE_ADDR = ORIGIN(sram);
|
||||||
|
SRAM_END_ADDR = ORIGIN(sram) + LENGTH(sram);
|
||||||
|
SRAM_STDBY_BASE_ADDR = ORIGIN(sram0_stdby);
|
||||||
|
SRAM_STDBY_END_ADDR = ORIGIN(sram0_stdby) + LENGTH(sram0_stdby);
|
||||||
|
SRAM_INIT_END_ADDR = ORIGIN(sram) + 320K;
|
||||||
|
ITCM_BASE_ADDR = ORIGIN(itcm);
|
||||||
|
ITCM_END_ADDR = ORIGIN(itcm) + LENGTH(itcm);
|
||||||
|
DTCM_BASE_ADDR = ORIGIN(dtcm);
|
||||||
|
DTCM_END_ADDR = ORIGIN(dtcm) + LENGTH(dtcm);
|
||||||
|
FLASH_BASE_ADDR = ORIGIN(BOOT_HEADER);
|
||||||
|
FLASH_END_ADDR = ORIGIN(flash) + LENGTH(flash);
|
124
boards/arm/s32k3xx/mr-canhubk3/scripts/user-space.ld
Normal file
124
boards/arm/s32k3xx/mr-canhubk3/scripts/user-space.ld
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* user-space.ld
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* NOTE: This depends on the memory.ld script having been included prior to
|
||||||
|
* this script.
|
||||||
|
*/
|
||||||
|
EXTERN(userspace)
|
||||||
|
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 functions (static constructors and the like)
|
||||||
|
*/
|
||||||
|
.init_section : {
|
||||||
|
_sinit = ABSOLUTE(.);
|
||||||
|
KEEP(*(.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)
|
||||||
|
/* Kernel heap start at _ebss, make _ebss MPU-friendly aligned */
|
||||||
|
. = ALIGN(0x1000);
|
||||||
|
_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) }
|
||||||
|
|
||||||
|
/* Start of the image signature. This
|
||||||
|
* has to be in the end of the image
|
||||||
|
*/
|
||||||
|
.signature : {
|
||||||
|
_boot_signature = ALIGN(4);
|
||||||
|
} > uflash
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user