TMS570: Add a place holder for the TMS570. Not much there yet
This commit is contained in:
parent
c1933a0814
commit
8fb76cf970
118
arch/arm/src/armv7-r/arm_signal_handler.S
Normal file
118
arch/arm/src/armv7-r/arm_signal_handler.S
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/armv7-r/arm_signal_handler.S
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <arch/syscall.h>
|
||||||
|
|
||||||
|
#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* File info
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
.syntax unified
|
||||||
|
.thumb
|
||||||
|
.cpu cortex-r4
|
||||||
|
.file "arm_signal_handler.S"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_signal_handler
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function is the user-space, signal handler trampoline function. It
|
||||||
|
* is called from up_signal_dispatch() in user-mode.
|
||||||
|
*
|
||||||
|
* R0-R3, R11 - volatile registers need not be preserved.
|
||||||
|
* R4-R10 - static registers must be preserved
|
||||||
|
* R12-R14 - LR and SP must be preserved
|
||||||
|
*
|
||||||
|
* Inputs:
|
||||||
|
* R0 = sighand
|
||||||
|
* The address user-space signal handling function
|
||||||
|
* R1-R3 = signo, info, and ucontext
|
||||||
|
* Standard arguments to be passed to the signal handling function.
|
||||||
|
*
|
||||||
|
* Return:
|
||||||
|
* None. This function does not return in the normal sense. It returns
|
||||||
|
* via the SYS_signal_handler_return (see svcall.h)
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
.text
|
||||||
|
.thumb_func
|
||||||
|
.globl up_signal_handler
|
||||||
|
.type up_signal_handler, function
|
||||||
|
up_signal_handler:
|
||||||
|
|
||||||
|
/* Save some register */
|
||||||
|
|
||||||
|
push {lr} /* Save LR on the stack */
|
||||||
|
|
||||||
|
/* Call the signal handler */
|
||||||
|
|
||||||
|
mov ip, r0 /* IP=sighand */
|
||||||
|
mov r0, r1 /* R0=signo */
|
||||||
|
mov r1, r2 /* R1=info */
|
||||||
|
mov r2, r3 /* R2=ucontext */
|
||||||
|
blx ip /* Call the signal handler */
|
||||||
|
|
||||||
|
/* Restore the registers */
|
||||||
|
|
||||||
|
pop {r2} /* Recover LR in R2 */
|
||||||
|
mov lr, r2 /* Restore LR */
|
||||||
|
|
||||||
|
/* Execute the SYS_signal_handler_return SVCall (will not return) */
|
||||||
|
|
||||||
|
mov r0, #SYS_signal_handler_return
|
||||||
|
svc 0
|
||||||
|
nop
|
||||||
|
|
||||||
|
.size up_signal_handler, .-up_signal_handler
|
||||||
|
.end
|
||||||
|
|
||||||
|
#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */
|
19
arch/arm/src/tms570/Kconfig
Normal file
19
arch/arm/src/tms570/Kconfig
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||||
|
#
|
||||||
|
|
||||||
|
if ARCH_CHIP_TMS570
|
||||||
|
|
||||||
|
comment "TMS570 Configuration Options"
|
||||||
|
|
||||||
|
# Chip Capabilities
|
||||||
|
|
||||||
|
# Summary configuratinos
|
||||||
|
|
||||||
|
# Chip Selection
|
||||||
|
|
||||||
|
#menu "TMS570 Peripheral Support"
|
||||||
|
# endmenu # TMS570 Peripheral Support
|
||||||
|
|
||||||
|
endif # ARCH_CHIP_TMS570
|
108
arch/arm/src/tms570/Make.defs
Normal file
108
arch/arm/src/tms570/Make.defs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
############################################################################
|
||||||
|
# arch/arm/tms570/Make.defs
|
||||||
|
#
|
||||||
|
# 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 Gregory Nutt nor the names of its contributors may be
|
||||||
|
# used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
# The vector table is the "head" object, i.e., the one that must forced into
|
||||||
|
# the link in order to draw in all of the other components
|
||||||
|
|
||||||
|
HEAD_ASRC = arm_vectortab.S
|
||||||
|
|
||||||
|
# Common assembly language files
|
||||||
|
|
||||||
|
CMN_ASRCS += arm_vectors.S arm_fpuconfig.S arm_fullcontextrestore.S
|
||||||
|
CMN_ASRCS += arm_saveusercontext.S arm_vectoraddrexcptn.S arm_vfork.S
|
||||||
|
CMN_ASRCS += cp15_coherent_dcache.S cp15_invalidate_dcache.S
|
||||||
|
CMN_ASRCS += cp15_clean_dcache.S cp15_flush_dcache.S cp15_invalidate_dcache_all.S
|
||||||
|
|
||||||
|
# Configuration dependent assembly language files
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_MEMCPY),y)
|
||||||
|
CMN_ASRCS += arm_memcpy.S
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Common C source files
|
||||||
|
|
||||||
|
CMN_CSRCS = up_initialize.c up_idle.c up_interruptcontext.c up_exit.c
|
||||||
|
CMN_CSRCS += up_createstack.c up_releasestack.c up_usestack.c up_vfork.c
|
||||||
|
CMN_CSRCS += up_puts.c up_mdelay.c up_stackframe.c up_udelay.c
|
||||||
|
CMN_CSRCS += up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c
|
||||||
|
|
||||||
|
CMN_CSRCS += arm_assert.c arm_blocktask.c arm_copyfullstate.c arm_dataabort.c
|
||||||
|
CMN_CSRCS += arm_doirq.c arm_initialstate.c arm_mmu.c arm_prefetchabort.c
|
||||||
|
CMN_CSRCS += arm_releasepending.c arm_reprioritizertr.c
|
||||||
|
CMN_CSRCS += arm_schedulesigaction.c arm_sigdeliver.c arm_syscall.c
|
||||||
|
CMN_CSRCS += arm_unblocktask.c arm_undefinedinsn.c
|
||||||
|
|
||||||
|
# Configuration dependent C files
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_BUILD_PROTECTED),y)
|
||||||
|
CMN_CSRCS += arm_mpu.c up_task_start.c up_pthread_start.c
|
||||||
|
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||||
|
CMN_CSRCS += arm_signal_dispatch.c
|
||||||
|
CMN_UASRCS += arm_signal_handler.S
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARMV7R_L2CC_PL310),y)
|
||||||
|
CMN_CSRCS += arm_l2cc_pl310.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ELF),y)
|
||||||
|
CMN_CSRCS += arm_elf.c arm_coherent_dcache.c
|
||||||
|
else ifeq ($(CONFIG_MODULE),y)
|
||||||
|
CMN_CSRCS += arm_elf.c arm_coherent_dcache.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||||
|
CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
|
||||||
|
CMN_CSRCS += arm_copyarmstate.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||||
|
CMN_CSRCS += up_checkstack.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
# SAMA5-specific assembly language files
|
||||||
|
|
||||||
|
CHIP_ASRCS =
|
||||||
|
|
||||||
|
# SAMA5-specific C source files
|
||||||
|
|
||||||
|
CHIP_CSRCS = tms570_boot.c
|
||||||
|
|
||||||
|
# Configuration dependent C and assembly language files
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_SCHED_TICKLESS),y)
|
||||||
|
CHIP_CSRCS += tms570_timerisr.c
|
||||||
|
endif
|
63
arch/arm/src/tms570/chip.h
Normal file
63
arch/arm/src/tms570/chip.h
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
/************************************************************************************
|
||||||
|
* arch/arm/src/tms570/chip.h
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __ARCH_ARM_SRC_TMS570_CHIP_H
|
||||||
|
#define __ARCH_ARM_SRC_TMS570_CHIP_H
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
#include <arch/tms570/chip.h>
|
||||||
|
|
||||||
|
#include "chip/tms570_memorymap.h"
|
||||||
|
|
||||||
|
/************************************************************************************
|
||||||
|
* Pre-processor Definitions
|
||||||
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* arch/arm/src/armv7-a/l2cc_pl310.h includes this file and expects it to provide the
|
||||||
|
* address of the L2CC-PL310 implementation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define L2CC_VBASE SAM_L2CC_VSECTION
|
||||||
|
|
||||||
|
/* Cache line sizes (in bytes)for the SAVA5Dx */
|
||||||
|
|
||||||
|
#define ARMV7A_DCACHE_LINESIZE 32 /* 32 bytes (8 words) */
|
||||||
|
#define ARMV7A_ICACHE_LINESIZE 32 /* 32 bytes (8 words) */
|
||||||
|
|
||||||
|
#endif /* __ARCH_ARM_SRC_TMS570_CHIP_H */
|
263
arch/arm/src/tms570/tms570_boot.c
Normal file
263
arch/arm/src/tms570/tms570_boot.c
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* arch/arm/src/tms570/tms570_boot.c
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Included Files
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
|
#include "chip.h"
|
||||||
|
#include "arm.h"
|
||||||
|
#include "cache.h"
|
||||||
|
#include "fpu.h"
|
||||||
|
#include "up_internal.h"
|
||||||
|
#include "up_arch.h"
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* Symbols defined via the linker script */
|
||||||
|
|
||||||
|
extern uint32_t _vector_start; /* Beginning of vector block */
|
||||||
|
extern uint32_t _vector_end; /* End+1 of vector block */
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Data
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Private Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: tms570_vectorsize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return the size of the vector data
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static inline size_t tms570_vectorsize(void)
|
||||||
|
{
|
||||||
|
uintptr_t src;
|
||||||
|
uintptr_t end;
|
||||||
|
|
||||||
|
src = (uintptr_t)&_vector_start;
|
||||||
|
end = (uintptr_t)&_vector_end;
|
||||||
|
|
||||||
|
return (size_t)(end - src);
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: tms570_copyvectorblock
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Copy the interrupt block to its final destination. Vectors are already
|
||||||
|
* positioned at the beginning of the text region and only need to be
|
||||||
|
* copied in the case where we are using high vectors or where the beginning
|
||||||
|
* of the text region cannot be remapped to address zero.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(CONFIG_ARCH_LOWVECTORS)
|
||||||
|
static void tms570_copyvectorblock(void)
|
||||||
|
{
|
||||||
|
uint32_t *src;
|
||||||
|
uint32_t *end;
|
||||||
|
uint32_t *dest;
|
||||||
|
|
||||||
|
/* Copy the vectors into ISRAM at the address that will be mapped to the vector
|
||||||
|
* address:
|
||||||
|
*
|
||||||
|
* SAM_VECTOR_PADDR - Unmapped, physical address of vector table in SRAM
|
||||||
|
* SAM_VECTOR_VSRAM - Virtual address of vector table in SRAM
|
||||||
|
* SAM_VECTOR_VADDR - Virtual address of vector table (0x00000000 or
|
||||||
|
* 0xffff0000)
|
||||||
|
*/
|
||||||
|
|
||||||
|
src = (uint32_t *)&_vector_start;
|
||||||
|
end = (uint32_t *)&_vector_end;
|
||||||
|
dest = (uint32_t *)SAM_VECTOR_VSRAM;
|
||||||
|
|
||||||
|
while (src < end)
|
||||||
|
{
|
||||||
|
*dest++ = *src++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flush the DCache to assure that the vector data is in physical in ISRAM */
|
||||||
|
|
||||||
|
arch_clean_dcache((uintptr_t)SAM_VECTOR_VSRAM,
|
||||||
|
(uintptr_t)SAM_VECTOR_VSRAM + tms570_vectorsize());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* Don't copy the vectors */
|
||||||
|
|
||||||
|
# define tms570_copyvectorblock()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: tms570_wdtdisable
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Disable the watchdog timer.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_TMS570_WDT
|
||||||
|
static inline void tms570_wdtdisable(void)
|
||||||
|
{
|
||||||
|
#warning Missing logic
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
# define tms570_wdtdisable()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Public Functions
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: arm_boot
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Complete boot operations started in arm_head.S
|
||||||
|
*
|
||||||
|
* Boot Sequence
|
||||||
|
*
|
||||||
|
* 1. The __start entry point in armv7-r/arm_head.S is invoked upon power-
|
||||||
|
* on reset.
|
||||||
|
* 2. __start prepares CPU for code execution.
|
||||||
|
* 3a. If CONFIG_BOOT_SDRAM_DATA is not defined, then __start will prepare
|
||||||
|
* memory resources by calling arm_data_initialize() and will then
|
||||||
|
* call this function.
|
||||||
|
* 3b. Otherwise, this function will be called without having initialized
|
||||||
|
* memory resources! We need to be very careful in this case. Here,
|
||||||
|
* this function will call tms570_boardinitialize() which, among other
|
||||||
|
* things, much initialize SDRAM memory. Upon return, this function
|
||||||
|
* will call arm_data_initialize() to initialize the memory resources
|
||||||
|
* 4. This function will initialize all TMS570-specific resources and
|
||||||
|
* return to __start.
|
||||||
|
* 4. _start will then branch to os_start() to start the operating system.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void arm_boot(void)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_ARCH_RAMFUNCS
|
||||||
|
const uint32_t *src;
|
||||||
|
uint32_t *dest;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_RAMFUNCS
|
||||||
|
/* Copy any necessary code sections from FLASH to RAM. The correct
|
||||||
|
* destination in SRAM is given by _sramfuncs and _eramfuncs. The
|
||||||
|
* temporary location is in flash after the data initialization code
|
||||||
|
* at _framfuncs
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (src = &_framfuncs, dest = &_sramfuncs; dest < &_eramfuncs; )
|
||||||
|
{
|
||||||
|
*dest++ = *src++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Flush the copied RAM functions into physical RAM so that will
|
||||||
|
* be available when fetched into the I-Cache.
|
||||||
|
*/
|
||||||
|
|
||||||
|
arch_clean_dcache((uintptr_t)&_sramfuncs, (uintptr_t)&_eramfuncs)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Setup up vector block. _vector_start and _vector_end are exported from
|
||||||
|
* arm_vector.S
|
||||||
|
*/
|
||||||
|
|
||||||
|
tms570_copyvectorblock();
|
||||||
|
|
||||||
|
/* Disable the watchdog timer */
|
||||||
|
|
||||||
|
tms570_wdtdisable();
|
||||||
|
|
||||||
|
/* Initialize clocking to settings provided by board-specific logic */
|
||||||
|
|
||||||
|
tms570_clockconfig();
|
||||||
|
|
||||||
|
#ifdef CONFIG_ARCH_FPU
|
||||||
|
/* Initialize the FPU */
|
||||||
|
|
||||||
|
arm_fpuconfig();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Perform board-specific initialization, This must include:
|
||||||
|
*
|
||||||
|
* - Initialization of board-specific memory resources (e.g., SDRAM)
|
||||||
|
* - Configuration of board specific resources (PIOs, LEDs, etc).
|
||||||
|
*
|
||||||
|
* NOTE: We must use caution prior to this point to make sure that
|
||||||
|
* the logic does not access any global variables that might lie
|
||||||
|
* in SDRAM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
tms570_boardinitialize();
|
||||||
|
|
||||||
|
#ifdef CONFIG_BOOT_SDRAM_DATA
|
||||||
|
/* If .data and .bss reside in SDRAM, then initialize the data sections
|
||||||
|
* now after SDRAM has been initialized.
|
||||||
|
*/
|
||||||
|
|
||||||
|
arm_data_initialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Perform common, low-level chip initialization (might do nothing) */
|
||||||
|
|
||||||
|
tms570_lowsetup();
|
||||||
|
|
||||||
|
#ifdef USE_EARLYSERIALINIT
|
||||||
|
/* Perform early serial initialization if we are going to use the serial
|
||||||
|
* driver.
|
||||||
|
*/
|
||||||
|
|
||||||
|
tms570_earlyserialinit();
|
||||||
|
#endif
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user