I tried to investigate how can I use Interop in order to integrate low level code with microframework.
I don't understand this :
1) I use wrapper class to microframework. But how can microframework know what kind of microprocessor is working? How can it compile this C or C++ code?
Thanks
Actually, register access is rather simple - if I omit code that checks address to prevent access to invalid/reserved areas:
// C# Wrapper using System; using Microsoft.SPOT; using System.Runtime.CompilerServices; namespace XXX.NETMF.Hardware { public static class Register { [MethodImpl(MethodImplOptions.InternalCall)] public static extern uint Read(uint address); [MethodImpl(MethodImplOptions.InternalCall)] public static extern void Write(uint address, uint value); } } // Native Code (.cpp) #include "XXX_NETMF_Hardware.h" #include "XXX_NETMF_Hardware_XXX_NETMF_Hardware_Register.h" using namespace XXX::NETMF::Hardware; UINT32 Register::Read(UINT32 address, HRESULT &hr) { // FIXME: Check address UINT32 retVal = *(UINT32*)address; return retVal; } void Register::Write(UINT32 address, UINT32 value, HRESULT &hr) { // FIXME: Check address *(UINT32 *)address = value; }