Netduino Plus 2 Firmware
From Eleccelerator Wiki
notes about modifying the firmware of Netduino Plus 2
Instructions on how to build the default firmware using YAGARTO 20110429, I've gotten this to work. Do not attempt to use any other GCC version, only 4.6.0 works, 4.6.2 will not work. Do not attempt to update the firmware if a new one is available.
Native Code Interop
Try to keep all of the native calls inside separate static classes, without any fields or properties, in order to avoid C++ compiler errors. The stub generation doesn't seem to generate everything you need.
Pin Mapping
See "STM32_GPIO_functions.cpp", it uses
GPIO_TypeDef* port = Port(pin >> 4);
and
#define Port(port) ((GPIO_TypeDef *) (GPIOA_BASE + (port << 10)))