Having mapped out all my IO pins, I decided to attempt support for the SD card first. It’s ostensibly a simpler device than the Ethernet controller, and the hardware assignment is fixed, so I should be able to do all my setup statically during boot.
Along the way, though, I noticed that there is another app configuration ‘usbnsh’. It does a CDC serial emulation over the usb, so I could use this instead of USART2 on PA2/PA3. I need to do something like this eventually anyway, since those pins must be available to user applications, so I give it a whirl. Much to my delight it works as expected, so I switch now to further development work from within the ‘usbnsh’ project.
Also, I grow weary of reconfiguring menuconfig options each time I do a distclean build. At length, I figure out that ‘defconfig’ in the various app directory supplies those options, so the first one that changes is the host build system and the toolchain selection. This works as expected. The file has a warning that it is a generated file, but I think that means generated by the author. Its certainly not generated from with the build system, so I don’t feel bad about accumulating my selections in this file as I go and as they are validated. My hope is that an end user will be able to simply deploy the code base, execute ‘make’, and have a correct and functional firmware, without having to make any configuration choices at all.
I removed ‘syslog’ to liberate USART2, this seemed to work. Oddity: ‘syslog’ is located under ‘File Systems’. There are many such placements that run counter to at least my intuition, so get used to it. There’s a lot of grepping in my future.
I also noticed and altered the JTAG options to be the NOJNTRST variant, because I believe that is what is correct for the netduino. I make the preceding changes the defaults in my defconfig.
OK, getting back to MMC, this is on SPI3, so I mapped all the SPI pins board.h, I mapped CS’s in netduinoplus2_internal.h, I modded up_spi.c to do CS stuff, and up_nsh.c to up_spiinitialize() and also mmcsd_spislotinitialize().
I build, and, why not try to mount?
nsh> mount -t vfat /dev/mmcsd0 /mnt/fs
nsh: mount: mount failed: 19
fail. I have no idea what 19 means, and if there is a better way to test, so I ask the group. They tell me its erno, ‘ENODEV’.
I put this aside for the day.