VisualStudio Quick Start: Difference between revisions

From Miosix Wiki
Jump to navigation Jump to search
m (Use internal links)
m (Formatting changes and removed thumbnail tag to first images)
Line 1: Line 1:
= Installing VisualGDB, Miosix =
= Installing VisualGDB, Miosix =
   
   
1. First of all, make sure to have installed Visual Studio, the supported versions are 2005-2015, exception made for the Express Editions that are not supported. If you need Visual Studio, you can download the 2015 Community Edition, that is free.
1.
First of all, make sure to have installed Visual Studio, the supported versions are 2005-2015, exception made for the Express Editions that are not supported. If you need Visual Studio, you can download the 2015 Community Edition, that is free.


2.  
2.  
Let’s get the environment ready for Miosix. Follow the [[Windows Quick Start|Getting Started on Windows]] guide and complete the steps “Before you begin”, “Install the Miosix Toolchain” and “Get the Miosix kernel sources”. Now
Let’s get the environment ready for Miosix. Follow the [[Windows Quick Start|Getting Started on Windows]] guide and complete the steps “Before you begin”, “Install the Miosix Toolchain” and “Get the Miosix kernel sources”. Now enter the miosix-kernel folder and complete the “Configuring the kernel” step.
enter the miosix-kernel folder and complete the “Configuring the kernel” step.
If you work with many boards, you would better clone the kernel many times in different folders (one folder for each board) and repeat the “Configuring the
If you work with many boards, you would better clone the kernel many times in
kernel” step for each folder. In the file  miosix/config/Makefile.inc please make sure that all variables OPT_OPTIMIZATION are commented out.
different folders (one folder for each board) and repeat the “Configuring the
kernel” step for each folder. In the file  miosix/config/Makefile.inc please make
sure that all variables OPT_OPTIMIZATION are commented out.


3.  
3.  
Close
Close Visual Studio if it’s open.
Visual Studio if it’s open.


4.  
4.  
Download
Download VisualGDB from [[http://visualgdb.com/download/]] and install it by following the wizard.
VisualGDB from [[http://visualgdb.com/download/]] and install it by following the
wizard.


5.  
5.  
Open
Open Visual Studio
Visual Studio


6.  
6.  
The
The following prompt will appear:
following prompt will appear:  
 
[[File:Image001.jpg|thumbnail]]
[[File:Image001.jpg]]
 
Answer Yes to continue.
Answer Yes to continue.


7.  
7.  
Another
Another popup will notify you of the operation success and ask to restart Visual Studio. Do it.
popup will notify you of the operation success and ask to restart Visual
Studio. Do it.


8.  
8.  
Another
Another VisualGDB screen will appear asking for your license details. For the moment you can start a trial (full featured for 30 days) or enter your license key.
VisualGDB screen will appear asking for your license details. For the moment
you can start a trial (full featured for 30 days) or enter your license key.


9.  
9.  
Now
Now you are prompted to choose wheter to use the VisualGDB-provided IntelliSense or continue to use the default Visual Studio Intellisense.
you are prompted to choose wheter to use the VisualGDB-provided IntelliSense or
 
continue to use the default Visual Studio Intellisense.
[[File:image003.jpg]]
[[File:image003.jpg|thumbnail]]
I recommend the Visual Studio IntelliSense. Uncheck the checkbox “enable
the engine..” and the “Show this dialog when VS
starts” one too.


I recommend the Visual Studio IntelliSense. Uncheck the checkbox “enable the engine..” and the “Show this dialog when VS starts” one too.
   
   
= 2         Creating a new project =
= 2 Creating a new project =
   
   
You
You

Revision as of 13:36, 14 April 2016

Installing VisualGDB, Miosix

1. First of all, make sure to have installed Visual Studio, the supported versions are 2005-2015, exception made for the Express Editions that are not supported. If you need Visual Studio, you can download the 2015 Community Edition, that is free.

2. Let’s get the environment ready for Miosix. Follow the Getting Started on Windows guide and complete the steps “Before you begin”, “Install the Miosix Toolchain” and “Get the Miosix kernel sources”. Now enter the miosix-kernel folder and complete the “Configuring the kernel” step. If you work with many boards, you would better clone the kernel many times in different folders (one folder for each board) and repeat the “Configuring the kernel” step for each folder. In the file miosix/config/Makefile.inc please make sure that all variables OPT_OPTIMIZATION are commented out.

3. Close Visual Studio if it’s open.

4. Download VisualGDB from [[1]] and install it by following the wizard.

5. Open Visual Studio

6. The following prompt will appear:

Image001.jpg

Answer Yes to continue.

7. Another popup will notify you of the operation success and ask to restart Visual Studio. Do it.

8. Another VisualGDB screen will appear asking for your license details. For the moment you can start a trial (full featured for 30 days) or enter your license key.

9. Now you are prompted to choose wheter to use the VisualGDB-provided IntelliSense or continue to use the default Visual Studio Intellisense.

Image003.jpg

I recommend the Visual Studio IntelliSense. Uncheck the checkbox “enable the engine..” and the “Show this dialog when VS starts” one too.

2 Creating a new project

You have to repeat this walkthrough every time you would like to create a new project based on miosix. If you feel that the procedure is too long, you can make a project stub for each platform/board you work with, and then reuse it as many times you want by copying it.


1. In Visual Studio, choose File -> New -> Project. Pick VisualGDB from the

project templates and then select “Embedded Project”.

Image005.jpg


2. If the project path contains spaces, you are warned about it. I strongly recommend to put the project in a path that doesn’t contain spaces.


3. The

VisualGDB wizard appears.

Image007.jpg


Here you can choose the desired output files. They will be put in the bin folder of the project, as for all other VS projects. Those files will be useful to you only if you need to send or publish them, since VisualGDB automatically deploys the project to the board when you run the project. Hit Next.


4. The Device Selection Screen appears. Before searching for your SoC from the list, you have to download the ARM toolchain. Due to changes that we will make later, that toolchain won’t be used to compile your project (Miosix toolchain will be used instead) but only to debug it. This has to be done only one time.


Image009.jpg

Select ARM from the dropdown list

and proceed with download after you have selected the latest version.


Once completed, you will be asked to install device support files.

Answer yes and download the support package you need.

Image011.jpg
Image013.jpg

Now

select your device from the list and hit next. Note that you will need to select the model of SoC on which your board is based and not the model of the board itself.


5. Leave the settings of the Sample Selection screen to their defaults, since we will delete all those files. Continue to the next screen.


6. Now it’s time to connect your board to the computer and verify that VisualGDB can connect to it. Start by installing OpenOCD by pressing “Install support for additional debug methods” at the bottom of the screen, selecting OpenOCD and

clicking OK. You can also install other debuggers if you need them.

Image015.jpg


Now select from the top dropdown list “Debug method” OpenOCD.


Press “Detect” on the right and VisualGDB will try to connect to your

board and configure OpenOCD.

Image017.jpg

Test if all is working correctly by

pressing “Test OpenOCD settings”. You can click finish and wait for the project to be created. We are not done yet.


7. In Visual Studio, once the project is loaded, right click the project in Solution Explorer and choose “VisualGDB Project Properties”. In the window that appears,

choose Embedded Frameworks from the left and then uncheck “STM32F4Cube HAL”.

Image019.jpg


Apply the changes and close the window by pressing OK. Go back focusing the Solution Explorer panel. Delete from the project the files system_stm32f4xx.c, stm32f4xx_hal_conf.h, startup_stm32f429xx.c, LEDBlink.cpp.


Image020.jpg


8. It’s time to integrate Miosix in the project. Open the project in Windows Explorer and copy to the project folder the miosix folder (and not the miosix-kernel folder) you got in step 1.2. Now replace debug.mak, release.mak and Makefile in the project folder with those provided with miosix kernel.


9. We are almost ready. Now let’s make the IntelliSense working by specifying the correct miosix folders where to look for .h files. Open a command prompt in the project directory (just right click the project in VS, choose Show in Explorer, and from there right click while pressing SHIFT -> Open command prompt here) and type make print-includes . Select the includes printed and press enter to copy the text. Now go back to VS, right click the project, choose Properties (last entry) and then Configuration properties -> NMake. At the very end of Inclusion file search path, paste the includes you

have copied before.

Image022.jpg


10. Lastly, we need to tell VisualGDB where to find Perl and the Miosix toolchain. If you haven’t those directories on the PATH variable of your system, or the compilation phase complains about executables not found, proceed with this step, otherwise skip.


Right click the project in Solution Explorer, choose “VisualGDB Project Properties”. In the window that appears, choose Makefile Settings from the left and then, under “Build Tools”, press Customize at the right of “Make command”. Now concatenate to PATH=C:\SysGCC\arm-eabi\bin;%PATH% the paths of your Perl installation and Miosix toolchain installation. You should

end up with something like: PATH=C:\SysGCC\arm-eabi\bin;%PATH%;C:\Strawberry\perl\bin;C:\arm-miosix-eabi\bin

Image024.jpg


11. Create a new main.cpp file and you are ready to go! If you like, you can copy to the root of the project the main.cpp file provided with miosix, and include it in the project to get started quicker. To do so, once you copied the file, choose “show all files” in Solution Explorer, then right click main.cpp and select “Include in the project”.


3 Customizing compilation

You can use the release.mak and debug.mak Makefiles to tune the compilation process for both Debug and Release configurations.


Use TOOLCHAIN_ROOT to specify Miosix toolchain location.


Use the INCLUDE_DIRS, LIBRARY_DIRS, LIBRARY_NAMES, STATIC_LIBS variables to specify your additional libraries. Includes for mxgui library are already present, remove them if you don’t plan to use that library.