diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-12 21:18:07 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-09-12 21:18:07 +0000 |
commit | 3ab13d5ce8ea0c3b7152b03a6ec8e20ef4c45e3d (patch) | |
tree | a33102536cae768109a7f9010c49323df9938417 /c/src/lib/libbsp/arm | |
parent | 2008-09-12 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-3ab13d5ce8ea0c3b7152b03a6ec8e20ef4c45e3d.tar.bz2 |
2008-09-12 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac, startup/bspclean.c, startup/bspstart.c:
Now support bsp_get_work_area() and used shared implementation of it
and bsp_pretasking_hook.
Diffstat (limited to 'c/src/lib/libbsp/arm')
-rw-r--r-- | c/src/lib/libbsp/arm/csb337/ChangeLog | 6 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb337/Makefile.am | 6 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb337/configure.ac | 2 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb337/startup/bspclean.c | 3 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/csb337/startup/bspstart.c | 164 |
5 files changed, 68 insertions, 113 deletions
diff --git a/c/src/lib/libbsp/arm/csb337/ChangeLog b/c/src/lib/libbsp/arm/csb337/ChangeLog index 205b61aebd..b16c18cdc1 100644 --- a/c/src/lib/libbsp/arm/csb337/ChangeLog +++ b/c/src/lib/libbsp/arm/csb337/ChangeLog @@ -1,3 +1,9 @@ +2008-09-12 Joel Sherrill <joel.sherrill@OARcorp.com> + + * Makefile.am, configure.ac, startup/bspclean.c, startup/bspstart.c: + Now support bsp_get_work_area() and used shared implementation of it + and bsp_pretasking_hook. + 2008-08-21 Joel Sherrill <joel.sherrill@oarcorp.com> * Makefile.am: No BSP should use exit.c as a file name. exit() is POSIX diff --git a/c/src/lib/libbsp/arm/csb337/Makefile.am b/c/src/lib/libbsp/arm/csb337/Makefile.am index 33baf87936..e7cd71141f 100644 --- a/c/src/lib/libbsp/arm/csb337/Makefile.am +++ b/c/src/lib/libbsp/arm/csb337/Makefile.am @@ -26,9 +26,9 @@ project_lib_DATA = start.$(OBJEXT) dist_project_lib_DATA += startup/linkcmds startup_SOURCES = ../../shared/bsplibc.c ../../shared/bsppost.c \ - ../../shared/bsppredriverhook.c \ - startup/bspstart.c startup/bspclean.c startup/memmap.c \ - ../../shared/bootcard.c ../../shared/sbrk.c \ + ../../shared/bsppredriverhook.c ../shared/bspgetworkarea.c \ + ../../shared/bsppretaskinghook.c startup/bspstart.c startup/bspclean.c \ + startup/memmap.c ../../shared/bootcard.c ../../shared/sbrk.c \ ../../shared/gnatinstallhandler.c console_SOURCES = console/uarts.c ../../shared/console.c abort_SOURCES = ../shared/abort/abort.c diff --git a/c/src/lib/libbsp/arm/csb337/configure.ac b/c/src/lib/libbsp/arm/csb337/configure.ac index a05ef96500..121761c352 100644 --- a/c/src/lib/libbsp/arm/csb337/configure.ac +++ b/c/src/lib/libbsp/arm/csb337/configure.ac @@ -18,6 +18,8 @@ RTEMS_PROG_CCAS RTEMS_CHECK_NETWORKING AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes") +RTEMS_BSP_BOOTCARD_HANDLES_RAM_ALLOCATION + # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/c/src/lib/libbsp/arm/csb337/startup/bspclean.c b/c/src/lib/libbsp/arm/csb337/startup/bspclean.c index 68448d9b55..c97f462dc9 100644 --- a/c/src/lib/libbsp/arm/csb337/startup/bspclean.c +++ b/c/src/lib/libbsp/arm/csb337/startup/bspclean.c @@ -10,7 +10,8 @@ * * * $Id$ -*/ + */ + #include <stdio.h> #include <bsp.h> #include <rtems/bspIo.h> diff --git a/c/src/lib/libbsp/arm/csb337/startup/bspstart.c b/c/src/lib/libbsp/arm/csb337/startup/bspstart.c index 0df2d458c4..a9fc19f602 100644 --- a/c/src/lib/libbsp/arm/csb337/startup/bspstart.c +++ b/c/src/lib/libbsp/arm/csb337/startup/bspstart.c @@ -34,92 +34,38 @@ extern void rtems_irq_mngt_init(void); void bsp_libc_init( void *, uint32_t, int ); static void fix_mac_addr(void); -/**************************************************************************/ -/* */ -/* NAME: bsp_pretasking_hook - Function to setup system before startup */ -/* */ -/* DESCRIPTION: */ -/* This function is called before drivers are initialized and used */ -/* to setup libc and BSP extensions. */ -/* */ -/* RESTRICTIONS/LIMITATIONS: */ -/* Since this function is setting up libc, it cannot use and libc */ -/* functions. */ -/* */ -/**************************************************************************/ -void bsp_pretasking_hook(void) -{ - uint32_t heap_start; - uint32_t heap_size; - - /* - * Set up the heap. - */ - heap_start = free_mem_start; - heap_size = free_mem_end - free_mem_start; - - /* call rtems lib init - malloc stuff */ - bsp_libc_init((void *)heap_start, heap_size, 0); -} - - -/**************************************************************************/ -/* */ -/* NAME: bsp_start_default - BSP initialization function */ -/* */ -/* DESCRIPTION: */ -/* This function is called before RTEMS is initialized and used */ -/* adjust the kernel's configuration. */ -/* */ -/* This function also configures the CPU's memory protection unit. */ -/* */ -/* RESTRICTIONS/LIMITATIONS: */ -/* Since RTEMS is not configured, no RTEMS functions can be called. */ -/* */ -/**************************************************************************/ +/* + * bsp_start_default - BSP initialization function + * + * This function is called before RTEMS is initialized and used + * adjust the kernel's configuration. + * + * This function also configures the CPU's memory protection unit. + * + * RESTRICTIONS/LIMITATIONS: + * Since RTEMS is not configured, no RTEMS functions can be called. + */ void bsp_start_default( void ) { - /* disable interrupts */ - AIC_CTL_REG(AIC_IDCR) = 0xffffffff; - - /* - * Some versions of the bootloader have the MAC address - * reversed. This fixes it, if necessary. - */ - fix_mac_addr(); - - /* Place RTEMS workspace at beginning of free memory. */ - Configuration.work_space_start = (void *)&_bss_free_start; - - free_mem_start = ((uint32_t)&_bss_free_start + - rtems_configuration_get_work_space_size()); - - free_mem_end = ((uint32_t)&_sdram_base + (uint32_t)&_sdram_size); - + /* disable interrupts */ + AIC_CTL_REG(AIC_IDCR) = 0xffffffff; + + /* + * Some versions of the bootloader have the MAC address + * reversed. This fixes it, if necessary. + */ + fix_mac_addr(); + + /* + * Init rtems exceptions management + */ + rtems_exception_init_mngt(); + + /* + * Init rtems interrupt management + */ + rtems_irq_mngt_init(); - /* - * Init rtems exceptions management - */ - rtems_exception_init_mngt(); - - /* - * Init rtems interrupt management - */ - rtems_irq_mngt_init(); - - /* - * The following information is very useful when debugging. - */ -#if 0 - printk( "work_space_size = 0x%x\n\r", - rtems_configuration_get_work_space_size() ); - printk( "microseconds_per_tick = 0x%x\n\r", - rtems_configuration_get_microseconds_per_tick() ); - printk( "ticks_per_timeslice = 0x%x\n\r", - rtems_configuration_get_ticks_per_timeslice() ); - printk( "work_space_size = 0x%x\n\r", - rtems_configuration_get_work_space_size() ); -#endif } /* bsp_start */ /* @@ -129,26 +75,26 @@ void bsp_start_default( void ) */ static void fix_mac_addr(void) { - uint8_t addr[6]; - - /* Read the MAC address */ - addr[0] = (EMAC_REG(EMAC_SA1L) >> 0) & 0xff; - addr[1] = (EMAC_REG(EMAC_SA1L) >> 8) & 0xff; - addr[2] = (EMAC_REG(EMAC_SA1L) >> 16) & 0xff; - addr[3] = (EMAC_REG(EMAC_SA1L) >> 24) & 0xff; - addr[4] = (EMAC_REG(EMAC_SA1H) >> 0) & 0xff; - addr[5] = (EMAC_REG(EMAC_SA1H) >> 8) & 0xff; - - /* Check which 3 bytes have Cogent's OUI */ - if ((addr[5] == 0x00) && (addr[4] == 0x23) && (addr[3] == 0x31)) { - EMAC_REG(EMAC_SA1L) = ((addr[5] << 0) | - (addr[4] << 8) | - (addr[3] << 16) | - (addr[2] << 24)); - - EMAC_REG(EMAC_SA1H) = ((addr[1] << 0) | - (addr[0] << 8)); - } + uint8_t addr[6]; + + /* Read the MAC address */ + addr[0] = (EMAC_REG(EMAC_SA1L) >> 0) & 0xff; + addr[1] = (EMAC_REG(EMAC_SA1L) >> 8) & 0xff; + addr[2] = (EMAC_REG(EMAC_SA1L) >> 16) & 0xff; + addr[3] = (EMAC_REG(EMAC_SA1L) >> 24) & 0xff; + addr[4] = (EMAC_REG(EMAC_SA1H) >> 0) & 0xff; + addr[5] = (EMAC_REG(EMAC_SA1H) >> 8) & 0xff; + + /* Check which 3 bytes have Cogent's OUI */ + if ((addr[5] == 0x00) && (addr[4] == 0x23) && (addr[3] == 0x31)) { + EMAC_REG(EMAC_SA1L) = ((addr[5] << 0) | + (addr[4] << 8) | + (addr[3] << 16) | + (addr[2] << 24)); + + EMAC_REG(EMAC_SA1H) = ((addr[1] << 0) | + (addr[0] << 8)); + } } @@ -158,7 +104,7 @@ static void fix_mac_addr(void) */ void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default"))); -/** +/* * Reset the system. * * This functions enables the watchdog and waits for it to @@ -166,12 +112,12 @@ void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default"))); */ void bsp_reset(void) { - rtems_interrupt_level level; + rtems_interrupt_level level; - rtems_interrupt_disable(level); + rtems_interrupt_disable(level); - /* Enable the watchdog timer, then wait for the world to end. */ - ST_REG(ST_WDMR) = ST_WDMR_RSTEN | 1; + /* Enable the watchdog timer, then wait for the world to end. */ + ST_REG(ST_WDMR) = ST_WDMR_RSTEN | 1; - while(1); + while(1); } |