Hello,
what about Extended Weak Reference on Netduino/Netduino Plus ?
It seems that it isn't supported in the current firmware. Is it right ?
Thanks,
Paolo.

  | ||||||||||||||
Extended Weak Reference support
Started by
Paolo Patierno
, Feb 01 2013 09:18 PM
13 replies to this topic
#1Posted 01 February 2013 - 09:18 PM Hello, what about Extended Weak Reference on Netduino/Netduino Plus ? It seems that it isn't supported in the current firmware. Is it right ?
Thanks, Paolo. Paolo Patierno Microsoft MVP on Windows Embedded & IoT Azure Advisor Blog : Embedded101 #2Posted 02 February 2013 - 02:58 PM I have seen that in 4.1 firmware version, the file Sam7x_Bl_config.cpp contains BLOCKTYPE_STORAGE_A and BLOCKTYPE_STORAGE_B definition. These definitions aren't in the 4.2 firmware version. Have you removed extended weak reference support in 4.2 version ? Paolo Patierno Microsoft MVP on Windows Embedded & IoT Azure Advisor Blog : Embedded101 #3Posted 03 February 2013 - 08:14 AM I have modified the Sam7x_Bl_config.cpp in this way :
const BlockRange g_SAM7X_BS_BlockRange[] = { // { BlockRange::BLOCKTYPE_BOOTSTRAP , 0, 5 }, { BlockRange::BLOCKTYPE_CODE , 6, 46 }, //{ BlockRange::BLOCKTYPE_DEPLOYMENT , 47, 62 }, { BlockRange::BLOCKTYPE_DEPLOYMENT , 47, 60 }, { BlockRange::BLOCKTYPE_STORAGE_A , 61, 61 }, { BlockRange::BLOCKTYPE_STORAGE_B , 62, 62 }, { BlockRange::BLOCKTYPE_CONFIG , 63, 63 } };
but nothing...the following example doesn't work...
public static void Main()
{
// Reads data from FLASH memory.
// If no entry with AppSettings/0 identifier exists in memory, a new one is created.
settingsReference = ExtendedWeakReference.RecoverOrCreate(typeof(AppSettings), 0, ExtendedWeakReference.c_SurvivePowerdown);
// If the entry was just created, its value is set to null.
if (settingsReference.Target == null)
Settings = new AppSettings();
else
Settings = (AppSettings)settingsReference.Target; // EWR.Target is of type object
Settings.RunCount++; // Change a settings value.
settingsReference.Target = Settings; // This call writes the updated data into FLASH.
Debug.Print(Settings.WelcomeMessage);
Debug.Print("Number of starts: " + Settings.RunCount.ToString());
Thread.Sleep(5000);
} Paolo Patierno Microsoft MVP on Windows Embedded & IoT Azure Advisor Blog : Embedded101 #4Posted 04 February 2013 - 07:56 AM no one can answer that question? no one from SecretLabs ?? Paolo Patierno Microsoft MVP on Windows Embedded & IoT Azure Advisor Blog : Embedded101 #5Posted 04 February 2013 - 04:43 PM
Hi Paolo,
Extended Weak References are not supported on Netduino.
There is a tradeoff between complete garbage collection and EWR support. Also the latest NETMF firmware releases don't leave enough room on Netduino Plus for EWR sectors. So we recommend using MicroSD for storage.
With the gen2 boards, there's enough extra room that we can look at possibly storing some data onboard using a simpler mechanism than EWR. EWR was really great for the original SPOT watches...but there are other ways to support on-chip storage now.
Chris
#6Posted 04 February 2013 - 05:03 PM Yes Chris...but I have recompiled the firmware enabling 2 flash blocks (8 KB for each block) for extended weak references so that I have reduced flash space for my application (128 KB - 2 * 8 KB = 112 KB). Is there anything else to do to enable EWR ? Paolo Patierno Microsoft MVP on Windows Embedded & IoT Azure Advisor Blog : Embedded101 #7Posted 04 February 2013 - 05:31 PM
[*]Update scatterfile to match the changes in block range, [*]Actually add the extended weak feature ("DataStorage") using the SolutionWizard. [/list] And, you'd want to flash the updated TinyBooterDecompressor.bin to make sure it uses correct flash memory layout. #8Posted 04 February 2013 - 05:34 PM
Hi Paolo,
You'll want to adjust these values in the Netduino.settings file.
<TinyCLR_Defines Include="PLATFORM_DEPENDENT_HEAP_SIZE_THRESHOLD=10240" /> <TinyCLR_Defines Include="PLATFORM_DEPENDENT_HEAP_SIZE_THRESHOLD_UPPER=131072" />EWRs are saved to flash based on "memory pressure". But for the garbage collector to clean everything up all the time we've needed to push the upper threshold all the way to 128KB. If you want to enable EWRs you'll need to reduce the upper threshold. There may be additional steps needed. Chris #9Posted 04 February 2013 - 06:40 PM
I haven't modified scatterfile because the "DataStorage" area is inside deployment area code. The two data storage blocks use 16 KB from 128 KB deployment area code so that the latter becomes 112 KB. According to you how can I modify the scatter file ? I have already flashed TinyBooterDecompressor. The only missing thing is to add EWK using the SolutionWizard. Paolo Patierno Microsoft MVP on Windows Embedded & IoT Azure Advisor Blog : Embedded101 #10Posted 04 February 2013 - 06:41 PM
There isn't a way to force GC to write EWR objects into flash ? Paolo Patierno Microsoft MVP on Windows Embedded & IoT Azure Advisor Blog : Embedded101 #11Posted 04 February 2013 - 06:52 PM I believe that NETMF 4.3 has a new "Flush" feature for EWRs. We don't use or support EWR with Netduino so I haven't tested it...but I saw it while browsing through the firmware source. Chris #12Posted 04 February 2013 - 07:02 PM
Well, then it is not necessary to update the scatterfile... #13Posted 04 February 2013 - 07:03 PM
So do you think that I only need to enable EWK feature with Solution Wizard ... And about Chris suggestion on heap threshold ? Paolo Patierno Microsoft MVP on Windows Embedded & IoT Azure Advisor Blog : Embedded101 #14Posted 19 January 2015 - 01:26 PM Hey Paolo !
I'm very much interested in making EWR work on the Netduino. Have you managed to make it happen ?
Thanks, Emilio 0 user(s) are reading this topic0 members, 0 guests, 0 anonymous users | ||||||||||||||
|
||||||||||||||
This webpage is licensed under a Creative Commons Attribution-ShareAlike License. | ||||||||||||||