summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-06-23 16:04:33 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-06-23 16:04:33 +0000
commit504c5ca0f2079fee64e27d5a08187c0bc9b77feb (patch)
treeac3b94dad516f8c05ce65bacf3f32ace247948d4
parentb7176bd70ce1f29f11b509d99396a6309c1ea581 (diff)
downloadrtems-504c5ca0f2079fee64e27d5a08187c0bc9b77feb.tar.bz2
2006-06-23 Worth Burruss <worth@motioncontrol.org>
* Makefile.am, README, startup/init5235.c, startup/linkcmds, startup/linkcmdsflash, startup/linkcmdsram: Modify to the mcf5235 eval boards to either load and run from ram using the dBug moniter as the boot deviced (Board setup as shipped from the factory), or it allows the user to Boot his code from flash he loads onto the eval board. The code changes between the two are based on the selected linker script using a variable in the script. The options to the linker are used to override the default linker script and select which options to configure at boot either from flash, or from ram: -qnolinkcmds -T linkcmdsflash If no options are given the standard linker sript assumes dBug was used to set up the board and the user is going to load his program to RAM.
-rw-r--r--c/src/lib/libbsp/m68k/mcf5235/ChangeLog16
-rw-r--r--c/src/lib/libbsp/m68k/mcf5235/Makefile.am3
-rw-r--r--c/src/lib/libbsp/m68k/mcf5235/README8
-rw-r--r--c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c81
-rw-r--r--c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds9
-rw-r--r--c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash13
-rw-r--r--c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram9
7 files changed, 101 insertions, 38 deletions
diff --git a/c/src/lib/libbsp/m68k/mcf5235/ChangeLog b/c/src/lib/libbsp/m68k/mcf5235/ChangeLog
index b8db910867..990ed5655c 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/ChangeLog
+++ b/c/src/lib/libbsp/m68k/mcf5235/ChangeLog
@@ -1,3 +1,19 @@
+2006-06-23 Worth Burruss <worth@motioncontrol.org>
+
+ * Makefile.am, README, startup/init5235.c, startup/linkcmds,
+ startup/linkcmdsflash, startup/linkcmdsram: Modify to the mcf5235
+ eval boards to either load and run from ram using the dBug moniter as
+ the boot deviced (Board setup as shipped from the factory), or it
+ allows the user to Boot his code from flash he loads onto the eval
+ board. The code changes between the two are based on the selected
+ linker script using a variable in the script. The options to the
+ linker are used to override the default linker script and select
+ which options to configure at boot either from flash, or from ram:
+ -qnolinkcmds -T linkcmdsflash
+ If no options are given the standard linker sript assumes dBug was
+ used to set up the board and the user is going to load his program
+ to RAM.
+
2006-02-08 Joel Sherrill <joel@OARcorp.com>
* startup/linkcmds, startup/linkcmdsflash, startup/linkcmdsram: Add
diff --git a/c/src/lib/libbsp/m68k/mcf5235/Makefile.am b/c/src/lib/libbsp/m68k/mcf5235/Makefile.am
index d72c1bb964..6430187260 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/Makefile.am
+++ b/c/src/lib/libbsp/m68k/mcf5235/Makefile.am
@@ -23,7 +23,8 @@ start.$(OBJEXT): start/start.S
$(CPPASCOMPILE) -DASM -o $@ -c $<
project_lib_DATA = start.$(OBJEXT)
-dist_project_lib_DATA += startup/linkcmds
+dist_project_lib_DATA += startup/linkcmds startup/linkcmdsflash \
+ startup/linkcmdsram
noinst_PROGRAMS += startup.rel
startup_rel_SOURCES = startup/bspclean.c \
diff --git a/c/src/lib/libbsp/m68k/mcf5235/README b/c/src/lib/libbsp/m68k/mcf5235/README
index c8897ea829..0c2d066ee0 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/README
+++ b/c/src/lib/libbsp/m68k/mcf5235/README
@@ -11,6 +11,14 @@ ROM: 2M
This is a Motorola evaluation board that uses the MCF5235 Coldfire CPU.
This board is running at 150MHz scaled from a 25MHz oscillator.
+By default the BSP creates an image file for use when loaded into the
+RAM of the evaluation board. To create an image file to boot from flash
+add the following command to the applications Makefile:
+LDFLAGS += -qnolinkcmds -T linkcmdsflash
+
+Note: This BSP has also been tested with the Freescale / Axiom Manufacturing
+(M5235BCC Business Card Controller) evaluation board.
+
ACKNOWLEDGEMENTS:
=================
This BSP is heavily based on the work of:
diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c b/c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c
index 47de7f6d3a..0efab30131 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c
+++ b/c/src/lib/libbsp/m68k/mcf5235/startup/init5235.c
@@ -14,11 +14,23 @@
#define m68k_set_acr1(_acr1) asm volatile ("movec %0,%%acr1" : : "d" (_acr1))
#define MM_SDRAM_BASE (0x00000000)
+/*
+ * MCF5235_BSP_START_FROM_FLASH comes from the linker script
+ * If it is set to 0 then it is assumed that the motorola debug monitor
+ * is present and we do not need to re-initialize the SDRAM. Otherwise,
+ * if it is set to 1 then we want to boot our own code from flash and we
+ * do need to initialize the SDRAM.
+ */
+
+
+extern uint32_t MCF5235_BSP_START_FROM_FLASH;
+
void Init5235 (void)
{
extern void CopyDataClearBSSAndStart (void);
int x;
int temp = 0;
+ int *address_of_MCF5235_BSP_START_FROM_FLASH;
//Setup the GPIO Registers
MCF5235_GPIO_UART=0x3FFF;
@@ -29,37 +41,40 @@ void Init5235 (void)
MCF5235_CS_CSMR0 = 0x001f0001;
MCF5235_CS_CSCR0 = 0x1980;
- //Setup the SDRAM
- for(x=0; x<20000; x++)
- {
- temp +=1;
- }
- MCF5235_SDRAMC_DCR = 0x042E;
- MCF5235_SDRAMC_DACR0 = 0x00001300;
- MCF5235_SDRAMC_DMR0 = (0x00FC0000) | (0x00000001);
- for(x=0; x<20000; x++)
- {
- temp +=1;
- }
- // set ip ( bit 3 ) in dacr
- MCF5235_SDRAMC_DACR0 |= (0x00000008) ;
- // init precharge
- *((unsigned long *)MM_SDRAM_BASE) = 0xDEADBEEF;
- // set RE in dacr
- MCF5235_SDRAMC_DACR0 |= (0x00008000);
- // wait
- for(x=0; x<20000; x++)
- {
- temp +=1;
- }
- // issue IMRS
- MCF5235_SDRAMC_DACR0 |= (0x00000040);
- *((short *)MM_SDRAM_BASE) = 0;
- for(x=0; x<60000; x++)
- {
- temp +=1;
- }
- *((unsigned long*)MM_SDRAM_BASE)=0x12345678;
+ address_of_MCF5235_BSP_START_FROM_FLASH = (int *) & MCF5235_BSP_START_FROM_FLASH;
+ if ( (int)address_of_MCF5235_BSP_START_FROM_FLASH == 1) {
+ //Setup the SDRAM
+ for(x=0; x<20000; x++)
+ {
+ temp +=1;
+ }
+ MCF5235_SDRAMC_DCR = 0x042E;
+ MCF5235_SDRAMC_DACR0 = 0x00001300;
+ MCF5235_SDRAMC_DMR0 = (0x00FC0000) | (0x00000001);
+ for(x=0; x<20000; x++)
+ {
+ temp +=1;
+ }
+ // set ip ( bit 3 ) in dacr
+ MCF5235_SDRAMC_DACR0 |= (0x00000008) ;
+ // init precharge
+ *((unsigned long *)MM_SDRAM_BASE) = 0xDEADBEEF;
+ // set RE in dacr
+ MCF5235_SDRAMC_DACR0 |= (0x00008000);
+ // wait
+ for(x=0; x<20000; x++)
+ {
+ temp +=1;
+ }
+ // issue IMRS
+ MCF5235_SDRAMC_DACR0 |= (0x00000040);
+ *((short *)MM_SDRAM_BASE) = 0;
+ for(x=0; x<60000; x++)
+ {
+ temp +=1;
+ }
+ *((unsigned long*)MM_SDRAM_BASE)=0x12345678;
+ } /* we have finished setting up the sdram */
/* Copy the interrupt vector table to address 0x0 in SDRAM */
{
@@ -73,7 +88,9 @@ void Init5235 (void)
}
}
- /*
+ m68k_set_vbr(0);
+
+ /*
* Copy data, clear BSS and call boot_card()
*/
CopyDataClearBSSAndStart ();
diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds
index 6a92da08db..ddb980112c 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds
+++ b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmds
@@ -1,6 +1,6 @@
/*
* This file contains directives for the GNU linker which are specific
- * to the Arcturus uC DIMM ColdFire 5282
+ * to the Freescale ColdFire mcf5235
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
@@ -13,6 +13,13 @@
*/
/*
+ * declare for the MCF5235_BSP_START_FROM_FLASH
+ * 0 - use debug monitor to load to ram
+ * 1 - load everything from flash from scratch
+ */
+MCF5235_BSP_START_FROM_FLASH = 0;
+
+/*
* Declare some sizes.
*/
_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0 ;
diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash
index 74d94f07c2..b4d6dbf4c4 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash
+++ b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsflash
@@ -1,6 +1,6 @@
/*
* This file contains directives for the GNU linker which are specific
- * to the Arcturus uC DIMM ColdFire 5282
+ * to the Freescale ColdFire mcf5235
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
@@ -13,6 +13,13 @@
*/
/*
+ * declare for the MCF5235_BSP_START_FROM_FLASH
+ * 0 - use debug monitor to load to ram
+ * 1 - load everything from flash from scratch
+ */
+MCF5235_BSP_START_FROM_FLASH = 1;
+
+/*
* Declare some sizes.
*/
_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0 ;
@@ -64,8 +71,8 @@ SECTIONS
/*
* Initialization and finalization code.
- *
- * Various files can provide initialization and finalization
+ *
+ * Various files can provide initialization and finalization
* functions. crtbegin.o and crtend.o are two instances. The
* body of these functions are in .init and .fini sections. We
* accumulate the bodies here, and prepend function prologues
diff --git a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram
index 6a92da08db..ddb980112c 100644
--- a/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram
+++ b/c/src/lib/libbsp/m68k/mcf5235/startup/linkcmdsram
@@ -1,6 +1,6 @@
/*
* This file contains directives for the GNU linker which are specific
- * to the Arcturus uC DIMM ColdFire 5282
+ * to the Freescale ColdFire mcf5235
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
@@ -13,6 +13,13 @@
*/
/*
+ * declare for the MCF5235_BSP_START_FROM_FLASH
+ * 0 - use debug monitor to load to ram
+ * 1 - load everything from flash from scratch
+ */
+MCF5235_BSP_START_FROM_FLASH = 0;
+
+/*
* Declare some sizes.
*/
_RamBase = DEFINED(_RamBase) ? _RamBase : 0x0 ;