[Solved] avrdevice not defined for building on MAC :-)

hello,
I have an issue while compiling, and i guess it comes from the 'AVR/io.h' file where it should set the __AVR_ATMEGA644__ variable and thus redirect the links to the right code

#elif defined (__AVR_ATmega644__)
#  include <avr/iom644.h>

how can i set in eclipse or in the .cproject the avrdevice ?
i tried the option -mmcu=atmega644 without any success !

cheers!

Comments

  • Can you show me what avr-gcc command line gets executed before you get this error?
  • ok, here is the command i have :

    arm-none-eabi-gcc
    -mcpu=cortex-m4 -mthumb O2  -g
    -DF_CPU=20000000UL -D__PROG_TYPES_COMPAT__
    -I/usr/local/CrossPack-AVR-20131216/avr/include -std=gnu11 -MMD -MP
    -MF"Preset/presetManager.d" -MT"Preset/presetManager.o" -c -o
    "Preset/presetManager.o" "../Preset/presetManager.c"

    note that meanwhile, i found a beginning of explanation on the web -> saying that i shouldd add in my compilation build the following option: -mmcu=avr5 -D__AVR_ATmega644__

    in eclipse (and I am on MAC), i setup in my eclipse config (toolchain) with the option flag: -mthumb -mmcu=avr5 -D__AVR_ATmega644__

    my compilation is now like this :
    arm-none-eabi-gcc
    -mcpu=cortex-m4 -mthumb -mmcu=avr5 -D__AVR_ATmega644__ -O2  -g
    -DF_CPU=20000000UL -D__PROG_TYPES_COMPAT__
    -I/usr/local/CrossPack-AVR-20131216/avr/include -std=gnu11 -MMD -MP
    -MF"Preset/presetManager.d" -MT"Preset/presetManager.o" -c -o
    "Preset/presetManager.o" "../Preset/presetManager.c"

    I got --> arm-none-eabi-gcc: error: unrecognized command line option '-mmcu=avr5'

    bouuuhhh :-(
    any advice ?
    cheers :-)
    :-)
  • I continue to try things ;-) I added a SYMBOL  --> __AVR__ATMEGA644__ in eclipse
    the code compils until i get the error:

    In file included from ../Preset/../Menu/menu.h:16:0,
                     from ../Preset/../Menu/CcNr2Text.h:12,
                     from ../Preset/presetManager.c:11:
    ../Preset/presetManager.c: In function 'preset_loadDrumset':
    /usr/local/CrossPack-AVR/avr/include/avr/pgmspace.h:452:5: error: impossible constraint in 'asm'
         __asm__ __volatile__                    \
         ^

    If it continues, i am going to use a Linux instead of a MAC !!!
  • Hm, I think you might be compiling the AVR code with the ARM compiler?
    I've managed to compile the cortex part with my makefile, I'll look at the rest tomorrow. It was easier than fighting Eclipse ;)
  • Yeah, you need to compile the avr project code with gcc for avr and the arm project code with gcc for arm. So once you have those separated, then we can continue to figure things out. Here is my command line for ARM (the c file will be different for each file obviously, and you will not have windows backslashes):

    arm-none-eabi-gcc -DHSE_VALUE=8000000 -DSTM32F4XX -DUSE_DEVICE_MODE -DUSE_USB_OTG_FS -DUSE_STDPERIPH_DRIVER -DUSE_STM32F4_DISCOVERY -DNDEBUG "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\CMSIS\\Include" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\Device\\STM32F4xx\\Include" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\STM32F4xx_StdPeriph_Driver\\inc" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\STM32_USB_Device_Library\\Core\\inc" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\Libraries\\STM32_USB_OTG_Driver\\inc" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\AudioCodecManager" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\DSPAudio" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\Hardware" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\Hardware\\SD_FAT" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\Hardware\\USB" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\MIDI" "-IC:\\project\\LXR\\mainboard\\firmware\\DrumSynth_FPU\\src\\Sequencer" -O3 -ffunction-sections -fdata-sections -ffast-math -freciprocal-math -fsingle-precision-constant -Wall -Wextra -Wa,-adhlns=$@.lst -c -fmessage-length=0 -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -o "src\\MIDI\\MidiParser.o" "..\\src\\MIDI\\MidiParser.c"

    And here is my command line for avr:
    avr-gcc -DF_CPU=20000000UL -D__PROG_TYPES_COMPAT__ -Os -Wall -Wextra -Wconversion -c -funsigned-char -funsigned-bitfields -ffast-math -freciprocal-math -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -mmcu=atmega644 -std=gnu99 -MD -MP -o main.o "..\\main.c"

  • oki, I am going if I can tommorrow to look at your commands.

    @pld if you could put somewhere your makefile, I would like to have a look at it :-)

    thanks guys, I really appreciate your patience with me :-)

  • This mornong I looked at your command, I start seeing that I messed up the AVR compilation and the Drum synth compilation. I will progress during the day, thanks again!
  • oki, so I closed eclpise. Fed up! I start to do my compilation by hand :-(
    and if it continues , I will go for my linux :-) anyhow, here the command I did thanks to you:

     arm-none-eabi-gcc -DHSE_VALUE=8000000 -DSTM32F4XX -DUSE_DEVICE_MODE -DUSE_USB_OTG_FS -DUSE_STDPERIPH_DRIVER -DUSE_STM32F4_DISCOVERY -DNDEBUG "-I/Users/music/Documents/workspace/DrumSynth_FPU/Libraries/CMSIS/Include" "-I/Users/music/Documents/workspace/DrumSynth_FPU/Libraries/Device/STM32F4xx/Include" "-I/Users/music/Documents/workspace/DrumSynth_FPU/Libraries/STM32F4xx_StdPeriph_Driver/inc" "-I/Users/music/Documents/workspace/DrumSynth_FPU/Libraries/STM32_USB_Device_Library/Core/inc" "-I/Users/music/Documents/workspace/DrumSynth_FPU/Libraries/STM32_USB_OTG_Driver/inc" "-I/Users/music/Documents/workspace/DrumSynth_FPU/src" "-I/Users/music/Documents/workspace/DrumSynth_FPU/src/AudioCodecManager" "-I/Users/music/Documents/workspace/DrumSynth_FPU/src/DSPAudio" "-I/Users/music/Documents/workspace/DrumSynth_FPU/src/Hardware" "-I/Users/music/Documents/workspace/DrumSynth_FPU/src/Hardware/SD_FAT" "-I/Users/music/Documents/workspace/DrumSynth_FPU/src/Hardware/USB" "-I/Users/music/Documents/workspace/DrumSynth_FPU/src/MIDI" "-I/Users/music/Documents/workspace/DrumSynth_FPU/src/Sequencer" -O3 -ffunction-sections -fdata-sections -ffast-math -freciprocal-math -fsingle-precision-constant -Wall -Wextra -Wa,-adhlns=$@.lst -c -fmessage-length=0 -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -o "/Users/music/Documents/workspace/DrumSynth_FPU/src/MIDI/MidiParser.o" "/Users/music/Documents/workspace/DrumSynth_FPU/src/MIDI/MidiParser.c"


    and it compiles :-) no error. I will continue the compilation and come back to you asap.
  • now, I did the second compilation instructions (avr-gcc) like this:

    MacBook-Pro-de-ribas:workspace music$ avr-gcc -DF_CPU=20000000UL -D__PROG_TYPES_COMPAT__ -Os -Wall -Wextra -Wconversion -c -funsigned-char -funsigned-bitfields -ffast-math -freciprocal-math -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -Wall -mmcu=atmega644 -std=gnu99 -MD -MP -o main.o "/Users/music/Documents/workspace/DrumSynth_FPU/src/main.c"

    I got an error about the lib STM32F4 not including in the path... I progress in a better way now than woth Eclipse!!!

    /Users/music/Documents/workspace/DrumSynth_FPU/src/main.c:36:23: fatal error: stm32f4xx.h: No such file or directory
     #include "stm32f4xx.h"

    keep you inform on my progress :-)
  • Looks like you're mixing the compilers and projects :)
    • Files in mainboard/DrumSynth_FPU should use only arm-none-eabi-gcc
    • Files in front/AVR should use only avr-gcc
    That last avr-gcc call is compiling DrumSynth_FPU/src/main.c... (but it also doesn't have any -Ixxxx includes) If you've pulled the makefiles, look in front/AVR/Makefile to see how it builds the command line for avr-gcc source files, and in mainboard/firmware/DrumSynth_FPU/Makefile for the arm version. You can run make on those makefiles with the VERBOSE=1 (I think) and it should print the full command line for each file.
  • oki, I have taken your makefile, adapt it and compiled successfully :-)
    i need to upload the new fresh firmware on the hardware now, i keep you inform.
  • hum , I go too quick :-(
    so I could compile your code for the DRUM part ... :-)
    now I will look at the AVR code and try to compile it.
    :-)
  • so it's okay as well on the AVR side :-)
    i am now going tp upload the new firmware i built :-)
    bye!
  • GREAT THX !!!!!
    works fine ! i am now going to write a tuto :-)
    and i allready changed successfully the LXR code :-)
    GREAT THX !!!!!
  • Cool, so it sounds like we have a successful compilation on mac.
  • YES and thanks to pld and you!!!

    not needed to say that I removed my eclipse installation right away !

    I will do a tuto before continuing :-)

    next, I want to create a git hub repo, etc... and change the code in order to
    - add a random function and
    - one knob changes several parameters when you are in PERF mode.

    I hope to have enough patient and knowledge to implement this!
  • Successful compilation, yes. Don't know if it works ;)
  • on my side, I change the title "drum box" and I could see the result changing on the LCD display :-)
    so I guess , it will work as well for you @pld :-)
Sign In or Register to comment.