mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
Removed symbols and renamed sections.
Added bsp_start_memcpy(). Documentation. Changes for external ROM start.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2009-09-15 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* shared/include/linker-symbols.h, shared/startup/linkcmds.base:
|
||||
Removed symbols and renamed sections.
|
||||
* shared/include/start.h, shared/start/start.S: Added
|
||||
bsp_start_memcpy(). Documentation. Changes for external ROM start.
|
||||
|
||||
2009-07-15 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* shared/irq/irq_asm.S, shared/startup/linkcmds.rom: Removed files.
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup bsp_linker
|
||||
*
|
||||
* @brief Symbols defined in linker command base file.
|
||||
*/
|
||||
|
||||
@@ -20,20 +22,22 @@
|
||||
#ifndef LIBBSP_ARM_SHARED_LINKER_SYMBOLS_H
|
||||
#define LIBBSP_ARM_SHARED_LINKER_SYMBOLS_H
|
||||
|
||||
/**
|
||||
* @defgroup bsp_linker Linker Support
|
||||
*
|
||||
* @ingroup bsp_kit
|
||||
*
|
||||
* @brief Linker support.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef ASM
|
||||
#define LINKER_SYMBOL(sym) extern char sym [];
|
||||
#else
|
||||
#define LINKER_SYMBOL(sym) .extern sym
|
||||
#endif
|
||||
|
||||
LINKER_SYMBOL(bsp_region_text_begin)
|
||||
LINKER_SYMBOL(bsp_region_text_end)
|
||||
LINKER_SYMBOL(bsp_region_text_size)
|
||||
|
||||
LINKER_SYMBOL(bsp_region_data_begin)
|
||||
LINKER_SYMBOL(bsp_region_data_end)
|
||||
LINKER_SYMBOL(bsp_region_data_size)
|
||||
|
||||
LINKER_SYMBOL(bsp_stack_irq_begin)
|
||||
LINKER_SYMBOL(bsp_stack_irq_end)
|
||||
LINKER_SYMBOL(bsp_stack_irq_size)
|
||||
@@ -94,4 +98,6 @@ LINKER_SYMBOL(bsp_section_stack_begin)
|
||||
LINKER_SYMBOL(bsp_section_stack_end)
|
||||
LINKER_SYMBOL(bsp_section_stack_size)
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* LIBBSP_ARM_SHARED_LINKER_SYMBOLS_H */
|
||||
|
||||
@@ -1,54 +1,74 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Start entry functions.
|
||||
* @ingroup bsp_start
|
||||
*
|
||||
* @brief System low level start.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008
|
||||
* Embedded Brains GmbH
|
||||
* Copyright (c) 2008, 2009
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* rtems@embedded-brains.de
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* The license and distribution terms for this file may be found in the file
|
||||
* LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
#ifndef LIBBSP_ARM_SHARED_START_H
|
||||
#define LIBBSP_ARM_SHARED_START_H
|
||||
|
||||
#ifndef ASM
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* @brief System start entry.
|
||||
*/
|
||||
void start( void);
|
||||
/**
|
||||
* @defgroup bsp_start System Start
|
||||
*
|
||||
* @ingroup bsp_kit
|
||||
*
|
||||
* @brief System low level start.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Start entry hook 0.
|
||||
*
|
||||
* This hook will be called from the start entry code after all modes and
|
||||
* stack pointers are initialized but before the copying of the exception
|
||||
* vectors.
|
||||
*/
|
||||
void bsp_start_hook_0( void);
|
||||
/**
|
||||
* @brief System start entry.
|
||||
*/
|
||||
void start(void);
|
||||
|
||||
/**
|
||||
* @brief Start entry hook 1.
|
||||
*
|
||||
* This hook will be called from the start entry code after copying of the
|
||||
* exception vectors but before the call to boot card.
|
||||
*/
|
||||
void bsp_start_hook_1( void);
|
||||
/**
|
||||
* @brief Start entry hook 0.
|
||||
*
|
||||
* This hook will be called from the start entry code after all modes and
|
||||
* stack pointers are initialized but before the copying of the exception
|
||||
* vectors.
|
||||
*/
|
||||
void bsp_start_hook_0(void);
|
||||
|
||||
#else
|
||||
/**
|
||||
* @brief Start entry hook 1.
|
||||
*
|
||||
* This hook will be called from the start entry code after copying of the
|
||||
* exception vectors but before the call to boot_card().
|
||||
*/
|
||||
void bsp_start_hook_1(void);
|
||||
|
||||
.extern bsp_start_hook_0
|
||||
/**
|
||||
* @brief Similar to standard memcpy().
|
||||
*
|
||||
* The memory areas must be word aligned. Copy code will be executed from the
|
||||
* stack. If @a dest equals @a src nothing will be copied.
|
||||
*/
|
||||
void bsp_start_memcpy(int *dest, const int *src, size_t n);
|
||||
|
||||
.extern bsp_start_hook_1
|
||||
/**
|
||||
* @brief ARM entry point to bsp_start_memcpy().
|
||||
*/
|
||||
void bsp_start_memcpy_arm(int *dest, const int *src, size_t n);
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
#endif /* LIBBSP_ARM_SHARED_START_H */
|
||||
|
||||
@@ -15,19 +15,23 @@
|
||||
* The license and distribution terms for this file may be found in the file
|
||||
* LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
|
||||
#include <rtems/asm.h>
|
||||
|
||||
#include <bspopts.h>
|
||||
#include <bsp/linker-symbols.h>
|
||||
#include <bsp/start.h>
|
||||
|
||||
/* External symbols */
|
||||
|
||||
.extern bsp_reset
|
||||
.extern boot_card
|
||||
.extern bsp_start_hook_0
|
||||
.extern bsp_start_hook_1
|
||||
|
||||
/* Global symbols */
|
||||
|
||||
.globl start
|
||||
.globl SWI_Handler
|
||||
.globl bsp_start_memcpy
|
||||
|
||||
/* Program Status Register definitions */
|
||||
|
||||
@@ -42,8 +46,9 @@
|
||||
.equ PSR_F, 0x40
|
||||
.equ PSR_T, 0x20
|
||||
|
||||
.section ".bsp_start", "ax"
|
||||
|
||||
.arm
|
||||
.section ".bsp_start", "x"
|
||||
|
||||
/*
|
||||
* This is the exception vector table and the pointers to the default
|
||||
@@ -66,7 +71,11 @@ vector_block:
|
||||
|
||||
handler_addr_reset:
|
||||
|
||||
#ifdef BSP_START_RESET_VECTOR
|
||||
.word BSP_START_RESET_VECTOR
|
||||
#else
|
||||
.word start
|
||||
#endif
|
||||
|
||||
handler_addr_undef:
|
||||
|
||||
@@ -100,63 +109,64 @@ handler_addr_fiq:
|
||||
|
||||
start:
|
||||
|
||||
/*
|
||||
* We do not save the context since we do not return to the boot
|
||||
* loader.
|
||||
*/
|
||||
/*
|
||||
* We do not save the context since we do not return to the boot
|
||||
* loader.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set SVC mode, disable interrupts and enable ARM instructions.
|
||||
*/
|
||||
/*
|
||||
* Set SVC mode, disable interrupts and enable ARM instructions.
|
||||
*/
|
||||
mov r0, #(PSR_MODE_SVC | PSR_I | PSR_F)
|
||||
msr cpsr, r0
|
||||
|
||||
/* Initialize stack pointer registers for the various modes */
|
||||
/* Initialize stack pointer registers for the various modes */
|
||||
|
||||
/* Enter IRQ mode and set up the IRQ stack pointer */
|
||||
/* Enter IRQ mode and set up the IRQ stack pointer */
|
||||
mov r0, #(PSR_MODE_IRQ | PSR_I | PSR_F)
|
||||
msr cpsr, r0
|
||||
ldr sp, =bsp_stack_irq_end
|
||||
|
||||
/* Enter FIQ mode and set up the FIQ stack pointer */
|
||||
/* Enter FIQ mode and set up the FIQ stack pointer */
|
||||
mov r0, #(PSR_MODE_FIQ | PSR_I | PSR_F)
|
||||
msr cpsr, r0
|
||||
ldr sp, =bsp_stack_fiq_end
|
||||
|
||||
/* Enter ABT mode and set up the ABT stack pointer */
|
||||
/* Enter ABT mode and set up the ABT stack pointer */
|
||||
mov r0, #(PSR_MODE_ABT | PSR_I | PSR_F)
|
||||
msr cpsr, r0
|
||||
ldr sp, =bsp_stack_abt_end
|
||||
|
||||
/* Enter UNDEF mode and set up the UNDEF stack pointer */
|
||||
/* Enter UNDEF mode and set up the UNDEF stack pointer */
|
||||
mov r0, #(PSR_MODE_UNDEF | PSR_I | PSR_F)
|
||||
msr cpsr, r0
|
||||
ldr sp, =bsp_stack_undef_end
|
||||
|
||||
/* Enter SVC mode and set up the SVC stack pointer */
|
||||
/* Enter SVC mode and set up the SVC stack pointer */
|
||||
mov r0, #(PSR_MODE_SVC | PSR_I | PSR_F)
|
||||
msr cpsr, r0
|
||||
ldr sp, =bsp_stack_svc_end
|
||||
|
||||
/* Stay in SVC mode */
|
||||
/* Stay in SVC mode */
|
||||
|
||||
/* Brach to start hook 0 */
|
||||
#ifdef __thumb__
|
||||
ldr r3, =bsp_start_hook_0
|
||||
mov lr, pc
|
||||
bx r3
|
||||
.thumb
|
||||
bx pc
|
||||
nop
|
||||
.arm
|
||||
#else
|
||||
bl bsp_start_hook_0
|
||||
#endif
|
||||
/*
|
||||
* Branch to start hook 0.
|
||||
*
|
||||
* This code up to the start hook 0 may run with an address offset so
|
||||
* it must be position independent. After the start hook 0 it is
|
||||
* assumed that the code can run at its intended position. The link
|
||||
* register will be loaded with the absolute address.
|
||||
*/
|
||||
|
||||
/*
|
||||
ldr lr, =bsp_start_hook_0_done
|
||||
b bsp_start_hook_0
|
||||
|
||||
bsp_start_hook_0_done:
|
||||
|
||||
/*
|
||||
* Initialize the exception vectors. This includes the exceptions
|
||||
* vectors and the pointers to the default exception handlers.
|
||||
*/
|
||||
*/
|
||||
|
||||
ldr r0, =bsp_section_vector_begin
|
||||
adr r1, vector_block
|
||||
@@ -165,26 +175,15 @@ start:
|
||||
ldmia r1!, {r2-r9}
|
||||
stmia r0!, {r2-r9}
|
||||
|
||||
/* Brach to start hook 1 */
|
||||
#ifdef __thumb__
|
||||
ldr r3, =bsp_start_hook_1
|
||||
mov lr, pc
|
||||
bx r3
|
||||
.thumb
|
||||
bx pc
|
||||
nop
|
||||
.arm
|
||||
#else
|
||||
/* Branch to start hook 1 */
|
||||
bl bsp_start_hook_1
|
||||
#endif
|
||||
|
||||
|
||||
/* Brach to boot card */
|
||||
/* Branch to boot card */
|
||||
mov r0, #0
|
||||
#ifdef __thumb__
|
||||
ldr r3, =boot_card
|
||||
mov lr, pc
|
||||
bx r3
|
||||
mov lr, pc
|
||||
bx r3
|
||||
.thumb
|
||||
bx pc
|
||||
nop
|
||||
@@ -193,11 +192,11 @@ start:
|
||||
bl boot_card
|
||||
#endif
|
||||
|
||||
/* Branch to reset function */
|
||||
/* Branch to reset function */
|
||||
#ifdef __thumb__
|
||||
ldr r3, =bsp_reset
|
||||
mov lr, pc
|
||||
bx r3
|
||||
mov lr, pc
|
||||
bx r3
|
||||
.thumb
|
||||
bx pc
|
||||
nop
|
||||
@@ -206,10 +205,50 @@ start:
|
||||
bl bsp_reset
|
||||
#endif
|
||||
|
||||
/* Spin forever */
|
||||
|
||||
SWI_Handler:
|
||||
/* Spin forever */
|
||||
|
||||
twiddle:
|
||||
|
||||
b twiddle
|
||||
|
||||
DEFINE_FUNCTION_ARM(bsp_start_memcpy)
|
||||
|
||||
/* Return if dest == src */
|
||||
cmp r0, r1
|
||||
bxeq lr
|
||||
|
||||
/* Return if length is zero */
|
||||
mov r3, #0
|
||||
cmp r3, r2
|
||||
bxeq lr
|
||||
|
||||
/* Save non-volatile registers */
|
||||
push {r4-r8, lr}
|
||||
|
||||
/* Copy worker routine to stack */
|
||||
adr ip, bsp_start_memcpy_begin
|
||||
ldm ip, {r3-r8}
|
||||
push {r3-r8}
|
||||
|
||||
/* Execute worker routine */
|
||||
mov r3, #0
|
||||
mov ip, sp
|
||||
mov lr, pc
|
||||
bx ip
|
||||
|
||||
/* Restore stack and non-volatile registers */
|
||||
add sp, sp, #24
|
||||
pop {r4-r8, lr}
|
||||
|
||||
/* Return */
|
||||
bx lr
|
||||
|
||||
bsp_start_memcpy_begin:
|
||||
|
||||
/* Worker routine */
|
||||
ldr ip, [r1, r3]
|
||||
str ip, [r0, r3]
|
||||
add r3, r3, #4
|
||||
cmp r3, r2
|
||||
bcc bsp_start_memcpy_begin
|
||||
bx lr
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup bsp_linker
|
||||
*
|
||||
* @brief Linker command base file.
|
||||
*/
|
||||
|
||||
@@ -30,14 +32,6 @@ bsp_section_align = 32;
|
||||
|
||||
bsp_stack_align = 4;
|
||||
|
||||
bsp_region_text_begin = ORIGIN (REGION_TEXT);
|
||||
bsp_region_text_size = LENGTH (REGION_TEXT);
|
||||
bsp_region_text_end = bsp_region_text_begin + bsp_region_text_size;
|
||||
|
||||
bsp_region_data_begin = ORIGIN (REGION_DATA);
|
||||
bsp_region_data_size = LENGTH (REGION_DATA);
|
||||
bsp_region_data_end = bsp_region_data_begin + bsp_region_data_size;
|
||||
|
||||
/*
|
||||
* BSP: Symbols that may be defined externally
|
||||
*/
|
||||
@@ -138,11 +132,6 @@ SECTIONS {
|
||||
*/
|
||||
bsp_section_text_begin = .;
|
||||
|
||||
/*
|
||||
* BSP: System startup entry
|
||||
*/
|
||||
KEEP (*(.bsp_start))
|
||||
|
||||
/*
|
||||
* BSP: Moved into .text from .init
|
||||
*/
|
||||
@@ -290,7 +279,7 @@ SECTIONS {
|
||||
.fast : {
|
||||
bsp_section_fast_begin = .;
|
||||
|
||||
*(.fast)
|
||||
*(.bsp_fast)
|
||||
|
||||
. = ALIGN (bsp_section_align);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user