Hi Peter,

Perfect, that worked!

Thanks,

Cris


On 1/3/2017 3:32 PM, Peter Snyder wrote:
Hi Cris,

There have been a number of changes in the 1.0-b1 release in how mynewt is 
initialized and the documentation hasn’t quite caught up yet. The kernel now 
initializes the packages that are specified in pkg.yml automatically as part of 
system start up, and that includes the nffs filesystem init code in your main.c.

Your syscfg.yml and pkg.yml files look okay. To be specific, you can remove the 
following lines from your code:

/* NFFS_AREA_MAX is defined in the BSP-specified bsp.h header file. */
    struct nffs_area_desc descs[NFFS_AREA_MAX];

    /* Initialize nffs's internal state. */
    rc = nffs_init();


    assert(rc == 0);

    /* Convert the set of flash blocks we intend to use for nffs into an array
     * of nffs area descriptors.
     */
    cnt = NFFS_AREA_MAX;
    rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, descs);
    assert(rc == 0);

    /* Attempt to restore an existing nffs file system from flash. */
    if (nffs_detect(descs) == FS_ECORRUPT) {
        /* No valid nffs instance detected; format a new one. */
        rc = nffs_format(descs);
        assert(rc == 0);
    }
Hope this helps.

- peter


On Jan 2, 2017, at 9:12 PM, Cris Frusina <[email protected]> wrote:

Hi All,

I'm trying to get NFFS working in my project but I'm not having any luck.

The *BSP* *syscfg.yml* file has this included:

syscfg.vals:
    CONFIG_FCB_FLASH_AREA: FLASH_AREA_NFFS
    REBOOT_LOG_FLASH_AREA: FLASH_AREA_REBOOT_LOG
    NFFS_FLASH_AREA: FLASH_AREA_NFFS
    COREDUMP_FLASH_AREA: FLASH_AREA_IMAGE_1

The *bsp.yml:*

bsp.flash_map:
    areas:
        # System areas.
        FLASH_AREA_BOOTLOADER:
            device: 0
            offset: 0x00000000
            size: 16kB
        FLASH_AREA_IMAGE_0:
            device: 0
            offset: 0x00008000
            size: 232kB
        FLASH_AREA_IMAGE_1:
            device: 0
            offset: 0x00042000
            size: 232kB
        FLASH_AREA_IMAGE_SCRATCH:
            device: 0
            offset: 0x0007c000
            size: 4kB

        # User areas.
        FLASH_AREA_REBOOT_LOG:
            user_id: 0
            device: 0
            offset: 0x00004000
            size: 16kB
        FLASH_AREA_NFFS:
            user_id: 1
            device: 0
            offset: 0x0007d000
            size: 12kB

*APP **syscfg.yml* has this line:

    CONFIG_NFFS: 1

*APP **pkg.yml:*

pkg.deps.CONFIG_NFFS:
    - "@apache-mynewt-core/fs/nffs"


In my main.c I have included the headers and added the sample code to 
initialize NFFS :

#include "nffs/nffs.h"
#include "fs/fs.h"


/* NFFS_AREA_MAX is defined in the BSP-specified bsp.h header file. */
    struct nffs_area_desc descs[NFFS_AREA_MAX];

    /* Initialize nffs's internal state. */
    rc = nffs_init();


    assert(rc == 0);

    /* Convert the set of flash blocks we intend to use for nffs into an array
     * of nffs area descriptors.
     */
    cnt = NFFS_AREA_MAX;
    rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, descs);
    assert(rc == 0);

    /* Attempt to restore an existing nffs file system from flash. */
    if (nffs_detect(descs) == FS_ECORRUPT) {
        /* No valid nffs instance detected; format a new one. */
        rc = nffs_format(descs);
        assert(rc == 0);
    }


    rc = fsutil_write_file("/test", "255", 3);
    if (rc != 0) {

    }


I'm getting this compile error:

*Compiling main.c**
**Error: main.c: In function 'main':**
**main.c:392:5: error: implicit declaration of function 
'flash_area_to_nffs_desc' [-Werror=implicit-function-declaration]**
**     rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, descs);**
**     ^**
**main.c:392:34: error: 'FLASH_AREA_NFFS' undeclared (first use in this 
function)**
**     rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, descs);**
**                                  ^**
**main.c:392:34: note: each undeclared identifier is reported only once for 
each function it appears in**
**main.c:403:2: error: implicit declaration of function 'fsutil_write_file' 
[-Werror=implicit-function-declaration]**
**  rc = fsutil_write_file("/color", "255", 3);**
**  ^**
**cc1: all warnings being treated as errors*


I did a search for "flash_area_to_nffs_desc" and I can't find a declaration for 
it anywhere in the repo.

Anyone have any ideas on why I'm getting these compile errors?

Thanks,

Cris






Reply via email to