Hello,
I already posted my problem here:
https://sourceforge.net/p/avr-eclipse/discussion/general/thread/7bc7d4e8/
but i think a ticket is a better way to hopefully solve my problem.
I am running AVR CrossPack, Eclipse and the AVR plugin on OS X 10.9.
Eclipse Version: Kepler Service Release 1 Build id: 20130919-0819
AVR Eclipse Plugin: 2.4.1.20131008-1720-beta
The problem I am facing is that it seems like the uC is running with a wrong clock.
In the project settings the clock is set and in the beginning of the program i also set F_CPU to 12000000UL just to make sure.
If i build and flash the C file file with avr studio everything runs fine, but when i build it in eclipse it seems like the program on the uC is running about 10-12 times slower than it expected (just counted with a blinking LED).
forgot to mention: the file "{your Project}/.settings/de.innot.avreclipse.core.prefs" shows the wanted CLK of 12MHz.
I already reinstalled Eclipse and avr crosspack, nothing changed...
i hope somebody can help me.
luki14
Diff:
Perhaps you could have a look at the Console tab after it has built the app. It should give the complete compiler invocation. In your case it should have -DF_CPU=12000000L somewhere in the command line.
The console output contains the mentioned "-DF_CPU=12000000UL" since i am not a experienced programmer i think it is better to post the whole line, maybe you can figure something out.
avr-gcc -UF_CPU -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=attiny1634 -DF_CPU=12000000UL -MMD -MP -MF"test.d" -MT"test.d" -c -o "test.o" "../test.c"
Finished building: ../test.c
thx
Last edit: Lukas 2013-12-09
btw. if i define the F_CPU with 1MHz the program runs as expected. it seems like even if F_CPU is defined with 12MHz, that the program is running with 1MHz.
Where is that -UF_CPU coming from? You may have typed that in the "Undefine Syms (-U)" tab.
Right click on the project, then Properties. Goto C/C++ Build -> Settings -> AVR Compiler -> Symbols
If you see F_CPU in the "Undefine Syms" tab, you must remove it.
You were right, there was really F_CPU in the "Undefine Syms", i deleted it, but unfortunately the problem still persists.
This is the whole console output, maybe it helps to resolve the issue:
22:38:46 * Incremental Build of configuration Release for project test *
make all
Building file: ../test.c
Invoking: AVR Compiler
avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=attiny1634 -DF_CPU=12000000UL -MMD -MP -MF"test.d" -MT"test.d" -c -o "test.o" "../test.c"
Finished building: ../test.c
Building target: test.elf
Invoking: AVR C Linker
avr-gcc -Wl,-Map,test.map -mmcu=attiny1634 -o "test.elf" ./test.o
Finished building target: test.elf
Invoking: AVR Create Extended Listing
avr-objdump -h -S test.elf >"test.lss"
Finished building: test.lss
Create Flash image (ihex format)
avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex test.elf "test.hex"
Finished building: test.hex
Create eeprom image (ihex format)
avr-objcopy -j .eeprom --no-change-warnings --change-section-lma .eeprom=0 -O ihex test.elf "test.eep"
Finished building: test.eep
Invoking: Print Size
avr-size --format=avr --mcu=attiny1634 test.elf
AVR Memory Usage
Device: attiny1634
Program: 170 bytes (1.0% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
Finished building: sizedummy
22:38:46 Build Finished (took 187ms)
By the Way, thank you very much for your help.
OK. At least one problem solved :-)
You say that with avr studio it runs fine. You should be able to capture the compiler command line that avr studio uses. I'd like to see that (assuming it uses GCC-AVR).
I solved my problem and actually it was caused by my own stupidity.
In my avr project i used the delay.h to let a led blink at a specified frequency and therefore to be able to check if my f_cpu is set correctly. Unfortunately the delay.h uses its own default f_cpu of 1mhz if not defined and i only used the #ifndef f_cpu below and it was therefore never executed.
Thank you very much for your help and support (;