changeset 1209:b33e882f6b64

Use .2ram strategy - from Jani Monoses
author gthomas
date Wed, 10 Sep 2003 20:52:52 +0000
parents 517229d4051f
children 786683319633
files packages/devs/flash/intel/strata/current/ChangeLog packages/devs/flash/intel/strata/current/cdl/flash_strata.cdl packages/devs/flash/intel/strata/current/src/flash_erase_block.c packages/devs/flash/intel/strata/current/src/flash_lock_block.c packages/devs/flash/intel/strata/current/src/flash_program_buf.c packages/devs/flash/intel/strata/current/src/flash_query.c packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
diffstat 7 files changed, 26 insertions(+), 92 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/flash/intel/strata/current/ChangeLog
+++ b/packages/devs/flash/intel/strata/current/ChangeLog
@@ -1,3 +1,13 @@
+2003-09-10  Jani Monoses <jani@iv.ro>
+	
+	* cdl/flash_strata.cdl:
+	* src/flash_lock_block.c (flash_lock_block): 
+	* src/flash_unlock_block.c (flash_unlock_block): 
+	* src/flash_erase_block.c (flash_erase_block): 
+	* src/flash_query.c (flash_query): 
+	* src/flash_program_buf.c (flash_program_buf): Use .2ram sections 
+	for putting flash functions to RAM instead of the old method.
+	
 2003-05-02  Jani Monoses <jani@iv.ro>
 
 	* src/strata.c: Switch to using generic flash_query_dev.
--- a/packages/devs/flash/intel/strata/current/cdl/flash_strata.cdl
+++ b/packages/devs/flash/intel/strata/current/cdl/flash_strata.cdl
@@ -57,90 +57,24 @@ cdl_package CYGPKG_DEVS_FLASH_STRATA {
 
     implements    CYGHWR_IO_FLASH_DEVICE
 
-#    implements    CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
-    cdl_option CYGOPT_DEVS_FLASH_STRATA_NOT_IN_RAM {
-	display   "Control Flash driver code copy to RAM"
-	flavor    bool
-	no_define
-	default_value 1
-	implements    CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
-	description "
-	Rarely, it is useful to disable the request that flash driver code
-	be copied to separate RAM for execution.  This option lets you do that.
-	It should only be controlled by redboot_XXX.ecm config files, for
-	building different varieties of RedBoot.
-	NEVER disable this option for ROM startup code, which executes in place
-	from Flash: the build will not work."
-    }
-
     active_if     CYGINT_DEVS_FLASH_STRATA_REQUIRED
 
     include_dir   .
     include_files ; # none _exported_ whatsoever
     description   "FLASH memory device support for Intel StrataFlash"
-    compile       strata.c
+    compile       strata.c flash_erase_block.c flash_program_buf.c flash_query.c
 
     define_proc {
         puts $::cdl_header "#include <pkgconf/system.h>";
         puts $::cdl_header "#include CYGDAT_DEVS_FLASH_STRATA_CFG";
     }
 
-    make -priority 1 {
-        flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c \
-                             $(REPOSITORY)/$(PACKAGE)/src/strata.h
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
-        echo " .text" >>flash_erase_block.s
-        echo " .globl flash_erase_block_end" >>flash_erase_block.s
-        echo "flash_erase_block_end:" >>flash_erase_block.s
-        $(CC) $(CFLAGS) -c -o flash_erase_block.o flash_erase_block.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_erase_block.o
-    }
-    make -priority 1 {
-        flash_program_buf.o: $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c \
-                             $(REPOSITORY)/$(PACKAGE)/src/strata.h
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
-        echo " .text" >>flash_program_buf.s
-        echo " .globl flash_program_buf_end" >>flash_program_buf.s
-        echo "flash_program_buf_end:" >>flash_program_buf.s
-        $(CC) $(CFLAGS) -c -o flash_program_buf.o flash_program_buf.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_program_buf.o
-    }
-    make -priority 1 {
-        flash_query.o: $(REPOSITORY)/$(PACKAGE)/src/flash_query.c \
-                             $(REPOSITORY)/$(PACKAGE)/src/strata.h
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
-        echo " .text" >>flash_query.s
-        echo " .globl flash_query_end" >>flash_query.s
-        echo "flash_query_end:" >>flash_query.s
-        $(CC) $(CFLAGS) -c -o flash_query.o flash_query.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
-    }
 
     cdl_component  CYGPKG_DEVS_FLASH_STRATA_LOCKING {
 	display "Flash device implements locking"
 	active_if 0 < CYGHWR_IO_FLASH_BLOCK_LOCKING
 	calculated 1
-
-	make -priority 1 {
-        flash_lock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c \
-                             $(REPOSITORY)/$(PACKAGE)/src/strata.h
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c
-        echo " .text" >>flash_lock_block.s
-        echo " .globl flash_lock_block_end" >>flash_lock_block.s
-        echo "flash_lock_block_end:" >>flash_lock_block.s
-        $(CC) $(CFLAGS) -c -o flash_lock_block.o flash_lock_block.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_lock_block.o
-	}
-	make -priority 1 {
-        flash_unlock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c \
-                             $(REPOSITORY)/$(PACKAGE)/src/strata.h
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c
-        echo " .text" >>flash_unlock_block.s
-        echo " .globl flash_unlock_block_end" >>flash_unlock_block.s
-        echo "flash_unlock_block_end:" >>flash_unlock_block.s
-        $(CC) $(CFLAGS) -c -o flash_unlock_block.o flash_unlock_block.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_unlock_block.o
-	}
+	compile flash_lock_block.c flash_unlock_block.c
     }
 }
 
--- a/packages/devs/flash/intel/strata/current/src/flash_erase_block.c
+++ b/packages/devs/flash/intel/strata/current/src/flash_erase_block.c
@@ -55,11 +55,8 @@
 #include <pkgconf/hal.h>
 #include <cyg/hal/hal_arch.h>
 
-//
-// CAUTION!  This code must be copied to RAM before execution.  Therefore,
-// it must not contain any code which might be position dependent!
-//
-
+int flash_erase_block(volatile flash_t *block, unsigned int block_size) 
+	__attribute__ ((section (".2ram.flash_erase_block")));
 int flash_erase_block(volatile flash_t *block, unsigned int block_size)
 {
     volatile flash_t *ROM;
--- a/packages/devs/flash/intel/strata/current/src/flash_lock_block.c
+++ b/packages/devs/flash/intel/strata/current/src/flash_lock_block.c
@@ -53,11 +53,9 @@
 #include "strata.h"
 
 
-//
-// CAUTION!  This code must be copied to RAM before execution.  Therefore,
-// it must not contain any code which might be position dependent!
-//
-
+int
+flash_lock_block(volatile flash_t *block)
+	__attribute__ ((section (".2ram.flash_lock_block")));
 int
 flash_lock_block(volatile flash_t *block)
 {
--- a/packages/devs/flash/intel/strata/current/src/flash_program_buf.c
+++ b/packages/devs/flash/intel/strata/current/src/flash_program_buf.c
@@ -55,11 +55,10 @@
 #include <pkgconf/hal.h>
 #include <cyg/hal/hal_arch.h>
 
-//
-// CAUTION!  This code must be copied to RAM before execution.  Therefore,
-// it must not contain any code which might be position dependent!
-//
-
+int
+flash_program_buf(volatile flash_t *addr, flash_t *data, int len,
+                  unsigned long block_mask, int buffer_size)
+ __attribute__ ((section (".2ram.flash_program_buf")));
 int
 flash_program_buf(volatile flash_t *addr, flash_t *data, int len,
                   unsigned long block_mask, int buffer_size)
--- a/packages/devs/flash/intel/strata/current/src/flash_query.c
+++ b/packages/devs/flash/intel/strata/current/src/flash_query.c
@@ -56,14 +56,12 @@
 #include <cyg/hal/hal_arch.h>
 #include CYGHWR_MEMORY_LAYOUT_H
 
-//
-// CAUTION!  This code must be copied to RAM before execution.  Therefore,
-// it must not contain any code which might be position dependent!
-//
 
 #define CNT 20*1000*10  // Approx 20ms
 
 int
+flash_query(unsigned char *data)  __attribute__ ((section (".2ram.flash_query")));
+int
 flash_query(unsigned char *data)
 {
     volatile flash_t *ROM;
--- a/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
+++ b/packages/devs/flash/intel/strata/current/src/flash_unlock_block.c
@@ -54,11 +54,6 @@
 
 
 //
-// CAUTION!  This code must be copied to RAM before execution.  Therefore,
-// it must not contain any code which might be position dependent!
-//
-
-//
 // The difficulty with this operation is that the hardware does not support
 // unlocking single blocks.  However, the logical layer would like this to
 // be the case, so this routine emulates it.  The hardware can clear all of
@@ -70,6 +65,9 @@
 
 int
 flash_unlock_block(volatile flash_t *block, int block_size, int blocks)
+	__attribute__ ((section (".2ram.flash_unlock_block")));
+int
+flash_unlock_block(volatile flash_t *block, int block_size, int blocks)
 {
     volatile flash_t *ROM;
     flash_t stat;