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) Uploading to Digispark within VS/Micro Add-In (Read 20359 times)
Brian Boatright
Newbies
*
Offline


Posts: 1
Joined: Nov 16th, 2014
Uploading to Digispark within VS/Micro Add-In
Nov 16th, 2014 at 6:34am
Print Post  
I install VS2013 Community edition and the Visual Micro Arduino for Visual Studio and got it pointed to my custom arduino ide that I've been using to code, compile, and upload to my digispark device. 

The problem with the digispark is it is only connected to USB port after compile and you are prompted to plug it in. This is part of the built in bootloader "micronucleus tiny85". 

more info on the bootloader https://github.com/micronucleus/micronucleus

Can I get Visual Micro to work with this type of setup?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Uploading to Digispark within VS/Micro Add-In
Reply #1 - Nov 16th, 2014 at 4:46pm
Print Post  
Hi,

I think you can probably make it work.

I don't have time to research it so please tell me more.

Does it use a boards.txt? platform.txt?

Do you upload using programmer in your modified ide or normal serial upload? (i understand this works different but the answer is still important)

Thanks
  
Back to top
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #2 - Apr 23rd, 2015 at 5:55am
Print Post  
I just bought 2 of these Digispark boards. In Visual Micro I have so far used a Pro Micro and an Arduino Micro successfully. Digispart is the only one that's a bit difficult to setup.

It compiles fine. I can't get it to upload. It includes boards.txt, platform.txt, and programmers.txt files as it should, but it doesn't seem to be enough for Visual Micro to work properly with the board.

programmers.txt looks like this:

Quote:
micronucleusprog.name=Micronucleus 
micronucleusprog.communication=usb
micronucleusprog.protocol=micronucleus
micronucleusprog.program.tool=micronucleus
micronucleusprog.program.extra_params=-Pusb

When I select the Micronucleus programmer from Visual Micro within Atmel Studio 6.2 and then try uploading to the Digispark, I see this as the result:

Quote:
Uploading to I/O board using 'Micronucleus'
Error during upload using programmer
MCUPreference property not found: program.pattern
The uploader returned an error


Any idea how to resolve that?
  
Back to top
 
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #3 - Apr 23rd, 2015 at 7:02am
Print Post  
I found out a way to make the Digispark work in Visual Micro using External Tools. I add a new tool using these settings:

Quote:
Title: Digispark Upload

Command: C:\Documents and Settings\Baron\My Documents\My Programs\Arduino\hardware\digistump\avr\tools\micronucleus.exe

Arguments: "$(TargetDir)$(TargetName).hex"

Initial Directory: C:\Documents and Settings\Baron\My Documents\My Programs\Arduino\hardware\digistump\avr\tools\



My sketch folder is shown in bold above. You will need to change this to suit your own sketch folder of course.

The micronucleus.exe file comes from the Digistump IDE. I don't install their IDE. I get their zip version and manually copy a few files from it.

I put all the Digistump specific stuff in my sketch folder under "hardware". All the hardware specific files needed are found in the Digistump IDE here after unzipping it: "DigistumpIDE1.5.8C\hardware\digistump" 

I manually copied the Digistump IDE files from "DigistumpIDE1.5.8C\hardware\digistump" to my sketch folder under "hardware\digistump". After copying, make sure to run the Visual Micro command "Reload Toolchains" so that the new files are seen by Visual Micro.

I don't modify my Arduino IDE at all. I just make sure those Digistump files are in a "hardware\digistump" folder where my sketch folder is.



To upload, DO NOT PLUG IN THE DIGISPARK at first. It must be unplugged. Also make sure to compile your program first and then highlight the project before running the external tool, otherwise if your project is not highlighted then TargetDir and TargetName will not be set by Visual Micro. After running the external tool, then plug in the Digispark and it works great.

The micronucleus tool could use a little work. It's a little buggy. If I try to run the tool with my Digispark plugged in, the micronucleus will actually crash. As long as I unplug the Digispark before running the tool, and plugging it in after the tools starts, then everything is ok.

