简体   繁体   中英

stm32 fatfs library from system workbench for stm32

I have a problem with STM32. I use System Workbench For STM32 and I inclue to my project Hal and FatFs (when I create a project I choose it). But after create a project have error:

Description Resource Path Location Type 'PPP_OK' undeclared (first use in this function) ppp_diskio_template.c /Hal_sd/Middlewares/Third_Party/FatFs/src/drivers line 98 C/C++ Problem

How can I build it? I want make an example project with FatFs but I can't build empty main.c .

I see you mention ppp_diskio_template.c .

FatFs is just a way to organize data on a storage, and access them via a "file abstraction". FatFs shows you "files", but at then end it's just bytes stored in a storage.

The diskio template is a file with some functions that you need to define so that the FatFs can read/write to the storage. Basically, it's the functions that FatFS will use to store the data "as bytes" when you provide a file.

The fact that PPP_OK is not defined means that perhaps ppp_diskio_template.h or ppp_diskio.h is unavailable, not at the right place or not included in the files of your project.

You can basically search it in all the .h you have to see which one you need to include.

1st Solution: If you are using STM32CubeMX or STM32CubeIDE, you should enable FatFS under Pinout & Configuration > Categories > Middlewares > FATFS . CubeMX handles the rest, you should be fine. Make sure you are using the latest version.

2nd Solution: If you are manually adding FatFS files, make sure to add all .h files into you include path, which is located in Properties > C/C++ General > Paths and Symbols > Includes if your IDE is Eclipse or STM32CubeIDE.

3rd Solution: Another possibility is that if you are trying to manually fork an example, this happens most of the times. Search the folder in Windows Explorer using the search box in upper right corner of the corresponding folder window for the variable that is not found which is in your case PPP_OK . Then find the variable where it's declared. This is generally a .c file, if so, make sure to add it to your project, also find the same named .h file and add its location to you include path as described in 2nd solution.

我不认为头文件已添加到您的项目中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM