VisualStudio Quick Start: Difference between revisions

From Miosix Wiki
Jump to navigation Jump to search
(Created page with "= 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 th...")
 
No edit summary
Line 31: Line 31:
6.  
6.  
The
The
following prompt will appear:[[Image:image001.jpg]]
following prompt will appear:  
 
[[File:Image001.jpg|thumbnail]]
   
   
Answer Yes to continue.
Answer Yes to continue.
Line 55: Line 55:


   
   
  [[Image:image003.jpg]]  
  [[File:image003.jpg|thumbnail]]  


   
   
Line 75: Line 75:
In
In
Visual Studio, choose File -> New -> Project. Pick VisualGDB from the
Visual Studio, choose File -> New -> Project. Pick VisualGDB from the
project templates and then select “Embedded Project”.[[Image:image005.jpg]]
project templates and then select “Embedded Project”.[[File:image005.jpg|thumbnail]]


   
   
Line 86: Line 86:
3.  
3.  
The
The
VisualGDB wizard appears.[[Image:image007.jpg]]
VisualGDB wizard appears.[[File:image007.jpg|thumbnail]]


   
   
Line 104: Line 104:


   
   
[[Image:image009.jpg]]Select ARM from the dropdown list
[[File:image009.jpg|thumbnail]]Select ARM from the dropdown list
and proceed with download after you have selected the latest version.
and proceed with download after you have selected the latest version.


   
   
Once completed, you will be asked to install device support files.
Once completed, you will be asked to install device support files.
Answer yes and download the support package you need. [[Image:image011.jpg]][[Image:image013.jpg]]Now
Answer yes and download the support package you need. [[File:image011.jpg|thumbnail]][[File:image013.jpg|thumbnail]]Now
select your device from the list and hit next. Note that you will need to
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
select the model of SoC on which your board is based and not the model of the
Line 126: Line 126:
connect to it. Start by installing OpenOCD by pressing “Install support for
connect to it. Start by installing OpenOCD by pressing “Install support for
additional debug methods” at the bottom of the screen, selecting OpenOCD and
additional debug methods” at the bottom of the screen, selecting OpenOCD and
clicking OK. You can also install other debuggers if you need them.[[Image:image015.jpg]]
clicking OK. You can also install other debuggers if you need them.[[File:image015.jpg|thumbnail]]


   
   
Line 133: Line 133:
   
   
Press “Detect” on the right and VisualGDB will try to connect to your
Press “Detect” on the right and VisualGDB will try to connect to your
board and configure OpenOCD. [[Image:image017.jpg]]Test if all is working correctly by
board and configure OpenOCD. [[File:image017.jpg|thumbnail]]Test if all is working correctly by
pressing “Test OpenOCD settings”. You can click finish and wait for the project
pressing “Test OpenOCD settings”. You can click finish and wait for the project
to be created. We are not done yet.
to be created. We are not done yet.
Line 142: Line 142:
Visual Studio, once the project is loaded, right click the project in Solution
Visual Studio, once the project is loaded, right click the project in Solution
Explorer and choose “VisualGDB Project Properties”. In the window that appears,
Explorer and choose “VisualGDB Project Properties”. In the window that appears,
choose Embedded Frameworks from the left and then uncheck “STM32F4Cube HAL”. [[Image:image019.jpg]]
choose Embedded Frameworks from the left and then uncheck “STM32F4Cube HAL”. [[File:image019.jpg|thumbnail]]


   
   
Line 150: Line 150:


   
   
[[Image:image020.jpg]]
[[File:image020.jpg|thumbnail]]


   
   
Line 171: Line 171:
project, choose Properties (last entry) and then Configuration properties ->
project, choose Properties (last entry) and then Configuration properties ->
NMake. At the very end of Inclusion file search path, paste the includes you
NMake. At the very end of Inclusion file search path, paste the includes you
have copied before. [[Image:image022.jpg]]
have copied before. [[File:image022.jpg|thumbnail]]


   
   
Line 187: Line 187:
concatenate to PATH=C:\SysGCC\arm-eabi\bin;%PATH% the
concatenate to PATH=C:\SysGCC\arm-eabi\bin;%PATH% the
paths of your Perl installation and Miosix toolchain installation. You should
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[[Image:image024.jpg]]
end up with something like: PATH=C:\SysGCC\arm-eabi\bin;%PATH%;C:\Strawberry\perl\bin;C:\arm-miosix-eabi\bin[[File:image024.jpg|thumbnail]]


   
   

Revision as of 09:08, 13 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. Go to [[1]] and complete the steps “Before you begin”, “Install the Miosix Toolchain”, “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 [[2]] 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.