Skip to content

Add uVisor support for the DISCO_F429ZI #3397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions features/FEATURE_UVISOR/AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion features/FEATURE_UVISOR/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.26.1
v0.26.2
4 changes: 2 additions & 2 deletions features/FEATURE_UVISOR/source/page_allocator.c_inc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
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.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand All @@ -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);
Expand Down Expand Up @@ -305,6 +307,7 @@ SECTIONS
} > m_data_2

USB_RAM_GAP = DEFINED(__usb_ram_size__) ? __usb_ram_size__ : 0x800;

/* Uninitialized data section */
.bss :
{
Expand Down Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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))

Expand Down Expand Up @@ -69,6 +94,7 @@ SECTIONS
} > FLASH

__exidx_start = .;

.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
Expand All @@ -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)
Expand Down Expand Up @@ -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__ = .;
Expand All @@ -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;

ASSERT(__StackLimit >= __HeapLimit, "Region RAM overflowed with stack and heap")

/* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
/* 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);
}
Loading