Dear Fabio,
In the previous working version, i'm only included the followind:
pkg.deps:
- "@apache-mynewt-core/fs/fs"
- "@apache-mynewt-core/fs/nffs"
code:
#include "fs/fs.h"
#include "fs/fsutil.h"
#include "nffs/nffs.h"
int write_config(void) { int rc; /* Create the parent directory. */ rc =
fs_mkdir("/cfg"); os_time_delay(1); if (rc != 0) { return -2; } //END if
// Create a file and write four bytes to it. rc =
fsutil_write_file("/cfg/config.txt <http://config.txt/>",
&system_cfg_desc.data_ch_addr <http://system_cfg_desc.data_ch_addr/>[0],
sizeof(SYSTEM_CONFIGURATION_DESC_T)); os_time_delay(1); return rc == 0 ?
0 : -1; } //END write_config int read_config() { uint32_t bytes_read;
int rc; /* Read up to 15 bytes from the start of the file. */ rc =
fsutil_read_file("/cfg/config.txt <http://config.txt/>", 0,
sizeof(system_cfg_desc), &system_cfg_desc.data_ch_addr
<http://system_cfg_desc.data_ch_addr/>[0], &bytes_read);
os_time_delay(1); return rc == 0 ? 0 : -1; } //END read_config
Thank you.
Regards,
Then Yoong Ze
On 14/2/2017 11:08 PM, Fabio Utzig wrote:
Hi,
FAT doesn't format a FS (I didn't enable) so it expects an already
formatted FS. FAT is also not appropriate to use with Flash if that's
what you're using, because it doesn't have a concept of "erase" and it
doesn't do wear leveling. I actualy only tested with MMC!
I will do some testing today to try to find what is causing your problem
with NFFS (or with no FS enabled).
What FS operations are you doing? Are you using any of the fs_* calls?
Could you copy/paste some of your FS usage code as a gist (or pastebin,
etc)?
Cheers,
Fabio Utzig
On Mon, Feb 13, 2017, at 02:57 AM, then yon wrote:
Dear Fabio,
The previous working project, i include fs/nffs package; but when i
include on latest mynewt straight away it gave me exception so i
disabled it (it gave me exception even all the filesystem code removed).
Below is the output with the fs/nffs included.
newt target dep blink_nordic Dependency graph (depender -->
[dependees]): * @apache-mynewt-core/compiler/arm-none-eabi-m4 --> [] *
@apache-mynewt-core/encoding/base64 --> [] * @apache-mynewt-core/fs/disk
--> [@apache-mynewt-core/kernel/os] * @apache-mynewt-core/fs/fs -->
[@apache-mynewt-core/fs/disk] * @apache-mynewt-core/fs/nffs -->
[@apache-mynewt-core/fs/fs @apache-mynewt-core/hw/hal
@apache-mynewt-core/kernel/os @apache-mynewt-core/sys/flash_map
@apache-mynewt-core/sys/log/full(api:log)
@apache-mynewt-core/sys/stats/full(api:stats)
@apache-mynewt-core/test/testutil @apache-mynewt-core/util/crc] *
@apache-mynewt-core/hw/bsp/nrf52dk -->
[@apache-mynewt-core/hw/drivers/uart/uart_hal
@apache-mynewt-core/hw/mcu/nordic/nrf52xxx
@apache-mynewt-core/libc/baselibc] * @apache-mynewt-core/hw/cmsis-core
--> [] * @apache-mynewt-core/hw/drivers/uart --> [] *
@apache-mynewt-core/hw/drivers/uart/uart_hal -->
[@apache-mynewt-core/hw/drivers/uart @apache-mynewt-core/hw/hal] *
@apache-mynewt-core/hw/hal --> [@apache-mynewt-core/kernel/os] *
@apache-mynewt-core/hw/mcu/nordic --> [@apache-mynewt-core/hw/cmsis-core
@apache-mynewt-core/hw/hal] * @apache-mynewt-core/hw/mcu/nordic/nrf52xxx
--> [@apache-mynewt-core/compiler/arm-none-eabi-m4
@apache-mynewt-core/hw/cmsis-core @apache-mynewt-core/hw/hal
@apache-mynewt-core/hw/mcu/nordic] * @apache-mynewt-core/kernel/os -->
[@apache-mynewt-core/sys/console/full(api:console)
@apache-mynewt-core/sys/sysinit @apache-mynewt-core/util/mem] *
@apache-mynewt-core/libc/baselibc --> [@apache-mynewt-core/kernel/os
@apache-mynewt-core/sys/console/full(api:console)] *
@apache-mynewt-core/sys/console/full -->
[@apache-mynewt-core/hw/drivers/uart @apache-mynewt-core/hw/hal
@apache-mynewt-core/kernel/os] * @apache-mynewt-core/sys/defs --> [] *
@apache-mynewt-core/sys/flash_map --> [@apache-mynewt-core/sys/defs
@apache-mynewt-core/sys/mfg] * @apache-mynewt-core/sys/log/full -->
[@apache-mynewt-core/kernel/os @apache-mynewt-core/sys/flash_map
@apache-mynewt-core/util/cbmem] * @apache-mynewt-core/sys/mfg -->
[@apache-mynewt-core/kernel/os @apache-mynewt-core/sys/flash_map] *
@apache-mynewt-core/sys/shell --> [@apache-mynewt-core/encoding/base64
@apache-mynewt-core/kernel/os
@apache-mynewt-core/sys/console/full(api:console)
@apache-mynewt-core/time/datetime @apache-mynewt-core/util/crc] *
@apache-mynewt-core/sys/stats/full --> [@apache-mynewt-core/kernel/os] *
@apache-mynewt-core/sys/sysinit --> [@apache-mynewt-core/kernel/os
@apache-mynewt-core/sys/flash_map] * @apache-mynewt-core/test/testutil
--> [@apache-mynewt-core/hw/hal @apache-mynewt-core/kernel/os
@apache-mynewt-core/sys/sysinit] * @apache-mynewt-core/time/datetime -->
[@apache-mynewt-core/kernel/os] * @apache-mynewt-core/util/cbmem -->
[@apache-mynewt-core/hw/hal @apache-mynewt-core/kernel/os] *
@apache-mynewt-core/util/crc --> [] * @apache-mynewt-core/util/mem -->
[@apache-mynewt-core/kernel/os] * apps/blinky -->
[@apache-mynewt-core/fs/fs @apache-mynewt-core/fs/nffs
@apache-mynewt-core/hw/hal @apache-mynewt-core/kernel/os
@apache-mynewt-core/sys/console/full @apache-mynewt-core/sys/log/full
@apache-mynewt-core/sys/shell @apache-mynewt-core/sys/stats/full] *
targets/blink_nordic --> []
sensmaster@sensmaster-Inspiron-3542:~/myNewtProject/mynewtresearch/myNewtProj$
newt target revdep blink_nordic Reverse dependency graph (dependee <--
[dependers]): * @apache-mynewt-core/compiler/arm-none-eabi-m4 <--
[@apache-mynewt-core/hw/mcu/nordic/nrf52xxx] *
@apache-mynewt-core/encoding/base64 <-- [@apache-mynewt-core/sys/shell]
* @apache-mynewt-core/fs/disk <-- [@apache-mynewt-core/fs/fs] *
@apache-mynewt-core/fs/fs <-- [@apache-mynewt-core/fs/nffs apps/blinky]
* @apache-mynewt-core/fs/nffs <-- [apps/blinky] *
@apache-mynewt-core/hw/cmsis-core <-- [@apache-mynewt-core/hw/mcu/nordic
@apache-mynewt-core/hw/mcu/nordic/nrf52xxx] *
@apache-mynewt-core/hw/drivers/uart <--
[@apache-mynewt-core/hw/drivers/uart/uart_hal
@apache-mynewt-core/sys/console/full] *
@apache-mynewt-core/hw/drivers/uart/uart_hal <--
[@apache-mynewt-core/hw/bsp/nrf52dk] * @apache-mynewt-core/hw/hal <--
[@apache-mynewt-core/fs/nffs
@apache-mynewt-core/hw/drivers/uart/uart_hal
@apache-mynewt-core/hw/mcu/nordic
@apache-mynewt-core/hw/mcu/nordic/nrf52xxx
@apache-mynewt-core/sys/console/full @apache-mynewt-core/test/testutil
@apache-mynewt-core/util/cbmem apps/blinky] *
@apache-mynewt-core/hw/mcu/nordic <--
[@apache-mynewt-core/hw/mcu/nordic/nrf52xxx] *
@apache-mynewt-core/hw/mcu/nordic/nrf52xxx <--
[@apache-mynewt-core/hw/bsp/nrf52dk] * @apache-mynewt-core/kernel/os <--
[@apache-mynewt-core/fs/disk @apache-mynewt-core/fs/nffs
@apache-mynewt-core/hw/hal @apache-mynewt-core/libc/baselibc
@apache-mynewt-core/sys/console/full @apache-mynewt-core/sys/log/full
@apache-mynewt-core/sys/mfg @apache-mynewt-core/sys/shell
@apache-mynewt-core/sys/stats/full @apache-mynewt-core/sys/sysinit
@apache-mynewt-core/test/testutil @apache-mynewt-core/time/datetime
@apache-mynewt-core/util/cbmem @apache-mynewt-core/util/mem apps/blinky]
* @apache-mynewt-core/libc/baselibc <--
[@apache-mynewt-core/hw/bsp/nrf52dk] *
@apache-mynewt-core/sys/console/full <--
[@apache-mynewt-core/kernel/os(api:console)
@apache-mynewt-core/libc/baselibc(api:console)
@apache-mynewt-core/sys/shell(api:console) apps/blinky] *
@apache-mynewt-core/sys/defs <-- [@apache-mynewt-core/sys/flash_map] *
@apache-mynewt-core/sys/flash_map <-- [@apache-mynewt-core/fs/nffs
@apache-mynewt-core/sys/log/full @apache-mynewt-core/sys/mfg
@apache-mynewt-core/sys/sysinit] * @apache-mynewt-core/sys/log/full <--
[@apache-mynewt-core/fs/nffs(api:log) apps/blinky] *
@apache-mynewt-core/sys/mfg <-- [@apache-mynewt-core/sys/flash_map] *
@apache-mynewt-core/sys/shell <-- [apps/blinky] *
@apache-mynewt-core/sys/stats/full <--
[@apache-mynewt-core/fs/nffs(api:stats) apps/blinky] *
@apache-mynewt-core/sys/sysinit <-- [@apache-mynewt-core/kernel/os
@apache-mynewt-core/test/testutil] * @apache-mynewt-core/test/testutil
<-- [@apache-mynewt-core/fs/nffs] * @apache-mynewt-core/time/datetime
<-- [@apache-mynewt-core/sys/shell] * @apache-mynewt-core/util/cbmem <--
[@apache-mynewt-core/sys/log/full] * @apache-mynewt-core/util/crc <--
[@apache-mynewt-core/fs/nffs @apache-mynewt-core/sys/shell] *
@apache-mynewt-core/util/mem <-- [@apache-mynewt-core/kernel/os]
Beside that i tried with fs/fatfs deps, it gave me no exception but the
data doesn't wrote into the filesystem. Do i need to do initialize on
fatfs?
Thank you.
Then Yoong Ze
On 11/2/2017 12:36 AM, Fabio Utzig wrote:
Your english is just fine. What surprised me is that you're using the fs
subsystem without any fs enabled (either having nffs or fatfs or both).
I was not expecting it, never tried it myself and it might indeed be a
bug.
Cheers,
Fabio Utzig
On Fri, Feb 10, 2017, at 02:01 PM, then yon wrote:
Dear Fabio,
That means i removed all the code related to fs and the package
dependencies. Sorry for my bad english.
newt target dep blink_nordic
Dependency graph (depender --> [dependees]): *
@apache-mynewt-core/compiler/arm-none-eabi-m4 --> [] *
@apache-mynewt-core/encoding/base64 --> [] * @apache-mynewt-core/fs/disk
--> [@apache-mynewt-core/kernel/os] * @apache-mynewt-core/fs/fs -->
[@apache-mynewt-core/fs/disk] * @apache-mynewt-core/hw/bsp/nrf52dk -->
[@apache-mynewt-core/hw/drivers/uart/uart_hal
@apache-mynewt-core/hw/mcu/nordic/nrf52xxx
@apache-mynewt-core/libc/baselibc] * @apache-mynewt-core/hw/cmsis-core
--> [] * @apache-mynewt-core/hw/drivers/uart --> [] *
@apache-mynewt-core/hw/drivers/uart/uart_hal -->
[@apache-mynewt-core/hw/drivers/uart @apache-mynewt-core/hw/hal] *
@apache-mynewt-core/hw/hal --> [@apache-mynewt-core/kernel/os] *
@apache-mynewt-core/hw/mcu/nordic --> [@apache-mynewt-core/hw/cmsis-core
@apache-mynewt-core/hw/hal] * @apache-mynewt-core/hw/mcu/nordic/nrf52xxx
--> [@apache-mynewt-core/compiler/arm-none-eabi-m4
@apache-mynewt-core/hw/cmsis-core @apache-mynewt-core/hw/hal
@apache-mynewt-core/hw/mcu/nordic] * @apache-mynewt-core/kernel/os -->
[@apache-mynewt-core/sys/console/full(api:console)
@apache-mynewt-core/sys/sysinit @apache-mynewt-core/util/mem] *
@apache-mynewt-core/libc/baselibc --> [@apache-mynewt-core/kernel/os
@apache-mynewt-core/sys/console/full(api:console)] *
@apache-mynewt-core/sys/console/full -->
[@apache-mynewt-core/hw/drivers/uart @apache-mynewt-core/hw/hal
@apache-mynewt-core/kernel/os] * @apache-mynewt-core/sys/defs --> [] *
@apache-mynewt-core/sys/flash_map --> [@apache-mynewt-core/sys/defs
@apache-mynewt-core/sys/mfg] * @apache-mynewt-core/sys/log/full -->
[@apache-mynewt-core/kernel/os @apache-mynewt-core/sys/flash_map
@apache-mynewt-core/util/cbmem] * @apache-mynewt-core/sys/mfg -->
[@apache-mynewt-core/kernel/os @apache-mynewt-core/sys/flash_map] *
@apache-mynewt-core/sys/shell --> [@apache-mynewt-core/encoding/base64
@apache-mynewt-core/kernel/os
@apache-mynewt-core/sys/console/full(api:console)
@apache-mynewt-core/time/datetime @apache-mynewt-core/util/crc] *
@apache-mynewt-core/sys/stats/full --> [@apache-mynewt-core/kernel/os] *
@apache-mynewt-core/sys/sysinit --> [@apache-mynewt-core/kernel/os
@apache-mynewt-core/sys/flash_map] * @apache-mynewt-core/time/datetime
--> [@apache-mynewt-core/kernel/os] * @apache-mynewt-core/util/cbmem -->
[@apache-mynewt-core/hw/hal @apache-mynewt-core/kernel/os] *
@apache-mynewt-core/util/crc --> [] * @apache-mynewt-core/util/mem -->
[@apache-mynewt-core/kernel/os] * apps/blinky -->
[@apache-mynewt-core/fs/fs @apache-mynewt-core/hw/hal
@apache-mynewt-core/kernel/os @apache-mynewt-core/sys/console/full
@apache-mynewt-core/sys/log/full @apache-mynewt-core/sys/shell
@apache-mynewt-core/sys/stats/full] * targets/blink_nordic --> []
newt target revdep blink_nordic Reverse dependency graph (dependee <--
[dependers]): * @apache-mynewt-core/compiler/arm-none-eabi-m4 <--
[@apache-mynewt-core/hw/mcu/nordic/nrf52xxx] *
@apache-mynewt-core/encoding/base64 <-- [@apache-mynewt-core/sys/shell]
* @apache-mynewt-core/fs/disk <-- [@apache-mynewt-core/fs/fs] *
@apache-mynewt-core/fs/fs <-- [apps/blinky] *
@apache-mynewt-core/hw/cmsis-core <-- [@apache-mynewt-core/hw/mcu/nordic
@apache-mynewt-core/hw/mcu/nordic/nrf52xxx] *
@apache-mynewt-core/hw/drivers/uart <--
[@apache-mynewt-core/hw/drivers/uart/uart_hal
@apache-mynewt-core/sys/console/full] *
@apache-mynewt-core/hw/drivers/uart/uart_hal <--
[@apache-mynewt-core/hw/bsp/nrf52dk] * @apache-mynewt-core/hw/hal <--
[@apache-mynewt-core/hw/drivers/uart/uart_hal
@apache-mynewt-core/hw/mcu/nordic
@apache-mynewt-core/hw/mcu/nordic/nrf52xxx
@apache-mynewt-core/sys/console/full @apache-mynewt-core/util/cbmem
apps/blinky] * @apache-mynewt-core/hw/mcu/nordic <--
[@apache-mynewt-core/hw/mcu/nordic/nrf52xxx] *
@apache-mynewt-core/hw/mcu/nordic/nrf52xxx <--
[@apache-mynewt-core/hw/bsp/nrf52dk] * @apache-mynewt-core/kernel/os <--
[@apache-mynewt-core/fs/disk @apache-mynewt-core/hw/hal
@apache-mynewt-core/libc/baselibc @apache-mynewt-core/sys/console/full
@apache-mynewt-core/sys/log/full @apache-mynewt-core/sys/mfg
@apache-mynewt-core/sys/shell @apache-mynewt-core/sys/stats/full
@apache-mynewt-core/sys/sysinit @apache-mynewt-core/time/datetime
@apache-mynewt-core/util/cbmem @apache-mynewt-core/util/mem apps/blinky]
* @apache-mynewt-core/libc/baselibc <--
[@apache-mynewt-core/hw/bsp/nrf52dk] *
@apache-mynewt-core/sys/console/full <--
[@apache-mynewt-core/kernel/os(api:console)
@apache-mynewt-core/libc/baselibc(api:console)
@apache-mynewt-core/sys/shell(api:console) apps/blinky] *
@apache-mynewt-core/sys/defs <-- [@apache-mynewt-core/sys/flash_map] *
@apache-mynewt-core/sys/flash_map <-- [@apache-mynewt-core/sys/log/full
@apache-mynewt-core/sys/mfg @apache-mynewt-core/sys/sysinit] *
@apache-mynewt-core/sys/log/full <-- [apps/blinky] *
@apache-mynewt-core/sys/mfg <-- [@apache-mynewt-core/sys/flash_map] *
@apache-mynewt-core/sys/shell <-- [apps/blinky] *
@apache-mynewt-core/sys/stats/full <-- [apps/blinky] *
@apache-mynewt-core/sys/sysinit <-- [@apache-mynewt-core/kernel/os] *
@apache-mynewt-core/time/datetime <-- [@apache-mynewt-core/sys/shell] *
@apache-mynewt-core/util/cbmem <-- [@apache-mynewt-core/sys/log/full] *
@apache-mynewt-core/util/crc <-- [@apache-mynewt-core/sys/shell] *
@apache-mynewt-core/util/mem <-- [@apache-mynewt-core/kernel/os]
Thank you.
Regards,
Then Yoong Ze
On 10/2/2017 11:42 PM, Fabio Utzig wrote:
No sure what you mean by "removed this fs part". What FS are you using?
Could you provide the output of "newt target dep" and "newt target
revdep"?
Cheers,
Fabio Utzig
On Fri, Feb 10, 2017, at 10:59 AM, then yon wrote:
Dear Support,
After updated to latest develop version, the fs code doesn't work
anymore.
It gave me the following error:
4:Unhandled interrupt (2), exception sp 0x200015a0 4: r0:0x000000
r1:0x00000000 r2:0x80000000 r3:0xe000ed0x0000cdf r5:0x000168b0
4:ICSR:0x00421802 HFSR:0x0000000 C:0x00000 4:BFAR:0xe000ed38
MMFAR:0xe000ed34
When i removed this fs part everything work well.
Thank you.
Regards,
Then Yoong Ze
.
.
.