CMSIS-DSP: Improvement to gcc+FVP support in test framework.
parent
83912a9360
commit
00368be949
@ -0,0 +1,38 @@
|
|||||||
|
/**************************************************************************//**
|
||||||
|
* @file mem_ARMCM7.h
|
||||||
|
* @brief Memory base and size definitions (used in scatter file)
|
||||||
|
* @version V1.1.0
|
||||||
|
* @date 15. May 2019
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2019 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed 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
|
||||||
|
*
|
||||||
|
* 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 __MEM_ARMCM7_H
|
||||||
|
#define __MEM_ARMCM7_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define STACK_SIZE 0x00003000
|
||||||
|
#define HEAP_SIZE 0x00100000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __MEM_ARMCM7_H */
|
||||||
@ -0,0 +1,189 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* @file startup_ARMCM7.c
|
||||||
|
* @brief CMSIS-Core(M) Device Startup File for a Cortex-M7 Device
|
||||||
|
* @version V2.0.3
|
||||||
|
* @date 31. March 2020
|
||||||
|
******************************************************************************/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2009-2020 Arm Limited. All rights reserved.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed 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
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (ARMv81MML_DSP_DP_MVE_FP)
|
||||||
|
#include "ARMv81MML_DSP_DP_MVE_FP.h"
|
||||||
|
#else
|
||||||
|
#error device not specified!
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
Exception / Interrupt Handler Function Prototype
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
typedef void( *pFunc )( void );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
External References
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
extern uint32_t __INITIAL_SP;
|
||||||
|
extern uint32_t __STACK_LIMIT;
|
||||||
|
|
||||||
|
extern __NO_RETURN void __PROGRAM_START(void);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
Internal References
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
__NO_RETURN void Reset_Handler (void);
|
||||||
|
void Default_Handler(void);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
Exception / Interrupt Handler
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
/* Exceptions */
|
||||||
|
void NMI_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void HardFault_Handler (void) __attribute__ ((weak));
|
||||||
|
void MemManage_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void BusFault_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void UsageFault_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void SVC_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void DebugMon_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void PendSV_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void SysTick_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
|
||||||
|
void Interrupt0_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt1_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt2_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt3_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt4_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt5_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt6_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt7_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt8_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
void Interrupt9_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
Exception / Interrupt Vector table
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if defined ( __GNUC__ )
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern const pFunc __VECTOR_TABLE[240];
|
||||||
|
const pFunc __VECTOR_TABLE[240] __VECTOR_TABLE_ATTRIBUTE = {
|
||||||
|
(pFunc)(&__INITIAL_SP), /* Initial Stack Pointer */
|
||||||
|
Reset_Handler, /* Reset Handler */
|
||||||
|
NMI_Handler, /* -14 NMI Handler */
|
||||||
|
HardFault_Handler, /* -13 Hard Fault Handler */
|
||||||
|
MemManage_Handler, /* -12 MPU Fault Handler */
|
||||||
|
BusFault_Handler, /* -11 Bus Fault Handler */
|
||||||
|
UsageFault_Handler, /* -10 Usage Fault Handler */
|
||||||
|
0, /* Reserved */
|
||||||
|
0, /* Reserved */
|
||||||
|
0, /* Reserved */
|
||||||
|
0, /* Reserved */
|
||||||
|
SVC_Handler, /* -5 SVCall Handler */
|
||||||
|
DebugMon_Handler, /* -4 Debug Monitor Handler */
|
||||||
|
0, /* Reserved */
|
||||||
|
PendSV_Handler, /* -2 PendSV Handler */
|
||||||
|
SysTick_Handler, /* -1 SysTick Handler */
|
||||||
|
|
||||||
|
/* Interrupts */
|
||||||
|
Interrupt0_Handler, /* 0 Interrupt 0 */
|
||||||
|
Interrupt1_Handler, /* 1 Interrupt 1 */
|
||||||
|
Interrupt2_Handler, /* 2 Interrupt 2 */
|
||||||
|
Interrupt3_Handler, /* 3 Interrupt 3 */
|
||||||
|
Interrupt4_Handler, /* 4 Interrupt 4 */
|
||||||
|
Interrupt5_Handler, /* 5 Interrupt 5 */
|
||||||
|
Interrupt6_Handler, /* 6 Interrupt 6 */
|
||||||
|
Interrupt7_Handler, /* 7 Interrupt 7 */
|
||||||
|
Interrupt8_Handler, /* 8 Interrupt 8 */
|
||||||
|
Interrupt9_Handler /* 9 Interrupt 9 */
|
||||||
|
/* Interrupts 10 .. 223 are left out */
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined ( __GNUC__ )
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern void _start(void) __NO_RETURN;
|
||||||
|
|
||||||
|
|
||||||
|
extern void _ttywrch(char c);
|
||||||
|
extern void _sys_exit();
|
||||||
|
|
||||||
|
int _write(int file,
|
||||||
|
char *ptr,
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
(void)file;
|
||||||
|
|
||||||
|
for(i=0; i < len;i++)
|
||||||
|
{
|
||||||
|
_ttywrch(*ptr++);
|
||||||
|
}
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _exit(int return_code)
|
||||||
|
{
|
||||||
|
(void)return_code;
|
||||||
|
_sys_exit();
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
Reset Handler called on controller reset
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
__NO_RETURN void ResetC_Handler(void)
|
||||||
|
{
|
||||||
|
__set_PSP((uint32_t)(&__INITIAL_SP));
|
||||||
|
|
||||||
|
__set_MSPLIM((uint32_t)(&__STACK_LIMIT));
|
||||||
|
__set_PSPLIM((uint32_t)(&__STACK_LIMIT));
|
||||||
|
|
||||||
|
SystemInit(); /* CMSIS System Initialization */
|
||||||
|
|
||||||
|
__PROGRAM_START();
|
||||||
|
|
||||||
|
//_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
Hard Fault Handler
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void HardFault_Handler(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
Default Handler for Exceptions / Interrupts
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void Default_Handler(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
.global Reset_Handler
|
||||||
|
.global __StackLimit
|
||||||
|
.global _ttywrch
|
||||||
|
.global _sys_exit
|
||||||
|
.syntax unified
|
||||||
|
.text
|
||||||
|
.thumb
|
||||||
|
.thumb_func
|
||||||
|
.align 2
|
||||||
|
.global Reset_Handler
|
||||||
|
|
||||||
|
|
||||||
|
.type _ttywrch, %function
|
||||||
|
|
||||||
|
_ttywrch:
|
||||||
|
PUSH {r3,lr}
|
||||||
|
MOV r1,sp
|
||||||
|
STRB r0,[sp,#0]
|
||||||
|
MOVS r0,#3
|
||||||
|
BKPT #0xab
|
||||||
|
POP {r3,pc}
|
||||||
|
MOVS r0,r0
|
||||||
|
|
||||||
|
.type _sys_exit, %function
|
||||||
|
|
||||||
|
_sys_exit:
|
||||||
|
LDR r1,=0x20026
|
||||||
|
MOVS r0,#0x18
|
||||||
|
BKPT #0xab
|
||||||
|
loop: B loop
|
||||||
|
|
||||||
|
.type Reset_Handler, %function
|
||||||
|
|
||||||
|
Reset_Handler:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LDR R0,=ResetC_Handler
|
||||||
|
BLX R0
|
||||||
|
|
||||||
|
.end
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char * _sbrk(int incr);
|
||||||
|
|
||||||
|
void __malloc_lock() ;
|
||||||
|
void __malloc_unlock();
|
||||||
|
|
||||||
|
char __HeapBase, __HeapLimit; // make sure to define these symbols in linker command file
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int totalBytesProvidedBySBRK = 0;
|
||||||
|
/*
|
||||||
|
//! sbrk/_sbrk version supporting reentrant newlib (depends upon above symbols defined by linker control file).
|
||||||
|
char * sbrk(int incr) {
|
||||||
|
static char *currentHeapEnd = &__HeapBase;
|
||||||
|
char *previousHeapEnd = currentHeapEnd;
|
||||||
|
if (currentHeapEnd + incr > &__HeapLimit) {
|
||||||
|
return (char *)-1; // the malloc-family routine that called sbrk will return 0
|
||||||
|
}
|
||||||
|
currentHeapEnd += incr;
|
||||||
|
|
||||||
|
totalBytesProvidedBySBRK += incr;
|
||||||
|
|
||||||
|
return (char *) previousHeapEnd;
|
||||||
|
}
|
||||||
|
//! Synonym for sbrk.
|
||||||
|
char * _sbrk(int incr) { return sbrk(incr); };
|
||||||
|
*/
|
||||||
|
void __malloc_lock() { };
|
||||||
|
void __malloc_unlock() { };
|
||||||
@ -1,5 +1,7 @@
|
|||||||
function(configure_platform PROJECTNAME ROOT CORE PLATFORMFOLDER)
|
function(configure_platform PROJECTNAME ROOT CORE PLATFORMFOLDER)
|
||||||
if (GCC)
|
if (GCC)
|
||||||
target_sources(${PROJECTNAME} PRIVATE ${PLATFORMFOLDER}/${CORE}/Startup/GCC/startup_asm_${CORE}.S)
|
target_sources(${PROJECTNAME} PRIVATE ${PLATFORMFOLDER}/${CORE}/Startup/GCC/startup_asm_${CORE}.S)
|
||||||
|
# target_link_options(${PROJECTNAME} PRIVATE "-lrdimon;-lc")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
Loading…
Reference in New Issue