The Digispark is now working great in Visual Micro.

Hope someone else finds this useful.
« Last Edit: Apr 23rd, 2015 at 7:49am by Baron »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Uploading to Digispark within VS/Micro Add-In
Reply #4 - Apr 23rd, 2015 at 11:17am
Print Post  
Hi,

The error you see "missing program.pattern" is expected to be in the platform.txt. It's  standard stuff which leads me to believe that the digistump does not use standard upload but instead has an optional software programmer defined.

With a sketch open, please look at the "tools>visual micro>programmers menu". Does it contain a digistump option? If so please make sure it is ticked and also tick "tools>visual micro>upload using programmer"

Then normal upload and debug should work?

Thanks

  
Back to top
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #5 - Apr 24th, 2015 at 6:55am
Print Post  
I didn't install the special Digistump IDE, so I don't see that digistump option, I see it as micronucleus. I don't want a special IDE just for the Digispark. I want it to work with the standard Arduino IDE with as little modifications as possible.

Digistump is a bit non-standard. I'm not too happy about that.

Their special IDE modifes the Arduino IDE to get their stuff working. They use micronucleus.exe as the Digispark programmer and AVRDUDE.exe for everything else. Actually they add their own hacked AVRDUDE.exe to the Arduino IDE which then call's micronucleus.exe when compiling for the Digispark. I couldn't get that working using the normal Arduino IDE. That route gives that error "MCUPreference property not found: program.pattern". I don't know how to resolve that.

Using an external tool works great. It's an extra step for me, but it works without needing a special IDE and it calls the same micronucleus.exe programmer their hacked AVRDUDE.exe is supposed to call.


What is this "program.pattern" property supposed to do? Is there some value I could set manually for this to make the system happy?

Also, I just wanted to mention that Visual Micro really simplifies things a lot. And it's well thought out. I tried compiling in Atmel Studio 6.2 for a few Arduino's without using Visual Micro. It's very messy to do it that way. Visual Micro makes it so much cleaner and easier. A+++
« Last Edit: Apr 24th, 2015 at 6:56am by Baron »  
Back to top
 
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #6 - Apr 24th, 2015 at 7:23am
Print Post  
It might be hard to get Digispark working the way everything else does in Visual Micro because the programming process is very different.

Unlike the Arduino Micro or Micro Pro, etc., you can't set the COM port for Digispark before calling the programmer because it cannot program it if the Digispark is plugged in when you call the programmer. The micronucleus programmer only works if you run it BEFORE plugging in the Digispark. It's not a good design. The Digispark bootloader only works for 5 seconds from the point you plug in the Digispark. After that, you can't program it anymore. It's impossible. So if you have it plugged in for 5 seconds and then you call the programmer, it cannot work because the bootloader is no longer running. There's nothing the host computer can do to put it into bootloader mode. You must manually unplug the Digispark and plug it back in. Then you have 5 seconds to start programming it or it doesn't work.

There's also some odd way the micronucleus programmer enumerates the ports when trying to find the Digispark. If you plug in the Digispark for only 1 second before calling the micronucleus programmer, it cannot find it, even though it's in bootloader mode. It will often crash if that's tried. So the recommended way to do it is to run the micronucleus programmer before plugging in the Digispark into the computer's USB port.

I think the micronucleus programmer enumerates all the USB devices, expecting all of them to be wrong. Then waits for a new USB port to appear and then only tries to program the new USB port that appears. Something like that. I could never get it working if it's plugged in before calling the programmer even if I try before the 5 seconds are up. It just doesn't work that way.

It would be nice if this could work with the normal process in Visual Micro, but since this is such odd behavior, I'm not sure it's worth the effort of the Visual Micro team to get it working. Especially considering the external tool method I mentioned in a previous post works.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Uploading to Digispark within VS/Micro Add-In
Reply #7 - Apr 24th, 2015 at 11:55am
Print Post  
Teensy works the same way with a separate uploader tool, I don't see a problem in general but don't have time to look into it.

