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

What are my options for increasing memory and deploying updates


  • Please log in to reply
24 replies to this topic

#1 MrSmoofy

MrSmoofy

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts
  • LocationOdessa, FL

Posted 30 August 2011 - 01:55 AM

Has far as hardware goes I'm probably at 10% knowledge, software 100% C# been doing software development for 15+ years so I have no doubt I can code my ideas. I have some probjects I want to try and possible even convert them into a little profit. My initial questions are between the three NetDuino options: 1. Some of my ideas are small simple applications others are a bit larger and I'm concerned I won't have enough space for the code. Is it expandable? 2. Storage options for data what are they? 3. Finally what about providing updates. Can this be done where the end user of my final product has a simple process for updating their device? What are the options, USB Update from pc or possibly just inserting a usb thumbdrive? Ability for the device/app to download and apply it's own update. Possible for use rto insert memory card where update is applied from or they simply replace the memory card and the app runs from the memory card.

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 30 August 2011 - 05:44 AM

Hello MrSmoofy. Maybe I ma not the best guy to answer you, but I will try to. 1- the available RAM is probably the most unhappy weakness. If your really need more rooms for your app, you should consider a bigger board, such as the GHI's. However the price is growing a lot as well. Another viewpoint is what you really need on your board. Since all the Netduinos use the same MCU, the total RAM is always 128KB. However, the Plus offers the networking, SD and some other stuffs, thus the remaining RAM is not a heaven. If your app needs RAM, but no extras, then a Netduino standard could fit your goal. 2- AFAIK the only storage option is the SD (with FileSystem) on the Plus version of Netduino. I don't know whether something else is coming available in the near future. 3- The ability to update the firmware remotely should be a brand new feature of the latest Micro Framework 4.2. At the moment should be available the RC1 of the Netduino firmware. Check in the proper forum section news about it. Cheers
Biggest fault of Netduino? It runs by electricity.

#3 MrSmoofy

MrSmoofy

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts
  • LocationOdessa, FL

Posted 08 September 2011 - 02:18 PM

Thanks for the reply. Not sure what the GHI item you mention is does it use C# as well? I'm a software guy not a hardware guy but my worry is the more functionality (code) I add to my project the closer I could get to running out of RAM with no way to increase it. Does the netduino not support the ability to add additional Card Slots for more storage or possible a USB port to support a thumb drive and or a usb hard drive? I'll check the framework looks like RC2 came out so I hope it provides an easy way to make software updates.

#4 liqdfire

liqdfire

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts

Posted 08 September 2011 - 02:32 PM

Thanks for the reply. Not sure what the GHI item you mention is does it use C# as well? I'm a software guy not a hardware guy but my worry is the more functionality (code) I add to my project the closer I could get to running out of RAM with no way to increase it.

Does the netduino not support the ability to add additional Card Slots for more storage or possible a USB port to support a thumb drive and or a usb hard drive?

I'll check the framework looks like RC2 came out so I hope it provides an easy way to make software updates.



All .Net MF devices use C#, and it looks like as of 4.2 you will be able to use VB.
GHI makes a .Net MF device called EMX or ChipWorks X that both have lots of additional RAM and Flash, I think up to 16 megs.
I have one of their Embedded Master dev kits (with touch LCD) I would be willing to sell pretty cheaply if you are interested in toying with their offerings without shelling out ~ $350 for the complete dev kit. The modules are about $90 each.

Adding USB storage is not as straight forward as it is on a PC, you still have to have drivers that can communicate with it; now the framework has a lot of capabilities to talk to USB devices with very RAW methods, but you have to know a lot about the internal workings of USB to make it all work. I have not looked into the NetDuino assemblies yet to know what all it offers in that area, Chris would be better to answer that one.

#5 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 08 September 2011 - 03:11 PM

Does the netduino not support the ability to add additional Card Slots for more storage or possible a USB port to support a thumb drive and or a usb hard drive?


You can use an SD card for additional storage of resources, but not code space. That has to stay within the limits.
Code carefully, we're spoilt with normal PC dev, we think performance - not size. In this world size is the more important of the two.

#6 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 08 September 2011 - 04:40 PM

MrSmoofy,

GOT to be a story behind that name!

I know I had a lot of the same concerns before I actually got a Netduino Plus... especially since it has even less room due to its support of the networking and SD card. But I’ve been surprised at how small the C# code I write is compiled down to before installing on the Netduino.

You can use an SD card for additional storage of resources, but not code space. That has to stay within the limits.


Colin, I’m not sure that is correct. AND, I’m not 100% sure I’m right either… AND IT’S A REAL PAIN IN THE ASS… but,

In the old days (aka Stone Age, IBM PC running a whopping 4.77 MHz) you had to segment out your code into sections. When you needed certain functionality, you dynamically loaded that off the hard disk floppy disk and ran it. Once done, you chucked the code and loaded some other over it and continued on. I played around with the Application.Load() method and got it working to do the loading and running side. The part I may be way off… I didn’t try unloading it. Being Managed code, I would assume, killing the reference will unload it, but I don’t know that.

Now… if you are needing all your code in the 28K memory at once, OR can’t live with the delayed loading, then basically… I’d have to agree with ColinR… you’re basically SOL.

If anyone is interested, I’d be glad to try and do that loading/unloading thing and see how large a program I can get into OFMME (Old Fart Memory Management Engine).

Would anyone happen to have a large C# code base they want tried?
Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#7 ColinR

ColinR

    Advanced Member

  • Members
  • PipPipPip
  • 142 posts
  • LocationCape Town, South Africa

Posted 08 September 2011 - 04:44 PM

I played around with the Application.Load() method


I forgot about that, sorry!

#8 MrSmoofy

MrSmoofy

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts
  • LocationOdessa, FL

Posted 08 September 2011 - 04:47 PM

MrSmoofy,

GOT to be a story behind that name!

I know I had a lot of the same concerns before I actually got a Netduino Plus... especially since it has even less room due to its support of the networking and SD card. But I’ve been surprised at how small the C# code I write is compiled down to before installing on the Netduino.



Colin, I’m not sure that is correct. AND, I’m not 100% sure I’m right either… AND IT’S A REAL PAIN IN THE ASS… but,

In the old days (aka Stone Age, IBM PC running a whopping 4.77 MHz) you had to segment out your code into sections. When you needed certain functionality, you dynamically loaded that off the hard disk floppy disk and ran it. Once done, you chucked the code and loaded some other over it and continued on. I played around with the Application.Load() method and got it working to do the loading and running side. The part I may be way off… I didn’t try unloading it. Being Managed code, I would assume, killing the reference will unload it, but I don’t know that.

Now… if you are needing all your code in the 28K memory at once, OR can’t live with the delayed loading, then basically… I’d have to agree with ColinR… you’re basically SOL.

If anyone is interested, I’d be glad to try and do that loading/unloading thing and see how large a program I can get into OFMME (Old Fart Memory Management Engine).

Would anyone happen to have a large C# code base they want tried?


Thanks for the reply. This sounds promising. What is the largest SD card the netduino plus can support? I can see myself having the main application on the main memory and loading and unloading dll's from the SD as needed.

#9 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 08 September 2011 - 05:50 PM

Thanks for the reply. This sounds promising. What is the largest SD card the netduino plus can support? I can see myself having the main application on the main memory and loading and unloading dll's from the SD as needed.


You got it. I know the current framework (4.1) limit is 2GB. Which is what I have. But I read that the 4.2 it tackling that one and various people have used at least 4GB. I haven't heard yet what the upper limit is going to be.

NOTE: Oh, also, I was looking at this method to handle the code updates for customers you mentioned. Its a whole lot easier (for the customer, not the developer) to just upload through the Internet via the Network connector and on down to the SD card, have the Netduino reboot and they get an upgraded application. Also, I noted that once the Application.Load() has finished loading, it doesn't lock the file... like the desktop does. So you can upload a new program even while the old program is running! Way cool! :D Just got to make sure the resident program stub is bullet proof! Good luck. Take the plunge.
Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#10 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 08 September 2011 - 05:59 PM

I thought I should comment... Having 2GB of code on a Netduino... Hmmmm.... maybe we need to evaluate our hardware paradigm. :P Also... unless you're my age, programming since the (mid 70's) you probably don't remember how abrasive this kind of segmented programming is. At least we had 64K instead to work in. And I don't even know if I could un-wrap from OOP principles... because it is decisively back to a procedural programming style.
Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#11 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 08 September 2011 - 07:53 PM

You got it. I know the current framework (4.1) limit is 2GB.

FYI, from 4.1.1 BETA 1 firmware thread: "KodeDaemon (David Stetz) who contributed SD card enhancements to support 4GB SDHC cards (8GB+ cards may work...but not tested)".

#12 liqdfire

liqdfire

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts

Posted 08 September 2011 - 08:10 PM

MrSmoofy,

GOT to be a story behind that name!

I know I had a lot of the same concerns before I actually got a Netduino Plus... especially since it has even less room due to its support of the networking and SD card. But I’ve been surprised at how small the C# code I write is compiled down to before installing on the Netduino.



Colin, I’m not sure that is correct. AND, I’m not 100% sure I’m right either… AND IT’S A REAL PAIN IN THE ASS… but,

In the old days (aka Stone Age, IBM PC running a whopping 4.77 MHz) you had to segment out your code into sections. When you needed certain functionality, you dynamically loaded that off the hard disk floppy disk and ran it. Once done, you chucked the code and loaded some other over it and continued on. I played around with the Application.Load() method and got it working to do the loading and running side. The part I may be way off… I didn’t try unloading it. Being Managed code, I would assume, killing the reference will unload it, but I don’t know that.

Now… if you are needing all your code in the 28K memory at once, OR can’t live with the delayed loading, then basically… I’d have to agree with ColinR… you’re basically SOL.

If anyone is interested, I’d be glad to try and do that loading/unloading thing and see how large a program I can get into OFMME (Old Fart Memory Management Engine).

Would anyone happen to have a large C# code base they want tried?


I am not for sure about MF, because I do not know what it uses to resolve assemblies; I know that on desktop once Fusion loads an assembly into an app domain it is stuck there. You have to unload the entire app domain to unload the assembly.

#13 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 08 September 2011 - 08:28 PM

Thanks for the reply. This sounds promising. What is the largest SD card the netduino plus can support? I can see myself having the main application on the main memory and loading and unloading dll's from the SD as needed.


Chris, Stefan, Mario, etc, correct me if I'm wrong.

You can't unload an assembly after it has been loaded. In the regular framework world, the way you handle that is creating a separate AppDomain and unload the entire AppDomain. I don't know if something like that is possible with NETMF though.

-dan

#14 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 09 September 2011 - 04:00 AM

Dan is right. The unload is possible only by loading the satellite code in another domain. Otherwise it will be glued in the main code, and there's no way to detach it. BTW, even on a std .Net (PC), the load/unload in a big pain, and I never used. That's because the several permissions' limitations when working across different domains. Too critical: nonsense. Consider that there are some functions such as dynamic expressions, or workflows, that must rely on the ability to "create" program on-the-fly, then trash it. They basically are build on several (normal) classes, which can be composed together (runtime). The execution engine wakls these classes, and interprets them. But all that is NOT "compilation"! Another fault about the load/unload, is that the extra code would be loaded in the RAM. And the RAM is the most precious part (most of the time is the resource that ends first). IMHO, you have only two choices if your app is pretty complex: - use a bigger (and expensive) board (such as the GHI's); - buy a Netduino (mini or standard, NOT plus), then write many parts as native. Not the heaven, though. Cheers
Biggest fault of Netduino? It runs by electricity.

#15 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 09 September 2011 - 05:58 AM

