cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I have written program for the spi initialization. I have got error like this can you please let me know how to clear this error .

Chandana
Associate II

I have got error like this can you please let me know how to resolve this error.

make: *** No rule to make target '../Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_spi.c', needed by 'Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_spi.o'. Stop.

10 REPLIES 10
TDK
Guru

Clean the build, then rebuild.

Check if that file exists.

Re-generate the code in CubeMX.

If you feel a post has answered your question, please click "Accept as Solution".

Thanks for the reply.

I have clean the build and rebuild , i got error like this.

Description Resource Path Location Type

'SPI_BAUDRATEPRESCALER_64' undeclared (first use in this function) main.c /vent_cont/Core/Src line 378 C/C++ Problem

'SPI_CRC_LENGTH_DATASIZE' undeclared (first use in this function) main.c /vent_cont/Core/Src line 383 C/C++ Problem

'SPI_CRC_LENGTH_DATASIZE' undeclared (first use in this function) main.c /vent_cont/Core/Src line 412 C/C++ Problem

'SPI_CRCCALCULATION_DISABLE' undeclared (first use in this function); did you mean 'SPI_TIMODE_DISABLE'? main.c /vent_cont/Core/Src line 381 C/C++ Problem

'SPI_CRCCALCULATION_DISABLE' undeclared (first use in this function); did you mean 'SPI_TIMODE_DISABLE'? main.c /vent_cont/Core/Src line 410 C/C++ Problem

'SPI_DATASIZE_8BIT' undeclared (first use in this function); did you mean 'I2C_MEMADD_SIZE_8BIT'? main.c /vent_cont/Core/Src line 374 C/C++ Problem

'SPI_DATASIZE_8BIT' undeclared (first use in this function); did you mean 'I2C_MEMADD_SIZE_8BIT'? main.c /vent_cont/Core/Src line 404 C/C++ Problem

'SPI_DIRECTION_2LINES' undeclared (first use in this function); did you mean 'I2C_DIRECTION_RECEIVE'? main.c /vent_cont/Core/Src line 373 C/C++ Problem

'SPI_DIRECTION_2LINES' undeclared (first use in this function); did you mean 'I2C_DIRECTION_RECEIVE'? main.c /vent_cont/Core/Src line 403 C/C++ Problem

'SPI_FIRSTBIT_MSB' undeclared (first use in this function); did you mean 'SPI_SR_BSY_Msk'? main.c /vent_cont/Core/Src line 379 C/C++ Problem

'SPI_FIRSTBIT_MSB' undeclared (first use in this function); did you mean 'SPI_SR_BSY_Msk'? main.c /vent_cont/Core/Src line 408 C/C++ Problem

'SPI_MODE_MASTER' undeclared (first use in this function); did you mean 'HAL_I2C_MODE_MASTER'? main.c /vent_cont/Core/Src line 372 C/C++ Problem

'SPI_MODE_SLAVE' undeclared (first use in this function); did you mean 'HAL_I2C_MODE_SLAVE'? main.c /vent_cont/Core/Src line 402 C/C++ Problem

'SPI_NSS_HARD_INPUT' undeclared (first use in this function); did you mean 'SPI_CS_MTR_Pin'? main.c /vent_cont/Core/Src line 407 C/C++ Problem

'SPI_NSS_PULSE_DISABLE' undeclared (first use in this function); did you mean 'SPI_TIMODE_DISABLE'? main.c /vent_cont/Core/Src line 413 C/C++ Problem

'SPI_NSS_PULSE_ENABLE' undeclared (first use in this function); did you mean 'I2C_NOSTRETCH_ENABLE'? main.c /vent_cont/Core/Src line 384 C/C++ Problem

'SPI_NSS_SOFT' undeclared (first use in this function); did you mean 'SPI_SR_OVR'? main.c /vent_cont/Core/Src line 377 C/C++ Problem

'SPI_PHASE_1EDGE' undeclared (first use in this function) main.c /vent_cont/Core/Src line 376 C/C++ Problem

'SPI_PHASE_1EDGE' undeclared (first use in this function) main.c /vent_cont/Core/Src line 406 C/C++ Problem

'TIM_MASTERSLAVEMODE_DISABLE' undeclared (first use in this function); did you mean 'TIM_AUTORELOAD_PRELOAD_DISABLE'? main.c /vent_cont/Core/Src line 507 C/C++ Problem

'TIM_MASTERSLAVEMODE_DISABLE' undeclared (first use in this function); did you mean 'TIM_AUTORELOAD_PRELOAD_DISABLE'? main.c /vent_cont/Core/Src line 544 C/C++ Problem

'TIM_OCFAST_DISABLE' undeclared (first use in this function); did you mean 'DMA_MINC_DISABLE'? motor.c /vent_cont/Core/Src line 201 C/C++ Problem

Problem

'TIM_OCPOLARITY_HIGH' undeclared (first use in this function); did you mean 'DMA_PRIORITY_HIGH'? motor.c /vent_cont/Core/Src line 200 C/C++ Problem

'TIM_TRGO_RESET' undeclared (first use in this function); did you mean 'TIM_RCR_REP'? main.c /vent_cont/Core/Src line 456 C/C++ Problem

'TIM_TRGO_RESET' undeclared (first use in this function); did you mean 'TIM_RCR_REP'? main.c /vent_cont/Core/Src line 506 C/C++ Problem

