Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
KreAture
PostPosted: Aug 30, 2011 - 10:23 PM
Rookie


Joined: Jun 11, 2005
Posts: 44


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 ---
 
 View user's profile Send private message  
Reply with quote Back to top
aamicron
PostPosted: Sep 03, 2011 - 07:10 AM
Rookie


Joined: Feb 03, 2010
Posts: 40
Location: Boulder, CO

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

http://www.avrfreaks.net/index.php?name ... highlight=
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
KreAture
PostPosted: Sep 03, 2011 - 08:49 AM
Rookie


Joined: Jun 11, 2005
Posts: 44


I got my code to work by forcing the 3 variables I needed into registers.
Code:
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.
 
 View user's profile Send private message  
Reply with quote Back to top
timojaask
PostPosted: Sep 23, 2011 - 07:23 AM
Wannabe


Joined: Nov 13, 2008
Posts: 88
Location: Turku, Finland

I have the same problem with ATtiny20 using AVR Studio 5. Anyone knows if there is any official solution from Atmel?
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
KreAture
PostPosted: Sep 23, 2011 - 04:00 PM
Rookie


Joined: Jun 11, 2005
Posts: 44


Nothing yet.
I did get a reply from them asking for more information, but that is a long while ago.
 
 View user's profile Send private message  
Reply with quote Back to top
KreAture
PostPosted: Oct 03, 2011 - 04:19 PM
Rookie


Joined: Jun 11, 2005
Posts: 44


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.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Oct 03, 2011 - 04:26 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62299
Location: (using avr-gcc in) Finchingfield, Essex, England

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

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
KreAture
PostPosted: Oct 03, 2011 - 04:35 PM
Rookie


Joined: Jun 11, 2005
Posts: 44


Still, they acknowledged the issue.
It's more than we had until now.
 
 View user's profile Send private message  
Reply with quote Back to top
timojaask
PostPosted: Oct 21, 2011 - 11:30 AM
Wannabe


Joined: Nov 13, 2008
Posts: 88
Location: Turku, Finland

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.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits