to count down to zero
if( val.low— ) val.high—;
Back then AVR-gcc was not smart enough to do the above automatically.
I used a lot of uint32_t and uint64_t as counters to mark the passage of time.
--
David Kelly N4HHE, dke...@hiwaay.net
functions on longs were dangerous.
That not all registers were stacked on entry to the interrupt handler (that
would be costly) and the compiler (and support library) assumed some registers
were free to use without preserving across function calls.
--
David Kelly N4HHE, dke...@hiwaay.net
ode ++ inline rather than let
avr-gcc call a library routine. Even more so if in an interrupt. Not all
library routines used to be re-entrant.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
; I suspect it's because your returning a void instead of an int,
In Unix convention its
int putc( int, FILE* )
int putchar( int )
Where upon success one returns the character put or -1 or EOF for failure. If
replacing standard function one should return the expe
On Nov 30, 2016, at 8:32 AM, Paul LeoNerd Evans wrote:
> Is it possible to get that added to as the expected names
>
> int24_t
> uint24_t
I am opposed because 24 is not a standard int.
stdint.h standardizes types across compilers.
--
David Kelly N4HHE, dke..
.
You don't return to where you thought you'd return.
And registers don't have the contents they had when the ISR was dispatched.
Anything is possible.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers wou
// disable once used
604: 1d ba out 0x1d, r1; 29
reti();
606: 18 95 reti
}
608: 0f 90 pop r0
60a: 0f be out 0x3f, r0; 63
60c: 0f 90 pop r0
60e: 1f 90 pop r
rty is leaking?
Dereferencing TCC0.CTRLE by taking its address and casting it as a pointer may
strip volatile allowing gcc to optimize. It should be able to optimize anyway.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would
ly a solid day hunting down
the buried small changes in each project's Properties before I finally had a
new project that would build. :-(
But also some here are mistaking the IDE with the text editor.
I am happy with the gnu toolchain, b
g
>
> I use Thunderbird and it came in as an entirely new thread.
It would if you have deleted the prior messages.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
__
what doesn't. Something that knows the files are in a savable state
so I don't have to exit AS6 to make sure everything is properly flushed to disk.
--
David Kelly N4HHE, dke...@hiwaay.net
W
not a life-threatening deal, but it is one of those things that separate
quality technical lists from the riff-raff. The result is a higher quality list
archive.
If we don't politely point this out now and then nobody will know and this
wisdom will be lost as it
0;
> }
>
> The for(;;) is the interesting part ;-)
Thanks!
Use for(;;) or while(1) all the time for infinite loops. Was confused because
the disassembly didn't list the code which generated rjmp .-2. Was concerned
whether for some reason main() was now getting special t
infinite loop as shown at 0x8a above? Is supposed to ret to caller
which then calls _exit or perhaps calls something else. But my point is that
int main() is a function that is supposed to return to caller.
--
David Kelly N4HHE, dke...@hiwaay.net
===
ts f000 instead of f000
> }
Celio, 0x0f is getting shifted left 12 bits into an int16_t (the AVR
default variable type) before being promoted to an uint32_t which is
when the sign bit gets stretched out.
Eric's version expands 0x0f into uint32_t first,
ecause I think
it adds readability and understanding to my code for ssram access to be obvious
where its being used than if it was hidden.
Perhaps this is a job for C++? But that also hits on why I do not use C++, that
I want to see what is being done, not expect things to be done ma
l but it
will be easier to understand 6 months from now than an edit of the
Makefile plus hacks to the memory segment definitions. I think it is
possible that way to write the .eeprom segment to two places in memory,
is just that you don't want to do it that way when there is an easier
way that i
On Thu, Aug 27, 2009 at 09:55:05AM -0500, David Kelly wrote:
> On Wed, Aug 26, 2009 at 08:21:00PM -0700, Parthasaradhi Nayani wrote:
>
> > Details of application - I have data packets each 32 bytes in size and
> > we have accommodate 2000 of these (predefined).
>
> 32 * 2
On Wed, Aug 26, 2009 at 08:21:00PM -0700, Parthasaradhi Nayani wrote:
> David Kelly wrote:
> > You are right that we know nothing about the application in question
> > - details here would make it much easier to give recommendations.
>
> Hello all,
>
> I mentioned 4MB
EEPROM, or an external device. Otherwise one
must manually manage allocation.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
__
op-post without trim.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
htt
at flash is constant.
Something like this might work for you:
typedef struct {
uint8_t variable;
uint16_t a, b, c, d;
uint32_t e;
} FLASH_STRUCT;
#define flash_p ((FLASH_STRUCT *)(0x8000))
Then use flash_p->variable to access.
The con of this method is that that
a means of
controlling the absolute address of allocation.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
___
AVR-GCC-
On Fri, May 22, 2009 at 07:38:36AM -0700, Parthasaradhi Nayani wrote:
>
> Hello David Kelly,
>
> Thanks a lot for the suggestions. Yes, I understand that initializing
> the variables will not actually save the vales into the memory
> locations. I will try a sample code and r
ion-lma .eeexternal=0 -O ihex
$< $@
Then you need a target such as this which will invoke the above rule
(think it needs a blank line after):
object_eeext.hex:
Finally, believe it goes without saying that you have to provide
routines to access your external E
r or provide the customer with the tools to
build one of their own. What he is trying to do is in effect create a
run time program linker.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first dr
On Mon, May 11, 2009 at 03:56:34PM +0200, Robert von Knobloch wrote:
> David Kelly wrote:
> > Sounds to me as if you are making the "bootloader" too big and
> > should simply link an entire application for every possible target.
> > What you are doing would make mor
not have this affecting the main code.
Sounds to me as if you are making the "bootloader" too big and should
simply link an entire application for every possible target. What you
are doing would make more sense if the loadable modules c
the end of most (not all)
routines. Pure waste. But the code ran correctly.
> This is a serious bug imho and should be fixed.
If its documented then its a feature, not a bug. Want smaller code? Try
one of the 3.x compilers.
--
David Ke
On Mon, May 04, 2009 at 11:46:40AM -0700, Steven Michalske wrote:
> On May 4, 2009, at 11:33 AM, David Kelly wrote:
> >
> >IIRC the compiler doesn't know internal AVR EEPROM either. AVR
> >EEPROM is not mapped in CPU address space but it faked into the load
>
pped in CPU address space but it faked into the load map for
debugging and device programming.
[85 lines deleted under top-post]
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must firs
a hard coded constant.
If I was defining the ED structure then I'd store 4 bytes of seconds
since some epoch rather than 6 bytes of year, month, day, hour, minute,
second. Much simpler, and routines to convert from seconds are readily
avai
ice required a slow system clock but thats now operated by hand
> anyhow). Thanks again!
If the SPI device is that slow then it might as well be handled in
software. Perhaps that is what "operated by hand" means?
--
David Kelly
not guarantee disable
> -mtiny-stack - not for what I wanted.
Isn't this part of what -ffreestanding does?
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destr
ess where the C
compiler has also thrown complaints for mixing signs. And for "precision
loss" when stuffing 32 bits into 8. Generates exactly the same code
without complaining if I write u8 = ( u32 & 0xff );
--
David Kelly N4HHE, dke...@hiwaay.net
===
ed-char, and -fno-unsigned-char in the
avr-gcc man page.
So in short plain old "char" is only being sloppy in not explicitly
stating signed or unsigned.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would
is expandable:
if( frequency == LOW_KHZ ) {
#define SAVED_F_CPU F_CPU
#undef F_CPU
#define F_CPU LOW_KHZ
_delay_us(us);
#undef F_CPU
#define F_CPU SAVED_F_CPU
#undef SAVED_F_CPU
} else {
e debugger seems to jump around.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
___
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
de.
Also make sure you have specified -g in the compiler flags.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
___
AVR-GCC-list
_String[i] = 0xff;
> > A_String[i + 1] = 0x00;
> > delay_about_1000_processor_cycles();
> > waste_about_2000_bytes_of_code_space();
>
> ROTF ! :-
sprintf() only costs 2kB? Sure enough, this little program is 2132 bytes
after strip:
#include
main()
{
char t
e, and zero T1.
> Then on the second rising edge, grab the count from T1, which is
> running at CK/1
Use an input capture I/O bit and let the hardware take a snapshot of the
timer value when the edge is detected. Zero latency as long as it
doesn't occur faster than you can reset the inp
On Fri, Feb 20, 2009 at 08:00:00AM +0100, Joerg Wunsch wrote:
> David Kelly wrote:
>
> > Strangely the JTAGICE mkII didn't work on the above hardware where the
> > ICE Cube did. I put a small 50 mA or maybe 100 mA linear regulator on
> > the 3.3V supply and the
On Feb 19, 2009, at 9:44 PM, Graham Davies wrote:
David Kelly wrote:
I have a Microchip 1000 or 2000 ICE thingy that cost about $2000
and was used for one project. Given a choice I much prefer the
ECROS
ICE Cube, avr-gcc, and of course an AVR.
Could I possibly quote that on the "
me because the
ICE Cube worked so well.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
___
AVR-GCC-list mailing list
AVR-GCC
ith releases of
> both coming up very soon.
Thought I ought to reply to make sure its clear that I'm not complaining
and very much appreciate the work Eric and Joerg are doing and have done
for avr-gcc.
Related to another thread: as to why *not* to use an 8051:
D
ed
> the prototype to call it.
Hey Joerg, you must be busy! FreeBSD's avr-gcc used to track WinAVR
closer than this. :-)
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would
5 ms!
Well, not "more than" but interrupt getMs() for some multiple of 256 ms
with a window of about 1 ms.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
_
e ? was intended
as wildcard character indicating that any character can be escaped as
itself when in doubt?
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computers would destroy, they must first drive mad.
is an avr-gcc patch and not standard gcc. Am more certain
the support of entering binary values is an avr-gcc enhancement because
I see the patch file in the FreeBSD port.
--
David Kelly N4HHE, dke...@hiwaay.net
ike when displaying.
Should be able to find them at constant offsets at run time.
The rule in the Makefile for the file containing __DATE__ needs to be an
"always build."
--
David Kelly N4HHE, dke...@hiwaay.net
Who
On Jan 14, 2009, at 5:58 PM, Daniel O'Connor wrote:
On Thursday 15 January 2009 04:15:14 Dave Hylands wrote:
And here's some code that implements such a ring buffer. As David
Kelly points out, as long as the index type is uint8_t, then nothing
special is required (which for this
o the ISR isn't initializing its variables, its making space for them.
Can declare your variables as static within the ISR to keep them from
being allocated in CPU registers or on the stack. But no matter what,
some register space is
bles that are modified inside an ISR they either
have to be the size of an atom or otherwise protected against change
while being used outside of an ISR. Elements of a ring buffer are are
known to be valid and stable for the next few moments based on the
values of the buffer indexes. But the buffe
;.
>
> Which is why there is the macros. Check out:
>
> ATOMIC_BLOCK( ATOMIC_RESTORESTATE )
> {
>... Mangle pointers
> }
Interesting. Don't recall those being there 3 or 4 years ago back in
pages one must block the interrupt before reading the
variable that the interrupt might modify.
But this is something warranting further study of your specific code. If
instructions are used that read the whole 16 bits without possibility of
an interrupt betwe
ances. Perhaps when the rest of the device was wiped for a code
reload or something? Anyway, it was cheaper to do without the first byte
than to worry about it.
--
David Kelly N4HHE, dke...@hiwaay.net
Whom computer
r tools can disassemble and comment an object file as a target in
the Makefile. Often all that is needed is a glance at that file's
contents to realize the code is not going to do what one expected.
Also good for tuning one's C coding style for maxim
like to put the semicolon on a separate line
so that the emptiness stands out.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must first drive mad.
___
uint16_tab;
uint8_t c;
} big_little;
struct {
uint8_t a;
uint16_tbc;
} little_big;
struct {
uint8_t a, b, c;
} by
r appeneded to each message has a link to the
instructions:
> ___
> AVR-GCC-list mailing list
> AVR-GCC-list@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
--
Davi
;
> uint16_t a = pgm_read_word(&__checksum);
>
> Or something like that.
Not only that but if the intent is to CRC the FLASH contents then
slow_crc16() needs to be coded accordingly. Is my understanding that
slow_crc16() is a standard IAR library function.
--
David Kelly N4HHE, [EM
g at the 2nd argument. Your code above is
making an assumption that it is to CRC everything from and including
address 0x to but not including a memory location containing
__checksum.
Avg-gcc isn't going to make or fill a variable
.12.
http://www.obdev.at/products/avrusb/index.html
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must first drive mad.
___
AVR-GCC-list mailing list
AVR
Nice touch in including both 3.4.6 and 4.2.2. Default is 3.4.6, but
"avr-gcc-select" is a script that will change the default.
Would like to see the build tools included. Brief look I don't see any
source code in the package or ava
pdates.
Or checkout this way and cd to ports/devel before "cvs update"
% cvs -d [EMAIL PROTECTED]:/home/ncvs co ports/devel/
avr-gcc ports/devel/avr-binutils ports/devel/avr-libc
--
David Kelly N4HHE, [EMAIL PROTECTED]
One option is to set the environment variable INDENT_PROFILE to the
location of one's default .indent.pro for GNU Indent, but I'd like to
know where the program searches by default? It doesn't seem to be:
C:\Documents and Settings\dkelly
--
David Kelly N4HHE, [
nclude for all my type definitions. This way there is
no question as to the size or signedness of a char when its uint8_t.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would
stand
your question. memcpy() isn't an inline function, its a called
function like most everything else.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must first
On Mon, Mar 17, 2008 at 09:28:47PM -0700, atifplus wrote:
>
> so as long as my move variable is 1 2 3 or 4 the interrupt should keep
> sending pulse accordingly but i am not getting anything on portB
> PORTB |= (0 << PB3)|(0 << PB4);
Do you really believe you can OR a 0 into bit location
jdump -dS" usually produces very good output. "-DS" does the same
as -dS plus a whole bunch of crap disassembled where its not code. At
least when one uses -O2 to compile.
--
David Kelly N4HHE, [EMAIL PROTECTED]
(a& 0x0c))
> {
> }
>
> Will produce much better code!
You changed horses in the middle of the stream. Replace "if" above with
"while" that you started with and your non-volatile may loop forever
based on one read.
The solution is to rol
, but I'm looking at some new parts...
There are/were older ports in fink and darwin-ports. You could start
with one of those. I would recommend closely following Joerg's
FreeBSD port as it and WinAVR march pretty much march in lockstep as
the state-of-the-art avr-gcc.
--
David K
all:object.elf object.list
It was the .list file I was looking at last night that looked
reasonable.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must first drive mad.
t; depending on the next Tx bit value.
There is a mode where one only writes the BIT_TIME in the OCRx register
once and the paired timer resets to 0 with the output bit change. So all
you have to do in the ISR is to decide which output value is to be sent
next. The transmitted timing will be as pr
ing output bits from interrupt is fine. If its picky then
connect the OCR timer to its output bit and let the hardware do it.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they
is not capable of doing this.
Placing object code around fixed obstacles is a common embedded task.
And not uncommon in non-embedded applications.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom c
.
I think this URL describes the syntax to do what Martin is looking to
do:
http://www.gnu.org/software/binutils/manual/ld-2.9.1/html_node/ld_21.html#SEC21
More hints here, in that one can edit the . address:
http://www.gnu.org/software/binutils/manual/ld-2.9.1/html_node/ld_10.html
--
David
your own.
Due to the memory map I had I/O in the midst of my EPROM space. Once I
got the Introl linker working the way I wanted it nicely split my object
code around the I/O sections.
One must question the need to map constants to a predetermined location
in FLASH?
in
> outside the maximum address (example : 0xA64) Is it a bug ? Or maybe I
> have to configure something ?
Yes its a bug in your software. The ATmega32 has 2k of RAM, 0x0800
bytes. Starts at 0x0060 and ends with $0x085f. 0x0a64 is way out of
range.
--
Davi
out of __udivmodqi4 with relative ease:
a = slashmod_u8( numerator, denominator, &remainder );
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must first
On Mon, Dec 10, 2007 at 12:51:31PM +0100, Schwichtenberg, Knut wrote:
On Friday, December 07, 2007 5:24 PM, David Kelly wrote:
The compiler won't read PINB using the above.
In general on AVR when one reads PORTB one reads the output latchs,
in
other words the last value written. On
~PORTB;
3ee: 85 b1 in r24, 0x05 ; 5
3f0: 80 95 com r24
3f2: 85 b9 out 0x05, r24 ; 5
PORTB ^= 0xff;
3f4: 85 b1 in r24, 0x05 ; 5
3f6: 80 95 com r24
3f8: 85 b9 out 0x05, r24
han you have, you can put a
software divider in your code. This should stretch it to 3.8 seconds per
toggle:
ISR (TIMER0_OVF_vect)
{
static uint8_t divider;
if( divider ) {
divider--;
} else {
divider = 100; // whatever you want to
big potential problem. The
other is that his LED is flashing too fast to see, assuming its wired
correctly.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must f
On Thu, Nov 29, 2007 at 09:25:12AM -0600, David Kelly wrote:
>
> I too have not found one. I snag a copy of the PINx and keep it in a
> static variable in my ISR() to compare for which pins changed. Something
> like this:
>
> current = PINA & PCMSK0;//
le in my ISR() to compare for which pins changed. Something
like this:
current = PINA & PCMSK0;// only the pins enabled
xor = previous ^ current; // pins changed since last time
...
previous = current;
return;
the FreeBSD systems.
ICE on XP with AVR Studio, WinAVR, and TortoiseSVN.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must first drive mad.
___
AV
PORTC = 0x7f;
PORTD = 0xff;
for( ;; )
;
return 0
Then again we've discussed the removal of empty loops to death. Make
sure the compiler doesn't optimize out that empty loop. Possibly it
recognizes it as infinite and leaves it alone.
me, notice the difference between:
(uint8_t)(~(0x55)) and ~((uint8_t)(0x55))
When 0x55 is sitting around bare its an int. The 2nd example puts it
into uint8_t first, then complements and remains uint8_t. The first
complements the int then chops it down to fit in a uint8_t.
--
Da
ut
loss of resolution so the compiler doesn't complain. When complimented
it no longer fits so the compiler complains. I would recommend changing
its definition:
#define CHK_1307((uint8_t) 0x55)
--
David Kelly N4HHE, [EMAIL PROTECTED]
===
aims *software*
knows better.
Avr-gcc *has* a delay loop that the compiler recognizes and leaves
alone. You've been told about yet you have written
more email than the amount of code you would have to change to use it.
--
David Kelly N4HHE, [EMAIL PROTECTED]
==
On Sep 28, 2007, at 8:58 PM, Graham Davies wrote:
David Kelly wrote:
... because it was volatile it *had* to
be fetched and stored each time.
Oh boy. That's a really interesting statement (to me anyway, but I
have a volatile fetish). You're saying that having chosen to
f sbcir25, 0xFF ; 255
e0: 81 f7 brne.-32 ; 0xc2
e2: 08 95 ret
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom comp
On Fri, Sep 28, 2007 at 09:05:40AM -0500, David Kelly wrote:
>
> For finer delays don't forget the OCR functions on the timers. Is pretty
> easy to write and create very accurate delays with:
>
> void delay( uint8_t delay );
> {
> OCR2A = TCNT2 +
On Fri, Sep 28, 2007 at 01:29:19PM +0530, Royce Pereira wrote:
> Hi all,
>
> In the latest WinAVR (avr-gcc (GCC) 4.1.2 (WinAVR 20070525) I found this.
>
> Check this out:
> //==
> void delay(unsigned del_cnt)
> {
>while(del_cnt--);
>
>return;
> }
> //=
to build gcc,
then attempted to use that gcc to build itself as the final test.
Also so as to have a gcc compiled by gcc.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would dest
4.1.2 for his Linux to see if it fails the same way?
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must first drive mad.
___
AVR-GCC-list mailing list
its xgcc (of _mulqi3.o):
>
> /home/root/shed/gcc-4.1.2/obj-avr/./gcc/xgcc
Stop right there. You are trying to cross compile avr-gcc 4.1.2 with
3.4.6? Seems like that is begging for trouble.
You know the easiest platform to run avr-gcc is Windows? Close second is
FreeBSD. MacOS X and Linux
tting much attention.
--
David Kelly N4HHE, [EMAIL PROTECTED]
Whom computers would destroy, they must first drive mad.
___
AVR-GCC-list mailing list
AVR-GCC-list@nongn
projects using the name MacAVR. Are you one of
those or another?
I have installed but only briefly experimented with the avr-gcc and
supporting tools in Fink. Joerg's FreeBSD port has been very good
under FreeBSD.
--
David Kelly N4HHE, [EMAIL PROT
1 - 100 of 163 matches
Mail list logo