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

Problem with 'debug' on Arduino2 #2

Open
ozarchie opened this issue Nov 13, 2024 · 1 comment
Open

Problem with 'debug' on Arduino2 #2

ozarchie opened this issue Nov 13, 2024 · 1 comment

Comments

@ozarchie
Copy link

ozarchie commented Nov 13, 2024

Hi,
I have been porting your library to the STM32 series uP.
After introducing some "#if defined(ARDUINO_ARCH_STM32)" into your examples to address some processor specific issues, I have run into a problem with the Interface,hpp code that I cannot understand.
I am using:
Arduino Version: 2.3.3
Date: 2024-09-25T09:35:36.798Z (1 month ago)
CLI Version: 1.0.4

on a MAC M2.

I can compile and upload (but not work!) successfully without 'debug' turned on.

However, if I set "Optimize" for debug (-Og'), I get the following errors:

Library/Arduino15/packages/STMicroelectronics/tools/xpack-arm-none-eabi-gcc/13.2.1-1.1/bin/../lib/gcc/arm-none-eabi/13.2.1/../../../../arm-none-eabi/bin/ld: sketch/TMCTestStepperInterface.ino.cpp.o: in function `TMC51X0::TMC51X0()':
Documents/Arduino/libraries/TMC51X0/src/TMC51X0.hpp:23:(.text._ZN7TMC51X0C2Ev[_ZN7TMC51X0C5Ev]+0x6c):

undefined reference to vtable for tmc51x0::Interface

collect2: error: ld returned 1 exit status

Internet searches suggest I need to change :

virtual void writeRegister(uint8_t register_address, uint32_t data);
virtual uint32_t readRegister(uint8_t register_address)};

to

virtual void writeRegister(uint8_t register_address, uint32_t data){};
virtual uint32_t readRegister(uint8_t register_address){return(0);};

This allows the code to compile and allows the Arduino debug interface to work.

But, if I then set the compile options back to smallest '-Os', compile fails with:

Documents/Arduino/libraries/TMC51X0/src/./TMC51X0/Interface.hpp: In member function 'virtual void tmc51x0::Interface::writeRegister(uint8_t, uint32_t)':
Documents/Arduino/libraries/TMC51X0/src/./TMC51X0/Interface.hpp:25:40: warning: unused parameter 'register_address' [-Wunused-parameter]
   25 |     virtual void writeRegister(uint8_t register_address, uint32_t data) {};
      |                                ~~~~~~~~^~~~~~~~~~~~~~~~
Documents/Arduino/libraries/TMC51X0/src/./TMC51X0/Interface.hpp:25:67: warning: unused parameter 'data' [-Wunused-parameter]
   25 |     virtual void writeRegister(uint8_t register_address, uint32_t data) {};
      |                                                          ~~~~~~~~~^~~~

Any suggestions?

@peterpolidoro
Copy link
Member

Hi! This library is still under active development so I may be making significant changes until I have worked out most of the functionality.

The unused parameter warning should disappear if you remove the parameter names. I have implemented these changes in one of the last commits that I pushed up to the repository. Can you please try it again and see if it fixes your issue? Thanks!

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