Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Alternative debug solutions to hardwareserial help (Read 125 times)
Ghostwriter
Newbies
*
Offline


Posts: 2
Location: Denmark
Joined: Dec 12th, 2024
Alternative debug solutions to hardwareserial help
Dec 12th, 2024 at 7:29pm
Print Post  
Hello there,

I am new to Visual Micro and have for a long time wanted to try this Visual studio integrated tool for my builds.

I have a project written in Arduino IDE 2 where i have used a library called NeoHWSerial for better serial control and to raise the serial buffer to 200. 

Another way of increasing the buffer size is just altering the Arduino core library through the SERIAL_TX_BUFFER_SIZE 
SERIAL_RX_BUFFER_SIZE #defines See topic: Changing Arduino Core HardwareSerial.h Defines

But then it is not compatible with the Arduino IDE´s core library anymore.
So in Arduino IDE I used NeoHWSerial in the beginning to adress this issue and as long as there is no callings to the Arduino serial class, there is no conflicts between these libraries.

So the problem is that i am struggling in Visual Micro because of this. When using the Debug option to use breakpoints and all the cool stuf, i get a conflict from the orignal HardwareSerial library from Arduino core. It suggest that VM is calling the serial class for its code to work.
When adding NeoHWSerial as a library to my sketch i get following message:

HardwareSerial0.cpp.o (symbol from plugin)*: In function Serial
(.text+0x0)*: multiple definition of __vector_25
NeoHWSerial0.cpp.o (symbol from plugin)*: (.text+0x0): first defined here

I have tried using Override remote port or transport under debugger in VM but i cannot manage to attach the NeoSerial class instead of the serial class.

So one of the Remote transport options is also FastSerial. So i tried using that option and that library to get a positive result. But it is the same problem. 
Selecting the FastSerial option under Remote transport just gives me the following message:

HardwareSerial0.cpp.o (symbol from plugin)*: In function Serial
(.text+0x0)*: multiple definition of __vector_25
FastSerial.cpp.o (symbol from plugin)*: (.text+0x0): first defined here

So i hope that someone can help me addressing this issue so i can use the debugging functionality along with the NeoHWSerial library.

I have attached a barebone solution of the problem.

Thanks in advance.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2499
Joined: Feb 13th, 2019
Re: Alternative debug solutions to hardwareserial help
Reply #1 - Dec 13th, 2024 at 2:24pm
Print Post  
Thanks for the report and we are looking into how the HardwareSerial code can be excluded, we don't directly include it in the debuggers' code.

Can you elaborate on why changing the Serial buffer define values "is not compatible with the Arduino IDE´s core library anymore."?

  
Back to top
IP Logged
 
Ghostwriter
Newbies
*
Offline


Posts: 2
Location: Denmark
Joined: Dec 12th, 2024
Re: Alternative debug solutions to hardwareserial help
Reply #2 - Dec 13th, 2024 at 2:43pm
Print Post  
Hi Simon,

When utilizing the debug feature, I encounter a conflict with the hardware serial code. However, this conflict does not manifest when the debugger is set to release mode. This situation mirrors the issue observed in the Arduino IDE, where any invocation of the serial class results in a similar conflict. Based on this observation, it is reasonable to infer that your debugger is likely making a call to the serial class as well.

Arduino IDE Core Library and #defines

I would like to clarify my previous statement regarding the Arduino IDE core library. The core library remains unaltered when my code is opened in the Arduino IDE. Consequently, while the #defines function correctly in Visual Micro (VM), they do not have the same effect in the Arduino IDE.

Potential Solutions and Considerations
While modifying the Arduino IDE core library is a potential solution, it is important to note that this approach would impact all future code. Although workarounds exist, I had initially assumed that Visual Micro already incorporated a feature to circumvent this issue.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2499
Joined: Feb 13th, 2019
Re: Alternative debug solutions to hardwareserial help
Reply #3 - Dec 13th, 2024 at 4:06pm
Print Post  
Thanks for clarifying, and editing the core files is often a bad route as updating the core loses all the tweaks.

To have a solution which works in both Arduino IDE and Visual Micro to alter the buffer defines, there are only really two sensible options:
1) Platform-local.txt:
This can override any entries in platform.txt, but it still needs to be cloned to the AVR Board Package folder, and would affect all boards/builds for that package, so still not as precise as you would like.
Arduino Documentation: https://arduino.github.io/arduino-cli/1.1/platform-specification/#platformlocalt...

2) Custom Board Defintion:
The files from the attached ZIP can be put into your Sketchbook\hardware folder (e.g. C:\Users\Simon\Documents\Arduino\hardware), and then when vMicro/Arduino IDE are loaded, there will be a new board visible "Arduino Mega 2560 (CustomSerial)":

When the board is selected, it will use the extended cpp compiler pattern which includes the defines for the buffers (which is in the platform.txt of the ZIP file).  This keeps all other projects' clear and updating the underlying AVR board package wouldn't lose these changes.

We will continue to try to understand why the NeoSerial route isn't working as well of course.
  

Please Register or Login to the Forum to see File Attachments
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint