fs_sample doesn't work in my nrf52840 DK.

I kept getting the compile error when trying to build `sample/subsys/fs/fs_sample` (github.com/.../fs_sample) to `nrf52840dk/nrf52840`. 

```

C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:533:1: error: return type defaults to 'int' [-Werror=implicit-int]
533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c: In function 'PM_FOREACH_AFFILIATED_TO_disk':
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:572:30: error: storage class specified for parameter 'flash_disks'
572 | static struct flashdisk_data flash_disks[] = {
| ^~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:572:15: error: parameter 'flash_disks' is initialized
572 | static struct flashdisk_data flash_disks[] = {
| ^~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:573:39: error: 'DEFINE_FLASHDISKS_DEVICE' undeclared (first use in this function)
573 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_DEVICE)
| ^~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:573:39: note: each undeclared identifier is reported only once for each function it appears in
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:582:1: error: expected declaration specifiers before 'PM_FOREACH_AFFILIATED_TO_disk'
582 | PM_FOREACH_AFFILIATED_TO_disk(VERIFY_CACHE_SIZE_IS_NOT_ZERO_IF_NOT_READ_ONLY)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/gcc.h:98,
from C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain.h:50,
from C:/ncs/v2.8.0/zephyr/include/zephyr/sys/__assert.h:11,
from C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:10:
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:141:44: error: storage class specified for parameter '__init_disk_flash_init'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:239:42: error: parameter '__init_disk_flash_init' is initialized
239 | static const Z_DECL_ALIGN(struct init_entry) \
| ^~~~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
| ^~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:141:44: error: section attribute not allowed for '__init_disk_flash_init'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:239:42: warning: 'used' attribute ignored [-Wattributes]
239 | static const Z_DECL_ALIGN(struct init_entry) \
| ^~~~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/common.h:195:55: note: in definition of macro 'Z_DECL_ALIGN'
195 | #define Z_DECL_ALIGN(type) __aligned(__alignof(type)) type
| ^~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:141:44: error: alignment may not be specified for '__init_disk_flash_init'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
In file included from C:/ncs/v2.8.0/zephyr/include/zephyr/device.h:13,
from C:/ncs/v2.8.0/zephyr/include/zephyr/sw_isr_table.h:18,
from C:/ncs/v2.8.0/zephyr/include/zephyr/arch/arm/irq.h:19,
from C:/ncs/v2.8.0/zephyr/include/zephyr/arch/arm/arch.h:24,
from C:/ncs/v2.8.0/zephyr/include/zephyr/arch/cpu.h:19,
from C:/ncs/v2.8.0/zephyr/include/zephyr/kernel_includes.h:36,
from C:/ncs/v2.8.0/zephyr/include/zephyr/kernel.h:17,
from C:/ncs/v2.8.0/zephyr/include/zephyr/drivers/disk.h:30,
from C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:12:
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:612:10: error: 'disk_flash_init' undeclared (first use in this function)
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:241:64: note: in definition of macro 'SYS_INIT_NAMED'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:533:1: error: type of 'DEFINE_FLASHDISKS_CACHE' defaults to 'int' [-Werror=implicit-int]
533 | PM_FOREACH_AFFILIATED_TO_disk(DEFINE_FLASHDISKS_CACHE)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:141:44: error: declaration for parameter '__init_disk_flash_init' but no such parameter
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
137 | #define _DO_CONCAT(x, y) x ## y
| ^
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:141:36: note: in expansion of macro '_CONCAT'
141 | #define Z_INIT_ENTRY_NAME(init_id) _CONCAT(__init_, init_id)
| ^~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:241:17: note: in expansion of macro 'Z_INIT_ENTRY_NAME'
241 | Z_INIT_ENTRY_NAME(name) = {.init_fn = {.sys = (init_fn_)}, \
| ^~~~~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/include/zephyr/init.h:223:9: note: in expansion of macro 'SYS_INIT_NAMED'
223 | SYS_INIT_NAMED(init_fn, init_fn, level, prio)
| ^~~~~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:612:1: note: in expansion of macro 'SYS_INIT'
612 | SYS_INIT(disk_flash_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
| ^~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:572:30: error: declaration for parameter 'flash_disks' but no such parameter
572 | static struct flashdisk_data flash_disks[] = {
| ^~~~~~~~~~~
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:614: error: expected '{' at end of input
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:614: warning: control reaches end of non-void function [-Wreturn-type]
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c: At top level:
C:/ncs/v2.8.0/zephyr/drivers/disk/flashdisk.c:464:37: warning: 'flash_disk_ops' defined but not used [-Wunused-const-variable=]
464 | static const struct disk_operations flash_disk_ops = {
| ^~~~~~~~~~~~~~
cc1.exe: some warnings being treated as errors

```

I am using nRF SDK v2.8.0. 

Any insight what am I missing?

Thanks

Parents Reply Children
No Data
Related