I’m trying to use SDBlockDevice.h to create a class for my SD card, however including that header incurs errors regarding undeclared arduino pin aliases that are in fact declared. I’ve got SD in my target overrides section in mbed_app.json and including this header file works fine on my F429ZI.
these errors really occur and it is right behavior because system/ current setting do not count there exist something else than Arduino Uno header standart, let’s look on that.
There is declaration of SDBlockDevice constructor, it defines default parameters (macros) MBED_CONF_SD_SPI_XX for the constructor. These macros are generated by build system before compilation and macros are fiilled to mbed_config.h (you can found it in build folder) file which is full of settings like this one.
But what are values of these macros? The file mbed_lib.json says these macros are equal to ARDUINO_UNO_SPI_XX. That if defined here and says ARDUINO_UNO_SPI_XX are equal to ARDUINO_UNO_DX which are pin alisase for pin masks according to Arduino UNO header standart. Definition of these are defined in PinNames.h of specific target, but only when the target is fit with that standard. It is marked like Arduino UNO Form Factor.
So because L432KC is not Arduino Uno FF and because of that it does not have Arduino Uno pin aliases, macros are empty = not defined.
That is the reason why the Nucleo-F429ZI (Arduino UNO header standard) is OK and Nucleo-L432KC (Arduino Nano header standard) not.
The configuration system - Program setup | Mbed OS 6 Documentation
Standard Pin Names - Porting | Mbed OS 6 Documentation
That was description of why, and now how to deal with that.
mbed_app.json just add pin seting for for SD card, that will override default settings descripted above
Then you can call also the constructor without pins because they are already defined via mbed_app.json above.
Thanks for the response.
I tried amending mbed_app.json as you showed and while this compiled successfully, I now have 38 linker errors pointing to files not located within my active program, but the mbed studio installation folders. Not sure if this is related.
Ok, that will be because of this settings.
Change it one more time and add one more line fot that, like below