mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #3397 from AlessandroA/stm32f4_support
Add uVisor support for the DISCO_F429ZIpull/3423/merge
commit
c14d7154e6
|
@ -1,13 +1,13 @@
|
|||
584 Milosch Meriac
|
||||
501 Alessandro Angelino
|
||||
588 Milosch Meriac
|
||||
506 Alessandro Angelino
|
||||
95 Jaeden Amero
|
||||
61 Niklas Hauser
|
||||
4 Irit Arkin
|
||||
3 Hugo Vincent
|
||||
3 JaredCJR
|
||||
3 Jim Huang
|
||||
3 Hugo Vincent
|
||||
2 tonyyanxuan
|
||||
2 Vincenzo Frascino
|
||||
2 tonyyanxuan
|
||||
1 Aksel Skauge Mellbye
|
||||
1 ccli8
|
||||
1 Nathan Chong
|
||||
1 ccli8
|
||||
|
|
|
@ -1 +1 @@
|
|||
v0.26.1
|
||||
v0.26.2
|
||||
|
|
|
@ -84,12 +84,12 @@ void page_allocator_init(void * const heap_start, void * const heap_end, const u
|
|||
"Page size pointer (0x%08x) is not in flash memory.\n",
|
||||
(unsigned int) page_size);
|
||||
}
|
||||
if (!heap_start || !vmpu_sram_addr((uint32_t) heap_start)) {
|
||||
if (!heap_start || !vmpu_public_sram_addr((uint32_t) heap_start)) {
|
||||
HALT_ERROR(SANITY_CHECK_FAILED,
|
||||
"Page heap start pointer (0x%08x) is not in sram memory.\n",
|
||||
(unsigned int) heap_start);
|
||||
}
|
||||
if (!heap_end || !vmpu_sram_addr((uint32_t) heap_end)) {
|
||||
if (!heap_end || !vmpu_public_sram_addr((uint32_t) heap_end)) {
|
||||
HALT_ERROR(SANITY_CHECK_FAILED,
|
||||
"Page heap end pointer (0x%08x) is not in sram memory.\n",
|
||||
(unsigned int) heap_end);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define vmpu_is_box_id_valid(...) 0
|
||||
#define vmpu_public_flash_addr(...) 1
|
||||
#define vmpu_sram_addr(...) 1
|
||||
#define vmpu_public_sram_addr(...) 1
|
||||
#define HALT_ERROR(id, ...) {}
|
||||
#define UVISOR_PAGE_ALLOCATOR_MUTEX_AQUIRE page_allocator_mutex_aquire()
|
||||
#define UVISOR_PAGE_ALLOCATOR_MUTEX_RELEASE osMutexRelease(g_page_allocator_mutex_id)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -93,9 +93,9 @@ SECTIONS
|
|||
/* The program code and other data goes into internal flash */
|
||||
/* Note: The uVisor expects this section at a fixed location, as specified by
|
||||
* the porting process configuration parameter: FLASH_OFFSET. */
|
||||
__UVISOR_TEXT_OFFSET = 0x410;
|
||||
__UVISOR_TEXT_START = ORIGIN(m_interrupts) + __UVISOR_TEXT_OFFSET;
|
||||
.text __UVISOR_TEXT_START :
|
||||
__UVISOR_FLASH_OFFSET = 0x410;
|
||||
__UVISOR_FLASH_START = ORIGIN(m_interrupts) + __UVISOR_FLASH_OFFSET;
|
||||
.text __UVISOR_FLASH_START :
|
||||
{
|
||||
/* uVisor code and data */
|
||||
. = ALIGN(4);
|
||||
|
@ -197,27 +197,26 @@ SECTIONS
|
|||
__interrupts_ram_end__ = .; /* Define a global symbol at data end */
|
||||
} > m_data
|
||||
|
||||
/* Ensure that the uVisor BSS section is put first after the relocated
|
||||
* interrupt table in SRAM. */
|
||||
/* Note: The uVisor expects this section at a fixed location, as specified by
|
||||
* the porting process configuration parameter: SRAM_OFFSET. */
|
||||
/* uVisor own memory and private box memories
|
||||
/* If uVisor shares the SRAM with the OS/app, ensure that this section is
|
||||
* the first one after the VTOR relocation section. */
|
||||
/* Note: The uVisor expects this section at a fixed location, as specified
|
||||
by the porting process configuration parameter: SRAM_OFFSET. */
|
||||
__UVISOR_SRAM_OFFSET = 0x400;
|
||||
__UVISOR_BSS_START = ORIGIN(m_data) + __UVISOR_SRAM_OFFSET;
|
||||
ASSERT(__interrupts_ram_end__ <= __UVISOR_BSS_START,
|
||||
"The ISR relocation region overlaps with the uVisor BSS section.")
|
||||
.uvisor.bss __UVISOR_BSS_START (NOLOAD):
|
||||
__UVISOR_SRAM_START = ORIGIN(m_data) + __UVISOR_SRAM_OFFSET;
|
||||
.uvisor.bss __UVISOR_SRAM_START (NOLOAD):
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_start = .;
|
||||
|
||||
/* protected uvisor main bss */
|
||||
/* Protected uVisor own BSS section */
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_main_start = .;
|
||||
KEEP(*(.keep.uvisor.bss.main))
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_main_end = .;
|
||||
|
||||
/* protected uvisor secure boxes bss */
|
||||
/* Protected uVisor boxes' static memories */
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_boxes_start = .;
|
||||
KEEP(*(.keep.uvisor.bss.boxes))
|
||||
|
@ -228,7 +227,10 @@ SECTIONS
|
|||
__uvisor_bss_end = .;
|
||||
} > m_data
|
||||
|
||||
/* Heap space for the page allocator */
|
||||
/* Heap space for the page allocator
|
||||
/* If uVisor shares the SRAM with the OS/app, ensure that this section is
|
||||
* the first one after the uVisor BSS section. Otherwise, ensure it is the
|
||||
* first one after the VTOR relocation section. */
|
||||
.page_heap (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(32);
|
||||
|
@ -305,6 +307,7 @@ SECTIONS
|
|||
} > m_data_2
|
||||
|
||||
USB_RAM_GAP = DEFINED(__usb_ram_size__) ? __usb_ram_size__ : 0x800;
|
||||
|
||||
/* Uninitialized data section */
|
||||
.bss :
|
||||
{
|
||||
|
@ -354,11 +357,13 @@ SECTIONS
|
|||
|
||||
.ARM.attributes 0 : { *(.ARM.attributes) }
|
||||
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
|
||||
ASSERT(__StackLimit >= __HeapLimit, "Region m_data_2 overflowed with stack and heap")
|
||||
|
||||
/* Provide the physical memory boundaries for uVisor. */
|
||||
__uvisor_flash_start = ORIGIN(m_interrupts);
|
||||
__uvisor_flash_end = ORIGIN(m_text) + LENGTH(m_text);
|
||||
__uvisor_sram_start = ORIGIN(m_data);
|
||||
__uvisor_sram_end = ORIGIN(m_data_2) + LENGTH(m_data_2);
|
||||
__uvisor_public_sram_start = __uvisor_sram_start;
|
||||
__uvisor_public_sram_end = __uvisor_sram_end;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Cloc
|
|||
* @{
|
||||
*/
|
||||
|
||||
extern void SystemInitPre(void);
|
||||
extern void SystemInit(void);
|
||||
extern void SystemCoreClockUpdate(void);
|
||||
extern void SetSysClock(void);
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
/* Linker script to configure memory regions. */
|
||||
M_VECTOR_RAM_SIZE = 0x400;
|
||||
|
||||
/* Heap: 1/4 of RAM. Stack: 1/8 of RAM. */
|
||||
STACK_SIZE = 0x6000;
|
||||
HEAP_SIZE = 0xC000;
|
||||
|
||||
/* Specify the memory areas */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048k
|
||||
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
RAM (rwx) : ORIGIN = 0x200001AC, LENGTH = 192k - 0x1AC
|
||||
{
|
||||
VECTORS (rx) : ORIGIN = 0x08000000, LENGTH = 0x400
|
||||
FLASH (rx) : ORIGIN = 0x08000400, LENGTH = 2048k - 0x400
|
||||
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 192k
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
|
@ -37,10 +44,28 @@ ENTRY(Reset_Handler)
|
|||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
.isr_vector :
|
||||
{
|
||||
__vector_table = .;
|
||||
KEEP(*(.isr_vector))
|
||||
. = ALIGN(4);
|
||||
} > VECTORS
|
||||
|
||||
/* Note: The uVisor expects this section at a fixed location, as specified
|
||||
* by the porting process configuration parameter:
|
||||
* FLASH_OFFSET. */
|
||||
__UVISOR_FLASH_OFFSET = 0x400;
|
||||
__UVISOR_FLASH_START = ORIGIN(VECTORS) + __UVISOR_FLASH_OFFSET;
|
||||
.text __UVISOR_FLASH_START :
|
||||
{
|
||||
/* uVisor code and data */
|
||||
. = ALIGN(4);
|
||||
__uvisor_main_start = .;
|
||||
*(.uvisor.main)
|
||||
__uvisor_main_end = .;
|
||||
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
|
@ -69,6 +94,7 @@ SECTIONS
|
|||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
|
@ -78,8 +104,62 @@ SECTIONS
|
|||
__etext = .;
|
||||
_sidata = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
.interrupts_ram :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__VECTOR_RAM__ = .;
|
||||
__interrupts_ram_start__ = .; /* Create a global symbol at data start */
|
||||
*(.m_interrupts_ram) /* This is a user defined section */
|
||||
. += M_VECTOR_RAM_SIZE;
|
||||
. = ALIGN(4);
|
||||
__interrupts_ram_end__ = .; /* Define a global symbol at data end */
|
||||
} > RAM
|
||||
|
||||
/* uVisor own memory and private box memories
|
||||
/* Note: The uVisor expects this section at a fixed location, as specified
|
||||
by the porting process configuration parameter: SRAM_OFFSET. */
|
||||
__UVISOR_SRAM_OFFSET = 0x0;
|
||||
__UVISOR_SRAM_START = ORIGIN(CCM) + __UVISOR_SRAM_OFFSET;
|
||||
.uvisor.bss __UVISOR_SRAM_START (NOLOAD):
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_start = .;
|
||||
|
||||
/* Protected uVisor own BSS section */
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_main_start = .;
|
||||
KEEP(*(.keep.uvisor.bss.main))
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_main_end = .;
|
||||
|
||||
/* Protected uVisor boxes' static memories */
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_boxes_start = .;
|
||||
KEEP(*(.keep.uvisor.bss.boxes))
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_boxes_end = .;
|
||||
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_end = .;
|
||||
} > CCM
|
||||
|
||||
/* Heap space for the page allocator
|
||||
/* If uVisor shares the SRAM with the OS/app, ensure that this section is
|
||||
* the first one after the uVisor BSS section. Otherwise, ensure it is the
|
||||
* first one after the VTOR relocation section. */
|
||||
.page_heap (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_page_start = .;
|
||||
KEEP(*(.keep.uvisor.page_heap))
|
||||
. = ALIGN((1 << LOG2CEIL(LENGTH(RAM))) / 8);
|
||||
__uvisor_page_end = .;
|
||||
} > RAM
|
||||
|
||||
.data :
|
||||
{
|
||||
PROVIDE( __etext = LOADADDR(.data) );
|
||||
|
||||
__data_start__ = .;
|
||||
_sdata = .;
|
||||
*(vtable)
|
||||
|
@ -112,9 +192,54 @@ SECTIONS
|
|||
__data_end__ = .;
|
||||
_edata = .;
|
||||
|
||||
} > RAM AT > FLASH
|
||||
|
||||
/* uVisor configuration section
|
||||
* This section must be located after all other flash regions. */
|
||||
.uvisor.secure :
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_secure_start = .;
|
||||
|
||||
/* uVisor secure boxes configuration tables */
|
||||
. = ALIGN(32);
|
||||
__uvisor_cfgtbl_start = .;
|
||||
KEEP(*(.keep.uvisor.cfgtbl))
|
||||
. = ALIGN(32);
|
||||
__uvisor_cfgtbl_end = .;
|
||||
|
||||
/* Pointers to the uVisor secure boxes configuration tables */
|
||||
/* Note: Do not add any further alignment here, as uVisor will need to
|
||||
* have access to the exact list of pointers. */
|
||||
__uvisor_cfgtbl_ptr_start = .;
|
||||
KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
|
||||
KEEP(*(.keep.uvisor.cfgtbl_ptr))
|
||||
__uvisor_cfgtbl_ptr_end = .;
|
||||
|
||||
/* Pointers to all boxes register gateways. These are grouped here to
|
||||
allow discoverability and firmware verification. */
|
||||
__uvisor_register_gateway_ptr_start = .;
|
||||
KEEP(*(.keep.uvisor.register_gateway_ptr))
|
||||
__uvisor_register_gateway_ptr_end = .;
|
||||
|
||||
. = ALIGN(32);
|
||||
__uvisor_secure_end = .;
|
||||
} > FLASH
|
||||
|
||||
/* Uninitialized data section
|
||||
* This region is not initialized by the C/C++ library and can be used to
|
||||
* store state across soft reboots. */
|
||||
.uninitialized (NOLOAD):
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uninitialized_start = .;
|
||||
*(.uninitialized)
|
||||
KEEP(*(.keep.uninitialized))
|
||||
. = ALIGN(32);
|
||||
__uninitialized_end = .;
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
.bss (NOLOAD):
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
|
@ -126,29 +251,27 @@ SECTIONS
|
|||
_ebss = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
.heap (NOLOAD):
|
||||
{
|
||||
__uvisor_heap_start = .;
|
||||
__end__ = .;
|
||||
end = __end__;
|
||||
*(.heap*)
|
||||
. += HEAP_SIZE;
|
||||
__HeapLimit = .;
|
||||
__uvisor_heap_end = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
_estack = __StackTop;
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
__stack = __StackTop;
|
||||
__StackLimit = __StackTop - STACK_SIZE;
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
ASSERT(__StackLimit >= __HeapLimit, "Region RAM overflowed with stack and heap")
|
||||
|
||||
/* Provide physical memory boundaries for uVisor. */
|
||||
__uvisor_flash_start = ORIGIN(VECTORS);
|
||||
__uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
|
||||
__uvisor_sram_start = ORIGIN(CCM);
|
||||
__uvisor_sram_end = ORIGIN(CCM) + LENGTH(CCM);
|
||||
__uvisor_public_sram_start = ORIGIN(RAM);
|
||||
__uvisor_public_sram_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||
}
|
||||
|
|
|
@ -72,10 +72,10 @@ defined in linker script */
|
|||
.section .text.Reset_Handler
|
||||
.weak Reset_Handler
|
||||
.type Reset_Handler, %function
|
||||
Reset_Handler:
|
||||
ldr sp, =_estack /* set stack pointer */
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
Reset_Handler:
|
||||
ldr sp, =__stack /* set stack pointer */
|
||||
|
||||
/* Copy the data segment initializers from flash to SRAM */
|
||||
movs r1, #0
|
||||
b LoopCopyDataInit
|
||||
|
||||
|
@ -93,6 +93,12 @@ LoopCopyDataInit:
|
|||
bcc CopyDataInit
|
||||
|
||||
/* Call the clock system intitialization function.*/
|
||||
bl SystemInitPre
|
||||
bl HAL_InitPre
|
||||
#if defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)
|
||||
ldr r0, =uvisor_init
|
||||
blx r0
|
||||
#endif /* defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED) */
|
||||
bl SystemInit
|
||||
/* Call static constructors */
|
||||
//bl __libc_init_array
|
||||
|
@ -130,7 +136,7 @@ Infinite_Loop:
|
|||
.size g_pfnVectors, .-g_pfnVectors
|
||||
|
||||
g_pfnVectors:
|
||||
.word _estack
|
||||
.word __stack
|
||||
.word Reset_Handler
|
||||
|
||||
.word NMI_Handler
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
uint32_t *vectors = (uint32_t *)SCB->VTOR;
|
||||
uint32_t i;
|
||||
|
||||
|
@ -49,7 +49,7 @@ void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
|||
vectors[IRQn + NVIC_USER_IRQ_OFFSET] = vector;
|
||||
}
|
||||
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn) {
|
||||
uint32_t __NVIC_GetVector(IRQn_Type IRQn) {
|
||||
uint32_t *vectors = (uint32_t*)SCB->VTOR;
|
||||
return vectors[IRQn + NVIC_USER_IRQ_OFFSET];
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn);
|
||||
void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
||||
uint32_t __NVIC_GetVector(IRQn_Type IRQn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2015, 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
|
||||
*
|
||||
* 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 "stm32f4xx.h"
|
||||
|
||||
/*!< Uncomment the following line if you need to relocate your vector Table in
|
||||
Internal SRAM. */
|
||||
/* note: if uVisor is present the definition must go in system_init_pre.c */
|
||||
/* #define VECT_TAB_SRAM */
|
||||
#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
|
||||
This value must be a multiple of 0x200. */
|
||||
|
||||
/* this function is needed to peform hardware initialization that must happen
|
||||
* before the uVisor; the whole SystemInit function for the STM32F4 cannot be
|
||||
* put here as it depends on some APIs that need uVisor to be enabled */
|
||||
void SystemInitPre(void)
|
||||
{
|
||||
/* FPU settings ------------------------------------------------------------*/
|
||||
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
|
||||
#endif
|
||||
|
||||
/* Configure the Vector Table location add offset address ------------------*/
|
||||
#ifdef VECT_TAB_SRAM
|
||||
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
|
||||
#else
|
||||
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
|
||||
#endif
|
||||
}
|
|
@ -187,10 +187,6 @@ void SetSysClock(void);
|
|||
*/
|
||||
void SystemInit(void)
|
||||
{
|
||||
/* FPU settings ------------------------------------------------------------*/
|
||||
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
|
||||
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
|
||||
#endif
|
||||
/* Reset the RCC clock configuration to the default reset state ------------*/
|
||||
/* Set HSION bit */
|
||||
RCC->CR |= (uint32_t)0x00000001;
|
||||
|
@ -214,13 +210,6 @@ void SystemInit(void)
|
|||
SystemInit_ExtMemCtl();
|
||||
#endif /* DATA_IN_ExtSRAM || DATA_IN_ExtSDRAM */
|
||||
|
||||
/* Configure the Vector Table location add offset address ------------------*/
|
||||
#ifdef VECT_TAB_SRAM
|
||||
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
|
||||
#else
|
||||
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
|
||||
#endif
|
||||
|
||||
/* Configure the Cube driver */
|
||||
SystemCoreClock = 16000000; // At this stage the HSI is used as system clock
|
||||
HAL_Init();
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2015, 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
|
||||
*
|
||||
* 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 "stm32f4xx_hal.h"
|
||||
|
||||
/* this function is needed to peform hardware initialization that must happen
|
||||
* before the uVisor; the whole SystemInit function for the STM32F4 cannot be
|
||||
* put here as it depends on some APIs that need uVisor to be enabled */
|
||||
HAL_StatusTypeDef HAL_InitPre(void)
|
||||
{
|
||||
/* Set Interrupt Group Priority */
|
||||
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
|
||||
|
||||
/* Return function status */
|
||||
return HAL_OK;
|
||||
}
|
|
@ -179,9 +179,6 @@ HAL_StatusTypeDef HAL_Init(void)
|
|||
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
|
||||
#endif /* PREFETCH_ENABLE */
|
||||
|
||||
/* Set Interrupt Group Priority */
|
||||
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
|
||||
|
||||
/* Use systick as time base source and configure 1ms tick (default clock after Reset is HSI) */
|
||||
HAL_InitTick(TICK_INT_PRIORITY);
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@
|
|||
* @{
|
||||
*/
|
||||
/* Initialization and de-initialization functions ******************************/
|
||||
HAL_StatusTypeDef HAL_InitPre(void);
|
||||
HAL_StatusTypeDef HAL_Init(void);
|
||||
HAL_StatusTypeDef HAL_DeInit(void);
|
||||
void HAL_MspInit(void);
|
||||
|
|
|
@ -56,13 +56,12 @@ __vector_size = 0xDC;
|
|||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
/* Note: The uVisor expects the text section at a fixed location, as specified
|
||||
by the porting process configuration parameter: FLASH_OFFSET. */
|
||||
__UVISOR_TEXT_OFFSET = 0x100;
|
||||
__UVISOR_TEXT_START = ORIGIN(FLASH) + __UVISOR_TEXT_OFFSET;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* Note: The uVisor expects the text section at a fixed location, as specified
|
||||
by the porting process configuration parameter: FLASH_OFFSET. */
|
||||
__UVISOR_FLASH_OFFSET = 0x100;
|
||||
__UVISOR_FLASH_START = ORIGIN(FLASH) + __UVISOR_FLASH_OFFSET;
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.vectors))
|
||||
|
@ -71,7 +70,7 @@ SECTIONS
|
|||
__end__ = .;
|
||||
|
||||
/* uVisor code and data */
|
||||
. = __UVISOR_TEXT_OFFSET;
|
||||
. = __UVISOR_FLASH_OFFSET;
|
||||
. = ALIGN(4);
|
||||
__uvisor_main_start = .;
|
||||
*(.uvisor.main)
|
||||
|
@ -147,24 +146,26 @@ SECTIONS
|
|||
} > FLASH
|
||||
*/
|
||||
|
||||
/* Ensure that the uVisor BSS section is put first in SRAM. */
|
||||
/* uVisor own memory and private box memories
|
||||
/* If uVisor shares the SRAM with the OS/app, ensure that this section is
|
||||
* the first one after the VTOR relocation section. */
|
||||
/* Note: The uVisor expects this section at a fixed location, as specified
|
||||
by the porting process configuration parameter: SRAM_OFFSET. */
|
||||
__UVISOR_SRAM_OFFSET = 0x0;
|
||||
__UVISOR_BSS_START = ORIGIN(RAM) + __UVISOR_SRAM_OFFSET;
|
||||
.uvisor.bss __UVISOR_BSS_START (NOLOAD):
|
||||
__UVISOR_SRAM_START = ORIGIN(m_data) + __UVISOR_SRAM_OFFSET;
|
||||
.uvisor.bss __UVISOR_SRAM_START (NOLOAD):
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_start = .;
|
||||
|
||||
/* uVisor main BSS section */
|
||||
/* Protected uVisor own BSS section */
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_main_start = .;
|
||||
KEEP(*(.keep.uvisor.bss.main))
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_main_end = .;
|
||||
|
||||
/* Secure boxes BSS section */
|
||||
/* Protected uVisor boxes' static memories */
|
||||
. = ALIGN(32);
|
||||
__uvisor_bss_boxes_start = .;
|
||||
KEEP(*(.keep.uvisor.bss.boxes))
|
||||
|
@ -175,15 +176,16 @@ SECTIONS
|
|||
__uvisor_bss_end = .;
|
||||
} > RAM
|
||||
|
||||
/* Heap space for the page allocator */
|
||||
/* Heap space for the page allocator
|
||||
/* If uVisor shares the SRAM with the OS/app, ensure that this section is
|
||||
* the first one after the uVisor BSS section. Otherwise, ensure it is the
|
||||
* first one after the VTOR relocation section. */
|
||||
.page_heap (NOLOAD) :
|
||||
{
|
||||
. = ALIGN(32);
|
||||
__uvisor_page_start = .;
|
||||
KEEP(*(.keep.uvisor.page_heap))
|
||||
|
||||
. = ALIGN( (1 << LOG2CEIL(LENGTH(RAM))) / 8);
|
||||
|
||||
__uvisor_page_end = .;
|
||||
} > RAM
|
||||
|
||||
|
@ -284,10 +286,6 @@ SECTIONS
|
|||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__stack = __StackTop;
|
||||
__StackLimit = __StackTop - STACK_SIZE;
|
||||
|
||||
.heap (NOLOAD):
|
||||
{
|
||||
__uvisor_heap_start = .;
|
||||
|
@ -296,17 +294,21 @@ SECTIONS
|
|||
end = __end__;
|
||||
_end = __end__;
|
||||
. += HEAP_SIZE;
|
||||
__HeapLimit = .;
|
||||
__uvisor_heap_end = .;
|
||||
} > RAM
|
||||
|
||||
__HeapLimit = __StackLimit;
|
||||
__uvisor_heap_end = __StackLimit;
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__stack = __StackTop;
|
||||
__StackLimit = __StackTop - STACK_SIZE;
|
||||
|
||||
ASSERT(__StackLimit >= __HeapLimit, "Region RAM overflowed with stack and heap")
|
||||
|
||||
/* Provide physical memory boundaries for uVisor. */
|
||||
__uvisor_flash_start = ORIGIN(FLASH);
|
||||
__uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
|
||||
__uvisor_sram_start = ORIGIN(RAM);
|
||||
__uvisor_sram_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||
|
||||
/* Check if FLASH usage exceeds FLASH size. */
|
||||
ASSERT(LENGTH(FLASH) >= __uvisor_secure_end, "FLASH memory overflowed!")
|
||||
__uvisor_public_sram_start = __uvisor_sram_start;
|
||||
__uvisor_public_sram_end = __uvisor_sram_end;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue