Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Change Default VMicro Project and after-update behavior? (Read 3444 times)
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Change Default VMicro Project and after-update behavior?
Jan 6th, 2020 at 4:42pm
Print Post  
I use #pragma a lot in my Arduino projects to help declutter code, so every time I create a new Arduino project I have to remember to add '-Wno-unknown-pragmas' to VMicro->Compiler->Advanced->extra cpp flags

Also, each time VMicro gets updated, the 'Optimize rendering...' checkbox gets re-checked, and I have to go  uncheck it again when I notice that the serial monitor window no longer displays correctly.

Is there any way to avoid these repetitive tasks via some sort of user global options file that VMicro can use to override it's normal new project and after-update behavior?

TIA,

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Change Default VMicro Project and after-update behavior?
Reply #1 - Jan 6th, 2020 at 4:52pm
Print Post  
We might be able to add an option with a default -Wno-unknown-pragmas for all projects. It's a good idea. In the meantime you could add it to the compiler command in the platform.txt that would set it in all projects of that platform.

The optimize rendering is a vs setting that Visual Micro does not change. Visual studio defaults to ON and that is no longer an issue in visual micro builds of past few months. Visual Micro should work with it on. So I am confused about this report.

Which vs version are you using from help>about and which visual micro version on extensions and updates?



  
Back to top
WWW  
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: Change Default VMicro Project and after-update behavior?
Reply #2 - Jan 8th, 2020 at 10:09pm
Print Post  
Tim,

Thanks for the response. VS 16.4.2, VM 1.1911.23.  I just recently (within the last few days) updated both to the most current version, and that's when I started having problems with the serial monitor display (again). Same symptoms - bottom cut off, but when a display refresh is forced by resizing the screen, everything comes back.  When I (once again) UNchecked the 'Optimize rendering...' checkbox and restarted my PC.  All was well again.

Regarding the platform.txt idea, I'm not sure which of the 98 instances of 'platform.txt' I should edit.  I primarily run Arduino UNO, MEGA and Teensy 3.x projects.  The one I found in 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\t4fb1en2.4xb\Micro Platforms\wiring10x\hardware\Arduino' (dated 01/04/2020) seemed to be the most relevant (at least for my non-Teensy projects.



Code
Select All
 build.core.libraries.path={runtime.ide.path}\cores\AVR8Bit\Libraries

# Arduino AVR Core and platform.
# ------------------------------

# For more info:
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification

name=Wiring Arduino AVR Boards
version=1.0.5

upload.tool=avrdude

# AVR compile variables
# ---------------------

# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.ide.path}/tools/avr/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections
# -w flag added to avoid printing a wrong warning http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
# This is fixed in gcc 4.8.3 and will be removed as soon as we update the toolchain
compiler.c.elf.flags=-w -Os -Wl,--gc-sections
compiler.c.elf.cmd=avr-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=avr-g++
compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections
compiler.ar.cmd=avr-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=avr-objcopy
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2hex.flags=-O ihex -R .eeprom
compiler.elf2hex.cmd=avr-objcopy
compiler.ldflags=
compiler.size.cmd=avr-size

# This can be overriden in boards.txt
build.extra_flags=

# These can be overridden in platform.local.txt
compiler.c.extra_flags=
compiler.c.elf.extra_flags=
compiler.S.extra_flags=
compiler.cpp.extra_flags=
compiler.ar.extra_flags=
compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags=

# AVR compile patterns
# --------------------

## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} {ide.compiler.defines} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} {ide.compiler.defines} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Compile S files
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} {ide.compiler.defines}  -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"

## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm

## Create eeprom
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"

## Create hex
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"

## Compute size
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*


# AVR Uploader/Programmers tools
# ------------------------------

tools.avrdude.cmd.path={runtime.ide.path}/tools/avr/bin/avrdude
tools.avrdude.config.path={runtime.ide.path}/tools/avr/bin/avrdude.conf

tools.avrdude.upload.params.verbose=-v -v -v -v
tools.avrdude.upload.params.quiet=-q -q
tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude.program.params.verbose=-v
tools.avrdude.program.params.quiet=-q -q
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"

tools.avrdude.erase.params.verbose=-v
tools.avrdude.erase.params.quiet=-q -q
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m

tools.avrdude.bootloader.params.verbose=-v
tools.avrdude.bootloader.params.quiet=-q -q
tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.platform.path}/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m


# USB Default Flags
# Default blank usb manufacturer will be filled it at compile time
# - from numeric vendor ID, set to Unknown otherwise
build.usb_manufacturer=
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'

# Intellisense info not used during build
# -------------------
8Bit;{vm.boardsource.path}\{build.hardware};
intellisense.tools.path={runtime.ide.path}/tools/avr
intellisense.include.paths={intellisense.tools.path}\avr\include\;
 



I also saw a reference to a platform.local.txt but didn't find anything like that on my PC. Is this a possibility for setting up a global override?

TIA,
Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Change Default VMicro Project and after-update behavior?
Reply #3 - Jan 8th, 2020 at 10:17pm
Print Post  
1)
The only reported issue with optimize rendering was after vs2019 was first released. Then we made some changes to prevent vs from trying to resize and adjust dpi when our tool windows open. You are obviously having some issues so please open a new thread and report what screen resolution/dpi settings you are working with. Changing the "adjust display" setting in vs only requires vs to restart so also please, in the new thread, clarify if the issue resolves or becomes an issue after changing the setting and restarting vs. If it really is your pc that needs a restart to replicate the issue we will need to look for some other extenal factor.

2)
By following the guide in yellow above you will see all the visual micro build properties. The current platform will not be in any visual micro extension files. It will be where the platform you are using is installed. For example teensy will be below a folder similar to "arduinoide/hardware/teensy", the Uno/mega will be in "arduinoide/hardware/arduino/cores/avr". The teensy might pretend to be avr so maybe it is "arduinoide/hardware/teensy/cores/avr". Anyway you will find the platform.txt files. If you had been using board manager to install packages the location would be c:\users\your_name\appdata\local\arduino15\packages\..."
« Last Edit: Jan 8th, 2020 at 10:19pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: Change Default VMicro Project and after-update behavior?
Reply #4 - Jan 9th, 2020 at 3:09am
Print Post  
You are correct - changing the 'Optimize rendering...' setting only requires a VS restart to change the behavior.  I can consistently cause and cure the problem with the 'Optimize rendering...' setting.

My primary display is 24" 2560 x 1440 (120 dpi?).  My secondary display is 24", 1920 x 1200 (90 dpi?).

Although I have not tested this exhaustively, the problem only seems to happen when I have the serial monitor show up on the secondary display.

I have attached a compile log with the build properties and verbose enabled.  Looking at the build properties, the only thing I can see relevant to platforms is 

Code
Select All
vm.platform.root.path=c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\t4fb1en2.4xb\Micro Platforms\arduino16x
 



However, this folder only has one sub-folder (hardware) and it's subfolders are all the available hardware modules. The 'teensy3' folder has a platform.txt file, but it doesn't have anything relevant in it, so I'm still at a loss as to which file to modify and what modification to apply.

More to the point - why would I want to modify a platform-specific file anyway? The modification I want is to add '-Wno-unknown-pragmas' to the 'extra cpp flags' which I think is hardware independent.

Frank
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Change Default VMicro Project and after-update behavior?
Reply #5 - Jan 9th, 2020 at 1:06pm
Print Post  
I installed teensy and see all the cores below a teensy\avr folder.

D:\Arduino\arduino-1.8.9\hardware\teensy\avr

In the avr folder they have a platform.txt that serves all teensy boards.

Your can add your command to any of the build commands

Code
Select All
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{build.toolchain}{build.command.g++}" -c {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} "-I{build.path}/pch" {includes} "{source_file}" -o "{object_file}"

## Compile c files
recipe.c.o.pattern="{compiler.path}{build.toolchain}{build.command.gcc}" -c {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.c} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} {includes} "{source_file}" -o "{object_file}"

## Compile S files
recipe.S.o.pattern="{compiler.path}{build.toolchain}{build.command.gcc}" -c {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.S} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} {includes} "{source_file}" -o "{object_file}"

## Create archives
recipe.ar.pattern="{compiler.path}{build.toolchain}{build.command.ar}" rcs "{archive_file_path}" "{object_file}"

## Link
" {build.flags.optimize} {build.flags.ld} {build.flags.ldspecs} {build.flags.cpu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" {build.flags.libs} 



  
Back to top
WWW  
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: Change Default VMicro Project and after-update behavior?
Reply #6 - Jan 10th, 2020 at 1:01am
Print Post  
Tim,

Thanks for the response.  I found teensy's platform.txt at 'C:\Program Files (x86)\Arduino\hardware\teensy\avr'.  Here's the cpp section:

Code
Select All
## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{build.toolchain}{build.command.g++}" -c {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} "-I{build.path}/pch" {includes} "{source_file}" -o "{object_file}"
 



But I don't have a clue how to add the '-Wno-unknown-pragmas' flag. The information at https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-speci... is sketchy to say the least.

And again, I would like this compile option to be added to ALL new projects, regardless of the hardware platform, so I would think this would be a perfect 'value added' feature for VM.  I suspect the VM preferences for a new Arduino project are stored in a TXT or XML file somewhere - why can't I just edit that one file, instead of hunting down and editing a different file for each hardware platform?

just my $0.02 Wink

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Change Default VMicro Project and after-update behavior?
Reply #7 - Jan 10th, 2020 at 12:00pm
Print Post  
The platform.txt system us unique to each platform. The authors of the platforms do not have an agreed standard to work too therefore your suggestions do not apply.

You either need to wait for vm to have a special option for this where we can then in background hack the cpp recipe/patterns or you need to do as I suggest.

You can simply add your own commands to the pattern as follows then click save and restart visual micro or click rescan:-

recipe.cpp.o.pattern="{compiler.path}{build.toolchain}{build.command.g++}" -c {build.flags.optimize} {build.flags.common} {build.flags.dep} {build.flags.cpp} {build.flags.cpu} {build.flags.defs} -DARDUINO={runtime.ide.version} -DF_CPU={build.fcpu} -D{build.usbtype} -DLAYOUT_{build.keylayout} "-I{build.path}/pch" {includes} "{source_file}" -o "{object_file}" Your_stuff_here
  
Back to top
WWW  
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: Change Default VMicro Project and after-update behavior?
Reply #8 - Jan 10th, 2020 at 6:25pm
Print Post  
I'll wait.  I have a text file with the desired options, and just change it in the UI for each new project.   

What happens to the project options when I save a project - they are obviously stored somewhere - do they get written back to the platform.txt file, or somewhere that VM controls?

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Change Default VMicro Project and after-update behavior?
Reply #9 - Jan 10th, 2020 at 8:14pm
Print Post  
Make sense to wait
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint