BlockStorage - General Discussion - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

BlockStorage


  • Please log in to reply
6 replies to this topic

#1 Savvkin

Savvkin

    Member

  • Members
  • PipPip
  • 15 posts

Posted 08 May 2014 - 02:52 AM

I've implemented native BlockStorage driver for external SPI flash (defined as BlockRange::BLOCKTYPE_FILESYSTEM).

 

It's detected in MFDeploy (both TinyBooter and TinyCLR).

But how to use it from managed code?

 

VolumeInfo.GetVolumes() throws System.NotSupportedException



#2 Savvkin

Savvkin

    Member

  • Members
  • PipPip
  • 15 posts

Posted 10 May 2014 - 10:12 AM

I've added FileSystem feature firmware and configured volumes/filesystems in FS_config.cpp.

Now GetFileSystems() and GetVolumes() are working.

 

But I don't actually need filesystem, using low-level BlockStorage would be enough for me.

What is the best approach?

Implement driver in C#? But I' afraid loosing performance.

Using Intetop? But how can I call BlockStorage (Or SimpleStorage, or my driver) directly from C#? Or I can't do this without additional cpp wrapper?

 



#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 May 2014 - 04:00 AM

Hi Savvkin,

The BlockStorage in NETMF is there for storing settings and for accessing SD cards and external flash sources. It is possible to use BlockStorage without a file system--but you'll probably need to create your own managed code wrapper (and some native code) to accomplish direct-block-access from C# code.

CHris

#4 Savvkin

Savvkin

    Member

  • Members
  • PipPip
  • 15 posts

Posted 13 May 2014 - 09:15 PM

Thanks, Chris.

I understand what BlockStorage is used for, but it's kinda strange there is no managed wrapper out-of-box. Anyway, I decided not to write native wrapper for BlockStorage + managed wrapper for native wrapper to organize direct-block-access and decided to go standard NETMF way (well, from the sources it looks to me like it's a standard way).

 

I'm implementing own very simple filesystem driver, like the Keil EFS one. I believe it's the best way. No need to write two wrappers, include custom libs, write storage logic in managed part. Just use File/Directory/FileStream. My external flash is just for internal use (store config, logs, sensor data, etc) and not planned to be exposed via USB (at least directly), it's not required to support common full-featured FS like FAT16 (which has lower limit of 4.1 MB, a lot of overhead and not made with low random access time and wear leveling in mind).

 

So, what do you think about that?

Is there any existing native implementations of simple flash-oriented FS  for NETMF?



#5 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 13 May 2014 - 11:11 PM

That sounds like fun :)

Today, most storage for NETMF is basic settings storage (ER_CONFIG sector), file system storage (SD cards), app storage (TinyCLR flashing your app to the board) or EEPROM storage (via SPI/I2C).

Are you going to loop in the wear leveling driver as well?

Chris

#6 Cuno

Cuno

    Advanced Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationZürich / Switzerland

Posted 14 May 2014 - 05:44 AM

Is there any existing native implementations of simple flash-oriented FS  for NETMF?

Yes. There is a high-quality and well-maintained log-structured file system implementation for NETMF called Tiny File System, written by tailorza.

 

See here: https://tinyfilesystem.codeplex.com/

 

Cuno



#7 Savvkin

Savvkin

    Member

  • Members
  • PipPip
  • 15 posts

Posted 14 May 2014 - 10:01 AM

@Chris, but from those types of storage only BLOCKTYPE_FILESYSTEM is intended to store own data and available to managed code. We can't (or have to avoid) write our data directly to BLOCKTYPE_CONFIG or BLOCKTYPE_DEPLOYMENT.

SPI/I2C based flash is also available to managed code, but we have to solve same memory access and organization problems, plus we loose speed and RAM.

 

I'm not sure about BlockStorage WearLeveling driver. I will try to implement basic wear leveling in FileSystem driver. It's more reusable this way (will work with any BlockStorage drivers).

 

@Cuno, I saw this project, but it's just a managed extensions for managed SPI driver. And I was looking for native (FileSystem HAL) implementation.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.