[132f194] | 1 | /* bsp_start() |
---|
| 2 | * |
---|
| 3 | * This routine starts the application. It includes application, |
---|
| 4 | * board, and monitor specific initialization and configuration. |
---|
| 5 | * The generic CPU dependent initialization has been performed |
---|
| 6 | * before this routine is invoked. |
---|
| 7 | * |
---|
| 8 | * INPUT: NONE |
---|
| 9 | * |
---|
| 10 | * OUTPUT: NONE |
---|
| 11 | * |
---|
| 12 | * COPYRIGHT (c) 1989-1998. |
---|
| 13 | * On-Line Applications Research Corporation (OAR). |
---|
| 14 | * Copyright assigned to U.S. Government, 1994. |
---|
| 15 | * |
---|
| 16 | * The license and distribution terms for this file may be |
---|
| 17 | * found in the file LICENSE in this distribution or at |
---|
| 18 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 19 | * |
---|
| 20 | * $Id$ |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #include <bsp.h> |
---|
| 24 | #include <rtems/libio.h> |
---|
| 25 | |
---|
| 26 | #include <libcsupport.h> |
---|
| 27 | |
---|
| 28 | #include <string.h> |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | /* |
---|
| 32 | * The original table from the application and our copy of it with |
---|
| 33 | * some changes. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | extern rtems_configuration_table Configuration; |
---|
| 37 | rtems_configuration_table BSP_Configuration; |
---|
| 38 | |
---|
| 39 | rtems_cpu_table Cpu_table; |
---|
| 40 | |
---|
| 41 | char *rtems_progname; |
---|
| 42 | |
---|
| 43 | /* Initialize whatever libc we are using |
---|
| 44 | * called from postdriver hook |
---|
| 45 | */ |
---|
| 46 | void bsp_postdriver_hook(void); |
---|
| 47 | void bsp_libc_init( void *, unsigned32, int ); |
---|
| 48 | |
---|
| 49 | /* |
---|
| 50 | * Function: bsp_pretasking_hook |
---|
| 51 | * Created: 95/03/10 |
---|
| 52 | * |
---|
| 53 | * Description: |
---|
| 54 | * BSP pretasking hook. Called just before drivers are initialized. |
---|
| 55 | * Used to setup libc and install any BSP extensions. |
---|
| 56 | * |
---|
| 57 | * NOTES: |
---|
| 58 | * Must not use libc (to do io) from here, since drivers are |
---|
| 59 | * not yet initialized. |
---|
| 60 | * |
---|
| 61 | */ |
---|
| 62 | |
---|
| 63 | void bsp_pretasking_hook(void) |
---|
| 64 | { |
---|
| 65 | extern void *_HeapStart; |
---|
| 66 | extern rtems_unsigned32 _HeapSize; |
---|
| 67 | |
---|
| 68 | bsp_libc_init(&_HeapStart, _HeapSize, 0); |
---|
| 69 | |
---|
| 70 | #ifdef RTEMS_DEBUG |
---|
| 71 | rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); |
---|
| 72 | #endif |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | /* |
---|
| 76 | * bsp_start |
---|
| 77 | * |
---|
| 78 | * This routine does the bulk of the system initialization. |
---|
| 79 | */ |
---|
| 80 | |
---|
| 81 | void bsp_start( void ) |
---|
| 82 | { |
---|
| 83 | extern void *_WorkspaceBase; |
---|
| 84 | |
---|
| 85 | /* |
---|
| 86 | * Allocate the memory for the RTEMS Work Space. This can come from |
---|
| 87 | * a variety of places: hard coded address, malloc'ed from outside |
---|
| 88 | * RTEMS world (e.g. simulator or primitive memory manager), or (as |
---|
| 89 | * typically done by stock BSPs) by subtracting the required amount |
---|
| 90 | * of work space from the last physical address on the CPU board. |
---|
| 91 | */ |
---|
| 92 | #if 0 |
---|
| 93 | Cpu_table.interrupt_vector_table = (mc68000_isr *) 0/*&M68Kvec*/; |
---|
| 94 | #endif |
---|
| 95 | |
---|
| 96 | /* |
---|
| 97 | * Need to "allocate" the memory for the RTEMS Workspace and |
---|
| 98 | * tell the RTEMS configuration where it is. This memory is |
---|
| 99 | * not malloc'ed. It is just "pulled from the air". |
---|
| 100 | */ |
---|
| 101 | |
---|
| 102 | BSP_Configuration.work_space_start = (void *)&_WorkspaceBase; |
---|
| 103 | |
---|
| 104 | /* |
---|
| 105 | * Account for the console's resources |
---|
| 106 | */ |
---|
| 107 | |
---|
| 108 | console_reserve_resources( &BSP_Configuration ); |
---|
| 109 | |
---|
| 110 | /* |
---|
| 111 | * initialize the CPU table for this BSP |
---|
| 112 | */ |
---|
| 113 | |
---|
| 114 | Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ |
---|
| 115 | Cpu_table.postdriver_hook = bsp_postdriver_hook; |
---|
| 116 | Cpu_table.do_zero_of_workspace = TRUE; |
---|
| 117 | Cpu_table.interrupt_stack_size = 4096; |
---|
| 118 | } |
---|