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

Porting Arduino code to Netduino


  • Please log in to reply
2 replies to this topic

#1 skyjumper

skyjumper

    Member

  • Members
  • PipPip
  • 15 posts

Posted 30 April 2012 - 09:57 AM

Hi All... I just ran across this project and its very, very cool! I have an "Arduino" project running on a custom board with a 1284p processor. I'm about at the limit of what I can make it do and am looking to move it to a 32 bit platform. I noticed that Netduino uses a 32 bit Atmel processor. I googled on this, but no luck... Is there any reason the AVR-GCC toolchain could not be used to target this processor, thereby enabling Arduino code to compile and run on this processor? People here have said that the "Arduino language" is a simple C or something to that effect, but in fact its a full implementation of C++. And while C++ can be ported to C#, given the libraries I used (I2C, A serial communications library, an SD FAT card library) it seems like that would be quite a bit of work... Of course there would need to be changes related to 8 bit vs 32 bit and such, but if AVG-GCC could target this processor, wouldn't that be easier?

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 30 April 2012 - 11:40 AM

The GCC is still unsupported by the Porting Kit, as far as I know. There are people being able to re-compile the Netduino firmware, though.
The only thing I can tell you about GCC, is that it's not enough optimized to make the Netduino Plus firmware fitting in the available flash.

Anyway, if are looking an Arduino-like board (I mean programmed in C++), and also 32 bit boosted, have a look at this product:
http://www.olimex.com/dev/index.html

Sorry, I can't say more.
Cheers
Biggest fault of Netduino? It runs by electricity.

#3 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 30 April 2012 - 12:34 PM

Is there any reason the AVR-GCC toolchain could not be used to target this processor, thereby enabling Arduino code to compile and run on this processor?

Unfortunately, AVR-GCC cannot be used to target Netduino microcontroller, because it produces code for AVRs and they have completely different architecture than Netduino's AT91SAM7X (ARM7TDMI). You need GCC for ARM (or any other ARM compiler) to produce code for Netduino microcontroller.

People here have said that the "Arduino language" is a simple C or something to that effect, but in fact its a full implementation of C++. And while C++ can be ported to C#, given the libraries I used (I2C, A serial communications library, an SD FAT card library) it seems like that would be quite a bit of work...

Apart from the completely different hardware, there is one more major difference between Arduino and Netduino: .NET Micro Framework. When you compile C/C++ code and flash it to Arduino, it runs directly on 'bare-metal'. On Netduino (or any .NET MF board in general), the code is written in C# or VB.NET ("managed") and when deployed to the device, there is already so called 'runtime' which interprets and executes managed program (simplified).

So, you can

1) Port your application and libraries to C#. There are already built-in classes in .NET Micro Framework which provide support for hardware peripherals (SPI, I2C, serial etc.) and many libraries and drivers for various sensors or other devices have been already created by .NET MF community members. However, due to certain .NET MF limitations, there is a few things that are not that easy to accomplish, especially when precise timing or fast response to interrupts is required.

2) Erase .NET MF from Netduino and use ARM compiler for 'native' development, which turns Netduino into very nice ARM development board, although without direct debugging support (no JTAG broken out). Then you can program it in C/C++, but you'd need to port Arduino libraries due to different hardware modules and interfaces; or wait until Arduino Due is released - it too has 32-bit Atmel ARM microcontroller, similar to Netduino, so perhaps porting its libraries would require less work.




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.