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] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) link error in vs2019 of a project that builds ok in vs2017 (Read 5520 times)
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
link error in vs2019 of a project that builds ok in vs2017
Jun 1st, 2021 at 7:06am
Print Post  
Hi!
We have redesigned our board (based on arduino due) and added jtag connector and bought an atmel ice.

To be able to use this I had to upgrade to vs2019.

I have been able to build and debug with it in a simple "empty" arduino due project in vs2019.

BUT when I build our project that builds fine in vs2017 it reports link error in vs2019.

I have attached the output from
vs2017 and from vs2019 both with debug on hardware and without debugging

We have found a bug in the arduino library code for the Uart, so we have added the source code for the UartClass to our project and it builds and runs ok with vs2017


the diff is in the write function

original:

size_t UARTClass::write( const uint8_t uc_data )
{
  // Is the hardware currently busy?
  if (((_pUart->UART_SR & UART_SR_TXRDY) != UART_SR_TXRDY) |
      (_tx_buffer->_iTail != _tx_buffer->_iHead))
  {
    // If busy we buffer


our bug-fix version:

size_t UARTClass::write( const uint8_t uc_data )
{
  // Using static since it is faster, no stack operation
  static bool put_in_buffer;
   
  // Make sure that UART_SR_TXRDY and _tx_buffer is not changed by IrqHandler during evaluation
  __ASM volatile ("cpsid i");
  put_in_buffer = (((_pUart->UART_SR & UART_SR_TXRDY) != UART_SR_TXRDY) | (_tx_buffer->_iTail != _tx_buffer->_iHead));
  __ASM volatile ("cpsie i");
   
  // Is the hardware currently busy?
  if (put_in_buffer)
  {
    // If busy we buffer


Can you please help me found why I can't build this in vs2019

Best regards,
Anders Eriksson

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #1 - Jun 1st, 2021 at 9:06am
Print Post  
Hi again,

When I am comparing the output files, I see that i didn't build with Release option in vs2017, but now I have tried that also, see attached output file.

Thanks,
Anders
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #2 - Jun 1st, 2021 at 2:19pm
Print Post  
Hi

On the 2017 version you have switched off "vMicro>Compiler>Deep Search for Libraries". This setting can be switched off if the .ino code has an #include for all the libraries that you need.

On the 2019 project you have switched off optimization which the core you are using is not designed to allow. You can see this in the output "-O0".

I suggest that switching the optimization to default is probably the solution because the library search looks okay, although possibly not needed in your project.

  
Back to top
WWW  
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #3 - Jun 1st, 2021 at 2:36pm
Print Post  
Hi,

I tried to use default optimization, but still same error, see attached output file.

Thanks,
Anders
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #4 - Jun 1st, 2021 at 2:47pm
Print Post  
Hi again,

I see now when comparing the output that the vs2017 output has;

ide.default.revision_name=1.9.0

whereas vs2019 has
ide.default.revision_name=1.8.13

where can I change this setting to test this?

Thanks,
Anders
« Last Edit: Jun 1st, 2021 at 2:48pm by Anders Eriksson »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #5 - Jun 1st, 2021 at 2:57pm
Print Post  
And now I found this strange path in the vs2019 output
-I"C:\SVN_proj\Arduino\MOTOR_~2\MOTORC~1"

whereas in vs2017 it is
-I"C:\SVN_proj\Arduino\motor_controller\MotorController"

see attached screen-dump

Can this enplane the link error? and how can it be fixed?

Thank, Anders
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #6 - Jun 1st, 2021 at 3:04pm
Print Post  
Deep search library OFF didn't help either, see attached output file.
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #7 - Jun 1st, 2021 at 3:30pm
Print Post  
Thanks for the info.

As a test, please set the optimization to "no project and libraries" then build and then set it back to default and build again. Then show the verbose output for the build.

The issue might be related to optimization not switching back to default after it has been on. This will show some useful info then I think we will be able to give you some settings for a short term workaround.

Thanks
  
Back to top
WWW  
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #8 - Jun 1st, 2021 at 3:37pm
Print Post  
Link error in both, see attached output files
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #9 - Jun 1st, 2021 at 5:26pm
Print Post  
The only way I can replicate is if I change the advanced optimization settings (Project Properties). 

Is it possible you have you added -O0 or the library and project "extra flags"? or disabled lib and project in same section? 

See both sets of settings off and/or empty in the attached image.

« Last Edit: Jun 1st, 2021 at 5:55pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
WWW  
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #10 - Jun 2nd, 2021 at 6:35am
Print Post  
But how does this setting differs between running visualmicro in vs2017 and vs2019, remind that it builds fine in vs2017?

And I can't remember me or any of my other colleagues have been changing this flag

I did email you the complete project yesterday to sales@visualmicro.com

Thanks,
Anders
  
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #11 - Jun 2nd, 2021 at 6:37am
Print Post  
If you prefer we could use teamviewer so you can run on my machine?

Thanks,
Anders
  
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #12 - Jun 2nd, 2021 at 6:49am
Print Post  
the 3 optimization flags are not existing in the vs2017 project settings, see attached screen-dumps of the project settings inside vs2017 and vs2019
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #13 - Jun 2nd, 2021 at 7:01am
Print Post  
I tried to set the 3 new project properties that disables optimization for core, Libraries and project and it then builds ok!!!

BUT the prog size is 5% bigger in vs2019 than building the same project with vs2017, how come this big difference?

see attached screen-dumps
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #14 - Jun 2nd, 2021 at 7:14am
Print Post  
I continued to test different combinations of these 3 new opt disable flags and found that only the disable optimization for project is necessary, but still prog size is 5% bigger, see attached screen-dump
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #15 - Jun 2nd, 2021 at 12:25pm
Print Post  
Hi

Thanks for all the info. We need to look into where the disabling of the optimization is coming from.

In the meantime, this switch is the normal/default mode which is what you should be seeing.

Code
Select All
-Os 



If you use that switch it will leave optimization on/normal.

  
Back to top
WWW  
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #16 - Jun 2nd, 2021 at 1:49pm
Print Post  
Hi yes -Os is shown in the output for both building in vs2017 and vs2019, but what about the prog size difference, about 30Kbyte more with vs2019?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #17 - Jun 4th, 2021 at 10:18am
Print Post  
Would it be possible to attach a clean set of logs from both VS2017 and VS2019 for review?
  
Back to top
 
IP Logged
 
Anders Eriksson
Junior Member
**
Offline


Posts: 30
Location: Gothenburg, Sweden
Joined: May 31st, 2021
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #18 - Jun 4th, 2021 at 10:35am
Print Post  
Certainly I really would like this to be solved.

Note the prog sizes 
for vs2017:
Program MotorController size: 132 444 bytes
but for vs2019:
Program MotorController size: 162 588 bytes
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: link error in vs2019 of a project that builds ok in vs2017
Reply #19 - Jun 4th, 2021 at 10:30pm
Print Post  
Hi, thanks very much for all the feedback and trials. We have found the issue. It relates to having previously disabled optimization, the switch off isn't working correctly. 

There have been a number of other minor updates that are currently being tested and a new release will be made before Monday. We will update this thread when the release is made.



  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint