Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Rebuild / Clean Solution: provide shortcut via Micro Menu (Read 908 times)
dok
Junior Member
**
Offline



Posts: 34
Rebuild / Clean Solution: provide shortcut via Micro Menu
Jul 25th, 2019 at 2:55pm
 
I find myself rather frequently using "Rescan toolchains and libraries" from the Micro Menu/General popup menu.
Then, I HAVE to click "Clean Solution" from the Visual Studio top-level "Build" menu. Next, I have to click the Build & Upload menu item or toolbar button.
Rather uncomfortable - the most time in this whole operation is on the poor user, the computer completes the intermediate steps rather instantly Smiley
Could you please provide some integral shortcut functions for this?
Btw, I'm am not paranoid, but at least on the ESP8266 developing a library requires REBUILDs all the time, or the changes don't get picked up by the linker properly Sad

Additional information: The ESP8266 intrinsic libraries, and there's quite a few of them, use in their library.properties:

dot_a_linkage=true

Maybe there's a bug in the dependency tree?
Back to top
« Last Edit: Jul 25th, 2019 at 4:53pm by dok »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #1 - Jul 25th, 2019 at 5:06pm
 
First of all the Build and Upload is for newer users. The standard Visual Studio Build or Debug menus provide same capability. There is nothing special about the Visual Micro Build and Upload buttons or menu items.

Your library should not need a rescan or rebuild if you have used the system that provides your library as a shared project in the solution explorer. How are you editing your library?

Dot-a-linkage is supported.
Back to top
 
WWW  
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #2 - Jul 28th, 2019 at 3:47pm
 
Pls read prev note but just a thought that maybe the cache is playing up with dot_a_linkage

Q:
Can you pls give small zip with simple example that fails in a solution with 1) shared library and 1) arduino project.

Q:
+ Assuming you do have a "references>shared project reference" from the arduino project to the lib?

Thanks
Back to top
 
WWW  
IP Logged
 
dok
Junior Member
**
Offline



Posts: 34
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #3 - Jul 31st, 2019 at 11:21am
 
I think I have quite different expectations.
In Arduino IDE style, I assume that either the dependencies are managed invisibly, or at least, that those project references you are referring to are automagically detected and set up during "Rescan toolchain and libraries". Neither is the case, it seems, as there are zero entries under "references->shared project references".
I am working on changes to the ESP8266 or ESP32 core, the libraries that are integral to those BSPs, or libraries installed in <sketchbook>/libraries. All default locations, all correctly picked up by Visual Micro IDE (invisibly). With the notable exception, that the ESP8266 integral libs (<sketchbook dir>\hardware\esp8266com\esp8266\libraries) are "dot_a_linkage=true", and for those I notice that source code changes don't get picked up by the make dependency system, unless I "force rebuild".

About the "Build and Upload" button. Relinking for each upload is a minor nuisance on a fast workstation already, but if I follow your suggestion of using the standard VS menus, I still have to locate either the menu item "upload last build" deep inside the menu structure, or click "Build and Upload", right? So there's no point in using the standard menus.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #4 - Jul 31st, 2019 at 11:36am
 
It sounds like just an issue with dot_a_linkage libs not releasing cache when you make manual changes to library code. WQe can look into that. Otherwise you are saying that it is identical.

However if you are adding new files to libraries, sounds like you are not then in visual micro you will need to use the create shared libtrary option so the new files are detected. It doesn't sound like you are creating new files in libraries so maybe you can ignore.

You are wrong about the usage of menus. The short cut keys on the Build and the Debug menu can all be used. As I said it's the same. Debug>Start F5 is compile and upload , same as Debug>Start without debugging. You will see that "Build" is CTRL+SHIFT+B

File>Open Project and File>Open Solution or File>New>Project also work, again you do not need to use the vMicro menu.

All vMicro menus and buttons can be placed anywhere in the IDE menus and bars, using the standard Customization option in Visual Studio.

Adding a shared library has other advantages. It gives intellisense specific to the currently selected board of the Arduino project. It also allows you to build your own list of libraries (even multiple versions of same library) in a location outside of the standard arduino library locations. This is important if you edit the libraries you do not want your modifications to be lost when you allow arduino or visual micro update/install new library version.

As I said, I will look at the issue if it is just the dot-a-linkage but I think you could review my answer in more depth and learn some things. The arduino ide is quite slow when you click build, this is because it has to re-read everything. The functionality in visual micro gives best speed, most flexibility and better protection of your changes.

The latest release of visual micro also supports auto creation of cloned library versions for Solution or Project but you can use the same system to create your own master list of shared libraries in any folder or folders that you want. Then you can share libraries in a single solution or for multiple solutions without our code breaking in the future after arduino update.

It's worth looking into shared libraries, especially for library coders.
Back to top
 
WWW  
IP Logged
 
dok
Junior Member
**
Offline



Posts: 34
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #5 - Jul 31st, 2019 at 8:08pm
 
Thanks for clarifying the actually satisfying integration with the standard build and run functionality - it wasn't obvious, so I naturally stuck to the toolbar and vMicro menu.

To make sure I wasn't sending you off bugtracking where it's just a misunderstanding on my part, I can confirm the following malfunction:

As an example, clone https://github.com/dok-net/Arduino.git master branch for the ESP8266 Arduino BSP into your sketchbook/hardware directory the usual way, …/Arduino/hardware/esp8266com/esp8266.

Assuming that you have an ESP8266 you can deploy to, use some simple sketch, ...\hardware\esp8266com\esp8266\libraries\ScheduledInterrupts\examples\Scheduled
Functional\ScheduledFunctional.ino for instance.

Rescan toolchains and libraries. Clean solution. Build solution -> fine.

Open ...\hardware\esp8266com\esp8266\libraries\FastScheduler\src\FastScheduler.cpp, introduce any syntax error, Build solution -> compiler error -> fine.

Undo syntax error, build solution -> SEEMS fine. Deploy, press button, serial log message appears, fine.

BUT:

Change

    void esp_loop()
    {
        loop();
        run_scheduled_functions(SCHEDULE_FUNCTION_FROM_LOOP);
    }

to

    void esp_loop()
    {
    }

thereby taking down the loop() function completely. Maybe throw in a Serial.println("loop is gone"); or whatever.

build solution -> SEEMS fine. Deploy, press button, oh, WTF! The just COMPILED changes are not in the deployed binary, but what was first compiled after the clean is there!

To verify, clean, build, deploy, only NOW the change is in the binary.

So, in short, the library archive is not refreshed from the recompiled compilation units, or it's not copied into the link directory.

This is the stuff that many wasted hours of development time are made of Wink

Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #6 - Aug 4th, 2019 at 5:01pm
 
I am not seeing an issue, we might need to look to see if you have changed the cache settings in F4 project properties or global options? or maybe I haven't set the test up very well.

If you see the yellow box above it shows how to switch on verbose compile. This shows us more clearly when a library is recompiled.

For my test I select any old library (AccelStepper) and switched on dot-a-linkage for the library.

I did not use the option to add as a shared library so the #include in my .ino file was the only reference to the library.

I also opened a .cpp file from the library so that I could make a change. Then when I clicked build I could see the change had been detected and the .a archive recreated like this.

Code (C++):
Using library AccelStepper version 1.58 in folder "file:///C:/Users/tl/Documents/Arduino/libraries/AccelStepper"
  Using previously compiled file: D:\System\WinTemp\VMBuilds\Dot_a_link_test\esp8266_generic\Release\AccelStepper\AccelStepper.cpp.o
"C:\Users\tl\AppData\Local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-IC:\Users\tl\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.5.2/tools/sdk/include" "-IC:\Users\tl\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.5.2/tools/sdk/lwip2/include" "-IC:\Users\tl\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.5.2/tools/sdk/libc/xtensa-lx106-elf/include" "-ID:\System\WinTemp\VMBuilds\Dot_a_link_test\esp8266_generic\Release/core" -c -w -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK221=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10809 -DARDUINO_ESP8266_GENERIC -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD=\"ESP8266_GENERIC\" -DLED_BUILTIN=2 -DFLASHMODE_DOUT -DESP8266 -I"C:\Users\tl\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266" -I"C:\Users\tl\AppData\Local\arduino15\packages\esp8266\hardware\esp8266\2.5.2\variants\generic" -I"C:\Users\tl\Documents\Arduino\libraries\AccelStepper\src" "C:\Users\tl\Documents\Arduino\libraries\AccelStepper\src\MultiStepper.cpp" -o "D:\System\WinTemp\VMBuilds\Dot_a_link_test\esp8266_generic\Release\AccelStepper\MultiStepper.cpp.o"

  Using previously compiled library archive: D:\System\WinTemp\VMBuilds\Dot_a_link_test\esp8266_generic\Release\AccelStepper\AccelStepper.a 



Please make a new simple test project using "File>New>Arduino Project" with empty setup() and loop() but with your library #included in the .ino code. Select your board and click build. Then make an error in your lib code and click build again. Then post the output as .txt file

Your report is a little confusing in the fact that your sketch code is acting differently but the error/change to the lib code hasn't been detected. It's possible you have two cachng issues because the .ino code shouldn't have sent any serial when you made an empty loop() and that would be unrelated to the library not being recompiled. So it is possible you options are wrong.

Let's look at the lib rebuild first and have that clear output as requested to show what is happening.

Thanks
Back to top
 
WWW  
IP Logged
 
dok
Junior Member
**
Offline



Posts: 34
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #7 - Aug 8th, 2019 at 2:32pm
 
Hi - I'm not sure if your proposed demonstration leads me to what I need to show. Please let's do it my way:

- Open a copy of the Blinker example (see screenshot)
- Rebuild
- Open hardware\esp8266com\esp8266\libraries\Ticker\src\Ticker.cpp
- Just build, locate in the verbose log, just to be sure:

Code:
Using library Ticker version 1.0 in folder "file:///D:/Users/dok/Documents/Arduino/hardware/esp8266com/esp8266/libraries/Ticker"
  Using previously compiled file: C:\Users\dok\AppData\Local\Temp\VMBuilds\Blinker\esp8266com_d1_mini\Release\Ticker\Ticker.cpp.o

  Using previously compiled library archive: C:\Users\dok\AppData\Local\Temp\VMBuilds\Blinker\esp8266com_d1_mini\Release\Ticker\Ticker.a
 



- Introduce any syntax error into Ticker.cpp, build, log file contains now:

Code:
Using library Ticker version 1.0 in folder "file:///D:/Users/dok/Documents/Arduino/hardware/esp8266com/esp8266/libraries/Ticker"
"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-ID:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266/tools/sdk/include" "-ID:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266/tools/sdk/lwip2/include" "-ID:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\dok\AppData\Local\Temp\VMBuilds\Blinker\esp8266com_d1_mini\Release/core" -c -Wall -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK22y=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10807 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD=\"ESP8266_WEMOS_D1MINI\" -DFLASHMODE_DIO -DESP8266 -I"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266" -I"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\variants\d1_mini" -I"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\libraries\Ticker\src" -I"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\libraries\FastScheduler\src" "D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\libraries\Ticker\src\Ticker.cpp" -o "C:\Users\dok\AppData\Local\Temp\VMBuilds\Blinker\esp8266com_d1_mini\Release\Ticker\Ticker.cpp.o"

Ticker.cpp: 35:2: error: found ':' in nested-name-specifier, expected

   _timer(nullptr)

Ticker.cpp: 35:10: error: expected constructor, destructor, or type conversion before '(' token
   _timer(nullptr)
  Using previously compiled library archive: C:\Users\dok\AppData\Local\Temp\VMBuilds\Blinker\esp8266com_d1_mini\Release\Ticker\Ticker.a 



- note file date of the Ticker.a archive file (15:08). That's from the original, successful compile... but there's more...

- Revert the previously introduced syntax error, if you feel like it, put in some change that will compile (something that triggers a compiler warning, maybe?). Build. Observe log, verify file date of the Ticker.a file (15:08):

Code:
Using library Ticker version 1.0 in folder "file:///D:/Users/dok/Documents/Arduino/hardware/esp8266com/esp8266/libraries/Ticker"
"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-g++" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-ID:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266/tools/sdk/include" "-ID:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266/tools/sdk/lwip2/include" "-ID:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266/tools/sdk/libc/xtensa-lx106-elf/include" "-IC:\Users\dok\AppData\Local\Temp\VMBuilds\Blinker\esp8266com_d1_mini\Release/core" -c -Wall -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 -std=gnu++11 -MMD -ffunction-sections -fdata-sections -fno-exceptions -DNONOSDK22y=1 -DF_CPU=80000000L -DLWIP_OPEN_SRC -DTCP_MSS=536 -DLWIP_FEATURES=1 -DLWIP_IPV6=0 -DARDUINO=10807 -DARDUINO_ESP8266_WEMOS_D1MINI -DARDUINO_ARCH_ESP8266 -DARDUINO_BOARD=\"ESP8266_WEMOS_D1MINI\" -DFLASHMODE_DIO -DESP8266 -I"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\cores\esp8266" -I"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\variants\d1_mini" -I"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\libraries\Ticker\src" -I"D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\libraries\FastScheduler\src" "D:\Users\dok\Documents\Arduino\hardware\esp8266com\esp8266\libraries\Ticker\src\Ticker.cpp" -o "C:\Users\dok\AppData\Local\Temp\VMBuilds\Blinker\esp8266com_d1_mini\Release\Ticker\Ticker.cpp.o"
Ticker.cpp: In constructor Ticker::Ticker()
Ticker.cpp: 38:8: warning: unused variable 'f' [-Wunused-variable]
   float f = x \ 3.14

  Using previously compiled library archive: C:\Users\dok\AppData\Local\Temp\VMBuilds\Blinker\esp8266com_d1_mini\Release\Ticker\Ticker.a 



Attachment 2 is a screenshot that shows how the build code obviously didn't recreate the archive file.

Yes, I'm hacking intrinsic libraries, does this make all the difference? No, using Code:
dot_a_linkage 

in my own library in <sketchbook>/libraries, the same behavior, once there is an .a archive, it's never updated again.
Back to top
« Last Edit: Aug 8th, 2019 at 2:35pm by dok »  

Blinker_002.png (26 KB | 6 )
Blinker_002.png
Ticker_001.png (45 KB | 5 )
Ticker_001.png
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #8 - Aug 8th, 2019 at 2:36pm
 
Ah okay thanks, we will zap the .a if the lib needs rebuild.
Back to top
 
WWW  
IP Logged
 
dok
Junior Member
**
Offline



Posts: 34
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #9 - Aug 8th, 2019 at 2:54pm
 
I can't update to the latest extension gallery release.
Back to top
 

already.png (4 KB | 5 )
already.png
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #10 - Aug 8th, 2019 at 3:01pm
 
I didn't say it was fixed I just said we now know what to fix. That message means there is no new version Smiley

However, it is now fixed in the 1908.7.2.
Back to top
« Last Edit: Aug 10th, 2019 at 11:34am by Visual Micro »  
WWW  
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #11 - Aug 8th, 2019 at 3:03pm
 
If you have other question about compile please create a new thread. This thread can then be assigned more clearly to dot-a-linkage rebuild.

If you post any questions about compile issues, please post an output showing the build with the issue or with the additional compiled files being recompiled. (in the new thread)
Back to top
« Last Edit: Aug 8th, 2019 at 3:04pm by Visual Micro »  
WWW  
IP Logged
 
dok
Junior Member
**
Offline



Posts: 34
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #12 - Aug 8th, 2019 at 3:27pm
 
I am sorry, I just wanted to let you know that I might not be using the latest version - I think I remember reading something relating to rebuilds in a recent changelog.
Also, I'm not stupid, the messagebox DOES show in error, because the Visual Studio extension updates tree keeps telling me that there is a new version - perhaps you didn't update all the version tags correctly?

Current version: 1908.5.0
New version: 1908.7.0



Rebuilding .o files like crazy COULD be related to not updating .a archives, that why I mentioned it here.
Next issues entry is coming right away.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #13 - Aug 8th, 2019 at 3:30pm
 
There was a new gallery version a few hours ago but the version that fixes the archive issue is not in the gallery yet.

As I said, the version you need is 1908.7.2 it is not in the gallery it is here in the "work in progress" thread https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
Back to top
 
WWW  
IP Logged
 
dok
Junior Member
**
Offline



Posts: 34
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #14 - Aug 8th, 2019 at 3:42pm
 
Except, that the VSIX installer refuses to install that either, same message box... Or wait, the box appeared, but it's updating now anyway after doing VS 2017 first (I'm actively using 2019).
Back to top
« Last Edit: Aug 8th, 2019 at 3:43pm by dok »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #15 - Aug 8th, 2019 at 3:53pm
 
I have refreshed the onedrive link for 1908.7.2 in the work in progress thread which might resolve the issue. This is it

https://1drv.ms/u/s!AsT00oFsGAmRnuUYREMWvnd8hdt0bA?e=GWEDKg
Back to top
 
WWW  
IP Logged
 
dok
Junior Member
**
Offline



Posts: 34
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #16 - Aug 8th, 2019 at 3:55pm
 
I'm clearly doing QA here Wink
Besides the oscillating build times (now another issue here as you asked for), the static archive is not rebuilt, but the .o file and the .d file are deleted, then recompiled - every other time... so sorry, I don't agree that these are different issues from my perspective...

(using the 1908.7.2 version)
Back to top
« Last Edit: Aug 8th, 2019 at 3:57pm by dok »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #17 - Aug 8th, 2019 at 4:00pm
 
The archive issue was clearly an issue that is resolved. It is possible this is related to using the arduino sketchbook\hardware folder for your custom tool chain and core. I used board manager to install esp8266 for my tests.

We will try to reproduce over the next few days

Back to top
 
WWW  
IP Logged
 
dok
Junior Member
**
Offline



Posts: 34
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #18 - Aug 8th, 2019 at 4:07pm
 
OK, one step back, the archive is rebuilt EVERY time the source changes - it's just not removed on compile failure, that confused me at first. Running the compiler every time is still an issue - but for the other report, not this one, I agree.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10623
United Kingdom
Re: Rebuild / Clean Solution: provide shortcut via Micro Menu
Reply #19 - Aug 10th, 2019 at 1:20pm
 
Looks like this is correct behaiour and is caused because you generate a new version.h for every build using a custom core build event hook.

https://www.visualmicro.com/forums/YaBB.pl?num=1565275024/0#14
Back to top
« Last Edit: Aug 10th, 2019 at 1:40pm by Visual Micro »  
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print