Could you please share your flash driver with me? In my code, my flash is accessed via a handler defined in Xilinx BSP.
typedef struct { rtems_jffs2_flash_control super; XQspiPs *flash_instance; } flash_control; static flash_control *get_flash_control(rtems_jffs2_flash_control *super) { return (flash_control *)super; } static int flash_read( rtems_jffs2_flash_control *super, uint32_t offset, unsigned char *buffer, size_t length) { flash_control *self = get_flash_control(super); XQspiPs *flash_handle = self->flash_instance; FlashRead(flash_handle, offset, length, QUAD_READ_CMD, temp_buffer, buffer); return S25FL256S_SUCCESS; } static int flash_write( rtems_jffs2_flash_control *super, uint32_t offset, unsigned char *buffer, size_t length) { flash_control *self = get_flash_control(super); XQspiPs *flash_handle = self->flash_instance; uint32_t num = length / S25FL256S_PAGE_SIZE; uint32_t remaining = length % S25FL256S_PAGE_SIZE; uint32_t written; for (written = 0; written < num; written++) { FlashWrite(flash_handle, beginning + written*S25FL256S_PAGE_SIZE, \ S25FL256S_PAGE_SIZE, WRITE_CMD, \ buffer + written*S25FL256S_PAGE_SIZE); } if (remaining) { FlashWrite(flash_handle, beginning + num*S25FL256S_PAGE_SIZE, \ remaining, WRITE_CMD, buffer + num*S25FL256S_PAGE_SIZE); } return S25FL256S_SUCCESS; } where, my FlashRead and FlashWrite functions will invoke the functions defined in Xilinx BSP to transfer data from/into flash. I do not know where the problem is... Best wishes, xuelin.t...@qkmtech.com From: Chris Johns Date: 2017-10-23 12:19 To: xuelin.t...@qkmtech.com; Sebastian Huber CC: users@rtems.org Subject: Re: Filesystem in RTEMS On 23/10/2017 12:53, xuelin.t...@qkmtech.com wrote: > Yes, Everything is going well, if I erase the flash before use. > > But, I need to store some files into flash, and reuse them when I restart my > system. I can not erase the flash every time. Oh I see what you are saying. I am using the JFFS2 on a Zynq with a 64M byte SPI flash and seeing no issues. I suggest you check your flash driver and make sure you are writing to the flash correctly. Chris
_______________________________________________ users mailing list users@rtems.org http://lists.rtems.org/mailman/listinfo/users