Changeset 091705c in rtems


Ignore:
Timestamp:
Sep 18, 2009, 8:06:32 AM (10 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, master
Children:
5e61c80
Parents:
ba938b8
Message:

Removed symbols and renamed sections.
Added bsp_start_memcpy(). Documentation. Changes for external ROM start.

Location:
c/src/lib/libbsp/arm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/ChangeLog

    rba938b8 r091705c  
     12009-09-15      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * shared/include/linker-symbols.h, shared/startup/linkcmds.base:
     4        Removed symbols and renamed sections.
     5        * shared/include/start.h, shared/start/start.S: Added
     6        bsp_start_memcpy(). Documentation. Changes for external ROM start.
     7
    182009-07-15      Sebastian Huber <sebastian.huber@embedded-brains.de>
    29
  • c/src/lib/libbsp/arm/shared/include/linker-symbols.h

    rba938b8 r091705c  
    11/**
    22 * @file
     3 *
     4 * @ingroup bsp_linker
    35 *
    46 * @brief Symbols defined in linker command base file.
     
    2123#define LIBBSP_ARM_SHARED_LINKER_SYMBOLS_H
    2224
     25/**
     26 * @defgroup bsp_linker Linker Support
     27 *
     28 * @ingroup bsp_kit
     29 *
     30 * @brief Linker support.
     31 *
     32 * @{
     33 */
     34
    2335#ifndef ASM
    2436  #define LINKER_SYMBOL(sym) extern char sym [];
     
    2638  #define LINKER_SYMBOL(sym) .extern sym
    2739#endif
    28 
    29 LINKER_SYMBOL(bsp_region_text_begin)
    30 LINKER_SYMBOL(bsp_region_text_end)
    31 LINKER_SYMBOL(bsp_region_text_size)
    32 
    33 LINKER_SYMBOL(bsp_region_data_begin)
    34 LINKER_SYMBOL(bsp_region_data_end)
    35 LINKER_SYMBOL(bsp_region_data_size)
    3640
    3741LINKER_SYMBOL(bsp_stack_irq_begin)
     
    9599LINKER_SYMBOL(bsp_section_stack_size)
    96100
     101/** @} */
     102
    97103#endif /* LIBBSP_ARM_SHARED_LINKER_SYMBOLS_H */
  • c/src/lib/libbsp/arm/shared/include/start.h

    rba938b8 r091705c  
    22 * @file
    33 *
    4  * @brief Start entry functions.
     4 * @ingroup bsp_start
     5 *
     6 * @brief System low level start.
    57 */
    68
    79/*
    8  * Copyright (c) 2008
    9  * Embedded Brains GmbH
     10 * Copyright (c) 2008, 2009
     11 * embedded brains GmbH
    1012 * Obere Lagerstr. 30
    1113 * D-82178 Puchheim
    1214 * Germany
    13  * rtems@embedded-brains.de
     15 * <rtems@embedded-brains.de>
    1416 *
    15  * The license and distribution terms for this file may be found in the file
    16  * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
     17 * The license and distribution terms for this file may be
     18 * found in the file LICENSE in this distribution or at
     19 * http://www.rtems.com/license/LICENSE.
    1720 */
    1821
     
    2023#define LIBBSP_ARM_SHARED_START_H
    2124
    22 #ifndef ASM
     25#include <stddef.h>
    2326
    24   /**
    25    * @brief System start entry.
    26    */
    27   void start( void);
     27/**
     28 * @defgroup bsp_start System Start
     29 *
     30 * @ingroup bsp_kit
     31 *
     32 * @brief System low level start.
     33 *
     34 * @{
     35 */
    2836
    29   /**
    30    * @brief Start entry hook 0.
    31    *
    32    * This hook will be called from the start entry code after all modes and
    33    * stack pointers are initialized but before the copying of the exception
    34    * vectors.
    35    */
    36   void bsp_start_hook_0( void);
     37/**
     38* @brief System start entry.
     39*/
     40void start(void);
    3741
    38   /**
    39    * @brief Start entry hook 1.
    40    *
    41    * This hook will be called from the start entry code after copying of the
    42    * exception vectors but before the call to boot card.
    43    */
    44   void bsp_start_hook_1( void);
     42/**
     43* @brief Start entry hook 0.
     44*
     45* This hook will be called from the start entry code after all modes and
     46* stack pointers are initialized but before the copying of the exception
     47* vectors.
     48*/
     49void bsp_start_hook_0(void);
    4550
    46 #else
     51/**
     52* @brief Start entry hook 1.
     53*
     54* This hook will be called from the start entry code after copying of the
     55* exception vectors but before the call to boot_card().
     56*/
     57void bsp_start_hook_1(void);
    4758
    48   .extern bsp_start_hook_0
     59/**
     60 * @brief Similar to standard memcpy().
     61 *
     62 * The memory areas must be word aligned.  Copy code will be executed from the
     63 * stack.  If @a dest equals @a src nothing will be copied.
     64 */
     65void bsp_start_memcpy(int *dest, const int *src, size_t n);
    4966
    50   .extern bsp_start_hook_1
     67/**
     68 * @brief ARM entry point to bsp_start_memcpy().
     69 */
     70void bsp_start_memcpy_arm(int *dest, const int *src, size_t n);
    5171
    52 #endif
     72/** @} */
    5373
    5474#endif /* LIBBSP_ARM_SHARED_START_H */
  • c/src/lib/libbsp/arm/shared/start/start.S

    rba938b8 r091705c  
    1616 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
    1717 */
    18        
     18
     19#include <rtems/asm.h>
     20
     21#include <bspopts.h>
    1922#include <bsp/linker-symbols.h>
    20 #include <bsp/start.h>
    2123
    2224/* External symbols */
     
    2426.extern bsp_reset
    2527.extern boot_card
     28.extern bsp_start_hook_0
     29.extern bsp_start_hook_1
    2630
    2731/* Global symbols */
    2832
    2933.globl start
    30 .globl SWI_Handler
     34.globl bsp_start_memcpy
    3135
    3236/* Program Status Register definitions */
     
    4347.equ PSR_T,          0x20
    4448
     49.section ".bsp_start", "ax"
     50
    4551.arm
    46 .section ".bsp_start", "x"
    4752
    4853/*
     
    6772handler_addr_reset:
    6873
     74#ifdef BSP_START_RESET_VECTOR
     75        .word   BSP_START_RESET_VECTOR
     76#else
    6977        .word   start
     78#endif
    7079
    7180handler_addr_undef:
     
    101110start:
    102111
    103         /*
    104         * We do not save the context since we do not return to the boot
    105         * loader.
    106         */
    107 
    108         /*
    109         * Set SVC mode, disable interrupts and enable ARM instructions.
    110         */
     112        /*
     113        * We do not save the context since we do not return to the boot
     114        * loader.
     115        */
     116
     117        /*
     118        * Set SVC mode, disable interrupts and enable ARM instructions.
     119        */
    111120        mov     r0, #(PSR_MODE_SVC | PSR_I | PSR_F)
    112121        msr     cpsr, r0
    113122
    114         /* Initialize stack pointer registers for the various modes */
    115 
    116         /* Enter IRQ mode and set up the IRQ stack pointer */
     123        /* Initialize stack pointer registers for the various modes */
     124
     125        /* Enter IRQ mode and set up the IRQ stack pointer */
    117126        mov     r0, #(PSR_MODE_IRQ | PSR_I | PSR_F)
    118127        msr     cpsr, r0
    119128        ldr     sp, =bsp_stack_irq_end
    120129
    121         /* Enter FIQ mode and set up the FIQ stack pointer */
     130        /* Enter FIQ mode and set up the FIQ stack pointer */
    122131        mov     r0, #(PSR_MODE_FIQ | PSR_I | PSR_F)
    123132        msr     cpsr, r0
    124133        ldr     sp, =bsp_stack_fiq_end
    125134
    126         /* Enter ABT mode and set up the ABT stack pointer */
     135        /* Enter ABT mode and set up the ABT stack pointer */
    127136        mov     r0, #(PSR_MODE_ABT | PSR_I | PSR_F)
    128137        msr     cpsr, r0
    129138        ldr     sp, =bsp_stack_abt_end
    130139
    131         /* Enter UNDEF mode and set up the UNDEF stack pointer */
     140        /* Enter UNDEF mode and set up the UNDEF stack pointer */
    132141        mov     r0, #(PSR_MODE_UNDEF | PSR_I | PSR_F)
    133142        msr     cpsr, r0
    134143        ldr     sp, =bsp_stack_undef_end
    135144
    136         /* Enter SVC mode and set up the SVC stack pointer */
     145        /* Enter SVC mode and set up the SVC stack pointer */
    137146        mov     r0, #(PSR_MODE_SVC | PSR_I | PSR_F)
    138147        msr     cpsr, r0
    139148        ldr     sp, =bsp_stack_svc_end
    140149
    141         /* Stay in SVC mode */
    142 
    143         /* Brach to start hook 0 */
    144 #ifdef __thumb__
    145         ldr     r3, =bsp_start_hook_0
    146         mov     lr, pc
    147         bx      r3
    148 .thumb
    149         bx      pc
    150         nop
    151 .arm
    152 #else
    153         bl      bsp_start_hook_0
    154 #endif
    155 
    156         /*
     150        /* Stay in SVC mode */
     151
     152        /*
     153         * Branch to start hook 0.
     154         *
     155         * This code up to the start hook 0 may run with an address offset so
     156         * it must be position independent.  After the start hook 0 it is
     157         * assumed that the code can run at its intended position.  The link
     158         * register will be loaded with the absolute address.
     159         */
     160
     161        ldr     lr, =bsp_start_hook_0_done
     162        b       bsp_start_hook_0
     163
     164bsp_start_hook_0_done:
     165
     166        /*
    157167         * Initialize the exception vectors.  This includes the exceptions
    158168         * vectors and the pointers to the default exception handlers.
    159         */
     169        */
    160170
    161171        ldr     r0, =bsp_section_vector_begin
     
    166176        stmia   r0!, {r2-r9}
    167177
    168         /* Brach to start hook 1 */
    169 #ifdef __thumb__
    170         ldr     r3, =bsp_start_hook_1
    171         mov     lr, pc
    172         bx      r3
    173 .thumb
    174         bx      pc
    175         nop
    176 .arm
    177 #else
     178        /* Branch to start hook 1 */
    178179        bl      bsp_start_hook_1
    179 #endif
    180 
    181 
    182         /* Brach to boot card */
     180
     181        /* Branch to boot card */
    183182        mov     r0, #0
    184183#ifdef __thumb__
    185184        ldr     r3, =boot_card
    186         mov     lr, pc
    187         bx      r3
     185        mov     lr, pc
     186        bx      r3
    188187.thumb
    189188        bx      pc
     
    194193#endif
    195194
    196         /* Branch to reset function */
     195        /* Branch to reset function */
    197196#ifdef __thumb__
    198197        ldr     r3, =bsp_reset
    199         mov     lr, pc
    200         bx      r3
     198        mov     lr, pc
     199        bx      r3
    201200.thumb
    202201        bx      pc
     
    207206#endif
    208207
    209         /* Spin forever */
    210 
    211 SWI_Handler:
     208        /* Spin forever */
    212209
    213210twiddle:
    214211
    215212        b       twiddle
     213
     214DEFINE_FUNCTION_ARM(bsp_start_memcpy)
     215
     216        /* Return if dest == src */
     217        cmp     r0, r1
     218        bxeq    lr
     219
     220        /* Return if length is zero */
     221        mov     r3, #0
     222        cmp     r3, r2
     223        bxeq    lr
     224
     225        /* Save non-volatile registers */
     226        push    {r4-r8, lr}
     227
     228        /* Copy worker routine to stack */
     229        adr     ip, bsp_start_memcpy_begin
     230        ldm     ip, {r3-r8}
     231        push    {r3-r8}
     232
     233        /* Execute worker routine */
     234        mov     r3, #0
     235        mov     ip, sp
     236        mov     lr, pc
     237        bx      ip
     238
     239        /* Restore stack and non-volatile registers */
     240        add     sp, sp, #24
     241        pop     {r4-r8, lr}
     242
     243        /* Return */
     244        bx      lr
     245
     246bsp_start_memcpy_begin:
     247
     248        /* Worker routine */
     249        ldr     ip, [r1, r3]
     250        str     ip, [r0, r3]
     251        add     r3, r3, #4
     252        cmp     r3, r2
     253        bcc     bsp_start_memcpy_begin
     254        bx      lr
  • c/src/lib/libbsp/arm/shared/startup/linkcmds.base

    rba938b8 r091705c  
    11/**
    22 * @file
     3 *
     4 * @ingroup bsp_linker
    35 *
    46 * @brief Linker command base file.
     
    3133bsp_stack_align = 4;
    3234
    33 bsp_region_text_begin = ORIGIN (REGION_TEXT);
    34 bsp_region_text_size = LENGTH (REGION_TEXT);
    35 bsp_region_text_end = bsp_region_text_begin + bsp_region_text_size;
    36 
    37 bsp_region_data_begin = ORIGIN (REGION_DATA);
    38 bsp_region_data_size = LENGTH (REGION_DATA);
    39 bsp_region_data_end = bsp_region_data_begin + bsp_region_data_size;
    40 
    4135/*
    4236 * BSP: Symbols that may be defined externally
     
    138132                 */
    139133                bsp_section_text_begin = .;
    140 
    141                 /*
    142                  * BSP: System startup entry
    143                  */
    144                 KEEP (*(.bsp_start))
    145134
    146135                /*
     
    291280                bsp_section_fast_begin = .;
    292281
    293                 *(.fast)
     282                *(.bsp_fast)
    294283
    295284                . = ALIGN (bsp_section_align);
Note: See TracChangeset for help on using the changeset viewer.