This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Linker issues

Hello All,

I am using Keil u vision4 for stm32f2 series.

I am building anSPI application using SPI libraries provided by STM. I am not able to recognise the problem. If i include those libraries in my file, i get these errors

Includes\stm32f2xx_spi.c(180): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(221): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(289): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(342): error: #20: identifier "RCC_CFGR_I2SSRC" is undefined
Includes\stm32f2xx_spi.c(348): error: #136: struct "<unnamed>" has no field "PLLI2SCFGR"
Includes\stm32f2xx_spi.c(348): error: #20: identifier "RCC_PLLI2SCFGR_PLLI2SN" is undefined
Includes\stm32f2xx_spi.c(352): error: #136: struct "<unnamed>" has no field "PLLI2SCFGR"
Includes\stm32f2xx_spi.c(352): error: #20: identifier "RCC_PLLI2SCFGR_PLLI2SR" is undefined
Includes\stm32f2xx_spi.c(356): error: #20: identifier "RCC_PLLCFGR_PLLM" is undefined
Includes\stm32f2xx_spi.c(472): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(496): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(523): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(543): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(569): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(593): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(624): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(675): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(691): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(780): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(802): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(821): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(845): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(882): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(993): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(1036): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(1076): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(1104): warning: #223-D: function "assert_param" declared implicitly
Includes\stm32f2xx_spi.c(1157): warning: #223-D: function "assert_param" declared implicitly

If i do not include the #include "stm32f2xx_spi.h"
#include "stm32f2xx_gpio.h"
#include "stm32f2xx_rcc.h" files, i get all the spi related stuffs as undefined.

