Hi,
for my project I need to add pins to my AxisHardwareConfig_t
(enable_gpio_pin
and error_gpio_pin
)
I define them in the board_config_v3.h
file like this :
const BoardHardwareConfig_t hw_configs[2] = { {
//M0
.axis_config = {
.step_gpio_pin = 1,
.dir_gpio_pin = 2,
.enable_gpio_pin = 5, // new pin 1
.error_gpio_pin = 3, // new pin 2
.thread_priority = (osPriority)(osPriorityHigh + (osPriority)1),
},
…
//M1
.axis_config = {
#if HW_VERSION_MAJOR == 3 && HW_VERSION_MINOR >= 5
.step_gpio_pin = 7,
.dir_gpio_pin = 8,
.enable_gpio_pin = 6, // same for M1
.error_gpio_pin = 4,
#else
.step_gpio_pin = 3,
.dir_gpio_pin = 4,
#endif
.thread_priority = osPriorityHigh,
},
I compiled a first time and it worked great, but I made a mistake in the value of enable_gpio_pin
for M1 (8 instead of 6), and now when I compile with the right value, enable_gpio_pin
is stuck to the wrong value (8).
I use visual studio code, and it seems that it doesn’t want to compile what’s after the #ifdef __MAIN_CPP__
anymore.
When I want to force this by adding
#ifndef __MAIN_CPP__
#define __MAIN_CPP__
#endif
up in the file I get the following errors :
build/obj/Board_v3_Src_usbd_desc.c.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/Board_v3_Src_usbd_desc.c.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/Board_v3_Src_usbd_desc.c.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/MotorControl_low_level.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/MotorControl_low_level.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/MotorControl_low_level.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/MotorControl_axis.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/MotorControl_axis.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/MotorControl_axis.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/MotorControl_motor.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/MotorControl_motor.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/MotorControl_motor.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/MotorControl_encoder.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/MotorControl_encoder.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/MotorControl_encoder.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/MotorControl_controller.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/MotorControl_controller.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/MotorControl_controller.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/MotorControl_sensorless_estimator.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/MotorControl_sensorless_estimator.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/MotorControl_sensorless_estimator.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/MotorControl_trapTraj.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/MotorControl_trapTraj.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/MotorControl_trapTraj.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/MotorControl_main.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/MotorControl_main.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/MotorControl_main.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/communication_communication.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/communication_communication.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/communication_communication.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/communication_ascii_protocol.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/communication_ascii_protocol.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/communication_ascii_protocol.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
build/obj/communication_interface_usb.cpp.o:(.rodata.hw_configs+0x0): multiple definition of `hw_configs'
build/obj/Board_v3_Src_main.c.o:(.rodata.hw_configs+0x0): first defined here
build/obj/communication_interface_usb.cpp.o:(.rodata.thermistor_num_coeffs+0x0): multiple definition of `thermistor_num_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_num_coeffs+0x0): first defined here
build/obj/communication_interface_usb.cpp.o:(.rodata.thermistor_poly_coeffs+0x0): multiple definition of `thermistor_poly_coeffs'
build/obj/Board_v3_Src_main.c.o:(.rodata.thermistor_poly_coeffs+0x0): first defined here
any help would be greatly appreciated