<div dir="ltr">Hello,<div><br></div><div>Now I'm struggling with mounting of jffs2 using my qspiflash driver.</div><div><br></div><div>main.c </div><div><br></div><div>#include <stdio.h><br>#include <stdlib.h><br>#include <string.h><br>#include <assert.h><br>#include <fcntl.h><br><br>#include <sched.h><br>#include <rtems/jffs2.h><br>#include <rtems/libio.h><br><br>#include "config.h"<br>#include "user.h"<br>#include "spiflash.h"<br><br>#define SPIFLASH_BLOCK_SIZE (0x100)<br>#define SPIFLASH_SIZE (0x1000000)<br>#define BASE_FOR_TEST "/mnt"<br><br>static int flash_read(<br>    __attribute__((unused))rtems_jffs2_flash_control *super,<br>    uint32_t offset,<br>    unsigned char *buffer,<br>    size_t size)<br>{<br>    spiflash_read(offset, buffer, size);<br><br>    return 0;<br>}<br><br>static int flash_write(<br>    __attribute__((unused))rtems_jffs2_flash_control *super,<br>    uint32_t offset,<br>    const unsigned char *buffer,<br>    size_t size)<br>{<br>    spiflash_write(offset, buffer, size);<br><br>    return 0;<br>}<br><br>static int flash_erase(<br>    __attribute__((unused))rtems_jffs2_flash_control *super,<br>    uint32_t offset)<br>{<br>    spiflash_erase(offset);<br><br>    return 0;<br>}<br><br>static rtems_jffs2_flash_control spiflash_control =<br>{<br>    .block_size = SPIFLASH_BLOCK_SIZE,<br>    .flash_size = SPIFLASH_SIZE,<br>    .read = flash_read,<br>    .write = flash_write,<br>    .erase = flash_erase<br>};<br><br>static rtems_jffs2_compressor_control compressor_instance = <br>{<br>    .compress = rtems_jffs2_compressor_rtime_compress,<br>    .decompress = rtems_jffs2_compressor_rtime_decompress<br>};<br><br>static const rtems_jffs2_mount_data mount_data =<br>{<br>    .flash_control = &spiflash_control,<br>    .compressor_control = &compressor_instance<br>};<br><br>void *test_qspi(void *arg)<br>{<br>    int rv = 0;<br><br>    spiflash_init();<br>    spiflash_bulk_erase();<br><br>    rv = mkdir(BASE_FOR_TEST, S_IRWXU | S_IRWXG | S_IRWXO);<br>    assert(rv == 0);<br><br>    rv = mount(<br>        NULL,<br>        BASE_FOR_TEST,<br>        RTEMS_FILESYSTEM_TYPE_JFFS2,<br>        RTEMS_FILESYSTEM_READ_WRITE,<br>        &mount_data);<br><br>    assert(rv == 0);<br><br>    return NULL;<br>}<br><br>void* POSIX_Init(void *arg)<br>{<br>    printf("*QSPI*\r\n");<br><br>    pthread_t qspi_thread_id; <br>    pthread_create(&qspi_thread_id, NULL, test_qspi, NULL);<br><br>    pthread_exit(0);<br>}<br></div><div><div><br></div><div>Output is</div><div>*QSPI*<br>assertion "rv == 0" failed: file "main.c", line 88, function: test_qspi<br><br>*** FATAL ***<br>fatal source: 7 (RTEMS_FATAL_SOURCE_ASSERT)<br>fatal code: 536917808 (0x2000b730)<br>RTEMS version: 5.0.0.7dde723c08912abd647750d6f7a45eca20372b85-modified<br>RTEMS tools: 7.4.1 20190514 (RTEMS 5, RSB 2c264c1ed6195214de095bbb9e67d8d4bfe78fd0, Newlib 1d35a003f)<br>executing thread ID: 0x08b010002<br>executing thread name:<br></div><div><br></div><div>rv is equal to -1 after the try of mounting. Qspiflash driver was checked separately for the write, read, erase operations. </div><div><br></div><div>Can someone suggest what to do here?</div><div><br></div><div>Thanks. </div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><span><div style="font-size:12.8px"><font face="verdana, sans-serif" color="#000000">--</font></div><div style="font-size:12.8px"><font face="verdana, sans-serif" color="#000000">Kind regards,</font></div><div style="font-size:12.8px"><font face="verdana, sans-serif" color="#000000"><b>Yaroslav Leshchinsky</b></font></div></span></div></div></div></div></div></div></div>