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
applications.txt not read in (MBED) (Read 9000 times)
garlicbread
Junior Member
**
Offline



Posts: 21
applications.txt not read in (MBED)
Nov 6th, 2016 at 10:59pm
 
Hi,
I've recently been looking at trying to get visual micro working with mbed

With the mbed cli tool (which can be installed via pip) all that needs to happen is a call to "mbed compile" with settings for the target board and GCC toolchain path
https://docs.mbed.com/docs/mbed-os-handbook/en/5.1/dev_tools/cli/#compiling-your
-program

However for the first question
I set the option Tools -> Options -> Visual Micro -> My Visual Micro Configs
to a path of C:\Apps\VMicro

I then put in there an applications.txt file with the following in

Code:
mbed_os_52.name=Mbed OS 5.2
mbed_os_52.ide.basedon=arduino15x
mbed_os_52.ide.location.ide.winreg=Mbed OS 5.2 Application
mbed_os_52.ide.location.sketchbook.winreg=Mbed OS 5.2 Sketchbook
mbed_os_52.ide.hint=Mbed OS 5.2
 



However this doesn't show up under Configure Ide locations in the drop down even if I restart VStudio or select Reload Toolchains

If I add it manually to the applications2.txt file in where the extension is located
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\sxiuva4e.y4m\Micro Platforms
Then it'll show up
I wonder if this is a bug or if I'm doing something wrong
(I do have the paid for version)

The next question is, since I just need a single call to "mbed compile" from the command line to let mbed do the actual compiling, would this be the best way to do it? (since I don't need a call for each C file)

platform.txt
Code:
name=Mbed OS ARM Boards
version=5.2.0

# Mbed compile variables
# ----------------------

compiler.path=./
compiler.c.elf.cmd=mbed
compiler.cpp.elf.cmd=mbed

# Mbed compile patterns
# ---------------------

## Compile c files
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" compile {build.mcu} -t GCC_ARM"

## Compile c++ files
recipe.cpp.combine.pattern="{compiler.path}{compiler.cpp.elf.cmd}" compile {build.mcu} -t GCC_ARM"
 



boards.txt
Code:
mbedos_lpc1769.name=Mbed Generic
mbedos_lpc1769.mcu=

mbedos_lpc1769.name=LPCXpresso LPC1769
mbedos_lpc1769.mcu=-m LPC1768
 


Back to top
« Last Edit: Nov 7th, 2016 at 7:25pm by Visual Micro »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10344
United Kingdom
Re: applications.txt not read in
Reply #1 - Nov 7th, 2016 at 1:55am
 
Hi,

Thanks for this post. I am very interested to help make visual micro work with mbed.

1)

For the applications.txt I hope it is not a bug.

If you have set the "My Visual Micro" folder to ""C:\Apps\VMicro" then I think the applications.txt should be in:-

"C:\Apps\VMicro\Micro Platforms\applications.txt"

2)

