Dela via


New article on using Interop posted

I've just posted an article on using interop in .NET Micro Framework V3.0.

Abstract

The .NET Micro framework provides a rich level of support for embedded systems development from handling interrupts on GPIO pins to talking to hardware on an SPI or I2C bus. Unfortunately, sometimes, that’s not quite enough. For example, an A/D converter built into the chip that is memory mapped to the processor core is unreachable by managed code in V2.5 and earlier. For this, and many other reasons, the .NET Micro Framework V3.0 Porting Kit supports extending the .NET run time libraries with custom interop code to call into native (C/C++) code.

This article will cover the process of creating and using custom interop libraries through an example. The sample library provides managed applications access to OEM defined named memory windows in the system for direct access to memory mapped devices in a safe, bounds-checked manner.

Comments

  • Anonymous
    June 18, 2009
    Hi, I am working on a migration of a quite large C/C++ project (500+ files) to MF since April. Aim is to get an existing C/C++ library to run on a MF 3.0 device. The linked article shows how to use interop with generated method stubs and skeletons and the interaction with eventually added code. As I'd like to avoid editing all of my project files to match the demonstrated structure it would be nice to have a howto for utilizing existing static libs without (essentially) changing their source code. I've reached a point where I am running out of ideas and just can't find anything more specific about this topic on the net. I wouldn't call myself an expert in c# and c++, although I got a few years of experience, but everything I can think of to get it to work is more than hacky, doesn't take concern of marshalling, and would probably run into some deeper problems later on. If there is an elegant way to use static c/c++ libs from managed code within the MF, please let me know, or even better extend the linked howto article. I read you wanted to provide a howto for this problem anyway. Thanks, Rob

  • Anonymous
    November 15, 2010
    Hi Rob. I have a question for you: When I put C or C++ code into managed code, how can CLR know what kind of microprocessor works? I mean: you write in C but there is a compiler customized for some microprocessor family, that know that when you write for example writeReg_A Pippo, it has to write at Pippo's address for example 0x0022; so How can CLR know these informations? where do you declare them?