Many thanks to your comprehensive post. As a hobbist, never heard of GCC, or WinAVR, and now am curious to know more about them.
All mistakes in running code by my AVR simply solved by changing stack values in bascom environment settings, setting them to higher values.
As I always say "Very difficult questions sometimes have simple answers, and sometimes very simple questions have the most difficult answers."
Thanks again to those friend on this list who remind me of stack size, as well as those who had some points on noise reduction and capacitors.
Behrooz hariri
Reza <reza_agha@yahoo.com> wrote: hi;
I'm working with GCC but i tried using CodeVision
also.
but as you may know, there is a problem in design of
AVR microcontrollers, they could not return from
interrupts when stack lies in external sram. because
of this some compilers like CodeVision (or maybe
BasCom) use a hardware stack, and another data stack.
but as I tested, these kind of dividing stack into two
separated regions means the compiler prepared for the
begineers or middle level programmers, not good ones.
just for testing an algorithm.
for example, in CodeVision AVR if you use a large
table placed in flash, for example a font with a size
of about 4KB in size, CodeVision never could generate
a good code. ofcouse target code will not be run.
maybe your problem solved using a powerfull compiler
which I prefered as GCC (or WinAVR). some compilers
seems to be a student work which released to be used
by the others.
if you checked the code the GCC I hope it works
properly. as a suggestion I prefered following tools
which I used frequently in different projects
specially for automation control in a wide varity of
projects. event with floating point operations and
large amount of data:
- CodeVision AVR (only for generating template program
and configuring hardware).
- WinAVR (from sourceforge or avrfreaks) for compiling
the program.
- Atmel AVRStudio 4.12 (or later) with Service Pack 2
installed for debugging and using as an IDE.
- Ponyprog2000 for programming and setting fuse bits.
- or AvReal 1.25 serial downloader for serial
programming when download speed is important, or using
a command line program is a need.
you should note if you are using floating point
package, you must preserve at least 4KB of code in
flash area, and somehow an amount of 128 or 256 bytes
of SRAM storage for runtime support. in some cases you
may have a bad result because of low speed in floating
point calculations, which depend on the algorithm you
may use, you may need a faster micro, using an
external math co-processor (like the one in
opencores.org) or simply convert your logic to use
long integers (fixed point arithmetic) beside of using
floating point (see PC Underground Book which uses a
fixed point arithmetic for 3D matrix calculations).
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------
See the all-new, redesigned Yahoo.com. Check it out.
[Non-text portions of this message have been removed]Message
RE: [AVR-Chat] Lack of enough stacks? (was: AVR Power Supply Noise)
2006-07-16 by Behrooz Hariri
Attachments
- No local attachments were found for this message.