Changeset f560d0a in rtems


Ignore:
Timestamp:
Sep 14, 2008, 8:22:57 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
a012d18
Parents:
12d853d
Message:

2008-09-14 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac, startup/bspstart.c: Split out bsp_get_work_area() into its own file and user BSP Framework to perform more initialization. Use same shared implementation as edb7312 and csb336.
Location:
c/src/lib/libbsp/arm/rtl22xx
Files:
4 edited

Legend:

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

    r12d853d rf560d0a  
     12008-09-14      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * Makefile.am, configure.ac, startup/bspstart.c: Split out
     4        bsp_get_work_area() into its own file and user BSP Framework to
     5        perform more initialization. Use same shared implementation as
     6        edb7312 and csb336.
     7
    182008-05-14      Joel Sherrill <joel.sherrill@OARcorp.com>
    29
  • c/src/lib/libbsp/arm/rtl22xx/Makefile.am

    r12d853d rf560d0a  
    2929include_HEADERS += ../../arm/shared/comm/uart.h
    3030startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \
    31     ../../shared/bsppredriverhook.c \
    32     startup/bspstart.c startup/bspclean.c ../../shared/bootcard.c \
    33     ../../shared/sbrk.c ../../shared/gnatinstallhandler.c
     31    ../../shared/bsppredriverhook.c ../../shared/bsppretaskinghook.c \
     32    ../shared/bspgetworkarea.c startup/bspstart.c startup/bspclean.c \
     33    ../../shared/bootcard.c ../../shared/sbrk.c \
     34    ../../shared/gnatinstallhandler.c
    3435console_SOURCES = ../../shared/console.c
    3536simple_abort_SOURCES = ../shared/abort/simple_abort.c
  • c/src/lib/libbsp/arm/rtl22xx/configure.ac

    r12d853d rf560d0a  
    1919AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
    2020
     21RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION
     22
    2123# Explicitly list all Makefiles here
    2224AC_CONFIG_FILES([Makefile])
  • c/src/lib/libbsp/arm/rtl22xx/startup/bspstart.c

    r12d853d rf560d0a  
    66 *  The license and distribution terms for this file may be
    77 *  found in the file LICENSE in this distribution or at
    8  *
    98 *  http://www.rtems.com/license/LICENSE.
    109 *
    11  *
    1210 *  $Id$
    13 */
     11 */
    1412
    1513#include <bsp.h>
     
    1816#include <lpc22xx.h>
    1917
    20 
    21 /*************************************************************/
    22 /* Macros                                                    */
    23 /*************************************************************/
    24 
    25 /*************************************************************/
    26 /* Data Structures                                           */
    27 /*************************************************************/
    28 
    29 /*************************************************************/
    30 /* Global Variables                                          */
    31 /*************************************************************/
    32 /*FIX ME:we do not have SDRAM, but can I define mutiple SRAM?*/
    33 
    34 extern void            *_flash_size;
    35 extern void            *_flash_base;
    36 extern void            *_sdram_size;
    37 extern void            *_sdram_base;
    38 extern void            *_bss_free_start;
    39 extern void            *_bss_start_;
    40 extern void            *_bss_end_;
    41 
    42 unsigned long           free_mem_start;
    43 unsigned long           free_mem_end;
    44 
    45 /*************************************************************/
    46 /* Function prototypes                                       */
    47 /*************************************************************/
     18/*
     19 * Function prototypes
     20 */
    4821extern void rtems_irq_mngt_init(void);
    4922void bsp_libc_init( void *, uint32_t, int );
    5023extern void  UART0_Ini(void);
    5124extern void printi(unsigned long);
    52 /**************************************************************************/
    53 /*                                                                        */
    54 /* NAME: bps_pretasking_hook - Function to setup system before startup    */
    55 /*                                                                        */
    56 /* DESCRIPTION:                                                           */
    57 /*   This function is called before drivers are initialized and used      */
    58 /*   to setup libc and BSP extensions. It configures non cacheable        */
    59 /*   SDRAM, SRAM, AIM, and ADM regions and sets up the CPU's memory       */
    60 /*   protection unit.                                                     */
    61 /*                                                                        */
    62 /* GLOBALS USED:                                                          */
    63 /*   free_mem_start                                                 */
    64 /*   free_mem_end                                                   */
    65 /*                                                                        */
    66 /* RESTRICTIONS/LIMITATIONS:                                              */
    67 /*   Since this function is setting up libc, it cannot use and libc       */
    68 /*   functions.                                                           */
    69 /*                                                                        */
    70 /**************************************************************************/
    71 void bsp_pretasking_hook(void)
    72 {
    73     uint32_t   heap_start;
    74     uint32_t   heap_size;
    7525
    76     /*
    77      * Set up the heap. It uses all free SDRAM except that reserved
    78      * for non-cached uses.
    79      */
    80     heap_start =  free_mem_start;
    81 
    82     /*   heap_size = (free_mem_end - heap_start - MEM_NOCACHE_SIZE); */
    83     /*the board seems to have only 512K memory, we use 256K as heap, 256K to
    84     store the .text*/
    85     heap_size = 0x40000;
    86 
    87     bsp_libc_init((void *)heap_start, heap_size, 0);
    88 } /* bsp_pretasking_hook */
    89 
    90 /**************************************************************************/
    91 /*                                                                        */
    92 /* NAME: bsp_start_default - BSP initialization function                  */
    93 /*                                                                        */
    94 /* DESCRIPTION:                                                           */
    95 /*   This function is called before RTEMS is initialized and used         */
    96 /*   adjust the kernel's configuration.                                   */
    97 /*                                                                        */
    98 /*   This function also configures the CPU's memory protection unit.      */
    99 /*                                                                        */
    100 /* GLOBALS USED:                                                          */
    101 /*    Configuration                                                       */
    102 /*    free_mem_start                                                      */
    103 /*    free_mem_end                                                        */
    104 /*    free_mem_nocache_start                                              */
    105 /*    _bss_free_start                                                     */
    106 /*    mpu_region_tbl                                                      */
    107 /*                                                                        */
    108 /*                                                                        */
    109 /*                                                                        */
    110 /*                                                                        */
    111 /* RESTRICTIONS/LIMITATIONS:                                              */
    112 /*   Since RTEMS is not configured, no RTEMS functions can be called.     */
    113 /*                                                                        */
    114 /**************************************************************************/
     26/*
     27 * bsp_start_default - BSP initialization function
     28 *
     29 * This function is called before RTEMS is initialized and used
     30 * adjust the kernel's configuration.
     31 *
     32 * This function also configures the CPU's memory protection unit.
     33 *
     34 * RESTRICTIONS/LIMITATIONS:
     35 *   Since RTEMS is not configured, no RTEMS functions can be called.
     36 *
     37 */
    11538void bsp_start_default( void )
    11639{
    117     PINSEL2 =0x0f814914;
    118     BCFG0 = 0x1000ffef;
    119     BCFG1 = 0x1000ffef;
     40  PINSEL2 =0x0f814914;
     41  BCFG0 = 0x1000ffef;
     42  BCFG1 = 0x1000ffef;
    12043
    121     MEMMAP = 0x2;  //debug and excute outside chip
     44  MEMMAP = 0x2;  //debug and excute outside chip
    12245
    123     PLLCON = 1;
    124 #if (Fpclk / (Fcclk / 4)) == 1
     46  PLLCON = 1;
     47  #if (Fpclk / (Fcclk / 4)) == 1
    12548    VPBDIV = 0;
    126 #endif
    127 #if (Fpclk / (Fcclk / 4)) == 2
     49  #endif
     50  #if (Fpclk / (Fcclk / 4)) == 2
    12851    VPBDIV = 2;
    129 #endif
    130 #if (Fpclk / (Fcclk / 4)) == 4
     52  #endif
     53  #if (Fpclk / (Fcclk / 4)) == 4
    13154    VPBDIV = 1;
    132 #endif
     55  #endif
    13356
    134 #if (Fcco / Fcclk) == 2
     57  #if (Fcco / Fcclk) == 2
    13558    PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
    136 #endif
    137 #if (Fcco / Fcclk) == 4
     59  #endif
     60  #if (Fcco / Fcclk) == 4
    13861    PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5);
    139 #endif
    140 #if (Fcco / Fcclk) == 8
     62  #endif
     63  #if (Fcco / Fcclk) == 8
    14164    PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5);
    142 #endif
    143 #if (Fcco / Fcclk) == 16
     65  #endif
     66  #if (Fcco / Fcclk) == 16
    14467    PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5);
    145 #endif
    146     PLLFEED = 0xaa;
    147     PLLFEED = 0x55;
    148     while((PLLSTAT & (1 << 10)) == 0);
    149     PLLCON = 3;
    150     PLLFEED = 0xaa;
    151     PLLFEED = 0x55;
     68  #endif
     69  PLLFEED = 0xaa;
     70  PLLFEED = 0x55;
     71  while((PLLSTAT & (1 << 10)) == 0);
     72  PLLCON = 3;
     73  PLLFEED = 0xaa;
     74  PLLFEED = 0x55;
    15275
    153     /* memory configure */
    154     /* it is not needed in my formatter board */
    155     //MAMCR = 0;
    156     // MAMTIM = 3;
    157     //MAMCR = 2;
     76  /* memory configure */
     77  /* it is not needed in my formatter board */
     78  //MAMCR = 0;
     79  // MAMTIM = 3;
     80  //MAMCR = 2;
    15881
    159     /* init VIC */
    160     VICIntEnClr = 0xffffffff;
    161     VICVectAddr = 0;
    162     VICIntSelect = 0;
     82  /* init VIC */
     83  VICIntEnClr = 0xffffffff;
     84  VICVectAddr = 0;
     85  VICIntSelect = 0;
    16386
    164     /* disable interrupts */
    165     /* Setup interrupt controller.*/
    166     VICProtection = 0;
     87  /* disable interrupts */
     88  /* Setup interrupt controller.*/
     89  VICProtection = 0;
    16790
    168     /* Place RTEMS workspace at beginning of free memory. */
    169     Configuration.work_space_start = (void *)&_bss_free_start;
     91  UART0_Ini();
    17092
    171     free_mem_start = ((uint32_t)&_bss_free_start +
    172                       rtems_configuration_get_work_space_size());
     93  /*
     94   * Init rtems exceptions management
     95   */
     96  rtems_exception_init_mngt();
    17397
    174     free_mem_end = ((uint32_t)&_sdram_base + (uint32_t)&_sdram_size);
    175 
    176     UART0_Ini();
    177 
    178     #if 0
    179     printk(" bsp_start_default 0x%08x\n", (int)&bsp_start_defalt);
    180     printk(" _bss_free_start 0x%08x\n", (int)&_bss_free_start);
    181     printk(" free_mem_start 0x%08x\n", (int)free_mem_start);
    182     printk(" _sdram_base 0x%08x\n", (int)&_sdram_base);
    183     printk(" _sdram_size 0x%08x\n", (int)&_sdram_size);
    184     printk(" free_mem_end 0x%08x\n", (int)free_mem_end);
    185     #endif
    186 
    187     /*
    188      * Init rtems exceptions management
    189      */
    190     rtems_exception_init_mngt();
    191 
    192     /*
    193      * Init rtems interrupt management
    194      */
    195     rtems_irq_mngt_init();
    196 
    197     /*
    198      *  The following information is very useful when debugging.
    199      */
    200 #if 0
    201 
    202     printk( "work_space_size = 0x%x\n",
    203             rtems_configuration_get_work_space_size() );
    204     printk( "microseconds_per_tick = 0x%x\n",
    205             rtems_configuration_get_microseconds_per_tick() );
    206     printk( "ticks_per_timeslice = 0x%x\n",
    207             rtems_configuration_get_ticks_per_timeslice() );
    208 
    209     /*  printk( "_stack_size = 0x%x\n", _stack_size );*/
    210     printk( "work_space_start = 0x%x\n", Configuration.work_space_start );
    211     printk( "work_space_size = 0x%x\n", rtems_configuration_get_work_space_size() );
    212 #endif
     98  /*
     99   * Init rtems interrupt management
     100   */
     101  rtems_irq_mngt_init();
    213102} /* bsp_start */
    214103
    215104
    216 /**
    217  *  Reset the system.
    218  *
    219  *  This functions enables the watchdog and waits for it to
    220  *  fire, thus resetting the system.
    221  */
    222105/**
    223106 *  Reset the system.
Note: See TracChangeset for help on using the changeset viewer.