AS5 + ATtiny10 still broken ?

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I sent this to avrbeta@atmel.com but I am replicating it here as well so people can find it and won't waste too much time wondeirng why their code doesn't work...

This is using the current (as of 2011-08.30) AVR Studio 5 with built in AVR-GCC 4.5.1:

--------------------
Compiling a simple app with a few global volatile variables lead to generation of illegal codes.

A short snippet from my main:
141: OCR0A = pwm;
000000BD 77 bd OUT 0x27,R23 Out to I/O location
000000BE 66 bd OUT 0x26,R22 Out to I/O location
145: update = false;
000000BF 10 93 42 00 ???STS 0x0042,R17 Store direct to data space(Not supported by current part)

update is "volatile bool update;" and resides in 0x0042 according to the watch-window.
It's updated to true from a ISR and cleared in main.
It's never changed due to both instructions addressing it being wrong.

Here's from the ISR:
196: update = true;
000000D6 81 e0 LDI R24,0x01 Load immediate
000000D7 80 93 42 00 ???STS 0x0042,R24 Store direct to data space(Not supported by current part)

Counter is 16-bit:
193: counter--;
000000C9 80 91 40 00 ???LDS R24,0x0040 Load direct from data space(Not supported by current part)
000000CB 90 91 41 00 ???LDS R25,0x0041 Load direct from data space(Not supported by current part)
000000CD 81 50 SUBI R24,0x01 Subtract immediate
000000CE 90 40 SBCI R25,0x00 Subtract immediate with carry
000000CF 90 93 41 00 ???STS 0x0041,R25 Store direct to data space(Not supported by current part)
000000D1 80 93 40 00 ???STS 0x0040,R24 Store direct to data space(Not supported by current part)

Other than access to stuff not in regs, it works well???

Kyrre

---- Begin studio info ---
Atmel AVR Studio 5 (Version: 5.0.1163)
© 2011 Atmel Corp.
All rights reserved.

OS Version: Microsoft Windows NT 6.1.7600.0
Platform: Win32NT

AVR Studio Assembler Language Service
Version: 1.0
Assembly: AVRAssemblyLanguage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {f12744aa-40f9-4f9c-9e47-5278950de605}
Company: Atmel Corporation

AVR Studio Assembler Project
Version: 1.0
Assembly: Assembler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {59b1d629-9dcc-43ed-a0fd-8ab0e4d622ab}
Company: Atmel Corporation

AVR Studio Device Service
Version: 1.0
Assembly: DeviceService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {9a7a9659-4d19-49ce-9838-099ea5896b86}
Company: Atmel Corporation

AVR Studio GCC Language Service
Version: 1.0
Assembly: AvrGCCLanguage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {2713c90c-7981-454a-aa3e-40ec5867c6fd}
Company: Atmel Corporation

AVR Studio GCC Project
Version: 1.0
Assembly: AvrGCC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {dce6c7e3-ee26-4d79-826b-08594b9ad897}
Company: Atmel Corporation

AVR Studio Help About
Version: 1.0
Assembly: HelpAbout, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {2b78c895-5b97-4cfe-a33c-1448b2fe89f9}
Company: Atmel Corporation

AVR Studio Object File Debug Project
Version: 1.0
Assembly: ObjProjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {5f937198-b7ed-4d9c-af7b-084765938652}
Company: Atmel Corporation

AVR Studio Software Framework
Version: 1.0
Assembly: AvrSoftwareFrameworkPackage, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {e3cf2594-fb44-4ddb-9ba7-9faef7dd8cf3}
Company: Atmel Corporation

AVR Studio Target Manager
Version: 1.0
Assembly: TargetService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {862171d0-4dac-4e71-9205-7714a7992e1f}
Company: Atmel Corporation

AVR Studio Target View
Version: 1.0
Assembly: TargetView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {e7a94af5-431f-41f2-9e51-7f923a6e4da4}
Company: Atmel Corporation

AVR Studio Tool Service
Version: 1.0
Assembly: ToolService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d264112969646cc9
Package GUID: {ad6d263d-0182-455b-a746-32a8d3a1da72}
Company: Atmel Corporation

Status Service
Version: 1.0.0
Assembly: StatusService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c999f8b26c714da3
Package GUID: {4c8f49c3-1a58-4949-86b2-a5223c13a068}
Company: Atmel Corporation

Text
Version: 1.0
Assembly: Microsoft.VisualStudio.Editor.Implementation, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Package GUID: {e269b994-ef71-4ce0-8bcd-581c217372e8}
Company: Microsoft

Visual Assist X
Version: 1.0
Assembly:
Package GUID: {44630d46-96b5-488c-8df9-26e21db8c1a3}
Company: Whole Tomato Software, Inc.

Visual Studio Debugger Managed Package
Version: 10.0
Assembly: VsDebugPresentationPackage
Package GUID: {BEB01DDF-9D2B-435B-A9E7-76557E2B6B52}
Company: Microsoft

AVR GCC 8-bit Toolchain
Version: gcc version 4.5.1 (AVR_8_bit_GNU_Toolchain_3.2.3_315)

AVR GCC 32-bit Toolchain
Version: gcc version 4.4.3 (AVR_32_bit_GNU_Toolchain_3.2.3_261)

AVR Software Framework
Version: ASF-2.5.1-17860.53
--- End Info ---

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is there a fix for this? I think I am seeing the same thing:

https://www.avrfreaks.net/index.p...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I got my code to work by forcing the 3 variables I needed into registers.

register uint8_t pwm asm("r18");
register uint8_t air asm("r19");
register uint8_t cold asm("r20");

That removes the bogus memory-access the compiler makes. It is however very limiting.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have the same problem with ATtiny20 using AVR Studio 5. Anyone knows if there is any official solution from Atmel?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nothing yet.
I did get a reply from them asking for more information, but that is a long while ago.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wohoo!
Good news to all tiny10 want-to-be-users.
AVR Toolchain guys have accepted the issue and confirmed they will work on a solution for a future release.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wouldn't pop the champagne just yet - it could have gone very flat by the time that "release" arrives ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Still, they acknowledged the issue.
It's more than we had until now.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For those still in trouble, IAR Embedded Workbench supports those smaller ATTinys. I have successfully moved my code to IAR and everything works fine.

KickStart edition of IAR Embedded Workbench is completely free with the following limitations:

Quote:
The kickstart edition corresponds to the latest release of the full edition of IAR Embedded Workbench, with the following exceptions:

• It has a code size limitation.
• It does (normally) not include source code for runtime libraries.
• It does not include support for MISRA C.
• Very limited Technical Support.

Code size limitation is 4K. For many smaller ATTiny projects should be just fine.