Quote:
The next question is, since I just need a single call to "mbed compile" from the command line to let mbed do the actual compiling, would this be the best way to do it? (since I don't need a call for each C file)


I might have to add a config switch for you to make this work.

It's possible you can use a pre-build hook for a single mbed call. However Visual Micro will still attempt to build the cpp and c files so we should agree something better.

Do you have example .bat commands that will build one known project?
Back to top
 
WWW  
IP Logged
 
garlicbread
Junior Member
**
Offline



Posts: 21
Re: applications.txt not read in
Reply #2 - Nov 7th, 2016 at 6:38pm
 
Thanks that change in path seemed to work

I've put a summary of how to use the mbed-cli / install it etc on a blog post here:

  * http://grbd.github.io/posts/2016/11/06/using-the-mbed-cli/

"mbed compile" should be all you need to build the example blinky project
It should be possible to set some of the configuration values via means other than the command line for mbed (details in blog post)

The options that visual micro would probably be interested in would be

  * -m to specify the target board (probably best to have at least one board where this isn't specified for custom boards)
  * --profile to specify the build profile such as "mbed-os/tools/profiles/debug.json" for debugging
  * -c to do a clean before the build

Bare bones example of a compile assuming everything is installed
is to do

Code:
# Download the source
mbed import https://github.com/ARMmbed/mbed-os-example-blinky
cd mbed-os-example-blinky

# Set some needed settings
mbed config target LPC1768
mbed toolchain GCC_ARM
mbed config GCC_ARM_PATH "C:\Program Files (x86)\GNU Tools ARM Embedded\5.4 2016q3\bin"

# Example of setting for debugging and overiding the target
mbed compile -c -m LPC1768 --profile mbed-os/tools/profiles/debug.json

# End result will be in
.\BUILD\LPC1768\GCC_ARM\mbed-os-example-blinky.bin
 


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



Posts: 10344
United Kingdom
Re: applications.txt not read in
Reply #3 - Nov 7th, 2016 at 6:47pm
 
excellent thanks, I will study
Back to top
 
WWW  
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10344
United Kingdom
Re: applications.txt not read in (MBED)
Reply #4 - Nov 7th, 2016 at 7:32pm
 
If you would like to try gdb then please install the android tools for visual studio via control panel>add or remove programs>?vs>change.

That will install the microsoft mi debugger and then visual micro will allow the "vMicro>Debugger>Use Visual Studio Debugger" option to be enabled.

The board and platform.txt can be edited to include the commands when you have them working. To test use a local project board.txt with similar to the following.

The gdb path needs to change to whatever you have used as the compiler path. The example is not accurate, params need to change. OCD path is correct.

Code:
#board
build.openocdscript=board/[mbed openOCD cfg name].cfg

#platform
debug.tool=gdb
tools.gdb.pre_init.tool=openocd
tools.gdb.cmd=arm­none­eabi­gdb.exe
tools.gdb.path={runtime.tools.arm­none­eabi­gcc.path}/bin
tools.gdb.pattern="{path}/{cmd}" ­interpreter=mi ­d "{build.project_path}"
tools.gdb.openocd.cmd=bin/openocd.exe
tools.gdb.tcp=localhost:3333
tools.gdb.openocd.path={runtime.vm.ide.platforms.path}/default/tools/openocd­0.9.0
tools.gdb.openocd.params.verbose=­d2
tools.gdb.openocd.params.quiet=­d0
tools.gdb.openocd.pattern="{path}/{cmd}" ­-f "{path}\scripts\interface\stlink-v2.cfg" s "{path}/scripts/" ­f "{path}/scripts/{build.openocdscript}"
 



Visual Micro installs openOCD below the default\tools folder below where the applications2.txt resides in case you want to add a .cfg file. If you get it working I can add to the distribution to save other having to make the changes.

note: if you don't use board.txt then the first entry needs the board id up the front. for example:-
uno.build.openocdscript=board/[mbed openOCD cfg name].cfg

.
Back to top
« Last Edit: Nov 7th, 2016 at 7:35pm by Visual Micro »  
WWW  
IP Logged
 
garlicbread
Junior Member
**
Offline



Posts: 21
Re: applications.txt not read in (MBED)
Reply #5 - Nov 7th, 2016 at 8:35pm
 
Thanks for the info
I'll have a go to see if I can get it to compile first (I don't know if a special hook is required yet), then look at gdb afterwards
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10344
United Kingdom
Re: applications.txt not read in (MBED)
Reply #6 - Nov 7th, 2016 at 8:51pm
 
Great. Look forward to hearing.

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



Posts: 21
Re: applications.txt not read in (MBED)
Reply #7 - Nov 8th, 2016 at 1:44am
 
I gave it a quick go building but ended up with the exception
```
Compiling debug version of 'BlinkyTest1' for 'Mbed Generic'
System.ArgumentException: The path is not of a legal form.
   at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.DirectoryInfo.Init(String path, Boolean checkHost)
   at System.IO.DirectoryInfo..ctor(String path)
   at Visual.Micro.MiroAppAPI.SketchCompiler.CreateFileTimeListXml(String fileType, String sPath, String outputPath)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino._compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino.compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp._CompileDo(Project oProject, Boolean IsDebugStartCommand, Boolean isRebuild, Boolean UseGdbIfAvailable)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp.CompileDo(Project oProject, Boolean IsDebugStartCommand, Boolean isRebuild, Boolean UseGdbIfAvailable)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp.Compile(Project oProject, Boolean IsDebugStartCommand, Boolean IsRebuild, Boolean UseGdbIfAvailable)
```

I put the files I'm using here

https://github.com/grbd/mbed.visualmicro.platform
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10344
United Kingdom
Re: applications.txt not read in (MBED)
Reply #8 - Nov 8th, 2016 at 1:15pm
 
Please switch on vMicro>Compiler>Verbose and vMicro>Compiler>Show Build Properties

Then build and email or post the output as .txt

Thanks very much
Back to top
 
WWW  
IP Logged
 
garlicbread
Junior Member
**
Offline



Posts: 21
Re: applications.txt not read in (MBED)
Reply #9 - Nov 8th, 2016 at 6:02pm
 
I've attached the output below
more than likley it's because I'm trying to cheat the system by skipping over the compile stage by using empty parameters

Code:
Board Properties
name=Mbed Generic
mcu=
runtime.ide.path=C:\Apps\VMicro\Micro Platforms\mbed_os_52
runtime.os=windows
build.system.path=C:\Apps\VMicro\Micro Platforms\mbed_os_52\hardware\arm\system
runtime.ide.version=166
target_package=arm
target_platform=arm
runtime.hardware.path=C:\Apps\VMicro\Micro Platforms\mbed_os_52\hardware
originalid=arm_arm_mbedos_generic
version=5.2.0
compiler.path=./
compiler.c.cmd=
compiler.c.flags=
compiler.c.elf.flags=
compiler.c.elf.cmd=mbed
compiler.S.flags=
compiler.cpp.cmd=mbed
compiler.cpp.flags=
compiler.cpp.elf.cmd=mbed
compiler.ar.cmd=msp430-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=
compiler.objcopy.eep.flags=
compiler.elf2hex.flags=
compiler.elf2hex.cmd=
compiler.ldflags=
compiler.size.cmd=
recipe.c.o.pattern=""
recipe.cpp.o.pattern=""
recipe.ar.pattern=""
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" compile {build.mcu} -t GCC_ARM"
recipe.cpp.combine.pattern="{compiler.path}{compiler.cpp.elf.cmd}" compile {build.mcu} -t GCC_ARM"
recipe.objcopy.hex.pattern=""
recipe.size.pattern=""
vm.platform.root.path=C:\Apps\VMicro\Micro Platforms\mbed_os_52
runtime.vm.boardinfo.id=arm_arm_arm_mbedos_generic
runtime.vm.boardinfo.name=arm_arm_arm_mbedos_generic
runtime.vm.boardinfo.desc=Mbed Generic
runtime.vm.boardinfo.src_location=C:\Apps\VMicro\Micro Platforms\mbed_os_52\hardware\arm
ide.hint=Mbed OS 5.2
ide.default.platform=arm
ide.platformswithoutpackage=true
ide.location.preferences=%VM_APPDATA_ROAMING%\mbed_os_52\preferences.txt
ide.location.key=mbed_os_52
ide.location.ide.winreg=Mbed OS 5.2 Application
ide.location.sketchbook.winreg=Mbed OS 5.2 Sketchbook
ide.location.sketchbook.preferences=sketchbook.path
ide.location.sketchbook.default=%MYDOCUMENTS%\mbed_os_52
ide.board_folders_are_platform_names=false
ide.appid=mbed_os_52
ide.iscustomapp=1
location.sketchbook=C:\Users\richard\Documents\Arduino
build.architecture=Common7
vmresolved.compiler.path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\
vmresolved.tools.path=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7
vm.core.include=wprogram.h
build.board=ARM_ARM_ARM_ARM_MBEDOS_GENERIC
vm.boardsource.path=C:\Apps\VMicro\Micro Platforms\mbed_os_52\hardware\arm
runtime.platform.path=C:\Apps\VMicro\Micro Platforms\mbed_os_52\hardware\arm
vm.platformname.name=arm
build.arch=ARM
builder.noino=false
vm.runtime.compiler.showwarnings=false
vm.runtime.upload.verbose=false
vm.runtime.upload.verify=false
vm.runtime.compiler.auto_discover_includes=true
build.vm.build.vmdebug=1
build.vm.build.isgdb=0
build.vm.build.optimised=1
vm.last.buildpath=C:\Users\richard\AppData\Local\Temp\VMicroBuilds\BlinkyTest1\arm_arm_arm_mbedos_generic

Compiling debug version of 'BlinkyTest1' for 'Mbed Generic'
Build folder: file:///C:/Users/richard/AppData/Local/Temp/VMicroBuilds/BlinkyTest1/arm_arm_arm_mbedos_generic
Additional Defines: VM_DEBUG;VM_DEBUG_ENABLE 1;VM_DEBUG_BANDWIDTH_THROTTLE_MS 50;VM_DEBUGGER_TYPE_HARDWARESERIAL 0;VM_DEBUGGER_TYPE_SOFTWARESERIAL 1;VM_DEBUGGER_TYPE_FASTSERIAL 2;VM_DEBUGGER_TYPE_USB 3;VM_DEBUGGER_TYPE_TEENSY 4;VM_DEBUGGER_TYPE_UART 5;VM_DEBUGGER_TYPE_USART 6;VM_DEBUGGER_TYPE_USBSERIAL 7;VM_DEBUGGER_TYPE_TTYUART 8;VM_DEBUGGER_TYPE_NET_CONSOLE 9;VM_DEBUGGER_TYPE_Uart 10;VM_DEBUGGER_TYPE_COSA 11;VM_DEBUGGER_TYPE_CDCSerialClass 12;VM_DEBUGGER_TYPE_HARDWARESERIAL1 13;VM_DEBUGGER_TYPE_HARDWARESERIAL2 14;VM_DEBUGGER_TYPE_HARDWARESERIAL3 15;VM_DEBUGGER_TYPE VM_DEBUGGER_TYPE_HARDWARESERIAL;VM_DEBUG_BREAKPAUSE;
Architecture Tools: ./
Sketchbook: file:\\\C:\Users\richard\Documents\Arduino
Sketch Include Paths
Core Include Paths
Include Path ''
Library Include Paths (1)
All import libraries will be re-compiled
System.ArgumentException: The path is not of a legal form.
   at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.IO.DirectoryInfo.Init(String path, Boolean checkHost)
   at System.IO.DirectoryInfo..ctor(String path)
   at Visual.Micro.MiroAppAPI.SketchCompiler.CreateFileTimeListXml(String fileType, String sPath, String outputPath)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino._compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   at Visual.Micro.MiroAppAPI.SketchCompilerArduino.compile(SketchBuilder lsketch, String primaryClassName, Boolean verbose, Boolean isDebug)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp._CompileDo(Project oProject, Boolean IsDebugStartCommand, Boolean isRebuild, Boolean UseGdbIfAvailable)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp.CompileDo(Project oProject, Boolean IsDebugStartCommand, Boolean isRebuild, Boolean UseGdbIfAvailable)
   at Visual.Micro.Visual.Studio.Arduino.AddInApp.Compile(Project oProject, Boolean IsDebugStartCommand, Boolean IsRebuild, Boolean UseGdbIfAvailable)
 

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



Posts: 10344
United Kingdom
Re: applications.txt not read in (MBED)
Reply #10 - Nov 8th, 2016 at 6:06pm
 
I think you are right. I will look at a switch to say don't build.

I guess you just want a single hook instead of the entire build process?
Back to top
 
WWW  
IP Logged
 
garlicbread
Junior Member
**
Offline



Posts: 21
Re: applications.txt not read in (MBED)
Reply #11 - Nov 8th, 2016 at 6:25pm
 
A single hook would be useful
Ideally I need to run "mbed compile" with the working directory being the project directory

This could also double up as useful for folks that want to use a custom python script for the build process in the project directory
(they'd just need to call python script.py for example)
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10344
United Kingdom
Re: applications.txt not read in (MBED)
Reply #12 - Nov 9th, 2016 at 12:44am
 
See how you get on with this version. It has support for a custombuild hook described in the draft doc below

Visual Micro VSIX ver 1611.8

hooks.custombuild www.visualmicro.com/page/Arduino-Build-Events-and-Hooks.aspx
Back to top
« Last Edit: Nov 9th, 2016 at 12:44am by Visual Micro »  
WWW  
IP Logged
 
garlicbread
Junior Member
**
Offline



Posts: 21
Re: applications.txt not read in (MBED)
Reply #13 - Nov 9th, 2016 at 10:54pm
 
Thanks this works great   Cheesy
I've now got mbed building with the new hook, I've placed the files I'm using and docs on how to set it up for others under

https://github.com/ASoftTech/mbed.visualmicro.platform

I've now got all the boards / targets listed and selectable.
The next thing I'm going to look at is getting gdb working with all the info you've given me so far.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10344
United Kingdom
Re: applications.txt not read in (MBED)
Reply #14 - Nov 9th, 2016 at 11:27pm
 
Great thanks very much!

When you are ready I would also like to ensure intellisense is working and ability to add libraries/lib files etc., ability to create new projects or more easily open existing ones, drill down into source from compiler errors etc. You must be missing some stuff in some areas?

Is intellisense not already a problem for you at the moment or have you made your own intellisense paths in platform.txt?

Let me know if you need any help with gdb. Thanks again.

Back to top
« Last Edit: Nov 9th, 2016 at 11:31pm by Visual Micro »  
WWW  
IP Logged
 
garlicbread
Junior Member
**
Offline



Posts: 21
Re: applications.txt not read in (MBED)
Reply #15 - Nov 9th, 2016 at 11:53pm
 
There are some intelisense issues I think mostly includes that the compiler is okay with but VStudio thinks is missing
I didn't realize platform.txt could influence that, I'll need to check to see how that works

For libraries this lists what's installed
Code:
mbed ls -a
 



Libs can be added or removed with
Code:
mbed add https://developer.mbed.org/users/wim/code/TextLCD/
mbed remove TextLCD
 



But I don't know of a fixed list of available libs, I think you just need to specify a link to the repo. This seems like a good source of libs though https://developer.mbed.org/code/

For the blinky example it's just the base mbed-os library that's installed

One thing I will need to add is a Tool command for "mbed deploy" this reads in any .lib text files in the project and downloads the actual content of each of the libraries and or any dependencies (similar to a Nuget restore)

Also I need to check if the built files need to be converted into a hex file before uploading etc
Back to top
« Last Edit: Nov 10th, 2016 at 12:09am by garlicbread »  
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10344
United Kingdom
Re: applications.txt not read in (MBED)
Reply #16 - Nov 10th, 2016 at 12:05am
 
Take a look at the platform.txt files for the arduino16x\samd. Not the best example but will show how you can feed additional paths to intellisense.

If you need to force any constants then take a look at intellisense.code.txt in the same folder. It's a dumping ground just to force intellisense to work better. You should be able to put this below the "my visual micro" folder in a similar structure.

Project and core intellisense should then work but library intellisense will still be looking at arduino libraries or not there at all.
Back to top
 
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print