1 #ifndef CYGONCE_HAL_PLATFORM_SETUP_H
2 #define CYGONCE_HAL_PLATFORM_SETUP_H
3 /*=============================================================================
5 // hal_platform_setup.h
7 // Platform specific support for HAL (assembly code)
9 //=============================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 // Copyright (C) 2008 eCosCentric Limited
16 // eCos is free software; you can redistribute it and/or modify it under
17 // the terms of the GNU General Public License as published by the Free
18 // Software Foundation; either version 2 or (at your option) any later version.
20 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 // You should have received a copy of the GNU General Public License along
26 // with eCos; if not, write to the Free Software Foundation, Inc.,
27 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
29 // As a special exception, if other files instantiate templates or use macros
30 // or inline functions from this file, or you compile this file and link it
31 // with other works to produce a work based on this file, this file does not
32 // by itself cause the resulting work to be covered by the GNU General Public
33 // License. However the source code for this file must still be made available
34 // in accordance with section (3) of the GNU General Public License.
36 // This exception does not invalidate any other reasons why a work based on
37 // this file might be covered by the GNU General Public License.
38 // -------------------------------------------
39 //####ECOSGPLCOPYRIGHTEND####
40 //=============================================================================
41 //#####DESCRIPTIONBEGIN####
43 // Author(s): Uwe Kindler
44 // Contributors: Uwe Kindler
46 // Purpose: EA LPC2468 OEM platform specific support routines
48 // Usage: #include <cyg/hal/hal_platform_setup.h>
50 //####DESCRIPTIONEND####
52 //===========================================================================*/
53 #include <pkgconf/system.h>
54 #include <cyg/hal/var_io.h>
58 // The minimum initialisation code - we simply setup a valid C stack in
59 // internal SRAM and do any further initialisation in C code
61 #if defined(CYG_HAL_STARTUP_ROM)
64 // While setting the stack pointer please note that the
65 // Flash programming routines use a
66 // section of the on-chip SRAM. In-System Programming (ISP) uses
67 // the top 256 bytes and In-Application Programming (IAP) uses the
68 // top 128 bytes of the on-chip SRAM. The application stack should
69 // not overlap this area.
71 ldr r2,=0x4000ffff // ram end
75 // now map the vector table to internal flash - normally this should be
76 // the default value after boot - but we go the save way here and force
77 // the mapping to internal flash (the value for
78 // CYGARC_HAL_LPC24XX_REG_MEMMAP is 1)
80 ldr r0,=CYGARC_HAL_LPC24XX_REG_SCB_BASE
82 str r1, [r0,#CYGARC_HAL_LPC24XX_REG_MEMMAP]
85 // Now its is save to copy the first 64 bytes of flash to RAM
97 // Now we can map the vector table to internal SRAM because the SRAM no
98 // contains a copy of the vector table from flash (the value for
99 // CYGARC_HAL_LPC24XX_REG_MEMMAP is 2 = SRAM)
101 ldr r0,=CYGARC_HAL_LPC24XX_REG_SCB_BASE
102 mov r1,#2 // User RAM Mode. Interrupt
103 // vectors are re-mapped to Static RAM.
104 str r1, [r0,#CYGARC_HAL_LPC24XX_REG_MEMMAP]
107 // now we have a valid stack and we can jump into the beautiful
108 // world of C and do any further initialisation in C code
112 #define CYGSEM_HAL_ROM_RESET_USES_JUMP
118 #define PLATFORM_SETUP1 _setup
120 //-----------------------------------------------------------------------------
121 // end of hal_platform_setup.h
122 #endif // CYGONCE_HAL_PLATFORM_SETUP_H