OpenFFBoard icon indicating copy to clipboard operation
OpenFFBoard copied to clipboard

const CAN_INITTYPE init and const uint32_t speed uninitialized

Open RunningPenguin opened this issue 8 months ago • 1 comments

I'm on linux and the compile worked great until the rewrite of the CAN with the commit "Abstracted CAN port definitions" the problems begin. Here you find the error.

/usr/include/newlib/c++/13.3.1/array:460:44: error: use of deleted function 'std::array<CANPortHardwareConfig::PresetEntry, 6>::array()' 460 | array<remove_cv_t<_Tp>, _Nm> __arr; | ^~~~~ /usr/include/newlib/c++/13.3.1/array:94:12: note: 'std::array<CANPortHardwareConfig::PresetEntry, 6>::array()' is implicitly deleted because the default definition would be ill-formed: 94 | struct array | ^~~~~ /usr/include/newlib/c++/13.3.1/array:94:12: error: use of deleted function 'CANPortHardwareConfig::PresetEntry::PresetEntry()' In file included from FFBoard/Inc/cpp_target_config.h:15: FFBoard/Inc/CAN.h:40:16: note: 'CANPortHardwareConfig::PresetEntry::PresetEntry()' is implicitly deleted because the default definition would be ill-formed: 40 | struct PresetEntry{// Helper for preset entries | ^~~~~~~~~~~ FFBoard/Inc/CAN.h:40:16: **error: uninitialized const member in 'struct CANPortHardwareConfig::PresetEntry' FFBoard/Inc/CAN.h:41:36: note: 'const uint32_t CANPortHardwareConfig::PresetEntry::init' should be initialized 41 | const CAN_INITTYPE init; | ^~~~ FFBoard/Inc/CAN.h:40:16: **error: uninitialized const member in 'struct CANPortHardwareConfig::PresetEntry' 40 | struct PresetEntry{// Helper for preset entries | ^~~~~~~~~~~

If I initialize these two constants in CAN.h everythings compiles perfectly. I couldn't do an pull request right now as I have no fork of your project right now. And I even don't know if my fix is alright because I just used zero to initialize without knowledge of correct values. CAN.h lines 38-42.

class CANPortHardwareConfig{
public:
	struct PresetEntry{// Helper for preset entries
		const CAN_INITTYPE init = 0;
		const uint32_t speed = 0;

RunningPenguin avatar Apr 07 '25 19:04 RunningPenguin

The CAN presets are supposed to be defined in a separate file in the target project in Core/Src/target_config.cpp

See here: https://github.com/Ultrawipf/OpenFFBoard/blob/master/Firmware/Targets/F407VG/Core/Src/cpp_target_config.cpp#L51

Ultrawipf avatar Apr 16 '25 07:04 Ultrawipf