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

TinyCore won't load


  • Please log in to reply
7 replies to this topic

#1 Arbiter

Arbiter

    Advanced Member

  • Members
  • PipPipPip
  • 132 posts
  • LocationBrisbane, Australia

Posted 28 June 2012 - 03:33 PM

A process of elimination has left me with the oddest thing: referencing TinyCore prevents my app from deploying. This behaviour normally means the app is too big, but I tried creating a new N+ 4.2 app and deploying it (no problem). Add TinyCore and blam! she won't deploy.

My next thought was "Have I somehow referenced the wrong version of TinyCore?" So I checked and this was the path:

C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.2\Assemblies\le\Microsoft.SPOT.TinyCore.dll

I can work around it; I really only wanted EventHandler, which isn't hard to replicate.

Nevertheless, has anyone else experienced this?

Never mind. Even though site search turned up nothing, google found another identical post on this site - apparently TinyCore is mostly about WPF and is not really supported on N+.


Let's therefore revise the question.



Chris can we pull out the useful parts of TinyCore such as the definition of EventHandler? I have to keep qualifying my own definition of EventHandler otherwise the compiler claims it's ambiguous with the definition from TinyCore (though how the hell it knows that without a TinyCore reference is beyond me).

Epilogue
I used a different name with the same signature:

public delegate StallEventHandler(object sender, EventArgs e);

No need to qualify the name, no need to import TinyCore.
One day, all this too shall parse.

#2 Corey H.

Corey H.

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationDallas

Posted 14 August 2012 - 11:52 PM

I also ran into the same file and it resulted in the size of the deployment growing significantly, so your first inclination is correct.

I could leave the reference to tiny core in there if I commented out all references to event handler...


//        public event EventHandler OnError;
Everything deploys just fine:


Incrementally deploying assemblies to device
Deploying assemblies for a total size of 14728 bytes
Assemblies successfully deployed to device.


Add the line to one of your classes:

public event EventHandler OnError;

Incrementally deploying assemblies to device

Deploying assemblies for a total size of 78608 bytes
Assemblies not successfully deployed to device.
Deployment to the device was not successful.

When I remove the reference to TinyCore, I get compile errors on EventHandler. Other than your idea of creating another handler, I don't know the workaround.

Something in that class is causing the size of the deployment to balloon up. Is this expected behavior or is this a bug?( N+ 4.2 app)

#3 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 15 August 2012 - 06:00 AM

Hi Corey and welcome to the forums.

Are you sure you only commented out that single line? I'm curious because of this:

Deploying assemblies for a total size of 14728 bytes
Assemblies successfully deployed to device.

Deploying assemblies for a total size of 78608 bytes
Assemblies not successfully deployed to device.
Deployment to the device was not successful.

That one line appairently makes a difference of 63880 bytes, which is a lot. With a Netduino Plus it's reaching the code memory limitation that way.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#4 Corey H.

Corey H.

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationDallas

Posted 15 August 2012 - 02:31 PM

Hi Corey and welcome to the forums.

Are you sure you only commented out that single line? I'm curious because of this:


That one line appairently makes a difference of 63880 bytes, which is a lot. With a Netduino Plus it's reaching the code memory limitation that way.


Yes, I went back and forth around 5 times verifying it. The fact that this was "odd" is why I mentioned it. I was originally porting a "non-micro framework" project that interacts through a serial port to the "micro framework" and was stumped when it would not deploy. I then removed every class and added items back one at a time until it no longer deployed. THen commented out items in that class until it deployed. The key to the size was referencing the EventHandler class. That is when I noticed that just referencing the event handler in the code caused the deployment size to become very large. There must be some dependent references where if you include that, other assemblies may be referenced or an issue with how the Netduino is loading that assembly.

I can try to pull together a solution that shows just that problem tonight when I get home.

Corey

#5 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 15 August 2012 - 02:36 PM

I can try to pull together a solution that shows just that problem tonight when I get home.

If you can share the solution tonight, I'll look into it. It's an interesting issue!
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#6 Corey H.

Corey H.

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationDallas

Posted 16 August 2012 - 01:48 AM

Case 1 - just referneceing TinyCore in your main project baloons the size up

Incrementally deploying assemblies to device
Deploying assemblies for a total size of 64856 bytes
Assemblies not successfully deployed to device.
Deployment to the device was not successful.


For Case 2 - if you have a class library project. Even if that other project includes TinyCore, it does not get pulled in unless you reference EventHandler in the class library project



        public TinyCLRTest()
        {
        }

        public void DoTest()
        {
            // I really don't need to do anything
        }

        //EventHandler OnError;


So For Case2, uncomment the line


EventHandler OnError;
<br class="Apple-interchange-newline">
This will cause your deployment to go From:


Incrementally deploying assemblies to device
Deploying assemblies for a total size of 1456 bytes
Assemblies successfully deployed to device.


To :


Incrementally deploying assemblies to device
Deploying assemblies for a total size of 65208 bytes
Assemblies not successfully deployed to device.
Deployment to the device was not successful.

Long Story Short: TinyCore is not so tiny...


Corey

Attached Files



#7 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 16 August 2012 - 05:20 AM

Ahh yes, I see it now!

The tinycore pe file is 61,168 bytes, which is very big for a micro platform.
If you need anything in particular I recommend to work around that, maybe build your own slimsize version of it. I never had to use tinycore (otherwise I was more familiar with this problem)...

For event handlers it's not required. I normally use the NativeEventHandler, for example:
public event NativeEventHandler OnKeyDown;

It's also possible to make your own events, for example:
event StateChange OnStateChange;
public delegate void StateChange(IIRQPort Object, bool State, DateTime Time);

Programming for a micro environment will always be a challenge :)
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#8 aalmada

aalmada

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts
  • LocationPortugal

Posted 13 September 2012 - 11:06 AM

For event handlers it's not required. I normally use the NativeEventHandler, for example:

public event NativeEventHandler OnKeyDown;


EventHandler (non-generic version) is to be used on events that don't have any data. It's unfortunate that .NET MF is missing such a basic feature (one line of code).

The use of NativeEventHandler has two issues: It supplies data that is not relevant for my case and it doesn't comply with the .NET design guidelines (chapter 5.4 of Cwalina's book).

aalmada




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.