nxp-mcuxpresso / mcux-sdk

MCUXpresso SDK
BSD 3-Clause "New" or "Revised" License
301 stars 136 forks source link

CMake SDMMC middleware is not usable as a standalone library #153

Open ohunter opened 7 months ago

ohunter commented 7 months ago

Is your enhancement proposal related to a problem? Please describe. I am trying to use the SDK as a standalone library and I need the functionality that the sdmmc middleware provides. The cmake setup for both middleware_sdmmc_host_usdhc_interrupt and middleware_sdmmc_host_usdhc_polling requires middleware_sdmmc_usdhc_template to be enabled which makes very little sense due to the following:

Describe the solution you'd like Remove the requirements for CONFIG_USE_middleware_sdmmc_usdhc_template in both middleware_sdmmc_host_usdhc_interrupt and middleware_sdmmc_host_usdhc_polling

Describe alternatives you've considered Unless a complete overhaul of the CMake setup is done I don't really think there are any alternatives

Additional context I am using the MIMXRT685S SDK for standalone arm gcc.

mcuxsusan commented 7 months ago

Thank you for reporting the issue, will check with development team. The feedback could be delayed, thanks advance for your patience.

ohunter commented 7 months ago

Another thing to mention is that the requirement for separated CONFIG_USE_middleware_sdmmc_osa_bm and CONFIG_USE_middleware_sdmmc_osa_freertos also doesn't really make sense. I think that it'd be a good idea to replace the different middleware_sdmmc_osa_*.cmake files with a single middleware_sdmmc_osa.cmake file that contains the following:

# Add set(CONFIG_USE_middleware_sdmmc_osa true) in config.cmake to use this component

include_guard(GLOBAL)
message("${CMAKE_CURRENT_LIST_FILE} component is included.")

set(VALID_DEVICE "$<IN_LIST:${CONFIG_DEVICE_ID},LPC54005;LPC54016;LPC54018;LPC54018J2M;LPC54018J4M;LPC54605J512;LPC54605J256;LPC54606J512;LPC54606J256;LPC54607J256;LPC54607J512;LPC54608J512;LPC54616J512;LPC54616J256;LPC54618J512;LPC54628J512;LPC54S005;LPC54S016;LPC54S018;LPC54S018J2M;LPC54S018J4M;LPC5526;LPC5528;LPC55S26;LPC55S28;LPC55S66;LPC55S69;K32L3A60xxx;MIMX8MD6xxxJZ;MIMX8MD6xxxHZ;MIMX8MD7xxxJZ;MIMX8MD7xxxHZ;MIMX8MQ5xxxJZ;MIMX8MQ5xxxHZ;MIMX8MQ6xxxJZ;MIMX8MQ6xxxHZ;MIMX8MQ7xxxJZ;MIMX8MQ7xxxHZ;MIMXRT1021xxxxx;MIMXRT1024xxxxx;MIMXRT1041xxxxB;MIMXRT1042xxxxB;MIMXRT1051xxxxB;MIMXRT1052xxxxB;MIMXRT1061xxxxA;MIMXRT1061xxxxB;MIMXRT1062xxxxA;MIMXRT1062xxxxB;MIMXRT1064xxxxA;MIMXRT1165xxxxx;MIMXRT1166xxxxx;MIMXRT1171xxxxx;MIMXRT1172xxxxx;MIMXRT1173xxxxx;MIMXRT1175xxxxx;MIMXRT1176xxxxx;MIMXRT533S;MIMXRT555S;MIMXRT595S;MIMXRT633S;MIMXRT685S>")

if(VALID_DEVICE AND (CONFIG_USE_component_osa OR CONFIG_USE_component_osa_bm OR CONFIG_USE_component_osa_interface OR CONFIG_USE_component_osa_free_rtos))

target_sources(${MCUX_SDK_PROJECT_NAME} PRIVATE
  ${CMAKE_CURRENT_LIST_DIR}/osa/fsl_sdmmc_osa.c
)

target_include_directories(${MCUX_SDK_PROJECT_NAME} PUBLIC
  ${CMAKE_CURRENT_LIST_DIR}/osa
)

else()

message(SEND_ERROR "middleware_sdmmc_osa dependency does not meet, please check ${CMAKE_CURRENT_LIST_FILE}.")

endif()

It allows the developers to more easily define whatever OSA they want (ofc it doesnt make sense to mix baremetal and freertos but a custom should always be possible)