changeset 1215:52985887e49e

* src/flash_query.c (flash_query): Casts to stop warnings. * src/flash_program_buf.c (flash_program_buf): Fixed compiler warning. * src/ebsa285_flash.c: include diag.h header file to stop warning. * src/flash_erase_block.c (flash_erase_block): * src/flash_query.c (flash_query): * src/flash_program_buf.c (flash_program_buf): Put flash functions in RAM using section attributes instead of the old method. * src/ebsa285_flash.c (flash_hwr_init): Use generic flash_query_dev.
author asl
date Sun, 14 Sep 2003 13:12:31 +0000
parents 349e2eadf98d
children d1c242cb506b
files packages/devs/flash/arm/ebsa285/current/ChangeLog packages/devs/flash/arm/ebsa285/current/cdl/flash_ebsa285.cdl packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c packages/devs/flash/arm/ebsa285/current/src/flash_erase_block.c packages/devs/flash/arm/ebsa285/current/src/flash_program_buf.c packages/devs/flash/arm/ebsa285/current/src/flash_query.c
diffstat 6 files changed, 30 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/packages/devs/flash/arm/ebsa285/current/ChangeLog
+++ b/packages/devs/flash/arm/ebsa285/current/ChangeLog
@@ -1,3 +1,17 @@
+2003-09-14  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/flash_query.c (flash_query): Casts to stop warnings.
+	* src/flash_program_buf.c (flash_program_buf): Fixed compiler warning.
+	* src/ebsa285_flash.c: include diag.h header file to stop warning.
+
+2003-09-12  Jani Monoses <jani@iv.ro>
+
+	* src/flash_erase_block.c (flash_erase_block): 
+	* src/flash_query.c (flash_query): 
+	* src/flash_program_buf.c (flash_program_buf): Put flash functions
+	in RAM using section attributes instead of the old method.
+	* src/ebsa285_flash.c (flash_hwr_init): Use generic flash_query_dev. 
+	
 2003-04-03  Jani Monoses <jani@iv.ro>
 
 	* src/flash_erase_block.c (flash_erase_block): 
--- a/packages/devs/flash/arm/ebsa285/current/cdl/flash_ebsa285.cdl
+++ b/packages/devs/flash/arm/ebsa285/current/cdl/flash_ebsa285.cdl
@@ -57,36 +57,11 @@ cdl_package CYGPKG_DEVS_FLASH_EBSA285 {
     requires	  CYGPKG_HAL_ARM_EBSA285
 
     implements    CYGHWR_IO_FLASH_DEVICE
-    implements    CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM
 
     include_dir   .
     include_files ; # none _exported_ whatsoever
     description   "FLASH memory device support for StrongARM EBSA-285"
-    compile       ebsa285_flash.c
+    compile       ebsa285_flash.c flash_query.c flash_erase_block.c flash_program_buf.c
 
-    make -priority 1 {
-        flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c
-        echo " .globl flash_erase_block_end" >>flash_erase_block.s
-        echo "flash_erase_block_end:" >>flash_erase_block.s
-        $(CC) -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
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_program_buf.c
-        echo " .globl flash_program_buf_end" >>flash_program_buf.s
-        echo "flash_program_buf_end:" >>flash_program_buf.s
-        $(CC) -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
-        $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_query.c
-        echo " .globl flash_query_end" >>flash_query.s
-        echo "flash_query_end:" >>flash_query.s
-        $(CC) -c -o flash_query.o flash_query.s
-        $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o
-    }
 }
 
--- a/packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c
+++ b/packages/devs/flash/arm/ebsa285/current/src/ebsa285_flash.c
@@ -52,7 +52,7 @@
 
 #include <pkgconf/hal.h>
 #include <cyg/hal/hal_arch.h>
-#include <cyg/hal/hal_cache.h>
+#include <cyg/infra/diag.h>
 
 #define  _FLASH_PRIVATE_
 #include <cyg/io/flash.h>
@@ -63,23 +63,9 @@ int
 flash_hwr_init(void)
 {
     unsigned char data[96];
-    extern char flash_query, flash_query_end;
-    typedef int code_fun(unsigned char *);
-    code_fun *_flash_query;
-    int code_len, stat, num_regions, region_size, icache_isenabled;
+    int num_regions, region_size;
 
-    // Copy 'program' code to RAM for execution
-    code_len = (unsigned long)&flash_query_end - (unsigned long)&flash_query;
-    _flash_query = (code_fun *)flash_info.work_space;
-    memcpy(_flash_query, &flash_query, code_len);
-    HAL_ICACHE_IS_ENABLED(icache_isenabled);
-    HAL_DCACHE_SYNC();  // Should guarantee this code will run
-    HAL_ICACHE_DISABLE(); // is also required to avoid old contents
-
-    stat = (*_flash_query)(data);
-
-    if (icache_isenabled)
-        HAL_ICACHE_ENABLE();
+    flash_dev_query(&data);
 
     if ((data[0] == FLASH_Intel_code) && ((data[4] == FLASH_28F008SA) ||
 					  (data[4] == FLASH_28F008SC))) {
--- a/packages/devs/flash/arm/ebsa285/current/src/flash_erase_block.c
+++ b/packages/devs/flash/arm/ebsa285/current/src/flash_erase_block.c
@@ -55,11 +55,9 @@
 #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 unsigned long *block) 
+	__attribute__ ((section (".2ram.flash_erase_block")));
 int
 flash_erase_block(volatile unsigned long *block)
 {
--- a/packages/devs/flash/arm/ebsa285/current/src/flash_program_buf.c
+++ b/packages/devs/flash/arm/ebsa285/current/src/flash_program_buf.c
@@ -55,15 +55,14 @@
 #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 unsigned long *addr, unsigned long *data, int len)
+	__attribute__ ((section (".2ram.flash_program_buf")));
+int
+flash_program_buf(volatile unsigned long *addr, unsigned long *data, int len)
 {
-    unsigned long stat;
+    unsigned long stat=0;
     int timeout = 5000000;
     volatile unsigned long *orig_addr = addr;
 
--- a/packages/devs/flash/arm/ebsa285/current/src/flash_query.c
+++ b/packages/devs/flash/arm/ebsa285/current/src/flash_query.c
@@ -55,22 +55,21 @@
 #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!
-//
 
 #define CNT 20*1000*10  // Approx 200ms
 
 int
 flash_query(unsigned char *data)
+	__attribute__ ((section (".2ram.flash_query")));
+int
+flash_query(unsigned char *data)
 {
     volatile unsigned long *lROM;
     volatile unsigned char *cROM;
     int i, cnt;
 
-    lROM = 0x41000000;
-    cROM = 0x41000000;
+    lROM = (unsigned long *)0x41000000;
+    cROM = (unsigned char *)0x41000000;
 
     lROM[0] = FLASH_Read_ID;
     for (cnt = CNT;  cnt > 0;  cnt--) ;