KDS3.1 + KSDK2.0 + fatfs0.11a  issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

KDS3.1 + KSDK2.0 + fatfs0.11a  issue

3,274 Views
neilporven
Senior Contributor I

Hi everyone,

 

I updated my KDS, KSDK  and fatfs0.11a

 

I wanted to change from fatfs R0.09 to R0.11a.

 

I have updated my paths and my build variable.  Here is what I did:

 

Build variable:

C:\Freescale\SDK_2.0_K64F

 

Cross ARM C Compiler->Includes:

 

"${ProjDirPath}/fatfs_0.11a"

"${ProjDirPath}/fatfs_0.11a/fsl_sd_disk"

 

It seems I am missing something, because I still getting the following error after I compile:

 

136461_136461.jpgfatfs issue.jpg

 

If anyone has done the update and has run into this issue, please advice as to what could be happening?

 

thanks,

Neil Porven

Labels (1)
0 Kudos
Reply
27 Replies

1,922 Views
neilporven
Senior Contributor I

Update,

Interesting enough, I found the following:

How would you handle KSDK in a product as far as version control is concerned?

Which I think is part of the issue that I am experiencing here! 

0 Kudos
Reply

1,922 Views
isaacavila
NXP Employee
NXP Employee

Hello Neil,

In KSDK 2.0, things are quite different than previous versions, in KSDK 1.3 for example, you had a library for your MCU which contains drivers for all the modules it has (uart, adc, spi, etc), then, you only need to compile this library and then add the library to your project and all drivers were already added, however, in KSDK 2.0, there is no library anymore, so, you should add all the drivers your need (in this case, fsl_card.h located at <KSDK_2_0_PATH>\middleware\sdmmc_2.0.0\inc) to your current project.

Besides adding fatfs_0.11a folder, you will need to add sdmmc2.0.0 folder as well (and maybe other drivers that could be requiered for some source files) and then compile your project again.

I hope this can help you!

Best Regards,

Isaac

----------------------------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

----------------------------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,922 Views
neilporven
Senior Contributor I

Hi Isaacavila,

I imported the sdmmc2.0.0 folder and added the PATH for it and I am now showing an error inside the sdmmc2.0.0??

Here is a picture:

Not working.jpg

Here is the path:

"${ProjDirPath}/sdmmc_2.0.0"

Here is the console error:

DescriptionResourcePathLocationType
fatal error: fsl_card.h: No such file or directoryfsl_mmc.c/K64_Boot_04/sdmmc_2.0.0/srcline 32C/C++ Problem
make: *** [sdmmc_2.0.0/src/fsl_mmc.o] Error 1K64_Boot_04C/C++ Problem

It looks like if its having an issue with fsl_card.h, not sure if maybe I need to include another folder?

Have you seen this issue before or from looking at this know what is happening?

thank you,

Neil Porven

0 Kudos
Reply

1,922 Views
isaacavila
NXP Employee
NXP Employee

Hello Neil,

If you look at {KSDK_2_0_PATH}\middleware\fatfs_0.11a\src you will find a 00readme.txt file in which, there is a note at the end:

"Low level disk I/O module is not included in this archive because the FatFs module is only a generic file system layer and not depend on any specific storage device. You have to provide a low level disk I/O module that written to control the target storage device."

This way, fatfs middleware has folders for different storage devices like mmc, ram disk, sd disk, etc. You only need to add the storage device you want to use and also, you will need to add their drivers. For example, if you will be using ram_disk, your structure should be like this:

Fatfs structure for ram disk.jpg

And, you will need to include next paths:

paths for ram disk.jpg

Also, notice that you will need to change the ffconf_template.h file for ffconf.h, due ffconf_template.h is only a template for current fatfs configuration. Inside this ffconf.h file, there is a definition for different storage devices:

/*---------------------------------------------------------------------------/

/ Freescale adaptation configuration

/---------------------------------------------------------------------------*/

#define RAM_DISK_ENABLE

/* Available options are:

/      RAM_DISK_ENABLE

/      USB_DISK_ENABLE

/      SD_DISK_ENABLE

/      MMC_DISK_ENABLE */

On the other hand, if you would like to use SD disk, you will need to include fsl_sd_disk files as well as other sd card drivers and header files. Next image shows the minimal files needed to compile SD Disk configuration.

Fatfs structure for sd card.jpg

And finally, you will need to add these paths:

paths for sd disk.jpg

Basically, fatfs has different configurations according to desired storage device and you will need to include different files according to this configuration.

I hope this can help you!

Best Regards,

Isaac Avila

----------------------------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

----------------------------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,922 Views
neilporven
Senior Contributor I

Hi isaacavila,

I tried what you suggested, but I am still getting errors:

FatFs.jpg

here are the paths:

"${ProjDirPath}/fatfs_0.11a"

"${ProjDirPath}/fatfs_0.11a/fsl_sd_disk"

"${ProjDirPath}/fatfs_0.11a/option"

"${ProjDirPath}/sd_card"

As you can see, there's something either I am not understanding or including, but if everything had stayed

as before, I would have expected some changes on 0.11a, but there are more changes here than expected?

0 Kudos
Reply

1,922 Views
isaacavila
NXP Employee
NXP Employee

Hello Neil,

You need to include the sdhc_config.h file (just as it is shown on my previous post) and this file is located at: <KSDK_2_0_PATH>\boards\frdmk64f\driver_examples\sdcard_fatfs.

I have already tested and it should compile correctly after these files are included.

Fatfs structure for sd card.jpg

And indeed, it seems that this middleware has changed its structure and you will need to add some specific files that were not needed on previous releases. I will recommend you to use this stack for this KSDK 2.0 version instead of KSDK 1.3, otherwise, you will have to adapt this middleware to previous structure (because for KSDK 2.0, drivers have changed).

I hope this can help you!

Best regards,

Isaac

0 Kudos
Reply

1,922 Views
neilporven
Senior Contributor I

Hi isaacavila,

Where can I find the SDHC drivers (fsl_sdhc.c/fsl_sdhc.h)?  Also, I noticed that it is stored in a file called drivers, but

on the path you suggested, it doesn't seem to address it?  Where should I place them and where do I need to call them

from?

Thanks,

Neil

0 Kudos
Reply

1,922 Views
neilporven
Senior Contributor I

Update,

I found SDHC drivers, they are located <KSDK_2_0_PATH>\devices\MK64F12\drivers. I created a folder as shown above,

but the path needs to be created or a way that lets the IDE know it exist and how to use them?

Thank,

Neil

0 Kudos
Reply

1,922 Views
neilporven
Senior Contributor I

Update,

I added the following paths:

"${PROJECT_KSDK_PATH}/platform/drivers"

"${ProjDirPath}/drivers"

the paths seemed to have taken care of a huge amount of errors I was getting after compiling, but now

I am left with this error, that is coming from fsl_sdhc.h

DescriptionResourcePathLocationType
fatal error: fsl_common.h: No such file or directoryfsl_sdhc.h/K64_Boot_04/driversline 33C/C++ Problem

Where is this file in the KSDK 2.0 and where should it go in my project file?

Thanks,

Neil

0 Kudos
Reply

1,922 Views
isaacavila
NXP Employee
NXP Employee

Hello Neil,

This file is located in same driver folder (<KSDK_2_0_PATH_K64>\devices\MK64F12\drivers), please check the images where I showed all the files that are needed (and compare with yours) in order to avoid compilation errors.

Best Regards,

Isaac

0 Kudos
Reply

1,922 Views
neilporven
Senior Contributor I

Hi isaacavila,

Update,

I found the driver fsl_common.h and .c and imported them in to my drivers folder just like on the images above.

I am getting the following error now:

DescriptionResourcePathLocationType
fatal error: fsl_device_registers.h: No such file or directoryfsl_common.h/K64_Boot_04/driversline 38C/C++ Problem

If I look at the above images, I don't find fsl_device_registers.h anywhere, but fsl_common.h is referring to it?

Thanks,

Neil

0 Kudos
Reply

1,922 Views
isaacavila
NXP Employee
NXP Employee

Hello Neil,

This file is located at: <KSDK_2_0_PATH>\devices\MK64F12\ and it should be already included by adding this path.

I do not know how you are setting your project but this files should be added in order to use KSDK drivers. Do you want to attach your project and I can check what paths are missing? In my previous images i took the hello_world_frdmk64f example from <KSDK_2_0_PATH>\boards\frdmk64f\demo_apps

and add fatfs supported and had no issues on it.

Best Regards,

Isaac

0 Kudos
Reply

1,922 Views
neilporven
Senior Contributor I

Thank you isaacavila,

I followed the path and was able to fix those errors.  Unfortunately, every time I fix something

more errors come out. Here are the new ones.

Issue.jpg

Here are the paths:

Issue.jpg

It looks like I am close. Can you see if you can spot something?

Thanks,

Neil

0 Kudos
Reply

1,920 Views
neilporven
Senior Contributor I

Quick update,

I found the issues with line 225 & 226, I had commented those defines, prior, trying to isolate other issues!

I simply wend ahead and remove the comments and those issues are gone. Now I still have the following:

DescriptionResourcePathLocationType
'BOARD_SDHC_BASEADDR' undeclared (first use in this function)fsl_sd_disk.c/K64_Boot_04/fatfs_0.11a/fsl_sd_diskline 229C/C++ Problem
'BOARD_SDHC_CLKSRC' undeclared (first use in this function)fsl_sd_disk.c/K64_Boot_04/fatfs_0.11a/fsl_sd_diskline 245C/C++ Problem

I thought I might have done the same thing, but that is not the case or at least I did a global search and I can't find them?

Thanks,

Neil

0 Kudos
Reply

1,922 Views
isaacavila
NXP Employee
NXP Employee

Hello Neil,

SDHC definitions that are missing should be declared in sdhc_config.h file (I can see that you are already including it and also you will need the fsl_sdhc.h file from SDK 2.0). Other definitions (BOARD_SDHC_BASEADDR and BOARD_SDHC_CLKSRC) are defined in board.h file from any SDK 2.0 example, so make sure these files are included and these macros are also defined there.

For this new SDK 2.0 some drivers have changed and structure is not the same as 1.3, that is why you are facing some problem on migrating fatfs 0.11a to SDK 1.3. Try to add these definition in and see if error are still presented, if so, you will need to migrate fatfs 0.11a version to KSDK 1.3 version manually.

Regards,

Isaac

0 Kudos
Reply

1,922 Views
neilporven
Senior Contributor I

Hi isaacavila,

I included the definitions, which I found on a demo.  It did take care of that issue, but now I am getting another error:

DescriptionResourcePathLocationType
fatal error: fsl_debug_console.h: No such file or directoryfsl_common.c/K64_Boot_04/driversline 32C/C++ Problem

I think that someone needs to write a document on this, and explain a step by step procedure on how this is done, otherwise,

they are going to experience the same issues I am having, fix one issue, jump to the next issue, etc....etc.....etc...

A good driver should include everything needed, so that you can import it and test at least the most basic functions. I understand

that other people might have other needs, but if they at least have the bare minimum, they can then ask for their specifics.  KSDK

1.3.0 was just that, import it, add a couple of paths and away you go with the bare minimum. KSDK 2.0 is a step backwards, I am

really frustrated at this point.

.........

0 Kudos
Reply

1,922 Views
isaacavila
NXP Employee
NXP Employee

Hello Neil,

If I am correct, you will only need to add this "fsl_debug_console.h" file in your current driver folder and everything should work now.

The current logic for SDK 2.0 is to add every driver that you need and only the one you need, this way, memory footprint for project will be reduced and simpler. Also, every change that is applied in this driver, is compiled along with the application project, otherwise you should compile the library and then compile the application project after library has been compiled.

Anyway, I understand your point and we will try to create a new document about this topic!

Sorry for this inconvenience.

Best Regards,

Isaac

0 Kudos
Reply

1,921 Views
neilporven
Senior Contributor I

Hi issacavila,

Unfortunately, more issues have come up:

Issue.jpg

Please let me know where this fsl_sdhc_driver.h is and where should it go?

Thanks.

0 Kudos
Reply

1,920 Views
neilporven
Senior Contributor I

Quick update,

I had to do a global search and the only information I found on fsl_sdhc_driver.h was another post I had created for the KSDK 1.2.0 where I am

asking the same thing!  I followed the post information and was able to resolve the issues, unfortunately, KSDK 2.0 doesn't have the library/file

required.  If anyone wants to address the issue they would have to go back to KSDK 1.2.0 and retrieve that to satisfy the issue?????? This is CRAZY!!!'

Now I am experiencing another issue:

Issue.jpg

I thought I took care of this issue, earlier!  ????

0 Kudos
Reply

1,920 Views
isaacavila
NXP Employee
NXP Employee

Hello Neil,

You are getting errors because you are trying to combine two different driver's versions: KSDK 1.3 (or KSDK 1.2) and SDK 2.0. As i already told you, SDK 2.0 is quite different than previous versions, so the way you are trying to combine both versions will result in getting compilation errors  (some driver APIs has changed).

If you look at fatfs files (integer.h, ffconf.h, ff.h, ff.c, diskio.h, diskio.c, syscall.c and unicode.c) the unique file that "depends" on driver's structure is diskio.c, in this function, disk initialization, disk status, disk read, disk write and more functions are re-directed to proper driver driver.

Depeding on the definition in ffconf.h

/*---------------------------------------------------------------------------/

/ Freescale adaptation configuration

/---------------------------------------------------------------------------*/

#define SD_DISK_ENABLE

/* Available options are:

/      RAM_DISK_ENABLE

/      USB_DISK_ENABLE

/      SD_DISK_ENABLE

/      MMC_DISK_ENABLE */

Your diskio.c file will use the proper function for SD disk, ram disk, usb disk, etc:

DSTATUS disk_initialize(BYTE pdrv /* Physical drive nmuber to identify the drive */

                        )

{

    DSTATUS stat;

    switch (pdrv)

    {

#ifdef RAM_DISK_ENABLE

        case RAMDISK:

            stat = ram_disk_initialize(pdrv);

            return stat;

#endif

#ifdef USB_DISK_ENABLE

        case USBDISK:

            stat = USB_HostMsdInitializeDisk(pdrv);

            return stat;

#endif

#ifdef SD_DISK_ENABLE

        case SDDISK:

            stat = sd_disk_initialize(pdrv);

            return stat;

#endif

#ifdef MMC_DISK_ENABLE

        case MMCDISK:

            stat = mmc_disk_initialize(pdrv);

            return stat;

#endif

#ifdef SDSPI_DISK_ENABLE

        case SDSPIDISK:

            stat = sdspi_disk_initialize(pdrv);

            return stat;

#endif

        default:

            break;

    }

    return STA_NOINIT;

}

However, if you look at diskio.c file from fatfs 0.09, these functions were different:

DSTATUS disk_initialize (

    /* [IN] Physical drive number (0) */

    uint8_t pdrv

)

{

    DSTATUS stat = STA_NOINIT;

    switch (pdrv)

    {

#if USB_DISK_ENABLE

    case USB:

        return msd_disk_initialize(pdrv);

#endif

#if SD_DISK_ENABLE

    case SD:

        return sdcard_disk_initialize(pdrv);

#endif

//    default:

//        return STA_NOINIT;

    }

    return stat;

}

So, you will only need to replace the integer.h, ffconf.h, ff.h, ff.c, diskio.h, diskio.c, syscall.c and unicode.c from 0.09 verstion, for the ones in 0.11, and then: do the migration MANUALLY for diskio.c, in order to be compatile with your old driver structure, in other words, replace (for USB case)

case USBDISK:

            stat = USB_HostMsdInitializeDisk(pdrv);

            return stat;

for

case USB:

    stat = msd_disk_initialize(pdrv);

    return stat;

this way, you will AVOID to included paths from different versions (SDK 1.3 and SDK 2.0) and drivers

Does ti make sense to you?

Best Regards,

Isaac

0 Kudos
Reply