Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length



Pages: [1]
  Print  
Author Topic: Avaible user ram  (Read 1508 times)
mmarolda
Newbie
*
Posts: 4


View Profile
« on: September 04, 2009, 03:07:11 AM »

In the USBizi documentation I can read that the "USER RAM" is about 40 Kb,
but when I execute one empty application doing really nothing I can see only about 20 Kb of free ram !

The simple application is this:

Code:
using System;
using Microsoft.SPOT;

namespace USBIzi_4 {
    public class Program {
        public static void Main() {
            Debug.GC(true);
        }
    }
}

The console output is:

Code:
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\mscorlib.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.Native.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.Hardware.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.Hardware.SerialPort.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.IO.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\System.IO.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.Hardware.Usb.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\csharp\USBIzi_4\USBIzi_4\bin\Debug\USBIzi_4.exe', Symbols loaded.
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
GC: 1msec 17544 bytes used, 22116 bytes available
Type 0F (STRING              ):     72 bytes
Type 11 (CLASS               ):    360 bytes
Type 12 (VALUETYPE           ):     48 bytes
Type 13 (SZARRAY             ):    384 bytes
Type 15 (FREEBLOCK           ):  22116 bytes
Type 17 (ASSEMBLY            ):   9564 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 1B (DELEGATE_HEAD       ):     72 bytes
Type 1D (OBJECT_TO_EVENT     ):     24 bytes
Type 1E (BINARY_BLOB_HEAD    ):   5328 bytes
Type 1F (THREAD              ):    384 bytes
Type 20 (SUBTHREAD           ):     48 bytes
Type 21 (STACK_FRAME         ):    408 bytes
Type 27 (FINALIZER_HEAD      ):     24 bytes
Type 31 (IO_PORT             ):     36 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):    672 bytes
COMPACT: 1msec - Biggest free block: 15780
The thread '<No Name>' (0x1) has exited with code 0 (0x0).

I'd like to know the really avaible RAM before starting my project
Please help me
Logged
SupportAdmin
Administrator
Hero Member
*****
Posts: 5516



View Profile WWW
« Reply #1 on: September 04, 2009, 03:51:05 AM »

If you look at the ouput, USBizi had loaded 7 assemblies before it loaded your app. Those had used up the RAM.
Logged
mmarolda
Newbie
*
Posts: 4


View Profile
« Reply #2 on: September 04, 2009, 04:48:22 AM »

Ok,
how can I avoid loading these assemblies ?
I suspect that they are part of the microframework himself

Let me know please
Logged
GHI_Support
Administrator
Hero Member
*****
Posts: 1295


View Profile
« Reply #3 on: September 04, 2009, 11:56:27 AM »

From the output below:
Quote
GC: 1msec 17544 bytes used, 22116 bytes available
You have about 40K available for user application, but some RAM is used to load these necessary assemblies.
Quote
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\mscorlib.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.Native.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.Hardware.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.Hardware.SerialPort.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.IO.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\System.IO.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Programmi\Microsoft .NET Micro Framework\v3.0\Assemblies\Microsoft.SPOT.Hardware.Usb.dll'
Logged
cypher
Jr. Member
**
Posts: 78


C# Padawan


View Profile
« Reply #4 on: September 05, 2009, 03:39:58 AM »

I think it is impossible to avoid loading the assemblies.

For example:

The mscorlib.dll contains base function and Hardware.SerialPort , when these dll is not loaded you cannot see the debug messages.

From my opinion , it is not possible to get more available RAM.

But 22kb is not bad , for a small board and an embedded application Cheesy

BR

Marc
Logged
SupportAdmin
Administrator
Hero Member
*****
Posts: 5516



View Profile WWW
« Reply #5 on: September 05, 2009, 09:21:31 AM »

Actually you can remove them but when all assemblies are removed, USBizi become useless.
There are optimization planned for USBizi to see if we can give uses more RAM but for most USBizi projects, 20 KB is well enough.
Logged
mmarolda
Newbie
*
Posts: 4


View Profile
« Reply #6 on: September 05, 2009, 12:35:03 PM »

Thank you for your answer,
but it's not good that in the USBIzi documentation GHI electronics declares 40Kb of free user RAM when in effect there are only about 20 KB !!
Removing these assemblies the USBIzi become useless, so the documentation is not telling the true.
The trouble is that I have to migrate to ARM a project based on 8051 that now use about 27 Kb of RAM,
so I think that is impossible to fix it in the USBIzi.
Maybe with 40kb there was a small chance.....

GHI pepole....please update your documentation

thank you
 
Logged
SupportAdmin
Administrator
Hero Member
*****
Posts: 5516



View Profile WWW
« Reply #7 on: September 05, 2009, 04:51:12 PM »

The documentation is correct, the HEAP size is 40KB and we can remove all those assemblies and you will see about 40KB but how would this help your development?

Note that changes in firmware can increase or decrease the final available memory size but what will not change is that we set the heap size to 40KB, which is what the documentation states.
Quote
The trouble is that I have to migrate to ARM a project based on 8051 that now use about 27 Kb of RAM, so I think that is impossible to fix it in the USBIzi.
How did you know it needs 27KB? In C# everything is a managed object that is usually dynamically allocated. If you create an application that uses all available RAM just for global variables then the system will simply not run.
What does your 8051 application that you are porting do? Just curious

With more details we maybe able to tweak the firmware to give you more ram.  our customers satisfaction is very important for us. and we offer the maximum flexibiltie to help.
« Last Edit: September 05, 2009, 11:28:28 PM by support » Logged
mmarolda
Newbie
*
Posts: 4


View Profile
« Reply #8 on: September 07, 2009, 01:25:07 AM »

In my opinion the "USER RAM" is the ram where I can put my application data and all the "optional" libraries I want to link.
If the 7 assemblies are mandatory for the developping they are to be considered "system libreries" and not "user libraries", but I know that you don't agree with me.

A last consideration: the chip has 96Kb of ram and now I have 22Kb free.....so the framework is allocating about 74Kb.... I think it's a lots.

Anyway my application is for factory automation, is not time critical (not real time) and I have to migrate one old project written from scratch in ansi C using about 27Kb RAM.
 
Logged
SupportAdmin
Administrator
Hero Member
*****
Posts: 5516



View Profile WWW
« Reply #9 on: September 07, 2009, 04:18:40 AM »

Quote
If the 7 assemblies are mandatory for the developping....
Actually they are not mandatory. We can remove them and give you more ram but in most cases you will be adding them, or most of them, back. But if this solves problems for some apps, we will look into removing them.

Quote
A last consideration: the chip has 96Kb of ram and now I have 22Kb free.....so the framework is allocating about 74Kb.... I think it's a lots.
Micro FRamework is not a small system. Porintg it to this single chip was a challange. If it wasn't for GHI long experince, it wouldn't have run on a singl chip. This is why it is the only one in world Smiley

Quote
.....one old project written from scratch in ansi C using about 27Kb RAM.
C# works with dynamic memories and GC extensively. This is very different from C. Porting a project from C to C# should be easy but your final usage of RAM and FLASH will not be the same.
Logged
usbizi
Newbie
*
Posts: 28


View Profile
« Reply #10 on: February 04, 2010, 07:32:17 AM »


How do you know when your application is to large.
Must the size of the application file be less then 40 kb or less then 22kb ?

regards
Michael
Logged
SupportAdmin
Administrator
Hero Member
*****
Posts: 5516



View Profile WWW
« Reply #11 on: February 04, 2010, 08:27:21 AM »

Through the applications I personally designed with USBizi, I found them all fit very well. In any application, you can rewrite the code to be more static allocation and then only use what you need. The free ebook talks about this.

By the way, we have done some magic on USBizi and now you have almost double the free RAM!! This will be in 4.0 release coming this month
Logged
Pages: [1]
  Print  
 
Jump to: