VS Arduino
Visual Micro >> Microchip Studio (Atmel Studio 7) >> Different board for each project?
https://www.visualmicro.com/forums/YaBB.pl?num=1499162555

Message started by Arecon on Jul 4th, 2017 at 10:02am

Title: Different board for each project?
Post by Arecon on Jul 4th, 2017 at 10:02am
Hi
I have a solution with 5 projects which are compiled for 2 different types of microcontroller.

At the moment I believe I have managed to set each of these projects to the correct controller type but that was not easy. I tried the several places in Atmel Studio where the target controller can be set and several times the set controller was changed back when I configured another project or even switched to a completely unrelated controller type.

Best Regards
Arecon

Title: Re: Improve support for solutions with different controllers
Post by Visual Micro on Jul 4th, 2017 at 11:05pm
Please state which hardware you are using.

Only the visual micro board setting is important for visual micro which is stored per project with only one setting via boards list on tool bar or vmicro menu

Thanks

Title: Re: Improve support for solutions with different controllers
Post by Visual Micro on Jul 5th, 2017 at 8:46pm
Cross post

http://www.visualmicro.com/forums/YaBB.pl?num=1499167217

Title: Re: Improve support for solutions with different controllers
Post by Arecon on Aug 22nd, 2017 at 12:51pm
Another issue: Building a solution by using the "Build Solution" command seems to ignore the board setting for the individual projects.

Title: Re: Improve support for solutions with different controllers
Post by Visual Micro on Aug 22nd, 2017 at 1:33pm
No it doesn't do that for me.

I think possible confusion is that you have not specifically set a board for each project? Visual Micro will use the last used board until you specifically choose a board for a project

For example I just created a new solution with two projects. I set a different board for each project and build solution. You can see the  two different boards are selected correctly for each build.

[code]Compiling debug version of 'saa' for 'Arduino Mega ADK'
Program size: 2,770 bytes (used 1% of a 253,952 byte maximum) (3.54 secs)
Minimum Memory Usage: 300 bytes (4% of a 8192 byte maximum)


Compiling debug version of 'Sketch1' for 'Arduino/Genuino Uno'
Program size: 1,688 bytes (used 5% of a 32,256 byte maximum) (3.56 secs)
Minimum Memory Usage: 272 bytes (13% of a 2048 byte maximum)

[/code]

Title: Re: Different board for each project?
Post by Arecon on Aug 26th, 2017 at 12:34am
Hi
Off course I have set the board for each project. Several times for each project because the setting kept changing erraticaly for some time as I described in other threads.

An example from exactly now:

I just opened my solution. It contains a couple of projects. Most for ATTiny828 and 1 for Arduino Due. The due project is selected as Startup Project because one project has to be selected as startup project.
I select a file in one of the Tiny projectes which I have compiled for ATTiny828 100 times before. The settings in the VM toolbar does not change to Tiny. It stays with Arduino Due! Then I open the context menu auf othe ATTiny project and click "Build".

The output is:

Visual Micro free version. CTRL+click for secure purchase http://www.visualmicro.com/page/shop.aspx

Compiling 'FrontPanelT828_A_Pot' for 'Arduino Due (Programming Port)'
Program size: 21.860 bytes (used 4% of a 524.288 byte maximum) (3,14 secs)


As expected. Now it click on the Arduino Due project and then again on the Tiny project. Back and forth. Now the setting in the toolbar switches to ATTiny828!

I click Build again and now it builds the project with the correct board setting.

Now I click ont he solution node in the tree, open the context menu and click "Build Solution".

Output:
Visual Micro free version. CTRL+click for secure purchase http://www.visualmicro.com/page/shop.aspx

Compiling 'ControllerDue' for 'Arduino Due (Programming Port)'

ControllerDue.ino: 2:25: fatal error: Oscillator2.h: No such file or directory
   #include "Oscillator2.h"
   compilation terminated



     An error was encountered during the 'Deep Search' library discovery process.
Build failed for project 'ControllerDue'
Visual Micro free version. CTRL+click for secure purchase http://www.visualmicro.com/page/shop.aspx

Compiling 'PulserT828' for 'ATtiny828 (No bootloader)'
Program size: 5.748 bytes (used 70% of a 8.192 byte maximum) (3,94 secs)
Minimum Memory Usage: 154 bytes (30% of a 512 byte maximum)

Visual Micro free version. CTRL+click for secure purchase http://www.visualmicro.com/page/shop.aspx

Compiling 'FrontPanelT828_A_Pot' for 'Arduino Due (Programming Port)'
Program size: 21.860 bytes (used 4% of a 524.288 byte maximum) (0,49 secs)

Visual Micro free version. CTRL+click for secure purchase http://www.visualmicro.com/page/shop.aspx

Compiling 'FrontPanelT828_A_QEnc' for 'ATtiny828 (No bootloader)'
Program size: 3.660 bytes (used 45% of a 8.192 byte maximum) (2,51 secs)
Minimum Memory Usage: 321 bytes (63% of a 512 byte maximum)

Visual Micro free version. CTRL+click for secure purchase http://www.visualmicro.com/page/shop.aspx

Compiling 'FrontPanelT828_B' for 'Arduino Due (Programming Port)'

FrontPanelT828_B.ino:5: In file included from

FrontPanelT828_B_Globals.h: 19:33: error: 'PIN_C6' was not declared in this scope
   #define Pin_InBtnAudioSetupMenu PIN_C6
FrontPanelT828_B.ino:18: note  in expansion of macro Pin_InBtnAudioSetupMenu
   OneButtonMbu btnAudioSetupMenu(Pin_InBtnAudioSetupMenu, true, BtnAudioSetupMenu)

[stream of error messages truncated]

FrontPanelT828_B_Globals.h: 20:30: error: 'PIN_C5' was not declared in this scope
   #define Pin_InBtnASelectProg PIN_C5
FrontPanelT828_B.ino:19: note  in expansion of macro Pin_InBtnASelectProg
   OneButtonMbu btnASelectProg(Pin_InBtnASelectProg, true, BtnASelectProg)


As expected.
So I have to compile every project one by one and I always have to make sure the the correct board is selected because the setting is only applied after a few clicks through the projects.

Arecon

Title: Re: Different board for each project?
Post by Arecon on Aug 26th, 2017 at 12:41am
Another interesting discovery:

There is one project in my solution that always gets the board selection from the project I selected before. If I click on the Due project and then on the mentioned project it is compiled for Arduino Due but if I first click on another ATTiny project, the mentioned project is also compiled for ATTiny.

Arecon

Title: Re: Different board for each project?
Post by Visual Micro on Aug 26th, 2017 at 8:37pm
I suspect the confusion is the settings to determine if the active code file syncs with the solution explorer

Try viewing/editing a source code file (such as project1.ino) for the project you want to set the board for. Then set the board.

Visual Studio has a strange concept of what the active source code or project is. For example you could have project1.ino open in the editor but the solution explorer could be positioned on the name of the solution which is NO project.

For users who have a code file open they normally expect the arduino board to be displayed for the code. The solution explorer could be positioned on an entirely different project to the active code so again what should the board selection show?

Make sure the "Micro Boards" tool bar is visible so you can more easily see which board is selected.

Make sure you set the board once for each project while active code is open in the editor.

The Startup project relates only to which project is built and uploaded when using the standard visual studio "Start commands". The visual micro build and upload commands build and upload the project of the active code (which is similar to way the board is determined).

Does this help?


Title: Re: Different board for each project?
Post by Arecon on Aug 27th, 2017 at 5:43pm
Hi

Does that mean that the active board selection of Visual Micro always and only depends on the active source code tab and that it only switches when clicking in the solution explorer because this also leads to switching of the active code tab?

If that is the case then I actually misunderstood the behavior.

I almost always use the solution explorer and its context menus for building and testing because I thought that this was the most reliable way to tell Visual Studio which project I mean when I have several source files from several projects open.

Arecon

Title: Re: Different board for each project?
Post by Visual Micro on Aug 27th, 2017 at 6:59pm
If you create Project1 and Project2 in the same solution...

1)

Select Project1 in the solution explorer and ensure that Project2.ino is open as a table in the editor

Then take a look at the standard VS "Build" menu, you will see the following it has some options for "Build Project2" and not build Project1

Visual Micro has to follow this way of working otherwise it confuses everyone (from experience). It also allows you to use the standard visual studio short cut keys to build the active code project.

2)

Set a specific board for Project2.ino and then switch the editor tab to Project1.ino.

Select a different board for Project1.ino

3)

With Project1.ino still selected as the active editor tab, right click Project2 in the solution explorer and select "Start new instance" or "launch" or whatever you can find that debug/runs a normal vs project.  This command should use the board or Project2 and build/upload. Does it do that?

So to re-cap, in this case you would expect to be able to use the solution explorer to build a project for board A while the active editor/board shows board B.

4)

If you have a solution open with more than one arduino project, each using a different board. Build>Solution should build each project using the correct board regardless of whatever is selected in the active code editor.

5)

If you click Debug>Start VS will tell Visual Micro to build the current startup project using whichever board has been specified for the project. If no board has been specified the currently selected editor board will be used.

6)

There are two options in visual studio that enable the sync between code and solution tree when you edit code or click the tree

The one for clicking the tree is a mini icon above the solution explorer, the other is in tools>options>solutions.


Hope that makes sense. Let me know if anything isn't how it is supposed to be

Title: Re: Different board for each project?
Post by Arecon on Aug 27th, 2017 at 9:27pm

Tim@Visual Micro wrote on Aug 27th, 2017 at 6:59pm:
If you create Project1 and Project2 in the same solution...

1)

Select Project1 in the solution explorer and ensure that Project2.ino is open as a table in the editor

Then take a look at the standard VS "Build" menu, you will see the following it has some options for "Build Project2" and not build Project1

No, it behaves differently.

A file from Project3 is shown in the current tab.
The Build menu shows "Build Project3".
I click on Project1 in solution explorer.
The Build menu shows "Build Project1".
The file from Project3 is still the active tab.
Now I open a file from Project2.
The file from Project2 is now the active tab.
The Build menu shows "Build Project2".

The Build menu always follows my mouse clicks. No matter wether I select a tab of an open document, open another document or click around in source explorer. In all cases my last mouse click decides what the Build menu considers the project to build.

The toolbar of VisualMicro follows this logic in most cases. But in some cases it misses the switch command.



Quote:
2)

Set a specific board for Project2.ino and then switch the editor tab to Project1.ino.

Select a different board for Project1.ino

3)

With Project1.ino still selected as the active editor tab, right click Project2 in the solution explorer and select "Start new instance" or "launch" or whatever you can find that debug/runs a normal vs project.  This command should use the board or Project2 and build/upload. Does it do that?

No. It uses Project1.
But if I click a second time with the right mouse key on the project node while the context menu is open, so that the context menu is closed and re-opened, Project2 is selected. Also the selection in the board drop-down switches with this second mouse click.


Quote:
So to re-cap, in this case you would expect to be able to use the solution explorer to build a project for board A while the active editor/board shows board B.

That was my expectation but as I now found out the project selection only becomes active after a second mouse click. that could explain the erratic behaviour I erperienced because I did everything by context menu and did not observe whether I opened the context menu with the first click on a project or with a later click.


Quote:
5)

If you click Debug>Start VS will tell Visual Micro to build the current startup project using whichever board has been specified for the project. If no board has been specified the currently selected editor board will be used.

I would prefer to have a "no board selected" entry in the drop-down instead of Visual Micro using whatever board the project clicked before had selected.

Thanks for the explanations.


Arecon

Title: Re: Different board for each project?
Post by Arecon on Aug 27th, 2017 at 9:48pm
If you like I can send you a screen capture video from the context menu thing. It is only 328KB.

Title: Re: Different board for each project?
Post by Visual Micro on Aug 27th, 2017 at 10:22pm
Switch off the options I mentioned and see difference

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.