Index: devs/flash/mips/atlas//current/ChangeLog =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/flash/mips/atlas/current/ChangeLog,v retrieving revision 1.5 diff -d -u -r1.5 ChangeLog --- devs/flash/mips/atlas//current/ChangeLog 23 May 2002 23:01:02 -0000 1.5 +++ devs/flash/mips/atlas//current/ChangeLog 16 Sep 2003 15:04:27 -0000 @@ -1,3 +1,14 @@ +2003-09-16 Jani Monoses + + * cdl/flash_atlas.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. Use + generic flash_dev_query. + 2001-06-11 Gary Thomas * src/atlas_flash.c: Remove dependency on printf() via user functions. Index: devs/flash/mips/atlas//current/cdl/flash_atlas.cdl =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/flash/mips/atlas/current/cdl/flash_atlas.cdl,v retrieving revision 1.4 diff -d -u -r1.4 flash_atlas.cdl --- devs/flash/mips/atlas//current/cdl/flash_atlas.cdl 23 May 2002 23:01:02 -0000 1.4 +++ devs/flash/mips/atlas//current/cdl/flash_atlas.cdl 16 Sep 2003 15:04:28 -0000 @@ -57,53 +57,17 @@ requires CYGPKG_HAL_MIPS_ATLAS implements CYGHWR_IO_FLASH_DEVICE - implements CYGHWR_IO_FLASH_DEVICE_NOT_IN_RAM implements CYGHWR_IO_FLASH_BLOCK_LOCKING include_dir . include_files ; # none _exported_ whatsoever description "FLASH memory device support for MIPS Atlas" - compile atlas_flash.c + compile atlas_flash.c flash_erase_block.c flash_program_buf.c flash_query.c - make -priority 1 { - flash_erase_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_erase_block.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -EL -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 -EL -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) -EL -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 -EL -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) -EL -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 -EL -o flash_query.o flash_query.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_query.o - } - make -priority 1 { - flash_lock_block.o: $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -EL -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_lock_block.c - echo " .globl flash_lock_block_end" >>flash_lock_block.s - echo "flash_lock_block_end:" >>flash_lock_block.s - $(CC) -c -EL -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 - $(CC) -S $(INCLUDE_PATH) $(CFLAGS) -EL -g0 -fno-function-sections $(REPOSITORY)/$(PACKAGE)/src/flash_unlock_block.c - echo " .globl flash_unlock_block_end" >>flash_unlock_block.s - echo "flash_unlock_block_end:" >>flash_unlock_block.s - $(CC) -c -EL -o flash_unlock_block.o flash_unlock_block.s - $(AR) rcs $(PREFIX)/lib/libtarget.a flash_unlock_block.o + cdl_component CYGPKG_DEVS_FLASH_ATLAS_LOCKING { + display "Flash device implements locking" + active_if 0 < CYGHWR_IO_FLASH_BLOCK_LOCKING + calculated 1 + compile flash_lock_block.c flash_unlock_block.c } } - Index: devs/flash/mips/atlas//current/src/atlas_flash.c =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/flash/mips/atlas/current/src/atlas_flash.c,v retrieving revision 1.4 diff -d -u -r1.4 atlas_flash.c --- devs/flash/mips/atlas//current/src/atlas_flash.c 23 May 2002 23:01:02 -0000 1.4 +++ devs/flash/mips/atlas//current/src/atlas_flash.c 16 Sep 2003 15:04:28 -0000 @@ -52,7 +52,7 @@ #include #include -#include +#include #define _FLASH_PRIVATE_ #include @@ -65,19 +65,9 @@ flash_hwr_init(void) { struct FLASH_query data, *qp; - 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; - - // 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); + int num_regions, region_size; - HAL_DCACHE_SYNC(); // Should guarantee this code will run - HAL_ICACHE_INVALIDATE_ALL(); // is also required to avoid old contents - stat = (*_flash_query)(&data); + flash_dev_query(&data); qp = &data; if (/*(qp->manuf_code == FLASH_Intel_code) && */ @@ -92,7 +82,7 @@ return FLASH_ERR_OK; } else { (*flash_info.pf)("Can't identify FLASH, sorry\n"); - diag_dump_buf(data, sizeof(data)); + diag_dump_buf((void*)&data, sizeof(data)); return FLASH_ERR_HWR; } } Index: devs/flash/mips/atlas//current/src/flash_erase_block.c =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/flash/mips/atlas/current/src/flash_erase_block.c,v retrieving revision 1.3 diff -d -u -r1.3 flash_erase_block.c --- devs/flash/mips/atlas//current/src/flash_erase_block.c 23 May 2002 23:01:02 -0000 1.3 +++ devs/flash/mips/atlas//current/src/flash_erase_block.c 16 Sep 2003 15:04:28 -0000 @@ -56,11 +56,9 @@ #include #include -// -// 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) { volatile unsigned long *ROM; Index: devs/flash/mips/atlas//current/src/flash_lock_block.c =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/flash/mips/atlas/current/src/flash_lock_block.c,v retrieving revision 1.3 diff -d -u -r1.3 flash_lock_block.c --- devs/flash/mips/atlas//current/src/flash_lock_block.c 23 May 2002 23:01:02 -0000 1.3 +++ devs/flash/mips/atlas//current/src/flash_lock_block.c 16 Sep 2003 15:04:28 -0000 @@ -53,11 +53,10 @@ #include "flash.h" #include -// -// 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 unsigned long *block) + __attribute__ ((section (".2ram.flash_lock_block"))); int flash_lock_block(volatile unsigned long *block) { Index: devs/flash/mips/atlas//current/src/flash_program_buf.c =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/flash/mips/atlas/current/src/flash_program_buf.c,v retrieving revision 1.3 diff -d -u -r1.3 flash_program_buf.c --- devs/flash/mips/atlas//current/src/flash_program_buf.c 23 May 2002 23:01:02 -0000 1.3 +++ devs/flash/mips/atlas//current/src/flash_program_buf.c 16 Sep 2003 15:04:29 -0000 @@ -55,11 +55,10 @@ #include #include -// -// 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) { Index: devs/flash/mips/atlas//current/src/flash_query.c =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/flash/mips/atlas/current/src/flash_query.c,v retrieving revision 1.3 diff -d -u -r1.3 flash_query.c --- devs/flash/mips/atlas//current/src/flash_query.c 23 May 2002 23:01:02 -0000 1.3 +++ devs/flash/mips/atlas//current/src/flash_query.c 16 Sep 2003 15:04:29 -0000 @@ -57,13 +57,11 @@ #include #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) { Index: devs/flash/mips/atlas//current/src/flash_unlock_block.c =================================================================== RCS file: /cvs/ecos/ecos/packages/devs/flash/mips/atlas/current/src/flash_unlock_block.c,v retrieving revision 1.3 diff -d -u -r1.3 flash_unlock_block.c --- devs/flash/mips/atlas//current/src/flash_unlock_block.c 23 May 2002 23:01:02 -0000 1.3 +++ devs/flash/mips/atlas//current/src/flash_unlock_block.c 16 Sep 2003 15:04:29 -0000 @@ -54,10 +54,6 @@ #include -// -// 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 @@ -69,6 +65,9 @@ #define MAX_FLASH_BLOCKS 128 +int +flash_unlock_block(volatile unsigned long *block, int block_size, int blocks) + __attribute__ ((section (".2ram.flash_unlock_block"))); int flash_unlock_block(volatile unsigned long *block, int block_size, int blocks) {