ErichStyger / McuOnEclipse_PEx

McuOnEclipse Processor Expert Source Files and Components
Other
66 stars 30 forks source link

SD_Card - SD1.c compile error #6

Closed neilh10 closed 9 years ago

neilh10 commented 9 years ago

I'm following WBNR_FTF11_ENT_F0345.pdf & tutorial http://mcuoneclipse.com/2012/07/30/fatfs-with-kinetis/ and Starting with a new PE project and PE SD_Card and selecting SM1:SPIMaster_LD it has a compile error with ../Generated_Code/SD1.c: In function 'SD1_SPI_WRITE': ../Generated_Code/SD1.c:413:26: error: 'SM1_DeviceData' undeclared (first use in this function) (void)SM1_ReceiveBlock(SM1_DeviceData, &dummy, sizeof(dummy));

I'm still a newbie working my way round the PE - but its fantastic. What seems to be happening is SM1:SPI_master_LDD in SM1.c specifies /* {FreeRTOS RTOS Adapter} Static object used for simulation of dynamic driver memory allocation */ static SM1_TDeviceData DeviceDataPrv__DEFAULT_RTOS_ALLOC; however there isn't a method in SM1.c for getting

The fix is possibly SD1.c LDD_TDeviceData * SM1_GetPtr(void); (should go in SM1.h)

define SM1_DeviceData SM1_GetPtr()

SM1.c: LDD_TDeviceData * SM1_GetPtr(){ return (LDD_TDeviceData *)&DeviceDataPrv__DEFAULT_RTOS_ALLOC; }

However I haven't tested it, and seems there are still some holes as it needs to be allocated to a real piece of memory.

ErichStyger commented 9 years ago

In the SM1 component settings, under Properties > Initialization > Auto Inititalization, have you configured that property to 'yes'? Because if set to yes, it will create that SM1_DeviceData variable.

neilh10 commented 9 years ago

Ok - got it that worked. Missed that. Many thanks.