Re: [avr-gcc-list] RFC: Speeding up small ISRs: PR20296

2017-06-20 Thread Thomas D. Dean
On 06/19/2017 10:48 PM, Erik Christiansen wrote: On 15.06.17 14:43, Georg-Johann Lay wrote: https://gcc.gnu.org/PR20296 is about speeding up "small" ISRs, and is open for 12 years now... Anyone familiar with avr-gcc knows that a fix would be high effort and risk, and that's the major reason

Re: [avr-gcc-list] gcc-avr 4.9.2 -Os messes with interrupt vectors

2016-05-08 Thread Thomas D. Dean
On 05/08/16 06:22, a...@tuta.io wrote: Looks like you are toggling the LED too fast to see it. Try adding a delay in the while loop while (1) { PORTB |= (1 << PB5); delay_ms(500); /* or something */ } Look at the avr-libc documentation. http://nongnu.org/avr-libc/user-manual/ Tom Dean

Re: [avr-gcc-list] Programming ATMega2560

2014-11-26 Thread Thomas D. Dean
On 11/26/14 11:46, Andreas Höschler wrote: #define F_CPU 1600UL /* 16 MHz CPU clock */ #include util/delay.h #define OUTPUTPORT PORTB #define OUTPUTPIN PB7 int main (void) { DDRB = 0xff; // all outputs while (1) /* loop forever */ { if

Re: [avr-gcc-list] Programming ATMega2560

2014-11-26 Thread Thomas D. Dean
On 11/26/14 14:25, Andreas Höschler wrote: #define F_CPU 1600UL /* 16 MHz CPU clock */ #include avr/io.h #include util/delay.h #define OUTPUTPORT PORTB #define OUTPUTPIN PB7 int main (void) { DDRB = 0xff; // all outputs while (1) /* loop forever */

[avr-gcc-list] ATMega128 Fast PWM

2014-08-26 Thread Thomas D. Dean
How do I change the polarity of the PWM output, WGM mode 5, OCR1A on the fly? I use WGM mode 5 to provide PWM to drive gearhead motors. I update the OCR values every 50 msec. The algorithm makes changes gradually. If, for example, the motor is CCW at 50%, the OCR value is 128. The

Re: [avr-gcc-list] ATMega128 Fast PWM

2014-08-26 Thread Thomas D. Dean
On 08/26/14 11:31, Thomas D. Dean wrote: I found a sort-of solution. I still have a 1 usec glitch at the end of the positive group of cycles but not at the inverted group of cycles. The manual says the change of COM bits is effected at the next compare match. On the logic analyzer

[avr-gcc-list] C++ Syntax Question

2014-07-07 Thread Thomas D. Dean
Sorry, if this is off topic. I have an application where I want to call a group of functions, in turn. My initial thought was to use function pointers and a list. If the function is defined outside the class, I can add it to the list. f1 in the example. If the function is declared in the

Re: [avr-gcc-list] How to use pgmspace.h in a library source without warning?

2013-06-07 Thread Thomas D. Dean
On 06/07/13 09:53, Georg-Johann Lay wrote: Suppose the following include in a library source.c: #include avr/pgmspace.h and the source compiled with, e.g. -mmcu=avr5 or -mmcu=avr35 etc. This throws a warning like: $ avr-gcc -mmcu=avr5 source.c -c In file included from

[avr-gcc-list] AVR Group Definitions

2011-03-23 Thread Thomas D. Dean
I forgot, again... Where do I find the definitions of the AVR groupings? avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tomdean ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org

Re: [avr-gcc-list] AVR Group Definitions

2011-03-23 Thread Thomas D. Dean
I have a group of .S files, library avrx2.6. I want to make a version of this library for each AVR group and install them in avr/lib/avrn, as appropriate. If I use 'make MCU=?', I get a list, including avr1, avr5, etc, as well as the known types like atmega128, etc. If I use 'make

Re: [avr-gcc-list] newbie needs setup instructions

2011-02-27 Thread Thomas D. Dean
On Sun, 2011-02-27 at 21:57 -0800, John Myers wrote: Hi Ernesto, www.avrfreaks.net has sticky post with a script to build avr-gcc. Doing an apt-get may not give you a version with the newest patches. You do not need the latest patches to get started. I have been using the apt version for a

[avr-gcc-list] Avr-libc Floating Point Problem

2011-01-14 Thread Thomas D. Dean
I am attempting to compare the uM-FPU and avr-libc floating point times. I think I am missing something, but, what? See the code at the bottom. The code is compiled with: avr-gcc -Os -mmcu=atmega128 -c -o main.o main.c avr-gcc -Os -mmcu=atmega128 main.o -o main.elf -lc avr-objcopy

Re: [avr-gcc-list] Avr-libc Floating Point Problem

2011-01-14 Thread Thomas D. Dean
On Fri, 2011-01-14 at 20:44 -0200, Marcelo Politzer wrote: It seems to me that you are missing the printf_flt. Try adding: LDFLAGS+=-lm -Wl,-u,vfprintf -lprintf_flt Since the avr are so tiny on rom and ram the developers made a version without float support to reduce resources usage

Re: [avr-gcc-list] Avr-libc Floating Point Problem

2011-01-14 Thread Thomas D. Dean
On Fri, 2011-01-14 at 20:44 -0200, Marcelo Politzer wrote: That fixed my problem I have some surprises in the results. Scope Timer1 What 4.3us 3.5us Convert tcnt1 to float 156us 154us sprintf M_PI 10us8.5us float mult 8.5us 7.0us float add 1.5us 0us float div - sometimes

Re: [avr-gcc-list] Avr-libc Floating Point Problem

2011-01-14 Thread Thomas D. Dean
On Fri, 2011-01-14 at 15:33 -0800, Thomas D. Dean wrote: I fixed my code and, now see funcvaluetime(usec) sprintf 3.141593 154.25 Ftcnt1 21740.00 3.312500 Fmul68298.227000 10.187500 Fadd90038.227000 7.875000 Fdiv0.758547 30.25 Fsin0.180126

[avr-gcc-list] Optimization Problem?

2010-12-29 Thread Thomas D. Dean
I think something strange is being produced by -Os I reduced a confusing large application to the below code. Compiling with default optimizaton produced an avr-objdump that follows the C code as I expected. avr-gcc -mmcu=atmega16 -c -o err.o err.c avr-gcc-mmcu=atmega16 err.o -o err.elf

Re: [avr-gcc-list] Optimization Problem?

2010-12-29 Thread Thomas D. Dean
On Wed, 2010-12-29 at 11:48 -0800, Thomas D. Dean wrote: However, using -Os, I see strange code at c8, ca, etc. The poly calculation and the sin call seem to be below here. The stack is cleaned correctly by the 4 ea pop r0's. Why the strange rcalls??? Sorry, should read d0, d2. tomdean

Re: [avr-gcc-list] Optimization Problem?

2010-12-29 Thread Thomas D. Dean
On Wed, 2010-12-29 at 11:48 -0800, Thomas D. Dean wrote: Sorry, again. I am really doing good with this post. avr-gcc --version avr-gcc (GCC) 4.3.4 Copyright (C) 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even

RE: [avr-gcc-list] Optimization Problem?

2010-12-29 Thread Thomas D. Dean
On Wed, 2010-12-29 at 13:01 -0800, larry barello wrote: Strange rcalls are a fast way to allocate four bytes on the stack for a local... Thanks, Larry. Looking thru the code, that is what is happening. tomdean ___ AVR-GCC-list mailing list

[avr-gcc-list] multiple definition of `__bad_interrupt'

2009-06-07 Thread Thomas D. Dean
I think I missed something. I am using the packages: avr-gcc 4.3.2 and avr-libc 1.6.2.cvs100810-2 on Ubuntu 9.04. I get several multiple definition errors avr-gcc -Os -mmcu=atmega128 hello.o hello -o hello.elf -lc hello: In function `__bad_interrupt': ../../../../crt1/gcrt1.S:193: multiple

RE: [avr-gcc-list] AVR-GCC compiler options

2009-03-24 Thread Thomas D. Dean
avr-gcc -mmcu=atmega32 -S xx.c avr-as -alhmd -mmcu=atmega16 xx.s xx.lst ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

RE: [avr-gcc-list] AVR-GCC compiler options

2009-03-24 Thread Thomas D. Dean
It is really bad when you can't cut-n-paste! avr-gcc -mmcu=atmega32 -S -fverbose-asm xx.c avr-as -alhmd -mmcu=atmega16 xx.s xx.lst Sorry. ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

[avr-gcc-list] Problem With Call to Mulsi3

2009-02-16 Thread Thomas D. Dean
I have code producing strange results. The application uses an 8-bit counter and overflow counts to measure distance with an ultrasonic transponder. The overflow and count look Ok. Fitting an equation to experimental data, I get dist = 0.013657 * cnts + -3.996578. Converting the

Re: [avr-gcc-list] Problem With Call to Mulsi3

2009-02-16 Thread Thomas D. Dean
On Mon, 2009-02-16 at 23:37 +0100, Georg-Johann Lay wrote: distance = =895*distance; See my followup message about the typo. distance = 895*distance. [...] 895*distance generates a call to __mulsi3, multiplying r25:22 by r21:18 and returning the result in r25:22.

Re: [avr-gcc-list] Problem With Call to Mulsi3

2009-02-16 Thread Thomas D. Dean
On Tue, 2009-02-17 at 07:05 +0100, Joerg Wunsch wrote: So you'd have to explain which compiler version exactly you are using (including patches). I am using the Ubuntu 8.10 package, installed with apt-get. Most likely from the ANL archive. # avr-gcc --version avr-gcc (GCC) 4.3.0 ... #

Re: [avr-gcc-list] Too much RAM used: __clz_tab[] linked

2008-06-08 Thread Thomas D. Dean
The inclusion of __clz_tab may be related to converting the result of a function call. This causes the inclusion float X_target; X_target = (float)pgm_read_dword(nav_cmd[cli_idx].arg1); This does NOT cause the inclusion int32_t lcount, rcount; // this iteration left_inches =

Re: [avr-gcc-list] Too much RAM used: __clz_tab[] linked

2008-06-08 Thread Thomas D. Dean
I did the assignment, cast. avr-gcc seemed to remove that. I did not try making the temporary variable volatile. I worked around the problem by putting the apropriate value in the integers in the structure and using *(float *)int_variable. -1044381696, copied to a float, not converted, is

Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os

2008-05-16 Thread Thomas D. Dean
In my case, I want to allow interrupts, just want to keep the statement ordering in the code segment. The PORTA bits are used for hardware control. I want to use the atan2(), etc. calls as pulse stretching. Making the resultant variable volatile works. tomdean

Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os

2008-05-16 Thread Thomas D. Dean
I have to do the atan2(). It takes a little longer than I would like the pulse, but, the longer pulse does not hurt anything. So, including the atan2() in the pulse duration does not waste as much time as delayxxx() and then do the atan2(). tomdean

[avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os

2008-05-15 Thread Thomas D. Dean
I have a code segment which 1. sets a bit in PORTA. 2. calls atan2. 3. clears the same bit in PORTA. The compiler produces code that 1. sets the bit in PORTA. 2. clears the same bit in PORT. 3. calls atan2. With -O0, the code is correct. # uname -a FreeBSD dv6000.tddhome

Re: [avr-gcc-list] Avr-gcc Produces Incorrect Code with -Os

2008-05-15 Thread Thomas D. Dean
I changed the variables to volatile and that fixed things. The compiler does not seem to move things around the sin/cos/tan/asin/acos/atan functions, only the atan2. I put the code segment below. I was looking into size/time for these functions. I saw what I expected around all the functions

[avr-gcc-list] Wait for a Particular Interrupt

2008-05-10 Thread Thomas D. Dean
I want to wait for a particular interrupt. I have a one shot trigger connected to POTRB[0] and Q back to INT2. The one shot is around 3 msec. I can make the interrupt happen. However, it is one of many. INT2 happens some 3 to 4 msec after the trigger to the one shot. The one shot triggers

Re: [avr-gcc-list] Preprocessor question

2008-05-05 Thread Thomas D. Dean
Thanks, That is close to what I have. I like a couple of your names better. I will change. tomdean ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

[avr-gcc-list] Preprocessor question

2008-05-02 Thread Thomas D. Dean
I have a question about preprocessor syntax. I want to declare som macros that ease controlling port assignments. in the include file, I have #define GLUE(a, b) (a##b) #define PORT(x)(GLUE(PORT, x)) #define PIN(x) (_BV((x))) #define DDR(x) (GLUE(DDR, x)) #define

[avr-gcc-list] ATmega16 Differential ADC Measurements

2007-09-07 Thread Thomas D. Dean
I have been looking at the ATmega16 adc in the differential mode in the STK500v2. I measured the input to the two adc channels with a Fluke 27 connected directly to the pins. I saw larger differences than I expected. I also expected the values of 0x3ff and 0x000 to be the same. Results below.

Re: [avr-gcc-list] ATmega16 PWM

2007-07-26 Thread Thomas D. Dean
I discovered the spectrum of the PWM wave was strange. I used the Fast PWM mode, 31kHz and a sinewave 600Hz modulation frequency, sampled 8 to 32 times per cycle. IOW, I changed the PWM pulse width 8 to 32 times per cycle of the modulation sine wave. The modulation sine wave sampling rate

[avr-gcc-list] Re: ATmega16 PWM

2007-07-16 Thread Thomas D. Dean
I did some measurements on a 600Hz, 50% modulated PWM wave at 32kHz. Modulate the PWM with 600Hz and 8 samples per cycle. I used a TDS 2014. I see an interrupt every 202.4usec, 1/(8*600). At every interrupt, the OCR value is set to value[idx], idx=(idx++)%8 value[8] = { 0x80, 0xad, 0xc0, 0xad,

Re: [avr-gcc-list] avr-gcc toolchain: applying WINAVR patches for Linux box

2007-07-16 Thread Thomas D. Dean
Looks like the patch succeeded. Hunks are consecutive parts of the patch. I believe fuzz is just white space. Where did you install avr-gcc? I put it in /usr/local. The man and info pages are in /usr/local/man, etc. tomdean ___ AVR-GCC-list

[avr-gcc-list] ATmega16 PWM

2007-07-15 Thread Thomas D. Dean
I have been investigating PWM on the ATmega16, thinking of how to produce a modulated output. I have a spectrum I am trying to duplicate or at least understang. This first attempt is to produce a PWM, 50% modulated at 600Hz. Some general PWM questions I have not answered include: What is the

Re: [avr-gcc-list] ATmega16 PWM

2007-07-15 Thread Thomas D. Dean
Thanks for the replies. I understand basic PWM. For example, if I modulate the PWM with 600Hz, and use, say, 8 samples per cycle of the 600Hz, I change the PW every 1.67ms. To recover the original modulation, I think I need something like 10 samples of the highest modulation frequency. So, for