'TIM_TRGO_RESET' undeclared (first use in this function); did you mean 'TIM_RCR_REP'? main.c /vent_cont/Core/Src line 543 C/C++ Problem

'UART_ADVFEATURE_NO_INIT' undeclared (first use in this function) main.c /vent_cont/Core/Src line 569 C/C++ Problem

'UART_ADVFEATURE_NO_INIT' undeclared (first use in this function) main.c /vent_cont/Core/Src line 594 C/C++ Problem

'UART_HWCONTROL_NONE' undeclared (first use in this function); did you mean 'UART_PARITY_NONE'? main.c /vent_cont/Core/Src line 566 C/C++ Problem

'UART_HWCONTROL_NONE' undeclared (first use in this function); did you mean 'UART_PARITY_NONE'? main.c /vent_cont/Core/Src line 591 C/C++ Problem

'UART_MODE_TX_RX' undeclared (first use in this function); did you mean 'USART_TDR_TDR'? main.c /vent_cont/Core/Src line 565 C/C++ Problem

'UART_MODE_TX_RX' undeclared (first use in this function); did you mean 'USART_TDR_TDR'? main.c /vent_cont/Core/Src line 590 C/C++ Problem

'UART_ONE_BIT_SAMPLE_DISABLE' undeclared (first use in this function) main.c /vent_cont/Core/Src line 568 C/C++ Problem

'UART_ONE_BIT_SAMPLE_DISABLE' undeclared (first use in this function) main.c /vent_cont/Core/Src line 593 C/C++ Problem

'UART_OVERSAMPLING_16' undeclared (first use in this function); did you mean 'UART_STOPBITS_1'? main.c /vent_cont/Core/Src line 567 C/C++ Problem

'UART_OVERSAMPLING_16' undeclared (first use in this function); did you mean 'UART_STOPBITS_1'? main.c /vent_cont/Core/Src line 592 C/C++ Problem

'UART_PARITY_NONE' undeclared (first use in this function); did you mean 'FLASH_PROC_NONE'? main.c /vent_cont/Core/Src line 564 C/C++ Problem

'UART_PARITY_NONE' undeclared (first use in this function); did you mean 'FLASH_PROC_NONE'? main.c /vent_cont/Core/Src line 589 C/C++ Problem

'UART_STOPBITS_1' undeclared (first use in this function) main.c /vent_cont/Core/Src line 563 C/C++ Problem

I have selected STM32FO51C8TX in the MCU selector .I have included the driver stm32f0xx_hal_spi.h,stm32f0xx_hal_tim.h,stm32f0xx_hal_uart.h file also but still i am getting the error like this. can you please tell me how to resolve this error

TDK
Guru

Just use the generated CubeMX code. It includes the right files. In this case, stm32f0xx.h.

If you feel a post has answered your question, please click "Accept as Solution".

Thanks for the reply.

I have tried this method to include the stm32f0xx_hal_spi.h file by using these steps.But still i couldn't able to resolve the error.

  1. Drivers/STM32xxxxx_HAL_Driver >> New >> File
  2. In the dialog that opens click on Advanced then Link to file in the file system
  3. Then click Variables...
  4. Click Extend... to be able to brows your system starting from the selected location (here the current workspace)
  5. Select the file you need (here stm32f4xx_hal_cryp.c), then clivk OK and Finish

I am new to this controller can you please tell me how to generate the code and please tell me how o resolve the issue.

More of a C thing.

Make sure the Include Paths point to the right location. Do not Add .H files to the project.​

Select modules in the stm32f0xx_hal_conf.h​ files, and add the .C library source files to the project.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks for the reply.

I have enabled the modules in the stm32f0xx_hal_conf.h files but still i am getting error like this.

Description Resource Path Location Type

fatal error: stm32f0xx_hal_spi.h: No such file or directory stm32f0xx_hal_conf.h /Nasa_venti/Core/Inc line 273 C/C++ Problem

make: *** [Drivers/STM32F0xx_HAL_Driver/Src/subdir.mk:60: Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal.o] Error 1 Nasa_venti C/C++ Problem

make: *** [Drivers/STM32F0xx_HAL_Driver/Src/subdir.mk:62: Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_cortex.o] Error 1 Nasa_venti C/C++ Problem

make: *** [Drivers/STM32F0xx_HAL_Driver/Src/subdir.mk:64: Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_dma.o] Error 1 Nasa_venti C/C++ Problem

make: *** [Drivers/STM32F0xx_HAL_Driver/Src/subdir.mk:66: Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_exti.o] Error 1 Nasa_venti C/C++ Problem

make: *** Waiting for unfinished jobs.... Nasa_venti C/C++ Problem

could you please tell me how to add the driver file stm32f0xx_hal_spi.h .

Please tell me how to resolve the issues.

TDK
Guru

You should only be #including stm32f0xx.h in your code, not the others. The others will get included from within that file if you have it configured correctly.

I'd recommend creating a project in STM32CubeMX, generating the code for it, and then looking at how that project is organized.

If you feel a post has answered your question, please click "Accept as Solution".

So if it can't find files, and you know where they are, but the compiler can't find them, it is because the INCLUDE PATHS are not being fed to the compiler properly. Check the makefile, the GNU/GCC compiler would take these as a '-I' option

Perhaps you work with someone who can guide you.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Chandana
Associate II

Thanks for the reply