grblHAL / Plugin_SD_card

grblHAL SD-card plugin
Other
1 stars 3 forks source link

Compile Error: diskio.c - conflicting types or 'disk_read' #1

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi terjeio,

I have attempted to complie for STM32F401 with SD Card. I have downloaed the FatFs code and made the changes in your instructions however the above error is reported which seems to be at line 407.

I am using the latest version of the STM32Cube IDE.

Regards George

terjeio commented 2 years ago

Have you deleted diskio.c from the FatFs folder?

ghost commented 2 years ago

Yes.

terjeio commented 2 years ago

Ok, did you download R0.13c or a later version? Check 00history.txt.

This is what my FatFs folder looks like:

image

ghost commented 2 years ago

I downloaed ff14b.

My folder is the same.

ghost commented 2 years ago

Description Resource Path Location Type conflicting types for 'disk_read' diskio.c /GRBL Driver STM32F401/Src line 407 C/C++ Problem make: [Src/subdir.mk:70: Src/diskio.o] Error 1 GRBL Driver STM32F401 C/C++ Problem make: Waiting for unfinished jobs.... GRBL Driver STM32F401 C/C++ Problem

These are the other errors being reported but I assumed they are from the original error.

terjeio commented 2 years ago

I guess the 14b has a different signature for the disk_read() function then.

From the readme:

NOTE: The discio.c implementation provided as part of this driver has been tested with FatFs R0.13c.

ghost commented 2 years ago

OK. I will try 0.13c.

ghost commented 2 years ago

OK. So same issue with 0.13c. I had uncommented #define SDCARD_ENABLE in my_machine.h but when I reverted back it compiled correctly.

Can I assume that this will need to be uncommented for SD Card functionality?

ghost commented 2 years ago

14b works OK when the above #define is commented.

terjeio commented 2 years ago

Can I assume that this will need to be uncommented for SD Card functionality?

Yes - when commented out the diskio.c code will not be compiled in and neither will SD card support.

This is the definition in diskio.h for 13c:

DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, BYTE count);

And the implementation in diskio.c:

DRESULT disk_read (
    BYTE drv,            /* Physical drive nmuber (0) */
    BYTE *buff,            /* Pointer to the data buffer to store read data */
    DWORD sector,        /* Start sector number (LBA) */
    BYTE count            /* Sector count (1..255) */
)

As you can see these matches.

The compiler error you get is about the definition and implementation not matching. Does the compiler find another diskio.h that does not match the implementation? Try with \<Ctrl> right click on #include "diskio.h" in line 23 in diskio.c to open the one that the indexer (and hopefully the compiler) is using and check that the signatures matches.

ghost commented 2 years ago

I just noticed that when SDCARD_ENABLE is uncommented, all but line 14 (#include "driver.h") is greyed out.

image

ghost commented 2 years ago

image

terjeio commented 2 years ago

I just noticed that when SDCARD_ENABLE is uncommented, all but line 14 (#include "driver.h") is greyed out.

Sometimes the indexer has to be manually rerun to show the correct greyed out status, right click on the project name in Project Explorer and select Index > Rebuild to do that.

The signature in the last comment is from driver.c? driver.c contains my implementation for 13c that has to match the one in driver.h.

ghost commented 2 years ago

I gave that a go but even the SD card pin mappings (under the generic_map.h file) are also greyed out.

ghost commented 2 years ago

Could this potentially have something to do with this?

Description Resource Path Location Type implicit declaration of function 'disk_timerproc' [-Wimplicit-function-declaration] driver.c /GRBL Driver STM32F401/Src line 2510 C/C++ Problem

terjeio commented 2 years ago

I gave that a go but even the SD card pin mappings (under the generic_map.h file) are also greyed out.

Are you sure the generic map is selected in _mymachine.h by uncommenting all board maps?

Hmm, maybe the FatFs folder is not listed for the build you are using? I went through all recently and fixed those who were missing build folders. Check that FatFs in this list found via project properties:

image

ghost commented 2 years ago

Yep. All boards are commented out.

I will check out suggestion tomorrow morning.

Cheers George

On Sat, 8 Jan 2022 at 21:29, Terje Io @.***> wrote:

I gave that a go but even the SD card pin mappings (under the generic_map.h file) are also greyed out.

Are you sure the generic map is selected in my_machine.h by uncommenting all board maps?

Hmm, maybe the FatFs folder is not listed for the build you are using? I went through all recently and fixed those who were missing build folders. Check that FatFs in this list found via project properties:

[image: image] https://user-images.githubusercontent.com/20260062/148640727-729adc8c-c496-4ced-aead-2ea72e8fd2e1.png

— Reply to this email directly, view it on GitHub https://github.com/grblHAL/Plugin_SD_card/issues/1#issuecomment-1007949872, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANYETO3G4LS33W3YZDEARX3UVAGYJANCNFSM5LQGSPIQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

ghost commented 2 years ago

Just had a quick chance to look. I think it is OK.

image

Also, image of my_machine.h

image

ghost commented 2 years ago

Would this make any difference?

image

image

terjeio commented 2 years ago

Would this make any difference?

No, it is the signature mismatch that bothers me. Replace your FatFs folder with this:

FatFs.zip

Still the same issue?

ghost commented 2 years ago

Just tried to compile. Attached is an image of the errors. image

terjeio commented 2 years ago

Well, something most be corrupted in the project on your end. Maybe a fresh import will help make it behave as it should?

This is how it looks for me end after Index > Rebuild, and I can compile without errors:

image

However, if it works as expected now then you are good to go?

ghost commented 2 years ago

I have downloaded all the zip files again and extracted and followed the instructions but I still get the SD card issue but I am sure it is an issue with how the IDE is either setup or the option I am using for the build. Are there any specific settings I need to adjust within the IDE? Any advice would be greatly appreciated.

image

terjeio commented 2 years ago

It is late here, I'll do a clean install on another machine tomorrow to see if there is something wrong with the published version.

ghost commented 2 years ago

Cheers and thanks for your help.

terjeio commented 2 years ago

I got the same issue, it is the FatFs folder that is incorrectly named FatFS in github. Try to rename it locally.

ghost commented 2 years ago

OK. That has fixed the 'conflicting types for disk_read' but now it is showing it cannot find ff.h

image

terjeio commented 2 years ago

Try compiling the Debug F411 Blackpill version, same issue?

If same issue it could be due to the project living outside your workspace. When importing this checkbox should be ticked:

image

ghost commented 2 years ago

OK. Have imported and attempted to compile.

With the 401 I get the same error and with the 411 I get the 'conflicting types for disk_read' error

terjeio commented 2 years ago

I have commited an update which contains the FatFS code, has SD card support removed from the generic map and some changes to the .cproject file. A fresh download and import compiles for me without errors with the CNC Boosterpack board and SD card enabled. Hopefully it will for you too...

Copy the _genericmap.h to _my_machinemap.h, add usable SD card definitions and enable that in _mymachine.h, this way your changes will not be overwritten on an update.

BTW are you compiling on Linux?

ghost commented 2 years ago

Cool.

I will download the latest version and test after I finish work today.

I am running Windows 10.

Cheers and thanks for all your support. G

On Mon, 10 Jan 2022 at 08:30, Terje Io @.***> wrote:

I have commited an update which contains the FatFS code, has SD card support removed from the generic map and some changes to the .cproject file. A fresh download and import compiles for me without errors with the CNC Boosterpack board and SD card enabled. Hopefully it will for you too...

Copy the generic_map.h to my_machine_map.h, add usable SD card definitions and enable that in my_machine.h, this way your changes will not be overwritten on an update.

BTW are you compiling on Linux?

— Reply to this email directly, view it on GitHub https://github.com/grblHAL/Plugin_SD_card/issues/1#issuecomment-1008427609, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANYETO6ZAXNCKW2XYSDCLQDUVH47DANCNFSM5LQGSPIQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

ghost commented 2 years ago

Thanks terjeio,

Perfect, compiles without error. Will look to build a PoC board (64 Pin version) and test further.

Cheers George