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

L6218E : undefined symbol, linker problems?

hi everyone, i've been struggling with a project im working on for the last day (or two).

i've got two external c files that provide some functions used by fatfs and one of them needs functions out of the other.

during linking keil spits out the following:

Error: L6218E: Undefined symbol SD_IO_CSState (referred from stm32_adafruit_sd.o).
Error: L6218E: Undefined symbol SD_IO_WriteByte (referred from stm32_adafruit_sd.o).
Error: L6218E: Undefined symbol SD_IO_WriteReadData (referred from stm32_adafruit_sd.o).

all of these functions are defined in nucleo.c, and declared in nucleo.h, originally called stm32g0xx_nucleo.c, and stm32g0xx_nucleo.c, (comes with cubemx. i shortened the name a bit and changed all of the #includes.)

nucleo.h is included in stm32_adafruit_sd.c and nucleo.c is added to the keil project.

(nucleo.h)

void SD_IO_CSState(uint8_t state);
void SD_IO_WriteReadData(const uint8_t *DataInuint8_t *DataOutuint16_t DataLength);
uint8_t SD_IO_WriteByte(uint8_t Data);
(SD_IO_CSSstate from nucleo.c)
void SD_IO_CSState(uint8_t val)
  if(val == 1
  {
    SD_CS_HIGH();
  }
  else
  {
    SD_CS_LOW();
  }
}

and its true, if i right click on one of the functions in stm32_adafruit_sd.c and select go to definition keil complains it cannot find the definition.

however, if i open the project in vs code and do the same it nearly instantly shows me the right definition. 

i've tried including nucleo.c, messing with extern in multiple header files, wrapping the function in a different one (which did work for a fourth function somehow) and if started to become a bit too frustrated for my liking.

do you guys/girls/men/women/other have any suggestions? have i missed something? should i have changed a linker setting somewhere?

(for those who are wondering, yes im attempting to get fatfs working via spi)

Parents Reply Children