Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling SKR 2 envs #181

Open
goeland86 opened this issue Jun 10, 2024 · 2 comments
Open

Error compiling SKR 2 envs #181

goeland86 opened this issue Jun 10, 2024 · 2 comments

Comments

@goeland86
Copy link

I'm a newbie with grblHAL, so apologies if I missed something in the documentation I should've seen.

I set up a new environment for the SKR 2 with TMC2209s as follows:

[env:btt_skr_2_tmc2209]
# Untested and might not boot.  Please report issues at:
# https://github.com/grblHAL/STM32F4xx/issues
board = genericSTM32F407VGT6
board_build.ldscript = STM32F407VGTX_FLASH.ld
build_flags = ${common.build_flags}
  # See Inc/my_machine.h for options
  -D BOARD_BTT_SKR_20=
  -D HSE_VALUE=8000000
  -D USB_SERIAL_CDC=1
  # Boot loader offset (32K)
  -D VECT_TAB_OFFSET=0x8000
  # TMC2209 stepper drivers
  -D HAS_BOOTLOADER
  -D TRINAMIC_ENABLE=2209
lib_deps = ${common.lib_deps}
  eeprom
  trinamic
lib_extra_dirs = ${common.lib_extra_dirs}
# Upload is not supported for this board since BOOT0 is tied to GND.
# With the default boot loader, you must deploy new firmware by copying
# .pio/build/<env name>/firmware.bin (produced by `pio run`) to the SD card.

When I build (using PlatformIO in VSCode), I get the following error during compilation (full log truncated for clarity).

[...]
Compiling .pio/build/btt_skr_2_tmc2209/FrameworkCMSISDevice/system_stm32f4xx.o
Archiving .pio/build/btt_skr_2_tmc2209/libFrameworkCMSISDevice.a
Indexing .pio/build/btt_skr_2_tmc2209/libFrameworkCMSISDevice.a
Linking .pio/build/btt_skr_2_tmc2209/firmware.elf
.pio/build/btt_skr_2_tmc2209/src/driver.o: In function `driver_init':
driver.c:(.text.driver_init+0x2a0): undefined reference to `_FLASH_VectorTable'
driver.c:(.text.driver_init+0x532): undefined reference to `board_init'
collect2: error: ld returned 1 exit status
*** [.pio/build/btt_skr_2_tmc2209/firmware.elf] Error 1
================================================================================================================================================================== [FAILED] Took 2.46 seconds ==================================================================================================================================================================

Environment        Status    Duration
-----------------  --------  ------------
btt_skr_2_tmc2209  FAILED    00:00:02.458
============================================================================================================================================================= 1 failed, 0 succeeded in 00:00:02.458 =============================================================================================================================================================

Out of curiosity, I tried the TMC2130 version, just to see if that builds. It seems not.

[...]
Compiling .pio/build/btt_skr_2_tmc2130/FrameworkCMSISDevice/system_stm32f4xx.o
Archiving .pio/build/btt_skr_2_tmc2130/libFrameworkCMSISDevice.a
Indexing .pio/build/btt_skr_2_tmc2130/libFrameworkCMSISDevice.a
Linking .pio/build/btt_skr_2_tmc2130/firmware.elf
.pio/build/btt_skr_2_tmc2130/src/driver.o: In function `driver_init':
driver.c:(.text.driver_init+0x51a): undefined reference to `board_init'
collect2: error: ld returned 1 exit status
*** [.pio/build/btt_skr_2_tmc2130/firmware.elf] Error 1
================================================================================================================================================================== [FAILED] Took 2.52 seconds ==================================================================================================================================================================

Environment        Status    Duration
-----------------  --------  ------------
btt_skr_2_tmc2130  FAILED    00:00:02.518
============================================================================================================================================================= 1 failed, 0 succeeded in 00:00:02.518 =============================================================================================================================================================

I would appreciate any input on how to resolve this. The WebBuilder also disables any EEPROM option for the SKR 2 board, which has proven frustrating when trying to set up my router.

Thanks for any pointers to resolve the issue.

@terjeio
Copy link
Contributor

terjeio commented Jun 17, 2024

It builds with both the STM32CubeIDE and the WebBuilder so must be something wrong with your platformio.ini.
Here is the WebBuilder generated platformio.ini for you to compare with:

[platformio]
include_dir = Inc
src_dir = Src

[common]
build_flags =
  -I .
  -I boards
  -I FatFs
  -I FatFs/STM
  -I Drivers/FATFS/Target
  -I Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
  -I Middlewares/ST/STM32_USB_Device_Library/Core/Inc
  -I USB_DEVICE/App
  -I USB_DEVICE/Target
  -D OVERRIDE_MY_MACHINE
  -D _USE_IOCTL=1
  -D _USE_WRITE=1
  -D _VOLUMES=1
  -Wl,-u,_printf_float
  -Wl,-u,_scanf_float
lib_deps =
  boards
  bluetooth
  grbl
  keypad
  laser
  motors
  trinamic
  odometer
  fans
  FatFs
  sdcard
  spindle
  embroidery
  Drivers/FATFS/App
  Drivers/FATFS/Target
  # USB serial support
  Middlewares/ST/STM32_USB_Device_Library/Core
  Middlewares/ST/STM32_USB_Device_Library/Class
  USB_DEVICE/App
  USB_DEVICE/Target
lib_extra_dirs =
  .
  boards
  FatFs
  Middlewares/ST/STM32_USB_Device_Library
  USB_DEVICE

[eth_networking]
build_flags =
  -I lwip/src/include
  -I networking/wiznet
lib_deps =
   lwip
   networking
lib_extra_dirs =

[env]
platform = ststm32
platform_packages = framework-stm32cubef4 @ ~1.26.2
framework = stm32cube
# Do not produce .a files for lib deps (which would prevent them from overriding weak symbols)
lib_archive = no
lib_ldf_mode = off

[env:test]
board = genericSTM32F407VGT6
board_build.ldscript = STM32F407VGTX_BL32K_FLASH.ld
build_flags = ${common.build_flags}
  -D WEB_BUILD
  -D BOARD_BTT_SKR_20
  -D USE_HAL_DRIVER
  -D STM32F407xx
  -D HSE_VALUE=8000000
  -D USB_SERIAL_CDC=1
  -D PROBE_ENABLE=1
  -D TRINAMIC_ENABLE=2209
  -D TRINAMIC_UART_ENABLE=2
  -D BLUETOOTH_ENABLE=0
  -D NETWORKING_ENABLE=0
  -D ESTOP_ENABLE=1
  -D SPINDLE0_ENABLE=11
  -D N_SPINDLE=1

lib_deps = ${common.lib_deps}
  eeprom

lib_extra_dirs = ${common.lib_extra_dirs}

@goeland86
Copy link
Author

Your provided platformio.ini test file works - and I was using the default from the project for SKR2.

May I kindly suggest that the SKR2 definitions in the provided platformio.ini file from the project re-use the provided values listed above?

I'm happy to create a PR to do so if it would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants