-
Hi, so basically as the title says, i have added a custom board json config, exported the linker using CubeMX when building the code builds fine yet on linking it spits out lots of "undefined" type of errors. Here is the custom board definition: {
"build": {
"arduino": {
"variant_h": "variant_generic.h"
},
"core": "stm32",
"cpu": "cortex-m33",
"mcu": "stm32u585ciu6",
"extra_flags": "-DSTM32U5 -DSTM32U5xx -DSTM32U585xx",
"f_cpu": "160000000L",
"framework_extra_flags": {
"arduino": "-DCUSTOM_PERIPHERAL_PINS -DARDUINO_GENERIC_U585CIUX"
},
"product_line": "STM32U585xx",
"variant": "STM32U5xx/U575C(G-I)(T-U)_U585CI(T-U)"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "STM32F411CE",
"openocd_target": "stm32u5x",
"svd_path": "STM32u585xx.svd"
},
"frameworks": [
"arduino",
"cmsis",
"stm32cube",
"libopencm3",
"zephyr"
],
"name": "GENERIC_U585CIUX",
"upload": {
"maximum_ram_size": 804864,
"maximum_size": 2097152,
"protocol": "stlink",
"protocols": [
"jlink",
"cmsis-dap",
"stlink",
"blackmagic",
"serial",
"dfu"
]
},
"url": "https://www.st.com/en/microcontrollers-microprocessors/stm32u585ci.html",
"vendor": "ST"
} Here's the error: Building in release mode
Compiling .pio\build\performance-optimised-pcb\src\project.ino.cpp.o
Linking .pio\build\performance-optimised-pcb\firmware.elf
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/SrcWrapper/src/stm32/analog.cpp.o: in function `get_dac_channel':
analog.cpp:(.text.get_dac_channel+0x20): undefined reference to `PinMap_DAC'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/SrcWrapper/src/stm32/analog.cpp.o: in function `dac_stop':
analog.cpp:(.text.dac_stop+0x30): undefined reference to `PinMap_DAC'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/SrcWrapper/src/stm32/analog.cpp.o: in function `pwm_stop':
analog.cpp:(.text.pwm_stop+0x54): undefined reference to `PinMap_TIM'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/SrcWrapper/src/stm32/uart.c.o: in function `uart_init':
uart.c:(.text.uart_init+0x318): undefined reference to `PinMap_UART_TX'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: uart.c:(.text.uart_init+0x31c): undefined reference to `PinMap_UART_RX'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: uart.c:(.text.uart_init+0x320): undefined reference to `PinMap_UART_RTS'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: uart.c:(.text.uart_init+0x324): undefined reference to `PinMap_UART_CTS'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/SrcWrapper/src/stm32/uart.c.o: in function `uart_debug_init':
uart.c:(.text.uart_debug_init+0x38): undefined reference to `PinMap_UART_TX'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/SrcWrapper/src/stm32/uart.c.o: in function `uart_debug_write':
uart.c:(.text.uart_debug_write+0xe0): undefined reference to `PinMap_UART_TX'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/lib9a7/libWire.a(twi.c.o): in function `i2c_custom_init':
twi.c:(.text.i2c_custom_init+0x1fc): undefined reference to `PinMap_I2C_SDA'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: twi.c:(.text.i2c_custom_init+0x200): undefined reference to `PinMap_I2C_SCL'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/lib257/libSPI.a(spi_com.c.o): in function `spi_init':
spi_com.c:(.text.spi_init+0x308): undefined reference to `PinMap_SPI_MOSI'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: spi_com.c:(.text.spi_init+0x30c): undefined reference to `PinMap_SPI_MISO'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: spi_com.c:(.text.spi_init+0x310): undefined reference to `PinMap_SPI_SCLK'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: spi_com.c:(.text.spi_init+0x314): undefined reference to `PinMap_SPI_SSEL'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/libFrameworkArduino.a(HardwareSerial.cpp.o): in function `HardwareSerial::HardwareSerial(void*, HalfDuplexMode_t)':
HardwareSerial.cpp:(.text._ZN14HardwareSerialC2EPv16HalfDuplexMode_t+0xd4): undefined reference to `PinMap_UART_TX'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: HardwareSerial.cpp:(.text._ZN14HardwareSerialC2EPv16HalfDuplexMode_t+0xdc): undefined reference to `PinMap_UART_RX'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/libFrameworkArduino.a(usbd_conf.c.o): in function `HAL_PCD_MspInit':
usbd_conf.c:(.text.HAL_PCD_MspInit+0x64): undefined reference to `PinMap_USB_OTG_FS'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: .pio/build/performance-optimised-pcb/libFrameworkArduino.a(wiring_digital.c.o): in function `pinMode':
wiring_digital.c:(.text.pinMode+0xe8): undefined reference to `PinMap_DAC'
c:/users/user/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld.exe: wiring_digital.c:(.text.pinMode+0xec): undefined reference to `PinMap_TIM'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\performance-optimised-pcb\firmware.elf] Error 1 Anyone has any idea why i'm getting this ? I believe i did define all the necessary flags to target the generic variant available in the framework so not sure why this output. Thanks in advance to anyone taking a minute to read and help :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @Zer0-bit |
Beta Was this translation helpful? Give feedback.
Hi @Zer0-bit
Here we do not support PIO.
Anyway, looking quickly to the error log and your json file it seems you tried to build a generic and requires to have a custom peripheral pins but I guess you do not create a dedicated one.
So simply remove
-DCUSTOM_PERIPHERAL_PINS
if it does not works you should ask on PIO forum or stm32duino.com.