Author Topic: Adventures in AVR ISP Programming  (Read 25300 times)

0 Members and 1 Guest are viewing this topic.

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #50 on: March 03, 2017, 03:50:44 am »
Quote
As for the install of the Atmel Studio  ... I've been using Visual Studio for a long time and while the install can be time consuming, it certainly doesn't take hours.
Ah; if you've been using VS before trying to install AS, it can probably skip a lot of the VS-related stuff that you already have.
Let's see, six .NET Framework, two SQL-related things, three C++ "redistributables", and VS 2015 Shell (isolated), making it less painful for you to install than for some of us...  ("Hours" might be an exaggeration, but it certainly takes long enough that my usual procedure is to start the install, and go do something else for hours, hoping that it will be done when I come back (and not sitting at some "do you want the xyz-sub-installer to modify this computer" prompt.  Sigh.)
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12298
  • Country: au
Re: Adventures in AVR ISP Programming
« Reply #51 on: March 03, 2017, 05:51:40 am »
All this hassle in order to use some chips...?

Are they actively trying to discourage people??
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16647
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #52 on: March 03, 2017, 08:02:28 am »
All this hassle in order to use some chips...?

Are they actively trying to discourage people??

It's par for the course.


 

Offline rrinker

  • Super Contributor
  • ***
  • Posts: 2046
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #53 on: March 03, 2017, 01:30:24 pm »
Since when? I have 2012 Professional on this machine but I just went and ran the online installer for 2015 Professional and you do not have to install the Windows Phone crap. There are a lot of optional components you don't have to install if you don't need.

And the whole ISO is only 3.8GB

Maybe the "Pro" version is different...  :popcorn:

Most of the Visual-Studio-based development systems install VS Community though. I don't know about Atmel Studio but I've used a couple of others (eg. Unity) and that requires the full 5Gb-with-Windows-Phone version of VS 2015.

 Community is exactly the same, I also tried 2015 Community (which is what I would install at home - my work laptop has Pro only because I occasionally write programs for clients) and it is the same way. If you don't click Next too quickly, there is an option to install it all or select what components you want.

 

Offline rrinker

  • Super Contributor
  • ***
  • Posts: 2046
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #54 on: March 03, 2017, 01:36:14 pm »
Quote
As for the install of the Atmel Studio  ... I've been using Visual Studio for a long time and while the install can be time consuming, it certainly doesn't take hours.
Ah; if you've been using VS before trying to install AS, it can probably skip a lot of the VS-related stuff that you already have.
Let's see, six .NET Framework, two SQL-related things, three C++ "redistributables", and VS 2015 Shell (isolated), making it less painful for you to install than for some of us...  ("Hours" might be an exaggeration, but it certainly takes long enough that my usual procedure is to start the install, and go do something else for hours, hoping that it will be done when I come back (and not sitting at some "do you want the xyz-sub-installer to modify this computer" prompt.  Sigh.)

 No, I mean a bare, from scratch install of Visual Studio. I have yet to install Atmel Studio anywhere. If I take a new computer that has no version of VS on it and install VS, it takes a little while but certainly not hours.  I do have a fast connection at home, but even at work where I am hampered by wireless it didn't take that long. I DO only install select components and not all the languages. If Atmel Studio auto-installs VS it could be that it just does a complete install. And then it depends on where they source the VS download from - if they have an agreement with Microsoft and host it themselves or if it just pulls from the MS download site. If it really does take that long and if it can detect you already have VS installed, the more efficient way may indeed be to just download the ISO from Microsoft and install it. I don;t really have the tools to use Atmel Studio yet but maybe I'll try installing it on an existing VS install and see what happens.

 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12298
  • Country: au
Re: Adventures in AVR ISP Programming
« Reply #55 on: March 03, 2017, 02:43:41 pm »
All this hassle in order to use some chips...?

Are they actively trying to discourage people??

It's par for the course.

Then it would seem an opportunity exists for someone to produce a stable, functional development platform that can be reliably installed in order to attract adopters in preference to other, ratty platforms - so that their chips become first choice of developers.

.... or am I just dreaming?
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: Adventures in AVR ISP Programming
« Reply #56 on: March 03, 2017, 02:50:33 pm »
You are dreaming.   S.O.P. is for a company that's got a usable IDE to be bought out by another that has a crappier IDE, which gets borked even further as they attempt to integrate their new acquisition's chips.  Just wait till Microchip start adding AVR support to MPLAB X . . . .
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12298
  • Country: au
Re: Adventures in AVR ISP Programming
« Reply #57 on: March 03, 2017, 02:54:13 pm »
You are dreaming.

Somehow, I just knew that was coming.
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 2028
  • Country: au
Re: Adventures in AVR ISP Programming
« Reply #58 on: March 03, 2017, 03:19:45 pm »
The problems above have not been my experience.
I will just say that I have, (currently installed across three Win 10 machines)

Atmel Studio.
Visual Studio. 2013 on one, 2015 on another, also 2015 express on my home machine
MPLaB
Eclipse CDT, GCC, Open OCD (about 3 different versions)
Altium 16
Kicad
Libre Office
MS Office
Labview

They all work.
Altium gives me the most trouble, then maybe MS Office or MPLab.
In the form of UI weirdness or very occasional crashes.
I just restart the app or the the OS.
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12298
  • Country: au
Re: Adventures in AVR ISP Programming
« Reply #59 on: March 03, 2017, 11:34:16 pm »
Restarting the Application is not so bad.  Restarting the OS could be a bit more of a nuisance.

The one issue that I would be concerned about is file corruption.  How often has that occurred with any of the S/W you have used?
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16647
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #60 on: March 04, 2017, 02:33:37 pm »
Community is exactly the same, I also tried 2015 Community (which is what I would install at home. If you don't click Next too quickly, there is an option to install it all or select what components you want.

You can add extra stuff, sure, but there's no way to avoid installing a whole load of unwanted crap, eg. Visual Basic, Windows Phone Development Kit, etc.

I normally have a fairly small SSD as my main boot disk so this stuff is important. An extra gig here and there soon adds up to no space left.
 

Offline rrinker

  • Super Contributor
  • ***
  • Posts: 2046
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #61 on: March 06, 2017, 02:00:01 pm »
 You most definitely do NOT have to install the Windows Phone junk.
Quick and dirty screen shot. The difference is a whopping 8GB, too. Default selections under Custom takes 8GB. Add the Phone crap and it goes to 16GB. And some stuff can be pointed to a drive other than C:.

SSDs are cheap these days, no sense to constrict yourself anyway. I have all that stuff, plus a full install of SQL Server, plus standard Office apps, KiCAD, Arduino IDE, and more, and it could al fit on a 256GB SSD, though I have a 512GB in this machine. Same stuff plus a few games on my home machine and that one actually DOES only have a 256GB SSD. In fact I have 2 versions of Visual Studio installed on that one because I wanted to use the OLD VB for a project (VS 6.0), but just VB and the IDE out of it.





 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16647
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #62 on: March 06, 2017, 02:27:16 pm »
SSDs are cheap these days

Sure, if you trust the OCX Christmas special SSD to look after your important data.

 

Offline rrinker

  • Super Contributor
  • ***
  • Posts: 2046
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #63 on: March 06, 2017, 03:18:57 pm »
 All Samsungs here. My original 120GB Kingston from the lappy a few years ago still works fine as an external USB drive though.

 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: Adventures in AVR ISP Programming
« Reply #64 on: March 06, 2017, 04:45:13 pm »
Here's a 'vanilla' AVR GCC ANSI C 'Hello World' under the Arduino IDE.
There isn't a single Arduino specific function used.   See my reply #41 for how to 'decrapify' the Arduino build process.

Here's "Hello_World.c":
Code: [Select]
/**********************************
/ 'Raw' AVR GCC 'Hello World!'    *
* Arduino UNO ATmega328P specific *
**********************************/
// *** AVR chip support ***
// #include <avr/pgmspace.h>
#include <avr/io.h>
// #include <avr/interrupt.h>
#include "AVR_UART_IO.h"

#define FOSC 16000000 // UNO Clock Speed
// ************************

#include <stdio.h>

int main(void){

   // *** ATmega328P Serial I/O setup ***
   UART_Init(Baud2UBRR(9600)); //Setup serial port @9600 Baud
   stdin=stdout=stderr= &UARTstdio; //Assign to standard streams for stdio.h functions()
   // ***********************************
   
   printf("Arduino UNO ATMega328P\n"
          "\n"
          "Hello, world!\n");

   return 0;
}


All project files attached as an Arduino archived 'sketch'
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16647
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #65 on: March 06, 2017, 05:10:24 pm »
Here's a 'vanilla' AVR GCC ANSI C 'Hello World' under the Arduino IDE.
There isn't a single Arduino specific function used.   See my reply #41 for how to 'decrapify' the Arduino build process.

All project files attached as an Arduino archived 'sketch'

Yes, you can write a 'main()' function that overrides the one in the Arduino folder.

Linkers look for several different flavors of 'main()' so you just add one that's first on the list. You'll lose the 1kHz Timr0 interrupt and millis() will stop working but you can do it.

Unfortunately the linker will still include the Timer0 interrupt vector for millis() and there's no way to tell it not to. If you try to use your own interrupt vector you'll get a symbol clash when it links the program.

If complete chip control is your thing then just go into %arduino_folder%\hardware\avr\cores\arduino and delete all the files. That way you get a completely clean slate to work with.  :popcorn:

(you can also create a new board variant with its own empty folder and leave the files in 'core' alone but it's more work - having multiple copies of the Arduino IDE installation is easier and it's not too big if you delete all the unwanted bootloaders, etc. Fortunately it's all in separate folders and the folder names are really obvious, like "lilypad").

 
The following users thanked this post: Ian.M

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: Adventures in AVR ISP Programming
« Reply #66 on: March 06, 2017, 06:22:28 pm »
Unfortunately the linker will still include the Timer0 interrupt vector for millis() and there's no way to tell it not to. If you try to use your own interrupt vector you'll get a symbol clash when it links the program.

If complete chip control is your thing then just go into %arduino_folder%\hardware\avr\cores\arduino and delete all the files. That way you get a completely clean slate to work with.  :popcorn:

(you can also create a new board variant with its own empty folder and leave the files in 'core' alone but it's more work - having multiple copies of the Arduino IDE installation is easier and it's not too big if you delete all the unwanted bootloaders, etc. Fortunately it's all in separate folders and the folder names are really obvious, like "lilypad").
Yes I've already run into that and had to use a workaround:
Code: [Select]
// Timer0 is already used for millis() - we'll just interrupt as
// soon as possible after the Timer 0 overflow ISR and call the
// "Compare A" function below
#define VFD_INTERRUPT_NUM TIMER0_COMPA_vect_num // to match interrupt selected below
#define VFD_CONFIG_INTERRUPT    (OCR0A = 0, TIMSK0 |= _BV(OCIE0A)) //Configure selected interrupt

Thanks for the suggestion to create a new board.  I don't want to have to keep multiple copies of the IDE or FUBAR the original for Arduino sketches when I'm trying to leverage 3rd party Arduino libraries to bring up new hardware addons quickly.

I'll dig into the code and see if its possible to make the timer 0 vector declaration in "wiring.c" overrideable.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #67 on: March 06, 2017, 10:33:41 pm »
Quote
it certainly doesn't take hours [to install AS7]
So... I had a near-virgin W7 VM around, so I though I'd time it.  About 3.5 hours, all together.
Admittedly, most of that was trying to figure out how to install the two patches that the AS installer insisted I needed, even though "Windows Update" insisted that my system was "Up to date" and had "no updates available."   And a good part of that was that the VM I was going to use initially had a Windows Explorer that was so old that it couldn't download the Update Manual Installer from microsoft, or even ... a new browser :-(  So, newer VM, newer Explorer, download the manual patches, let them cogitate and reboot and so on...  2 hours gone.
The main part of the AS7 (web) install took a bit under an hour.  Then it wanted me to reboot, and took another 20 or 30 minutes to install drivers (with about 6 "trust this content" prompts.)
 

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16647
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #68 on: March 08, 2017, 10:14:09 am »
FWIW I just installed the new VS2017 on a laptop to see what it was like. I heard it has very fine control over what you choose to install.

It's web-installer only at the moment, this is normal for VS releases - the ISO will come later.

Bottom line: I chose only C++ and Windows SDK from the long list of options and 5.2Gb of disk disappeared - about the same as VS2015 without the options.

I'll have a poke around it today but usually I wait for SP1 before using Visual Studio for critical work.

 

Offline rrinker

  • Super Contributor
  • ***
  • Posts: 2046
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #69 on: March 08, 2017, 01:25:14 pm »
 Exactly what I said. Had you checked the Windows Phone bits it would have been 10GB. It even tells you BEFORE you proceed, so if you just wanted to see you could have canceled and not installed.


 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12856
Re: Adventures in AVR ISP Programming
« Reply #70 on: March 12, 2017, 11:06:09 am »
Does anyone know of a free lightweight MS Windows front end for AVR-GDB?
I've been experimenting with remote debugging a standard unmodified Arduino Uno over its built in USB serial port using the ATmega328P GDB stub:
   https://www.codeproject.com/Articles/1037057/Debugger-for-Arduino
from the GDB command line.
I can set breakpoints, list the current file, step and finish executing functions but its <expletive> tedious to do it from a CLI I am not too familiar with.

I'm still using the Arduino IDE to build, using a custom boards.txt to add the compiler switches needed for debugging:
Code: [Select]
# See: http://code.google.com/p/arduino/wiki/Platforms
# and: [url]https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification[/url]
#
# Note path: {Sketchbook}\hardware\uno_gdb\avr\boards.txt
##############################################################

uno_gdb.name=Arduino Uno (GDB debug)

uno_gdb.vid.0=0x2341
uno_gdb.pid.0=0x0043
uno_gdb.vid.1=0x2341
uno_gdb.pid.1=0x0001
uno_gdb.vid.2=0x2a03
uno_gdb.pid.2=0x0043

uno_gdb.upload.tool=arduino:avrdude
uno_gdb.upload.protocol=arduino
uno_gdb.upload.maximum_size=32256
uno_gdb.upload.maximum_data_size=2048
uno_gdb.upload.speed=115200

uno_gdb.bootloader.tool=arduino:avrdude
uno_gdb.bootloader.low_fuses=0xFF
uno_gdb.bootloader.high_fuses=0xDE
uno_gdb.bootloader.extended_fuses=0x05
uno_gdb.bootloader.unlock_bits=0x3F
uno_gdb.bootloader.lock_bits=0x0F
uno_gdb.bootloader.file=arduino:optiboot/optiboot_atmega328.hex

uno_gdb.build.mcu=atmega328p
uno_gdb.build.f_cpu=16000000L
uno_gdb.build.board=AVR_UNO
uno_gdb.build.core=arduino:arduino
uno_gdb.build.variant=arduino:standard
uno_gdb.build.extra_flags=-g2 -gdwarf-2 -DAVR_DEBUG

##############################################################
and don't really want to install any all-singing all-dancing IDEs that include the kitchen sink as well.

Still to do:- figure out a clean way of overriding the default Arduino AVR core WInterrupts.c so I can get debug builds to use a patched vesion to avoid conflicts when using attachInterrupt().
« Last Edit: March 12, 2017, 02:36:24 pm by Ian.M »
 

Offline f4eru

  • Super Contributor
  • ***
  • Posts: 1093
  • Country: 00
    • Chargehanger
Re: Adventures in AVR ISP Programming
« Reply #71 on: March 12, 2017, 12:34:46 pm »
install all AVR-related stuff ?

Code: [Select]
sudo apt-get install gcc-avr gdb-avr build-essential uisp usbprog-gui simulavr avr-libc gdb-avr avrdude avrp avrprog avarice arduinoThen just confirm.
And wait about 10 minutes.

Online Fungus

  • Super Contributor
  • ***
  • Posts: 16647
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #72 on: March 12, 2017, 12:45:07 pm »
Still to do:- figure out a clean way of overriding the default Arduino AVR core WInterrupts.c so I can get debug builds to use a patched vesion to avoid conflicts when using attachInterrupt().

If your goal is to write code that compiles on anybody's IDE then I don't think it's possible.

At the very least you'll have to modify WInterrupts.c and add a hint for the linker.

(the people at Arduino should really do this...)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf