Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Creating new Project for STM32F407 Discovery board and HAL driver with FatFs

Hi

I created a new project and selected to use the HAL drivers and also the third party FatFs (which shows twice on the list).

After trying to Build, I got the following message:

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:78:6: warning: implicit declaration of function ‘BSP_SD_Init’ -Wimplicit-function-declaration
if(BSP_SD_Init() == MSD_OK)

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:78:23: error: ‘MSD_OK’ undeclared (first use in this function)
if(BSP_SD_Init() == MSD_OK)

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:78:23: note: each undeclared identifier is reported only once for each function it appears in
../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c: In function ‘SD_status’:
../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:95:6: warning: implicit declaration of function ‘BSP_SD_GetStatus’ -Wimplicit-function-declaration
if(BSP_SD_GetStatus() == MSD_OK)

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:95:28: error: ‘MSD_OK’ undeclared (first use in this function)
if(BSP_SD_GetStatus() == MSD_OK)

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c: In function ‘SD_read’:
../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:115:6: warning: implicit declaration of function ‘BSP_SD_ReadBlocks’ -Wimplicit-function-declaration
if(BSP_SD_ReadBlocks((uint32_t*)buff,

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:118:34: error: ‘MSD_OK’ undeclared (first use in this function)
count) != MSD_OK)

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c: In function ‘SD_write’:
../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:139:6: warning: implicit declaration of function ‘BSP_SD_WriteBlocks’ -Wimplicit-function-declaration
if(BSP_SD_WriteBlocks((uint32_t*)buff,

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:141:47: error: ‘MSD_OK’ undeclared (first use in this function)
BLOCK_SIZE, count) != MSD_OK)

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c: In function ‘SD_ioctl’:
../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:161:3: error: unknown type name ‘SD_CardInfo’
SD_CardInfo CardInfo;

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:174:5: warning: implicit declaration of function ‘BSP_SD_GetCardInfo’ -Wimplicit-function-declaration
BSP_SD_GetCardInfo(&CardInfo);

../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c:175:29: error: request for member ‘CardCapacity’ in something not a structure or union
*(DWORD*)buff = CardInfo.CardCapacity / BLOCK_SIZE;
^
make: *** Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.o Error 1


Any idea which src/inc files I am missing?

i have a dicovrey f4 fattfs + usb msc + micro-sd ( +free rtos) running
i started from an old cubemx generated project (more than a year ago)
I remenber i had look at the cubef4 exemples to undertand a few things
and make it works in dma mode
but it was builing and almost working straigth away.


look like your are missing the BSP side that is “your wrapper arround sd and fatfts”
on my project source are in \Src\bsp_driver_sd.c
proto in “bsp_driver_sd.h”
this header is inlcude on “ffconf.h” that is referecne from fatfts middleware

few stuff in the header related to errors you’r getting

/* USER CODE BEGIN 0 */
/* Includes ----------------------*/

  1. include “stm32f4xx_hal.h”


/* Exported constants --------------------*/

/**
* @brief SD status structure definition
*/

  1. define MSD_OK 0x00
  2. define MSD_ERROR 0x01

  1. ifndef SD_CardInfo

#define SD_CardInfo HAL_SD_CardInfoTypedef

  1. endif


/** @defgroup STM324x9I_EVAL_SD_Exported_Constants
* @{
*/

  1. define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF)

  1. define SD_PRESENT ((uint8_t)0x01)
  2. define SD_NOT_PRESENT ((uint8_t)0x00)

 

Newest Forum Posts

  1. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  2. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  10. Build a project in "release" mode by tang, 2025-02-20 10:36

Last-Modified Blogs