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

Compiling netmf with GCC4.2


  • Please log in to reply
2 replies to this topic

#1 Illishar

Illishar

    Advanced Member

  • Members
  • PipPipPip
  • 146 posts

Posted 10 February 2011 - 09:32 AM

Hello there,

Just a small info (yet another) to those who wants to compile the Netduino source.

- Start compiling with the CodeSourcery (GCC 4.2) compiler, which is supported by Microsoft.
- To make it compile, you most likely need to edit the memory layout. This is due to changing and different compiler outputs.
- The files are:
C:\MicroFrameworkPK_v4_1\Solutions\Netduino\TinyCLR\scatterfile_tinyclr_gcc.xml
C:\MicroFrameworkPK_v4_1\Solutions\Netduino\DeviceCode\Blockstorage\Sam7X_blockstorage\Sam7x_Bl_Config.cpp

In the sam7x file you'll find this:
const BlockRange g_SAM7X_BS_BlockRange[] =
{
    { BlockRange::BLOCKTYPE_BOOTSTRAP       ,  0,  5 },		
    { MEMORY_BLOCKTYPE_GCC_SPECIAL_BOOTSTRAP,  6, 14 },		
    { BlockRange::BLOCKTYPE_CODE            , 15, 44 },		
    { MEMORY_BLOCKTYPE_GCC_SPECIAL_CODE     , 45, 46 },		
    { BlockRange::BLOCKTYPE_DEPLOYMENT      , 47, 60 },		
    { BlockRange::BLOCKTYPE_STORAGE_A       , 61, 61 },	
    { BlockRange::BLOCKTYPE_STORAGE_B       , 62, 62 },	
    { BlockRange::BLOCKTYPE_CONFIG          , 63, 63 }
};
Which doesn't fit when using GCC4.2. If you look at it it will tell you, that the BootLoader will take up either 6 blocks (RVDS) or 15 blocks (GCC). This is mostly correct. However depending on what you're trying to do, the BootLoader might not be of interest to you. The TinyCLR is. Which means that you can keep your SecretLabs compiled RVDS BootLoader (much smaller) and combine it with your own TinyCLR.

I've therefor changed my setup to this:
const BlockRange g_SAM7X_BS_BlockRange[] =
{
    //
    { BlockRange::BLOCKTYPE_BOOTSTRAP       ,  0,  5 },		//  ~50k (RVDS BootLoader)
    { BlockRange::BLOCKTYPE_CODE            ,  6, 49 },		//  ~360k = 0x0C000
    { BlockRange::BLOCKTYPE_DEPLOYMENT      , 50, 62 },		//  ~106k = 0x64000
    { BlockRange::BLOCKTYPE_CONFIG          , 63, 63 }
};
Depending on the size on your TinyCLR you might have to alter the CODE and DEPLOYMENT addresses.
Yes, I've removed the STORAGE_A and B. They're official areas in the netmf, but they're not currently in use by the Netduino.

When you've made this change, you also need to adjust the scatterfile. This is what I use:
    <Set Name="Heap_Begin"      Value="0x00010000"/>
    <Set Name="Heap_End"        Value="0x00017FF8"/>
    <Set Name="Stack_Bottom"    Value="0x00018000"/>
    <Set Name="Stack_Top"       Value="0x0001FFF8"/>

    <If Name="TARGETLOCATION" In="FLASH">
        <Set Name="Code_BaseAddress"    Value="0x0010C000"/> <!-- This is start TinyCLR -->
        <Set Name="Deploy_BaseAddress"  Value="0x00164000"/> <!-- This is start app code -->
        <Set Name="Code_Size"           Value="%Deploy_BaseAddress - Code_BaseAddress%"/>
        <Set Name="Config_BaseAddress"  Value="0x0017E000"/>    
        <Set Name="Config_Size"         Value="0x00002000"/>
        <Set Name="Valid"               Value="true"/>
    </If>

Notice that the Heap and Stack is only using half of the ram? Yeah ... fancy that.

If you make it compile then just open up your MFDeploy and flash your own ER_FLASH and ER_CONFIG. They're placed in:
C:\MicroFrameworkPK_v4_1\BuildOutput\THUMB\GCC4.2\le\FLASH\release\Netduino\bin\tinyclr.hex\

#2 FelixEmman

FelixEmman

    Member

  • Members
  • PipPip
  • 25 posts

Posted 24 February 2011 - 03:07 PM

I can really appreciate your information. However, being a newbie with regards to netduino in general, I really don't know where to start. I have a need to build some custom SPI drivers, but I'm at a loss on how I should go about it. I've seen different people building the netduino firmware with different compilers (RVDS and various versions of GCC) with different results. Given my need, I'm not sure if i really need to rebuild the netduino firmware myself? From your post it looks like there are different options with regards to loading the bootloader/tinyCLR. It would be nice if someone would explain (in a wiki, but there's no wiki) what the different options/components of deployment are. With the standard netduino firmware (Chris Walker's pinned posts), there is a big lag after you power up the netduino, until the actual code starts running (a few seconds .. thats a lot). So I would be interested in making that go away, while still enabling updating the firmware. Also, it would be nice if someone explained these XML files in more detail, for instance - whats a 'block'?

#3 Illishar

Illishar

    Advanced Member

  • Members
  • PipPipPip
  • 146 posts

Posted 04 March 2011 - 03:20 PM

For building SPI stuff, I'd recommend not messing with custom firmware. (If you can avoid it.) The best compiler you can get is the RVDS compiler. The newer GNU (gcc 4.5) is not bad either though. The issue with netmf is that it's only officially supported by gcc 4.2. Which isn't that impressive. (You'll get too big images.) This issue is enhanced by the fact that neither Microsoft nor Secret Labs are putting much efforts into supporting GNU. The question about image sizes is only really important on very small boards (like the Netduino). The rest of the world has plenty of storage space. (No one has ever complained about the GNU image size on eg. *nix.) A block btw, is often used for defining the minimum write size on a flash. In this case it's 8k. (I think the Atmel blocks are really 256b though. Meh, who cares.) Btw, Secret Labs are planning an upgrade to ease custom firmware. So that we won't have to buy RVDS or recompile the whole netmf.




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.