The error you see in the arduino ide is the same as form visual micro because both uses patterns in the platform.txt to define commands.

I tried digistump when it was released and it worked fine but might have changed. I used it with Arduino 1.0 ide versions at the time.

It would help if you answer my question about what programmers are display on the programmers menu

Thanks
  
Back to top
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #8 - Apr 25th, 2015 at 5:05am
Print Post  
Tim@Visual Micro wrote on Apr 24th, 2015 at 11:55am:
It would help if you answer my question about what programmers are display on the programmers menu


It's "Micronucleus". That's the only extra one that appears when I select the Digispark. The others are the same as when I select Arduino Micro or Pro Micro, etc. "Micronucleus" is the one for Digispark. No other programmer is added for Digispark.

I would attach a screen shot to make that more clear, but the forum doesn't let me.

Again, this is the output from Visual Micro when trying to upload using the Micronucleus programmer for Digispark:

Quote:
Uploading to I/O board using 'Micronucleus'
Error during upload using programmer
MCUPreference property not found: program.pattern
The uploader returned an error


Here's the info from the boards.txt file distributed with the Digispark showing the reference to the programmer "micronucleus":

Quote:
# See: http://code.google.com/p/arduino/wiki/Platforms

menu.cpu=Processor

##############################################################




digispark-tiny.name=Digispark (Default - 16.5mhz)
digispark-tiny.upload.using=micronucleusprog
digispark-tiny.upload.protocol=usb
digispark-tiny.upload.tool=micronucleus
digispark-tiny.upload.maximum_size=6012
digispark-tiny.build.mcu=attiny85
digispark-tiny.build.f_cpu=16500000L
digispark-tiny.build.board=AVR_DIGISPARK
digispark-tiny.build.core=tiny
digispark-tiny.build.variant=digispark
digispark-tiny.upload.wait_for_upload_port = false
digispark-tiny.upload.use_1200bps_touch = false
digispark-tiny.upload.disable_flushing = false


digispark-pro.name=Digispark Pro (Default 16 Mhz)
digispark-pro.upload.using=micronucleusprog
digispark-pro.upload.protocol=usb
digispark-pro.upload.tool=micronucleus
digispark-pro.upload.maximum_size=14844
digispark-pro.build.mcu=attiny167
digispark-pro.build.f_cpu=16000000L
digispark-pro.build.board=AVR_DIGISPARKPRO
digispark-pro.build.core=pro
digispark-pro.build.variant=pro
digispark-pro.upload.wait_for_upload_port = false
digispark-pro.upload.use_1200bps_touch = false
digispark-pro.upload.disable_flushing = false

digispark-pro32.name=Digispark Pro (16 Mhz) (32 byte buffer)
digispark-pro32.upload.using=micronucleusprog
digispark-pro32.upload.protocol=usb
digispark-pro32.upload.tool=micronucleus
digispark-pro32.upload.maximum_size=14844
digispark-pro32.build.mcu=attiny167
digispark-pro32.build.f_cpu=16000000L
digispark-pro32.build.board=AVR_DIGISPARKPRO
digispark-pro32.build.core=pro
digispark-pro32.build.variant=pro32buffer
digispark-pro32.upload.wait_for_upload_port = false
digispark-pro32.upload.use_1200bps_touch = false
digispark-pro32.upload.disable_flushing = false

digispark-pro64.name=Digispark Pro (16 Mhz) (64 byte buffer)
digispark-pro64.upload.using=micronucleusprog
digispark-pro64.upload.protocol=usb
digispark-pro64.upload.tool=micronucleus
digispark-pro64.upload.maximum_size=14844
digispark-pro64.build.mcu=attiny167
digispark-pro64.build.f_cpu=16000000L
digispark-pro64.build.board=AVR_DIGISPARKPRO
digispark-pro64.build.core=pro
digispark-pro64.build.variant=pro64buffer
digispark-pro64.upload.wait_for_upload_port = false
digispark-pro64.upload.use_1200bps_touch = false
digispark-pro64.upload.disable_flushing = false


Again, here's the entire content of the programmers.txt file for Digispark:

Quote:
micronucleusprog.name=Micronucleus
micronucleusprog.communication=usb
micronucleusprog.protocol=micronucleus
micronucleusprog.program.tool=micronucleus
micronucleusprog.program.extra_params=-Pusb



Here's the entire content of the platform.txt file for Digispark. Note the use of a modified version of AVRDUDE used to call micronucleus. I don't why they do that. I can use it without calling AVRDUDE. Maybe this is their problem. I'll see if I can fix it.

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

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

name=Digistump AVR Boards
version=1.5.4

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

# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
compiler.c.elf.flags=-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 -MMD
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=

# 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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.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} -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} "{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} "{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.micronucleus.cmd.path={runtime.ide.path}/hardware/digistump/avr/tools/avrdude
tools.micronucleus.cmd.path.linux={runtime.ide.path}/hardware/digistump/avr/tools/avrdude

tools.micronucleus.upload.params.verbose=-v
tools.micronucleus.upload.params.quiet=-q
#tools.micronucleus.upload.pattern="{cmd.path}" --run --timeout 60 "{build.path}/{build.project_name}.hex"
tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:{build.path}/{build.project_name}.hex:i
 
# 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=


If you need any other information let me know.
« Last Edit: Apr 25th, 2015 at 5:49am by Baron »  
Back to top
 
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #9 - Apr 25th, 2015 at 6:15am
Print Post  
Ok, I fixed it. The Digispark boards now work properly from within Visual Micro's upload process, no external tool needed.Smiley

First, I DO NOT recommend installing the Digistump IDE. Use the standard Arduino IDE. Don't modify it.

Their IDE is old. The latest one, 1.5.8, is found here: https://github.com/digistump/DigistumpArduino/releases/download/v1.5.8C/Digistum...

Get that zip file. Unzip it. Install the drivers if you haven't already (found in "DigistumpIDE1.5.8C\drivers"). Don't install the IDE.

Take all of the files from the "DigistumpIDE1.5.8C\hardware" folder and copy them to your sketch folder's "hardware" sub-folder (create one if you don't have it).

Now you will have a Digistump file named platform.txt located in your sketch folder under "hardware\digistump\avr"

The Digistump platform.txt file for Digispark is the problem. It's missing the program.pattern element. We need to fix it to make it work with Visual Micro.

To fix this, open up the Digistump platform.txt file and copy the code below into the Digistump platform.txt file and save it. 

This changes the platform.txt file to have the missing program.pattern element. It also bypasses their hacked AVRDUDE because it doesn't work. It makes Visual Micro call micronucleus directly for Digispark.

Note the path in the code below for micronucleus is within the Arduino sketch folder:

tools.micronucleus.cmd.path={location.sketchbook}/hardware/digistump/avr/tools/micronucleus
tools.micronucleus.cmd.path.linux={location.sketchbook}/hardware/digistump/avr/tools/micronucleus

If you put their stuff in the Arduino IDE program's hardware folder, which I do not recommend, then you would change that to be

tools.micronucleus.cmd.path={runtime.ide.path}/hardware/digistump/avr/tools/micronucleus
tools.micronucleus.cmd.path.linux={runtime.ide.path}/hardware/digistump/avr/tools/micronucleus


With this working, when the compile is done and it says "Uploading to I/O board using 'Micronucleus", then plug in the Digispark and it should work. The Digispark should not be plugged in before that. If it is, unplug it and plug it in again.

Code
Select All
# Arduino AVR Core and platform.
# ------------------------------

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

name=Digistump AVR Boards
version=1.5.4

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

# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
compiler.c.elf.flags=-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 -MMD
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=

# 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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.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} -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} "{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} "{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
# ------------------------------

######################################################################
# Original settings which did not work with Visual Micro
#
dude
ls/avrdude
#tools.micronucleus.upload.params.verbose=-v
#tools.micronucleus.upload.params.quiet=-q
#tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:{build.path}/{build.project_name}.hex:i
######################################################################

######################################################################
# Working settings modification by Baron Williams
#
# We bypass the hacked AVRDUDE and call micronucleus directly.
# We add the missing tools.micronucleus.program.pattern element.
#
# Note the path is looking for the Digispark hardware files inside the sketchbook folder.
# I recommend adding all non Arduino hardware files to your sketchbook folder instead of modifying
#  your Arduino IDE.
#
# If you instead put the Digispark hardware files in your Arduino IDE's hardware folder then you
# need to use {runtime.ide.path} instead of {location.sketchbook} for the first two lines like this:
#
#  onucleus
#  s/micronucleus
######################################################################
icronucleus
ools/micronucleus
tools.micronucleus.upload.params.verbose=
tools.micronucleus.upload.params.quiet=
tools.micronucleus.upload.pattern="{cmd.path}" --run --timeout 60 "{build.path}/{build.project_name}.hex"
tools.micronucleus.program.pattern="{cmd.path}" --run --timeout 60 "{build.path}/{build.project_name}.hex"


# 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=
 

« Last Edit: Apr 25th, 2015 at 7:19am by Baron »  
Back to top
 
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #10 - Apr 25th, 2015 at 7:17am
Print Post  
To make things a bit less confusing, change the Digistump programmers.txt file from this:

Code
Select All
micronucleusprog.name=Micronucleus
micronucleusprog.communication=usb
micronucleusprog.protocol=micronucleus
micronucleusprog.program.tool=micronucleus
micronucleusprog.program.extra_params=-Pusb
 



to this:

Code
Select All
micronucleusprog.name=Digispark
micronucleusprog.communication=usb
micronucleusprog.protocol=micronucleus
micronucleusprog.program.tool=micronucleus
micronucleusprog.program.extra_params=
 



(-Pusb is not needed)

Then reload the toolchains, select a non Digispark board and reselect the Digispark board and everything will now be changed to the new settings.

Now when you select your Digispark board, instead of Micronucleus appearing in the Programmers menu of Visual Micro you will see Digispark in the programmers menu. I personally like this more.

Now, is there a way to force the "Upload Using Programmer" option on when selecting a Digispark board? I'll look into that.
« Last Edit: Apr 25th, 2015 at 7:23am by Baron »  
Back to top
 
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #11 - Apr 25th, 2015 at 7:46am
Print Post  
To fix it so that the Digispark boards appear with a check box checked when you select them in Visual Micro change the Digistump boards.txt file to contain the following code. Note that Digistump used "-" characters in the board names. This updated code removes that character. That character is is not supported in Visual Micro for variable names. This is why the boards don't show up selected in Visual Micro's menu even after they are selected.

Code
Select All
menu.cpu=Processor

##############################################################

digisparktiny.name=Digispark (Default - 16.5mhz)
digisparktiny.build.board=AVR_DIGISPARK

digisparktiny.upload.tool=micronucleus
digisparktiny.upload.protocol=usb
digisparktiny.upload.maximum_size=6012
digisparktiny.upload.disable_flushing=false
digisparktiny.upload.use_1200bps_touch=false
digisparktiny.upload.wait_for_upload_port=false
digisparktiny.upload.using=micronucleusprog

digisparktiny.build.mcu=attiny85
digisparktiny.build.f_cpu=16500000L
digisparktiny.build.core=tiny
digisparktiny.build.variant=digispark

##############################################################

digisparkpro.name=Digispark Pro (Default 16 Mhz)
digisparkpro.upload.using=micronucleusprog
digisparkpro.upload.protocol=usb
digisparkpro.upload.tool=micronucleus
digisparkpro.upload.maximum_size=14844
digisparkpro.build.mcu=attiny167
digisparkpro.build.f_cpu=16000000L
digisparkpro.build.board=AVR_DIGISPARKPRO
digisparkpro.build.core=pro
digisparkpro.build.variant=pro
digisparkpro.upload.wait_for_upload_port=false
digisparkpro.upload.use_1200bps_touch=false
digisparkpro.upload.disable_flushing=false

##############################################################

digisparkpro32.name=Digispark Pro (16 Mhz) (32 byte buffer)
digisparkpro32.upload.using=micronucleusprog
digisparkpro32.upload.protocol=usb
digisparkpro32.upload.tool=micronucleus
digisparkpro32.upload.maximum_size=14844
digisparkpro32.build.mcu=attiny167
digisparkpro32.build.f_cpu=16000000L
digisparkpro32.build.board=AVR_DIGISPARKPRO
digisparkpro32.build.core=pro
digisparkpro32.build.variant=pro32buffer
digisparkpro32.upload.wait_for_upload_port=false
digisparkpro32.upload.use_1200bps_touch=false
digisparkpro32.upload.disable_flushing=false

##############################################################

digisparkpro64.name=Digispark Pro (16 Mhz) (64 byte buffer)
digisparkpro64.upload.using=micronucleusprog
digisparkpro64.upload.protocol=usb
digisparkpro64.upload.tool=micronucleus
digisparkpro64.upload.maximum_size=14844
digisparkpro64.build.mcu=attiny167
digisparkpro64.build.f_cpu=16000000L
digisparkpro64.build.board=AVR_DIGISPARKPRO
digisparkpro64.build.core=pro
digisparkpro64.build.variant=pro64buffer
digisparkpro64.upload.wait_for_upload_port=false
digisparkpro64.upload.use_1200bps_touch=false
digisparkpro64.upload.disable_flushing=false
 

« Last Edit: Apr 25th, 2015 at 7:49am by Baron »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Uploading to Digispark within VS/Micro Add-In
Reply #12 - Apr 25th, 2015 at 12:47pm
Print Post  
Thanks very much!!

The dash issue sounds like a bug I will take a look at that.

« Last Edit: Apr 25th, 2015 at 1:43pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Uploading to Digispark within VS/Micro Add-In
Reply #13 - Apr 25th, 2015 at 1:58pm
Print Post  
Quote:
To fix it so that the Digispark boards appear with a check box checked when you select them in Visual Micro change the Digistump boards.txt file to contain the following code. Note that Digistump used "-" characters in the board names. This updated code removes that character. That character is is not supported in Visual Micro for variable names. This is why the boards don't show up selected in Visual Micro's menu even after they are selected.


Yep good bug found and fixed for the next release thanks. This meant that you were looking for the board to be ticked when viewing the "Tools>Visual Micro>Boards menu". 

Can you see the Boards List on the main Visual Studio tool bar? That will show the currently selected board even in the current release?

  
Back to top
IP Logged
 
Baron
Junior Member
**
Offline


Posts: 10
Joined: Apr 5th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #14 - Apr 25th, 2015 at 10:09pm
Print Post  
Tim@Visual Micro wrote on Apr 25th, 2015 at 1:58pm:
Quote:
To fix it so that the Digispark boards appear with a check box checked when you select them in Visual Micro change the Digistump boards.txt file to contain the following code. Note that Digistump used "-" characters in the board names. This updated code removes that character. That character is is not supported in Visual Micro for variable names. This is why the boards don't show up selected in Visual Micro's menu even after they are selected.


Yep good bug found and fixed for the next release thanks. This meant that you were looking for the board to be ticked when viewing the "Tools>Visual Micro>Boards menu".


Yes, exactly. I could select it in that location, but the "-" character in the name was preventing the item being checked after selection. I didn't know this was a Visual Micro bug. I only saw this problem when selecting the Digispark board. I'll leave mine "fixed" so it doesn't step on this minor bug for now until it's fixed in the next release of Visual Micro.

Tim@Visual Micro wrote on Apr 25th, 2015 at 1:58pm:
Can you see the Boards List on the main Visual Studio tool bar? That will show the currently selected board even in the current release?


I am using Atmel Studio 6.2, but yes, the Boards List tool bar shows the proper board is selected even with the Digistump boards.txt file having the "-" character in the names. It was only the CHECK mark that was the problem in the "Tools>Visual Micro>Boards" menu.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Uploading to Digispark within VS/Micro Add-In
Reply #15 - Apr 26th, 2015 at 1:24am
Print Post  
Yes we have to ensure the are no "illegal" Visual Studio macro characters in the names it gives to Visual Studio commands. This is because Visual Micro creates all features (including each board and library) as macros that can be added by users to menus and tool bars (via the "Tools>Customization")

The lookup of which board name was selected, for the menu tick, was missing the translation back to the real name (with the dash)

Thanks for the update.
« Last Edit: Apr 26th, 2015 at 1:25am by Tim@Visual Micro »  
Back to top
IP Logged
 
Felipe
Junior Member
**
Offline


Posts: 12
Joined: Sep 16th, 2015
Re: Uploading to Digispark within VS/Micro Add-In
Reply #16 - Oct 25th, 2015 at 4:06pm
Print Post  
I wasn't able to use the platform.txt supplied by Baron, because of the new way arduino and visual micro installs additional boards (Board Manager / Visual Micro Explorer). 

The only problem I'm seeing is that Visual Micro seems to be uploading the program twice! I can't figure it out why.

Code
Select All
# Arduino AVR Core and platform.
# ------------------------------

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

name=Digistump AVR Boards
version=1.5.4

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

# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
compiler.c.elf.flags=-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 -MMD
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=

# 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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {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} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.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} -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} "{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} "{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
# ------------------------------

######################################################################
# Original settings which did not work with Visual Micro
#
dude
ls/avrdude
#tools.micronucleus.upload.params.verbose=-v
#tools.micronucleus.upload.params.quiet=-q
#tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:{build.path}/{build.project_name}.hex:i
######################################################################

######################################################################
# Working settings modification by Baron Williams
#
# We bypass the hacked AVRDUDE and call micronucleus directly.
# We add the missing tools.micronucleus.program.pattern element.
#
# Note the path is looking for the Digispark hardware files inside the sketchbook folder.
# I recommend adding all non Arduino hardware files to your sketchbook folder instead of modifying
#  your Arduino IDE.
#
# If you instead put the Digispark hardware files in your Arduino IDE's hardware folder then you
# need to use {runtime.ide.path} instead of {location.sketchbook} for the first two lines like this:
#
#  onucleus
#  s/micronucleus
######################################################################
# New modification by Felipe Maimon
#
# Changed the path to {runtime.tools.micronucleus.path}/micronucleus so it works with the new
# Arduino Board Manager
######################################################################
tools.micronucleus.cmd.path={runtime.tools.micronucleus.path}/micronucleus

tools.micronucleus.upload.params.verbose=
tools.micronucleus.upload.params.quiet=
tools.micronucleus.upload.pattern="{cmd.path}" --run --timeout 60 "{build.path}/{build.project_name}.hex"
tools.micronucleus.program.pattern="{cmd.path}" --run --timeout 60 "{build.path}/{build.project_name}.hex"


# 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= 

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


Posts: 12145
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Uploading to Digispark within VS/Micro Add-In
Reply #17 - Oct 25th, 2015 at 4:21pm
Print Post  
1)
Yes it they have updated to board manager then you don't need to change anything.

2)
There is a bug if you click the new toolbar icon to upload it uploads twice.

That is fixed in the next release

Use F5 or click the Green toolbar arrow debug>start. These commands are the same but only do it once.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint