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

0 Members and 1 Guest are viewing this topic.

Online EEVblog

  • Administrator
  • *****
  • Posts: 30859
  • Country: au
    • EEVblog
Adventures in AVR ISP Programming
« on: February 18, 2017, 01:09:34 am »
Dave battles the Atmel/Microchip AVR ISP Mk2 programmer with AVRdude in order to program an ATMEGA328 and get his uRAD radiation monitor working again. Can he do it?
http://www.uradmonitor.com

 
The following users thanked this post: radhoo

Offline VK3DRB

  • Super Contributor
  • ***
  • Posts: 1695
  • Country: au
Re: Adventures in AVR ISP Programming
« Reply #1 on: February 18, 2017, 02:15:12 am »
I agree, the AVR Studio is a debacle with installation.

If you don't want very annoying vague error messages popping up during installation, you cannot have the AVR studio on any other drive than drive C. This bug has been around for yonks and the programmers at Atmel have not seen it fit to fix it.

Also, don't bother with WinAVR. It is olde school. The last release was in 2010. I had problems with WinAVR on Windows 10 and Atmel Studio 7. Atmel Studio 7 comes with a native C compiler built in and from my experience, it is "pin compatible" with WinAVR and it works a treat. I recompiled a major WinAVR project with the native C one and no error messages at all. No adjustments needed. Good one, Atmel.

But a real gripe is the PFC ribbon cable Atmel has on their JTAGICE MKII programmer. What pot smoker came up with that idea? They tear and break with ease. Atmel charge a king's ransom to replace the cable - around $40 USD. However I found a MUCH cheaper pin compatible replacement for around $3.50 USD. They are almost impossible to find, but you can get them here...

Longer cable (about 8")...
http://au.element14.com/wurth-elektronik/687730200002/cable-ffc-rev-0-5mm-200mm-30way/dp/1908559 (Only 3 left, sorry, after I bought 3 others two days ago)

Shorter cable (about 6")...
http://au.element14.com/wurth-elektronik/687730152002/ffc-cable-30pos-152mm-60v-white/dp/2520275 (Plenty in stock)

You won't find them as cheap anywhere else.


 

Offline Muttley Snickers

  • Supporter
  • ****
  • Posts: 2066
  • Country: au
Re: Adventures in AVR ISP Programming
« Reply #2 on: February 18, 2017, 02:30:27 am »
I agree, the AVR Studio is a debacle with installation.
+1

Slightly old school, I found this little beauty below at the local recycle center a while back and couldn’t possibly leave it there, not at $20 anyway with the box half filled with dozens of various unused Atmels still in the wrappers, a good reminder that I’m probably due for an updated version, this thread should be a good guide.
 

Offline HwAoRrDk

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: gb
Re: Adventures in AVR ISP Programming
« Reply #3 on: February 18, 2017, 02:48:13 am »
Never used avrdude before? Now that's not true, he has! ;) But he probably didn't realise it. The Arduino IDE uses avrdude to program boards. And so, Dave didn't need to bother with installing WinAVR, as he could have just used the copy of avrdude that the Arduino IDE uses - assuming he still had it installed, of course.

Although one thing to note is that if he had gone ahead and finished installing Atmel Studio to start with, it would have installed the 'Jungo' driver for his ISP MkII, which avrdude doesn't work with. It only works when the programmer is using the libusb driver. Fortunately, Atmel Studio 7 also plays nicely with libusb-driven programmers. :)
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 2470
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Adventures in AVR ISP Programming
« Reply #4 on: February 18, 2017, 03:18:00 am »
Indeed, the Arduino IDE even has an up to date version of the avr toolchain including avrdude these days, instead of the fairly ancient version it was stuck with for a while.

Even if you don't ever open the Arduino IDE, it makes for a nice simple install of a working toolchain.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline TheSteve

  • Supporter
  • ****
  • Posts: 3105
  • Country: ca
  • Living the Dream
Re: Adventures in AVR ISP Programming
« Reply #5 on: February 18, 2017, 05:08:15 am »
Newer AVR Studio is so terrible. They should be ashamed.
VE7FM
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 11041
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #6 on: February 18, 2017, 08:07:05 am »
I agree, the AVR Studio is a debacle with installation.
+1

Slightly old school, I found this little beauty below at the local recycle center a while back and couldn’t possibly leave it there, not at $20 anyway with the box half filled with dozens of various unused Atmels still in the wrappers, a good reminder that I’m probably due for an updated version, this thread should be a good guide.

The STK500 is great, I bought mine around 17 years ago and still use it, it's been rock solid. I forget what version of AVR Studio I use but it's an older one. I also use Bascom AVR which can talk directly to the STK.
 

Offline radhoo

  • Contributor
  • Posts: 31
  • Country: ro
    • My technology blog
Re: Adventures in AVR ISP Programming
« Reply #7 on: February 18, 2017, 09:11:59 am »
Newer AVR Studio is so terrible. They should be ashamed.
At its core, this is more of a Microsoft issue then Atmel's. Especially for the latter, I have nothing but my appreciation, for all the great things they created (that includes Arduino with everything that resulted from it).

Blog :: My Youtube :: uRADMonitor :: "Build something that matters!"
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 12101
  • Country: gb
    • Mike's Electric Stuff
Re: Adventures in AVR ISP Programming
« Reply #8 on: February 18, 2017, 09:47:38 am »
Newer AVR Studio is so terrible. They should be ashamed.
+1
Especially if all you want to do is program a part.
Last time I had to do it, ISTR they'd stopped including the command-line stk500.exe standalone programmer, and the new studio loads firmware into AVRISP that the old STK500.exe won't talk to.

Ever since the very earliest days. Atmel just didn't get what was needed for device programming, like including fuse settings in the hex file. And being able to set fuses to disable the programming interface on a device in about 3 different ways. And requiring a clock for programming,. so your programmer has to either program slowly or know what the clock is, or program the clock fuses before speeding up to program the main flash.

And did they ever get round to including a disaasembler view in Studio? V4 is the most recent I've used serously and that didn't even have a memory view!
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 12101
  • Country: gb
    • Mike's Electric Stuff
Re: Adventures in AVR ISP Programming
« Reply #9 on: February 18, 2017, 09:56:50 am »
..and the bigger question is why didn't the urad monitor people bother to include a bootloader to allow easy firmware updates without having to dick about with hardware programmers?
If you're doing something that will be used by lots of people all over the place surely that's a total no-brainer.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline radhoo

  • Contributor
  • Posts: 31
  • Country: ro
    • My technology blog
Re: Adventures in AVR ISP Programming
« Reply #10 on: February 18, 2017, 10:13:42 am »
..and the bigger question is why didn't the urad monitor people bother to include a bootloader to allow easy firmware updates without having to dick about with hardware programmers?
If you're doing something that will be used by lots of people all over the place surely that's a total no-brainer.
Because everything takes a lot of time, and for the size of this project there were other priorities.
But good news, not only a boot-loader, but a full OTA firmware upgrade system is one of the upcoming features  :-+. One step at a time.

Blog :: My Youtube :: uRADMonitor :: "Build something that matters!"
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 12101
  • Country: gb
    • Mike's Electric Stuff
Re: Adventures in AVR ISP Programming
« Reply #11 on: February 18, 2017, 10:22:30 am »
..and the bigger question is why didn't the urad monitor people bother to include a bootloader to allow easy firmware updates without having to dick about with hardware programmers?
If you're doing something that will be used by lots of people all over the place surely that's a total no-brainer.
Because everything takes a lot of time, and for the size of this project there were other priorities.
But good news, not only a boot-loader, but a full OTA firmware upgrade system is one of the upcoming features  :-+. One step at a time.
A bootloader shouldn't take more than a day to do - for something designed for wide distribution like this, it should be pretty much the first thing that gets done, as it will easily save way more time in the long term.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline radhoo

  • Contributor
  • Posts: 31
  • Country: ro
    • My technology blog
Re: Adventures in AVR ISP Programming
« Reply #12 on: February 18, 2017, 10:57:17 am »
A bootloader shouldn't take more than a day to do - for something designed for wide distribution like this, it should be pretty much the first thing that gets done, as it will easily save way more time in the long term.
Years ago, when I started with software development, I had the same drive: "yes, it only takes one day". This almost became the answer for any task, no matter of the complexity. Then I learned there is a big difference between "prototype" and "production", between "proof of concept" and "stable". Then the bugs, which doubled everything beyond initial estimation. I learned that to stay committed to a direction and actually finish something beyond a simple prototype (putting to production for instance), there needs to be a balance in the decisions: some features go first, others are part of future updates.
IMO, first thing was to get the system going and do its job, and it took a lot to make that happen (hardware, suppliers, manufacturing, firmware, server infrastructure, API access, frontend, bugs, new features, and then the human part: emails, support).

But, I already said this feature is on the list, and will be done when times allows it. Some hardware changes are needed too, like adding a FT232  for USB upgrades and an EEPROM for OTA upgrades. The USB thing triggers a change to the DC connector used, and I'm not happy with that.

Blog :: My Youtube :: uRADMonitor :: "Build something that matters!"
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 3403
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Adventures in AVR ISP Programming
« Reply #13 on: February 18, 2017, 03:32:31 pm »
A bootloader shouldn't take more than a day to do - for something designed for wide distribution like this, it should be pretty much the first thing that gets done, as it will easily save way more time in the long term.
Mike, of all the people you're the last one I was expecting such a comment from.

You are right, it takes a day or two... To get it working on your desk with the debugger hooked in.
The real world expands beyond your desk though, and challenges your software with various obstacles. To name an example: users.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 12101
  • Country: gb
    • Mike's Electric Stuff
Re: Adventures in AVR ISP Programming
« Reply #14 on: February 18, 2017, 04:12:59 pm »
A bootloader shouldn't take more than a day to do - for something designed for wide distribution like this, it should be pretty much the first thing that gets done, as it will easily save way more time in the long term.
Mike, of all the people you're the last one I was expecting such a comment from.

You are right, it takes a day or two... To get it working on your desk with the debugger hooked in.
The real world expands beyond your desk though, and challenges your software with various obstacles. To name an example: users.
Which is exactly why the first thing you should do is the bootloader, and use it as the method for firmware loading during development as much as possible. That way it gets well tested.
 Once you have that done reliably, it doesn't matter how flaky the rest of the system is as you always have a way to fix it easily in the field later.
 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline radhoo

  • Contributor
  • Posts: 31
  • Country: ro
    • My technology blog
Re: Adventures in AVR ISP Programming
« Reply #15 on: February 18, 2017, 04:19:45 pm »
The firmware update, at least on these things, is a feature, not a must have. There is no need for updates in the field. The units are shipped preloaded with the stock firmware, and only the more technical users are approaching the upgrade subject for the new features that are implemented. And they know how to do it, regardless of using an USB cable, or an ISP cable.

But generally speaking, having easier tools helps, and I think I say it the third time that I agree with mike's input. It's just that other things went first.

Blog :: My Youtube :: uRADMonitor :: "Build something that matters!"
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 11041
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #16 on: February 18, 2017, 08:54:24 pm »
Maybe I'm in the minority here but I never cared much for bootloaders, more trouble than they're worth with an open project. Just give me a standard 6 or 10 pin programming header so I can plug in my STK500 or USBASP and I can program the device in about 10 seconds, no screwing around with serial cables and bootloaders.

Some valid points above though, as much as I like AVR micros, the requirement of a clock for programming is ridiculous, get the clock settings wrong and you can brick the chip and require HV programming which most hardware doesn't support. The programming interface should get a clock from the programmer talking to it and bypass all settings.
 

Offline radhoo

  • Contributor
  • Posts: 31
  • Country: ro
    • My technology blog
Re: Adventures in AVR ISP Programming
« Reply #17 on: February 18, 2017, 08:58:16 pm »
Just give me a standard 6 or 10 pin programming header so I can plug in my STK500 or USBASP and I can program the device in about 10 seconds, no screwing around with serial cables and bootloaders.
You would set a new record, James, as if I recall, the fastest update on one of the units so far was 4 minutes. Because the aluminium enclosure also has some screws :-DD
What I want the bootloader for is the OTA updates. To be able to push the new firmware from the server directly.
That might be tricky over the LoraWAN connections, but will go just fine on Ethernet/Wifi/GSM , these 4 being the communication methods used so far.

Blog :: My Youtube :: uRADMonitor :: "Build something that matters!"
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 11041
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #18 on: February 18, 2017, 09:05:42 pm »
Well, yeah if the firmware needs to be updated regularly then a bootloader is nice. I rarely update things once they work though.
 

Offline radhoo

  • Contributor
  • Posts: 31
  • Country: ro
    • My technology blog
Re: Adventures in AVR ISP Programming
« Reply #19 on: February 18, 2017, 09:09:56 pm »
Well, yeah if the firmware needs to be updated regularly then a bootloader is nice. I rarely update things once they work though.
Well, it's the same here: Once the device is shipped with its stock firmware, can go like that forever. But the feature is in the (big) TODO list and I'll do it when I get the chance.

Blog :: My Youtube :: uRADMonitor :: "Build something that matters!"
 

Offline fki82

  • Contributor
  • Posts: 34
  • Country: de
Re: Adventures in AVR ISP Programming
« Reply #20 on: February 18, 2017, 09:30:06 pm »
Wouldn't it be enough to just put the Arduino bootloader there?
The device may have a serial port to a PC anyway.
I think they are using AVRdude on the PC side, to do the flashing.
Add a few scripts to that and you could have a standalone firmware update tool.
 

Offline radhoo

  • Contributor
  • Posts: 31
  • Country: ro
    • My technology blog
Re: Adventures in AVR ISP Programming
« Reply #21 on: February 18, 2017, 09:33:39 pm »
Yes that would work, but as said it would also require a FT232 / CH340 for the UART to USB. What I will do is to have it get its firmware via the network (OTA updates).

Blog :: My Youtube :: uRADMonitor :: "Build something that matters!"
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 12101
  • Country: gb
    • Mike's Electric Stuff
Re: Adventures in AVR ISP Programming
« Reply #22 on: February 18, 2017, 10:00:02 pm »
Maybe I'm in the minority here but I never cared much for bootloaders, more trouble than they're worth with an open project. Just give me a standard 6 or 10 pin programming header so I can plug in my STK500 or USBASP and I can program the device in about 10 seconds, no screwing around with serial cables and bootloaders.
Depends on your target market. Dave's vid is a classic example - 10 seconds to program, after a couple of hours dicking about to get a programmer to work.
 Bootloader doesn't necessarily needs a serial cable - the whole point is that the device can use whatever interface is available in the product. If it interfaces to anything you can get a file to, you can get firmware onto it.
But a serial cable is probably more widely available than a programmer for a specific micro family, and there are ways to write a serial loader that doesn't need specific host software - just throw a serial file at the device with generic terminal software.
Bunnie also showed a neat solution using audio form a web browser.
 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline G0HZU

  • Super Contributor
  • ***
  • Posts: 2576
  • Country: gb
Re: Adventures in AVR ISP Programming
« Reply #23 on: February 18, 2017, 10:03:15 pm »
Quote
The STK500 is great, I bought mine around 17 years ago and still use it, it's been rock solid. I forget what version of AVR Studio I use but it's an older one. I also use Bascom AVR which can talk directly to the STK.

I scored a free STK500 kit a few years ago and it has been useful a few times but I still prefer my old homemade LPT based programmer for ISP stuff. It can erase, program and verify a fairly simple program for a MEGA168 in about 2 seconds.

I got the STK500 for free at work because nobody (in the SW team) could remember what it was and so it went in the bin during a lab cleanup. I doubt any of them use Atmel AVRs as PICs seem to be the choice where I work. On the version of STK500 I have here, Atmel don't even tell you what this thing is or what it does. It doesn't even say 'STK500' or 'programmer' anywhere on the hardware. The Atmel documentation that I found for the STK500 was a bit odd and vague but I think this is normal for Atmel.
« Last Edit: February 18, 2017, 10:09:20 pm by G0HZU »
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 3403
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Adventures in AVR ISP Programming
« Reply #24 on: February 18, 2017, 10:39:53 pm »
Long time ago I bought one of these:
http://shop.myavr.com/index.php?sp=article.sp.php&artID=200006
It's an STK500 in a stick. It served me well. Now I have an mkII, which is better because it does tpi.
 

Offline radhoo

  • Contributor
  • Posts: 31
  • Country: ro
    • My technology blog
Re: Adventures in AVR ISP Programming
« Reply #25 on: February 18, 2017, 10:45:27 pm »
I had a DIY lpt1 programmer too, was among the first things I built when I started with AVRs . But newer computers have no parallel port so I wanted something easier to use.

Next was the usbAsp which I use a lot these days too.

It costs only 2-3 USD and supports both 3.3V/5V.

I also use a MKII clone that is great, as it support 3.3V/5V and ISP, PDI and TPI (so can be used with XMEGAs too)

Blog :: My Youtube :: uRADMonitor :: "Build something that matters!"
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3139
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #26 on: February 19, 2017, 12:01:40 am »
All a very entertaining example of how annoying it can be for even an EE professional to try to do something uncommon, based on fuzzy memories of outdated procedures and environments.   This is one reason why Professionals can be enthusiastic about something like Arduino, even with its annoying toy-like simplicity - sometimes (OFTEN!) all you need is something simple.  And having something that's easy to install, whose development is "tracking" recent changes in the world and with lots of online community, is frequently ... nice.

FWIW:
  • The Atmel Studio 7 install is much better than the AS 6 install.  Yes, it still takes a very long time, but with 7 it doesn't stop every <inconvenient time> asking to to checkbox some license for some sub-piece.  (On the minus side, AS7 doesn't run on WXP.)
  • WINAVR is long obsolete and no longer being updated.  It's closest logical replacement is probably the Atmel command line toolchain download ( http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORWINDOWS.aspx )  Unfortunately, this is a much smaller set of tools (doesn't include make, doesn't include avrdude, doesn't include the unix shell utilities, etc.) (because even OSSW licenses are a pain, not to mention having to track a half-dozen different projects.)
  • Arduino provides a one-place download and install of a pretty complete and modern toolchain for AVR.  It's buried deep inside a convoluted directory structure, but it IS there.
  • There were some Atmel tools that were famous for needing different drivers depending on whether you wanted to use the Atmel tools with them, or the open source tools like avrdude.  :-(
  • W8 and W10 have introduced a set of relatively annoying security features that can make unsigned drivers harder to install.
  • AVRDUDE has a fairly high update rate.  Not all of the updates have been wonderful things :-(  There are some GUI front ends that make using AVRDUDE a lot easier.  (AVRDUDESS is one, I think?)
  • The 6-pin vs 10-pin programming connector thing is indeed a thing.  More recently, you can add the 1.27mm pitch connectors to the mix, plus SWD and JTAG.  And the connectors that look the same aren't necessarily compatible.  You'd almost be better off with a set of jumpers that you ALWAYS need to fiddle with.
  • a STK500 is a swell thing, if you've got a serial port and a 12V power supply.  Similarly parallel port programmers.  If you've got the right computer and have it all set up, you're in good shape.  if you have to find a modern computer/OS/hardware/instructions set, you're NOT in good shape...  (I'm not even sure that AS7 still supports the STK500.)
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 11041
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #27 on: February 19, 2017, 02:11:03 am »
As simple as the Arduino is, I found it very frustrating when I first started messing with them and that's coming from years of experience using AVR microcontrollers. There are multiple versions of the Arduino IDE which for some reason cannot be installed concurrently on a system and some of the later versions break large amounts of older code, spitting out cryptic errors. I find this absolutely absurd for a platform aimed at beginners.
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 2470
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: Adventures in AVR ISP Programming
« Reply #28 on: February 19, 2017, 03:57:44 am »
Getting off topic, but

which for some reason cannot be installed concurrently on a system

Don't know about Windows, but on my Linux box

Code: [Select]
$ ls -ltrd /usr/local/stow/ard*
drwxrwxr-x  8 boffin boffin 4096 May 18  2013 /usr/local/stow/arduino-1.0.5
drwxrwxr-x  8 boffin boffin 4096 Sep 17  2014 /usr/local/stow/arduino-1.0.6
drwxr-xr-x 10 boffin boffin 4096 Aug 28  2015 /usr/local/stow/arduino-1.6.5-r5
drwxr-xr-x 11 boffin boffin 4096 Nov  4  2015 /usr/local/stow/arduino-1.6.6
drwxr-xr-x 11 boffin boffin 4096 Dec 18  2015 /usr/local/stow/arduino-1.6.7
drwxr-xr-x 11 boffin boffin 4096 May 10  2016 /usr/local/stow/arduino-1.6.9
drwxr-xr-x 10 boffin boffin 4096 Dec 13 00:02 /usr/local/stow/arduino-1.6.13

though to be fair since they all use the same preferences directory, it's a bit iffy to go backwards (usually if I need to check something in an older version I'll move my prefs out of the way first).

some of the later versions break large amounts of older code

Well you can't maintain 100% backwards compatibility all the time, things have to change.  But that said the Arduino IDE release QC process is.. well they don't have one, some releases of the IDE (eg 1.6.10) caused all sorts of problems. 

I wish they would have a proper release cycle, with beta releases, so that the people who are capable of debugging problems can do so, before it got to a stable release for the masses.

The whole development of the IDE is a bit... weird really, for a high profile project, I think it boils down to a few "gate keeping" egos in there doing things their way, a lot of good ideas get pooh-poohed, they do IMHO crazy-ass things like writing it's build system (arduino-builder) in what really is a pretty obscure language (Go), the afore-mentioned lackadaisical release cycles...

~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 11041
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #29 on: February 19, 2017, 06:07:27 am »
I see no reason why they couldn't maintain 100% backward compatibility, even if it's at the expense of some forward progress. The Arduino platform is aimed at beginners, and a large part of the draw to the platform is the huge library of existing code. When someone downloads code someone has published and it doesn't work and spits out some cryptic error it's frustrating. A beginner friendly platform should first and foremost "just work" and not require a bunch of screwing around and troubleshooting to use code that was working for someone else. If they are going to change how something works, there should at least be a compatibility mode. I never really got into it but I do keep the IDE around for building/modifying some of the many projects that are out there and I ended up staying at an earlier version.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3139
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #30 on: February 19, 2017, 07:06:55 am »
Quote
a large part of the draw to the platform is the huge library of existing code. When someone downloads code someone has published and it doesn't work and spits out some cryptic error it's frustrating.
yeah, infinite backward compatibility is a nice theory.  Come back and tell us how you did when you've tried to support a large project with significant development for 10 years or so...
Don't forget that over this time period avr-gcc, java, windows and macos have all changed in ways that have not beenvery backward compatible...
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 11041
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #31 on: February 19, 2017, 08:29:24 am »
yeah, infinite backward compatibility is a nice theory.  Come back and tell us how you did when you've tried to support a large project with significant development for 10 years or so...
Don't forget that over this time period avr-gcc, java, windows and macos have all changed in ways that have not beenvery backward compatible...
[/quote

Well I'm still using 1.0.6 that I rolled back to and it works just fine, it seems most people are on the older versions still because I don't remember the last time I downloaded a library or code that didn't work. When I originally tried a newer version almost nothing worked without rewriting portions of it and I couldn't really find anything different about the newer versions except that it broke a bunch of existing code.

So if they can't maintain backward compatibility, they shouldn't make changes. At the very least have a compatibility mode so it works with the existing libraries and code, and failing that, make the installations portable so that it's trivial to install multiple versions. I have two different versions of Xilinx ISE to support different generations of their FPGAs and those coexist just fine, but I can't have two versions of the Arduino IDE installed on Windows? That's ridiculous. This is a *beginner* platform, and it's a fragmented mess. When I first started playing with it there were two completely different entities, both proclaiming to be the "real" Arduino, I haven't even looked to see if that's still the case. It's so much more hassle than using Bascom or even standard C bare metal on an AVR. The *only* thing that makes the Arduino stand out is the huge collection of libraries and code. If that gets broken regularly by new releases then the the platform has failed at the very thing that makes it worthwhile to have in the first place.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3139
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #32 on: February 19, 2017, 11:50:41 am »
Quote
Well I'm still using 1.0.6 that I rolled back to and it works just fine
if they can't maintain backward compatibility, they shouldn't make changes.
People can stay at the old version if they want...  You can always install new drivers for new OSes manually, and update specific tools that stop working one at a time, and so on.  Just like Dave had to do for the simple task of putting a new .hex file on a piece of turn-key hardware, causing all that pain and frustration...

Quote
make the installations portable so that it's trivial to install multiple versions.
I don't understand the problem.  I have multiple versions (on mac.  I've also done it on windows, though I don't know whether I've used it enough there to see any problems.)  There are some problems with "extensions" because the format of various things have changed (1.0.6 only supports AVR.  The latest supports AVR, SAM3X, SAMD, ESP8266, and more), but the base install shouldn't have much of a problem.

Oh, and modern versions support a "portable" option that should help.  Download the .zip instead of the installer, unzip to \Program Files\Arduino-1.8.0 or wherever, and create a directory \Program Files\Arduino-whatever\portable before the first time you run the IDE.  Then, when you run it it will put all its normal per-user and per-installation files under "portable" instead of the normal places in the windows environment (which are weird.)  I guess this might qualify as a not-backward-compatible change, though...
 

Offline Gustavo-ar

  • Newbie
  • Posts: 3
  • Country: ar
Re: Adventures in AVR ISP Programming
« Reply #33 on: February 20, 2017, 01:19:00 am »
Hi!, this is my first post here, recently I have to program an atmega328p and make an programmer using an arduino nano, is very useful.
I can use it in two ways: by putting the AVR in the socket, or by connecting it to a cable (leaving the socket empty).

http://www.martyncurrey.com/arduino-nano-as-an-isp-programmer/

« Last Edit: February 20, 2017, 01:30:29 am by Gustavo-ar »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3139
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #34 on: February 20, 2017, 07:09:13 am »
Quote
modern versions support a "portable" option
Sigh.  In Windows10, at least, you don't want to put an Arduino tree with "portable" configured into the normal ProgramFiles area, because W10 won't allow it to write anything there, and it won't work (unless you want to run it "as administrator.")
It'll be OK in your personal area, or somewhere that isn't protected.

Look: 1.6.13 and 1.8.1 not only both installed, but both running simultaneously!
« Last Edit: February 20, 2017, 07:10:51 am by westfw »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3139
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #35 on: February 27, 2017, 09:13:46 pm »
I went ahead and wrote a little windows batch script that will add the tools included with an Arduino install to your "command prompt" path, so that you can use avrdude, avr-gcc, and so on.   Enjoy...  (copied from other posts; may have some redundancies.)

With WINAVR becoming unmaintained, various people including myself are starting to think that the easiest way of getting a basic set of avr-gcc tools installed on your Windows system is to install Arduino, and use the tools that it includes.
 But they're buried rather deeply, and a bit of a pain to get to.
 So I wrote this batch script to go out and look at your Windows (XP, 7, 8, 10) system, find the Arduino tools (1.0.x, 1.6.5+, 1.8.x), and sticks them in the search path for that "Command Prompt" session.  It gets avrdude too.  It doesn't copy or actually install anything, so it's pretty quick.  Now, command-line access to the bare compiler isn't a particularly wonderful development environment, but it might be good for a quick start...
 
 >C:\Users\User>e:install-avr-tools
 
No avr-gcc currently installed.
 At least one Arduino install found.

 
Looks like C:\Program Files\Arduino1.8.0 has version
 avr-gcc.exe (GCC) 4.9.2
 Use C:\Program Files\Arduino1.8.0 ? [y/n]>y
 Found avr-gcc

 Checking tool versions
avr-gcc (GCC) 4.9.2
 Copyright (C) 2014 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
          Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
          Copyright (c) 2007-2014 Joerg Wunsch
          System wide configuration file is "C:\Program Files\Arduino1.8.0\hardware\tools\avr\etc\avrdude.conf"

C:\Users\User>

  https://hackaday.io/project/19935-install-avr-tools
 
 
The following users thanked this post: thm_w, Ian.M

Online rrinker

  • Super Contributor
  • ***
  • Posts: 1970
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #36 on: February 27, 2017, 09:25:27 pm »
  I just have my library and sketches folders pointed to my OneDrive, that way I can access my projects from any computer, either my main desktop or the workbench computer, or even my lappy at work if I get an idea and want to put it in code while still fresh in my mind. I've done this with other programs as well, like KiCad and my model railroad CAD.
 

Offline Nobody2

  • Contributor
  • Posts: 17
  • Country: de
Re: Adventures in AVR ISP Programming
« Reply #37 on: March 02, 2017, 09:11:35 am »
First thing I thought when i saw the image on twitter and the video title was: "Yep, that's why I am still using AVRStudio 4". Using the visual studio base makes it just too bloated in my opinion. Also just talking to a programmer with the newer version is too convoluted imho, but the biggest issue I have with it, is that they removed the ability to use self-build programmers like the ones I use.
I'm not use about WinAVR though, I'm pretty sure my version is newer than 2010?
 
The following users thanked this post: Someone

Offline SingedFingers

  • Frequent Contributor
  • **
  • Posts: 599
  • Country: gb
Re: Adventures in AVR ISP Programming
« Reply #38 on: March 02, 2017, 10:50:41 am »
Argh this thread makes me angry. Sorry for the rant...

About a year ago I needed to program an old PIC16F684 with some code that was lying around that I wrote back in the late 1990s. Didn't want to invest in a programmer for a one off so I dug an Arduino out of the junk box and set up a bodge rig on a breadboard with the software and hardware here: http://rweather.github.io/ardpicprog/ . That took about an hour to get working. I had to download and install MPLAB and fix a few things in the code but it all worked which took about an hour. Not too terrible.

Then about 9 months ago I needed to use an AVR to replace a bit of relatively complex discrete logic (nothing fancy just PLC grade logic which was trivial to implement in C) in something so I grabbed a cheap USBasp programmer from a local supplier and a couple of AVRs from RS and got to work.

5 hours later I was still trying to get bloody Atmel studio working. Now the day job is mainly mud wrestling with Visual Studio, which may have contributed to it because I already had VS2015 installed, and I've been using it for about 15 years now for C++ and C# and I've even built addins for it so I'm no noob when it comes to this sort of stuff. But FMH it just didn't want to work.

Eventually I fired up a VirtualBox VM with Debian on it, connected the USB device to that and wrote the code with vim in about 30 minutes, compiled it with avr-gcc, burned it with avrdude and I was done. Joy to platform agility on my part  :-+

None of this was ISP programming - I didn't want to bite that one off but I can imagine the difficulty that adds.
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #39 on: March 02, 2017, 12:18:23 pm »
If it's just a quick job then use the Arduino IDE. It's designed for noobs.

Atmel Studio is a huge fail unless you really need to program in assembly language or whatever.

 

Offline SingedFingers

  • Frequent Contributor
  • **
  • Posts: 599
  • Country: gb
Re: Adventures in AVR ISP Programming
« Reply #40 on: March 02, 2017, 12:30:56 pm »
It's OK until you hit something they bastardised. Do they run it through a transpiler or something before they compile it to the final language? It feels like C++ but it's not.
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 8246
Re: Adventures in AVR ISP Programming
« Reply #41 on: March 02, 2017, 01:01:05 pm »
The Arduino IDE runs it through a pre-preprocessor (or bastardizer)  that inserts forward declarations for functions etc.   Unfortunately it frequently gets stuff wrong if you are trying to use the more advanced features of the GCC C++ language.  The easy fix is to ONLY use <sketch_name>.ino to provide a list of headers to include to MAKE as the bastardizer doesn't parse any other files in the sketch.  Don't put any code or declarations in the .ino file! 

You can then create a normal C++ project structure with all .cpp and .h files in the Arduino sketch folder, with a normal main() function and without the Arduino's enforced setup() and loop() functions.   You must avoid using the filename <sketch_name>.cpp as the bastardizer will overwrite it. Also don't use the filename main.cpp.

See Gammon.com.au: How to avoid the quirks of the IDE sketch file pre-preprocessing for details.

Project headers listed in the .ino file should be 'pure' (i.e. only declare or #define stuff, not create/initialise any C objects).  See Gamedev.net: Organizing Code Files in C and C++

« Last Edit: March 02, 2017, 01:14:47 pm by Ian.M »
 

Offline SingedFingers

  • Frequent Contributor
  • **
  • Posts: 599
  • Country: gb
Re: Adventures in AVR ISP Programming
« Reply #42 on: March 02, 2017, 01:04:33 pm »
Thanks for the info - explained. I used a pointer once and it shit itself so I gave up and just used C :)
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 8246
Re: Adventures in AVR ISP Programming
« Reply #43 on: March 02, 2017, 01:30:05 pm »
N.B. if you are using the ArduinoIDE and are getting mysterious build errors for perfectly good code that go away if you insert a dummy function call or some other crap just before the line with the error, its because the build process can fail randomly if the path to the temp folder is too long or contains spaces,

The fix is to give the IDE a temp folder in the root of the drive. Open the Arduino preferences.txt file, close the IDE, then add the line
Code: [Select]
build.path=C:\tempand create the corresponding temp folder on C, with full access for your username.
 

Online rrinker

  • Super Contributor
  • ***
  • Posts: 1970
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #44 on: March 02, 2017, 02:38:40 pm »
 I am so stealing westfw's script. Doing a one-off it's not so bad drilling through the Arduino install to find the bits, but after the first time, a script like that is a lifesaver.

 As for the install of the Atmel Studio - at least part of that HAS to be something they've (Atmel) has done, because I've been using Visual Studio for a long time and while the install can be time consuming, it certainly doesn't take hours.

 Good tip on the temp path Ian. I've come across strange hard to debug issues like that in many other unrelated things and it can be very frustrating to find the cause when everything looks just fine. My favorites are when the software reports something like "file not found" but you can manually open the path and see the file sitting right there in plain sight.

 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #45 on: March 02, 2017, 04:47:16 pm »
It's OK until you hit something they bastardised. Do they run it through a transpiler or something before they compile it to the final language? It feels like C++ but it's not.

They do one thing before it runs: They search the files for function prototypes and insert them at the top of the file. This allows you to call functions below you in the file without adding explicit prototypes. It's usually invisible in practice.

Also: The way the IDE works it's best not to try and write separate header/object files for everything. You can do it if you want but all you achieve is double the number of open files in the IDE so it gets messy. The way I do it is to just make everything as .h files (all code inlined in classes) then #include them in the main file. Separating interface from implementation doesn't gain you much in programs this size, so...  :-//

Apart from that it's perfectly standard C++.

PS: If you want to write in assembly language with Arduino IDE you can do that, too, but only in libraries. The IDE doesn't look for .asm files in sketch folders, only in library folders. If you put them library folders it will look for them and assemble them just fine. You have to use an external editor because the IDE won't load them in your sketch, but... you can do it.
« Last Edit: March 02, 2017, 06:39:41 pm by Fungus »
 

Offline HwAoRrDk

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: gb
Re: Adventures in AVR ISP Programming
« Reply #46 on: March 02, 2017, 05:42:25 pm »
As for the install of the Atmel Studio - at least part of that HAS to be something they've (Atmel) has done, because I've been using Visual Studio for a long time and while the install can be time consuming, it certainly doesn't take hours.

I suppose it could take hours if you've downloaded the stub 'web' installer and you have a crappy internet connection. The web installer has to download hundreds of MB of stuff, and it's not very good at giving you feedback on progress.

(As an aside, personally, I have a real dislike of 'web' installers. The only advantage I can see for them is it saves on download time in cases where the user is not going to be installing a significant portion of optional modules. And they have a huge downside for if you want to archive the installer, but the vendor does not deign to make a 'full' package available. On more than one occasion I have had to hunt through temp folders to find the actual full installation files. >:()

Another reason that just occurred to me that explains prolonged installation - Atmel Studio and Visual Studio alike - is that the installer creates a system restore point before it begins, which can be a lengthy process sometimes.
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #47 on: March 02, 2017, 06:35:12 pm »
(As an aside, personally, I have a real dislike of 'web' installers. The only advantage I can see for them is it saves on download time in cases where the user is not going to be installing a significant portion of optional modules.

Sure, but Visual Studio doesn't actually give you any install options at all*. No matter what happens you're in for a 5Gb download.

(*) If they did that then people might not install the Windows Phone development platform  :scared:

The best part of Visual Studio is when you're on site with a client and it suddenly asks you to reconfirm your Microsoft account before it'll compile anything. And you don't have an Internet connection. Yes this happened to me.  |O
« Last Edit: March 02, 2017, 06:41:04 pm by Fungus »
 

Online rrinker

  • Super Contributor
  • ***
  • Posts: 1970
  • Country: us
Re: Adventures in AVR ISP Programming
« Reply #48 on: March 02, 2017, 07:43:33 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

 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • Country: 00
Re: Adventures in AVR ISP Programming
« Reply #49 on: March 02, 2017, 08:21:25 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.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 3139
  • 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.)
 

Online Brumby

  • Supporter
  • ****
  • Posts: 9776
  • 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??
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • 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.


 

Online rrinker

  • Super Contributor
  • ***
  • Posts: 1970
  • 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.

 

Online rrinker

  • Super Contributor
  • ***
  • Posts: 1970
  • 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.

 

Online Brumby

  • Supporter
  • ****
  • Posts: 9776
  • 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: 8246
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 . . . .
 

Online Brumby

  • Supporter
  • ****
  • Posts: 9776
  • 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: 1954
  • 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.
 

Online Brumby

  • Supporter
  • ****
  • Posts: 9776
  • 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?
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • 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.
 

Online rrinker

  • Super Contributor
  • ***
  • Posts: 1970
  • 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.





 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • 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.

 

Online rrinker

  • Super Contributor
  • ***
  • Posts: 1970
  • 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: 8246
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'
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • 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: 8246
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: 3139
  • 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.)
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • 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.

 

Online rrinker

  • Super Contributor
  • ***
  • Posts: 1970
  • 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: 8246
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

  • Frequent Contributor
  • **
  • Posts: 571
  • Country: 00
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.
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 10483
  • 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