Filesystem in RTEMS

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 23 09:44:13 UTC 2017


On 23/10/17 11:40, Sebastian Huber wrote:
>
>
> On 23/10/17 11:33, xuelin.tian at qkmtech.com wrote:
>> 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...
>
> You assume length % S25FL256S_PAGE_SIZE == 0. 

Sorry, I should have read the code more carefully.

What is "beginning"? Why don't you use "offset" in this function?

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the users mailing list