Could any one pls suggest me how to include these library and make my code work??
Thanks

  • Those are Compiler messages!

    It looks like you've omitted some basic configuration, so that nothing from the Standard Peripheral Library is defined.

    See: my.st.com/.../DispForm.aspx

    Clickable: http://bit.ly/PlihWE

    Complete thread: http://bit.ly/TaBoSj

  • Thanks for the reply.

    I just added the path of the library in Target Options->C/C++->include paths.

    But still no difference. Errors still exists

    Please help to sort out this

    Thanks

  • So have you searched which files contains these symbols?

    Have you then continued and tried to figure out what is required to get these symbols available (which sequence of files that must be included, and if potentially any #define set)?

    What was your conclusion?

  • "But still no difference. Errors still exists"

    You didn't show any errors reporting that any files were not found.

    If you didn't get any reports of files not found, then adding extra paths isn't going to help - is it?

    Look again at my earlier post here, and in the linked ST thread; I strongly suspect that your problem is that you have not provided the correct configuration options to your project...

    As Per says, you can search through the source files to see what is preventing thyse symbold from getting defined...

  • Hi,

    Thanks for the reply.

    These are the errors I am getting. I am not getting any file not found messages.
    I am new to programing and controllers. I will have a look into my code.
    And one more thing I want to add is, the code wotks fine with Red Suite IDE, i have provided the path of this library during project creation.

    I am totally unaware of what i have missed out.
    I will have a look.

    compiling main.c...
    compiling spi.c...
    Includes\spi.h(222): error: #20: identifier "SPI_InitTypeDef" is undefined
    Includes\spi.c(47): warning: #223-D: function "SPI_I2S_DeInit" declared implicitly
    Includes\spi.c(72): error: #20: identifier "SPI_InitTypeDef" is undefined
    Includes\spi.c(76): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(76): error: #20: identifier "SPI_Direction_2Lines_FullDuplex" is undefined
    Includes\spi.c(78): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(78): error: #20: identifier "SPI_Mode_Master" is undefined
    Includes\spi.c(80): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(80): error: #20: identifier "SPI_DataSize_8b" is undefined
    Includes\spi.c(82): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(82): error: #20: identifier "SPI_CPOL_High" is undefined
    Includes\spi.c(84): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(84): error: #20: identifier "SPI_CPHA_2Edge" is undefined
    Includes\spi.c(86): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(86): error: #20: identifier "SPI_NSS_Soft" is undefined
    Includes\spi.c(88): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(88): error: #20: identifier "SPI_BaudRatePrescaler_2" is undefined
    Includes\spi.c(90): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(90): error: #20: identifier "SPI_FirstBit_LSB" is undefined
    Includes\spi.c(92): error: #132: expression must have pointer-to-struct-or-union type
    Includes\spi.c(94): warning: #223-D: function "SPI_Init" declared implicitly
    Includes\spi.c(96): warning: #223-D: function "SPI_I2S_ITConfig" declared implicitly
    Includes\spi.c(96): error: #20: identifier "SPI_IT_TXE" is undefined
    Includes\spi.c(97): error: #20: identifier "SPI_IT_RXNE" is undefined
    Includes\spi.c(99): warning: #223-D: function "SPI_Cmd" declared implicitly
    Includes\spi.c(128): warning: #223-D: function "SPI_I2S_GetFlagStatus" declared implicitly
    Includes\spi.c(128): error: #20: identifier "SPI_I2S_FLAG_TXE" is undefined
    Includes\spi.c(129): warning: #223-D: function "SPI_I2S_SendData" declared implicitly
    Includes\spi.c(130): error: #20: identifier "SPI_I2S_FLAG_RXNE" is undefined
    Includes\spi.c(131): warning: #223-D: function "SPI_I2S_ReceiveData" declared implicitly
    Includes\spi.c(127): warning: #550-D: variable "SlaveData" was set but never used
    Includes\spi.c(162): warning: #223-D: function "SPI_I2S_GetITStatus" declared implicitly
    Includes\spi.c(162): error: #20: identifier "SPI_I2S_IT_RXNE" is undefined
    Includes\spi.c(163): warning: #223-D: function "SPI_I2S_ReceiveData" declared implicitly
    Includes\spi.c(191): error: #20: identifier "GPIO_InitTypeDef" is undefined
    Includes\spi.c(194): warning: #223-D: function "RCC_APB1PeriphClockCmd" declared implicitly
    Includes\spi.c(194): error: #20: identifier "RCC_APB1Periph_SPI2" is undefined
    Includes\spi.c(197): warning: #223-D: function "RCC_AHB1PeriphClockCmd" declared implicitly
    Includes\spi.c(197): error: #20: identifier "RCC_AHB1Periph_GPIOB" is undefined
    Includes\spi.c(203): warning: #223-D: function "GPIO_PinAFConfig" declared implicitly
    Includes\spi.c(203): error: #20: identifier "GPIO_PinSource13" is undefined
    Includes\spi.c(203): error: #20: identifier "GPIO_AF_SPI2" is undefined
    Includes\spi.c(204): error: #20: identifier "GPIO_PinSource14" is undefined
    compiling stm32f2xx_spi.c...
    Includes\stm32f2xx_spi.c(180): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(221): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(289): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(342): error: #20: identifier "RCC_CFGR_I2SSRC" is undefined
    Includes\stm32f2xx_spi.c(348): error: #136: struct "<unnamed>" has no field "PLLI2SCFGR"
    Includes\stm32f2xx_spi.c(348): error: #20: identifier "RCC_PLLI2SCFGR_PLLI2SN" is undefined
    Includes\stm32f2xx_spi.c(352): error: #136: struct "<unnamed>" has no field "PLLI2SCFGR"
    Includes\stm32f2xx_spi.c(352): error: #20: identifier "RCC_PLLI2SCFGR_PLLI2SR" is undefined
    Includes\stm32f2xx_spi.c(356): error: #20: identifier "RCC_PLLCFGR_PLLM" is undefined
    Includes\stm32f2xx_spi.c(472): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(496): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(523): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(543): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(569): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(593): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(624): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(675): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(691): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(780): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(802): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(821): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(845): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(882): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(993): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(1036): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(1076): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(1104): warning: #223-D: function "assert_param" declared implicitly
    Includes\stm32f2xx_spi.c(1157): warning: #223-D: function "assert_param" declared implicitly

    Thanks

  • In that case, use the Red Suite IDE to show you where those symbols should get defined.

    IIRC, Red Suite is Eclipse-based - so clicking on a symbol and then pressing F3 should take you to the definition...

  • Hi,

    Thanks. I was able to resolve the previous errors.But now i am getting new set of linker errors.
    Is there anything i have to add any LIB file for this to work.
    But i could not find any LIB file specificaly for stm32f2xxx series.

    Could you pls help me knowing whats the soultion

    Build target 'Target 1'
    linking...
    tst.axf: Error: L6218E: Undefined symbol GPIO_PinAFConfig (referred from spi.o).
    tst.axf: Error: L6218E: Undefined symbol RCC_AHB1PeriphClockCmd (referred from spi.o).
    Sensor unit.axf: Error: L6218E: Undefined symbol RCC_APB1PeriphClockCmd (referred from spi.o).
    tst.axf: Error: L6218E: Undefined symbol SPI_Cmd (referred from spi.o).
    tst.axf: Error: L6218E: Undefined symbol SPI_I2S_DeInit (referred from spi.o).
    tst.axf: Error: L6218E: Undefined symbol SPI_I2S_GetFlagStatus (referred from spi.o).
    Setst.axf: Error: L6218E: Undefined symbol SPI_I2S_GetITStatus (referred from spi.o).
    tst.axf: Error: L6218E: Undefined symbol SPI_I2S_ITConfig (referred from spi.o).
    tst.axf: Error: L6218E: Undefined symbol SPI_I2S_ReceiveData (referred from spi.o).
    tst.axf: Error: L6218E: Undefined symbol SPI_I2S_SendData (referred from spi.o).
    tst.axf: Error: L6218E: Undefined symbol SPI_Init (referred from spi.o).

  • Thanks Andrew!!

    I got it working

    I included the library files needed along with my files. And compiled.

    So now its working fine.

    Thanks

  • That's right: ST don't provide a ready-built library - so you have to include the source files in your project, and build them as part of your project.

    (or you could create your own library, if you wanted)

    "I included the library files needed along with my files. And compiled. So now its working fine."

    That's it - well done!

    "Thanks"

    You're welcome.