... creating a separate AppDomain and unload the entire AppDomain. I don't know if something like that is possible with NETMF though.

There is support for AppDomains (CreateDomain(), Unload() etc.) in .NET MF, the question is if it really works - in Launching an application from an SD card fails... thread the final solution uses current domain, but it just could be the goal.

#16 MrSmoofy

MrSmoofy

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts
  • LocationOdessa, FL

Posted 09 September 2011 - 11:45 AM

Is reflection supported? If so what about using Assembly.Load and then .CreateInstance

#17 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 09 September 2011 - 02:27 PM

Is reflection supported? If so what about using Assembly.Load and then .CreateInstance


Some reflection is supported. I was going great guns on a project, until...

You can find methods on an object, but you can't query for parameters.

Type typ = GetType();
MethodInfo[] methods = typ.GetMethods();
ParameterInfo[] prms = methods[0].GetParameters();  // <==== This doesn't exist.

Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#18 MrSmoofy

MrSmoofy

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts
  • LocationOdessa, FL

Posted 09 September 2011 - 02:51 PM

Some reflection is supported. I was going great guns on a project, until...

You can find methods on an object, but you can't query for parameters.

Type typ = GetType();
MethodInfo[] methods = typ.GetMethods();
ParameterInfo[] prms = methods[0].GetParameters();  // <==== This doesn't exist.


I shouldn't need to use GetMethods or GetParameters since I'm writing the code myself I will already know the Methods and Parameters for them.

#19 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 09 September 2011 - 02:51 PM

Is reflection supported? If so what about using Assembly.Load and then .CreateInstance


Sorry, didn't answer the second part... This works.

using System;
using Microsoft.SPOT;
using System.IO;
using System.Reflection;

namespace Sandbox
{
    public class Instantiate
    {
        private Assembly _ass;
        private object _obj;
        private Type _type;
        private MethodInfo _mi;
        private MethodInfo _ma;

        public Instantiate()
        {
            try
            {
                FileStream fs = new FileStream(@"\SD\bin\OutsideLE.pe", FileMode.Open);
                byte[] image = new byte[(int)fs.Length];
                fs.Read(image, 0, (int)fs.Length);
                fs.Close();
                _ass = Assembly.Load(image);
                _obj = AppDomain.CurrentDomain.CreateInstanceAndUnwrap(
                    "Outside", "ASSM.TestClass");
                _type = _ass.GetType("ASSM.TestClass");

                _mi = _type.GetMethod("Print");
                _ma = _type.GetMethod("DoSomeMath");
                _mi.Invoke(_obj, null);
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }

        public long DoSomeMathExternal(params object[] args)
        {
            return (long)_ma.Invoke(_obj, args);
        }
    }
}

The object in the SD binary file

using System;
using Microsoft.SPOT;

namespace ASSM
{
    public class TestClass
    {
        public TestClass()
        {
            Debug.Print("TestClass Instantiated");
        }

        public void Print()
        {
            Debug.Print("Hello there");
        }

        public long DoSomeMath(int a, int B)
        {
            return a * b + b;
        }
    }
}

Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#20 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 09 September 2011 - 03:03 PM

But another thing that’s important and since you don’t have yours yet… The code seems to be smaller. As you note above the binary is not the tradition dll/exe that you’re probably used to. The dll equivalent is the *.pe files found in the le (Little Endian) sub folder under the bin\Debug folder. For instance… for one of my projects my exe/dll’s are 27,136 bytes. The *.pe files actually going to the Netduino are 10,632 bytes. I’m guessing that you could gauge your projects (if you have them on a PC already) and take a WAG of what they’d be on the Netduino with that ratio… ~40% If binaries can't be unloaded (and I tried it) I couldn't free up their space and load something else. I don’t think the overhead wouldn't be worth it to me. I'd look to bigger hardware or simplify to fit or segregate to fit. However, in a customer centric product, that on the fly upgradeability has some serious draw for it! Good Luck with whatever you decide.
Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com




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.