Hey, Ich hoffe ich bin hier richtig und es kann mir jemand helfen: Ich versuche gerade mittels cmake ein hex file zu erstellen. Folgende Dateien habe ich bereits angelegt (Beispiel von dieser Seite genutzt: http://robot-develop.org/archives/2952): CMakeLists.txt: cmake_minimum_required (VERSION 2.6.0) INCLUDE("C:/Users/name/Desktop/example/Code/test_crosscompile.cmake") INCLUDE("C:/Users/name/Desktop/example/Code/macro.cmake") project (Code) MESSAGE(STATUS "\n -------------------------------->Creating Test-Projekt...") IF( NOT CMAKE_BUILD_TYPE ) SET( CMAKE_BUILD_TYPE Release ... FORCE ) ENDIF() SET(MAIN_FILE class.c) # add the executable add_executable(Code ${MAIN_FILE}) #makro AVR_CREATE_HEX(class) makro.cmake: # create avr hex MACRO(AVR_CREATE_HEX name) ADD_CUSTOM_COMMAND(TARGET ${name} POST_BUILD COMMAND avr-objcopy ARGS -O ihex -R.eeprom ${name} "C:/Users/name/Desktop/example/Code/class.hex") MESSAGE(STATUS "\n ----------JONAS---------------------->Macro") ENDMACRO(AVR_CREATE_HEX) test_crosscompile.cmake: SET(CMAKE_SYSTEM_NAME "Windows") SET(CMAKE_C_COMPILER avr-gcc) SET(CMAKE_CXX_COMPILER avr-g++) SET(CSTANDARD "-std=gnu99") SET(CDEBUG "-gstabs") SET(CWARN "-Wall -Wstrict-prototypes") SET(CTUNING "-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums") SET(COPT "-Os") SET(CMCU "-mmcu=atmega32") SET(CDEFS "-DF_CPU=12000000UL") SET(CFLAGS "${CMCU} ${CDEBUG} ${CDEFS} ${CINCS} ${COPT} ${CWARN} ${CSTANDARD} ${CEXTRA}") SET(CXXFLAGS "${CMCU} ${CDEFS} ${CINCS} ${COPT}") SET(CMAKE_C_FLAGS ${CFLAGS}) SET(CMAKE_CXX_FLAGS ${CXXFLAGS}) Wenn ich bei cmake als Generator Visual Studio 10 auswähle, dann erhalte ich keinen Fehler. Jedoch wird keine hex Datei erstellt, was wohl daran liegt, dass Visual Studio nur das Projekt anlegt und kein Makefile generiert. (verbessert mich wenn meine Interpretation falsch ist) Falls ich nun MinGW Makefiles auswähle, mit der Option "Specify toolchain file for crosscompiling", dann erhalte ich folgenden Fehler: The C compiler identification is GNU 4.3.3 The CXX compiler identification is GNU 4.3.3 Check for working C compiler: C:/WinAVR-20100110/bin/avr-gcc.exe Check for working C compiler: C:/WinAVR-20100110/bin/avr-gcc.exe -- broken CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "C:/WinAVR-20100110/bin/avr-gcc.exe" is not able to compile a simple test program. Kann mir jemand diesbezüglich helfen? Ich arbeite unter Windows, nutze WinAVR-20100110. Den Bin Ordner und utils/bin Ordner habe ich beim PATH hinzugefügt. Zudem habe ich die sh.exe im utils/bin Ordner umbenannt da ich sonst einen Fehler erhalten habe, dass diese Datei nicht im PATH liegen darf. Danke für jede Antwort
Funktioniert denn der avr-gcc? Teste mal im cmd Fenster. Dann bin ich auch nicht sicher ob als Dateiname class.c eine gute Idee ist.
Der Befehl avr-gcc class.c scheint zu funktionieren. Dann wird eine a.out Datei erstellt
Habs mal in Linux probiert. cmake meint das mein avr-gcc ok ist aber der avr-g++ --broken Das bedeutet das schon bei der cmake test compilierung der Fehler auftritt und die class.c noch garnicht benutzt wird.
Jetzt habe ich so viel geändert das auch avr-gcc "broken" ist. Was mir auffiel: The C compiler identification is GNU 4.8.2 da stand vorher: The C compiler identification is unknown glaube ich. Das cmake scheint ein Problem mit dem avr-g.. compiler zu haben. Bzw man muss noch etwas anderes mit übergeben. ??
Weißt du denn wieso die Test-Compilierung bei cmake fehlschlägt? Bei mir schlug aber bereits der avr-gcc fehlt: The C compiler identification is GNU 4.3.3 The CXX compiler identification is GNU 4.3.3 Check for working C compiler: C:/WinAVR-20100110/bin/avr-gcc.exe Check for working C compiler: C:/WinAVR-20100110/bin/avr-gcc.exe -- broken Auf jeden Fall schon einmal vielen Dank für deine Hilfe!
:
Bearbeitet durch User
Lass uns ein Beispiel nehmen das auch funktioniert ;-) http://www.avrfreaks.net/sites/default/files/cmake_avr.tar.gz
Benutzt du auch die cmake Gui? Welchen Generator und welche weiteren Optionen (specify tooilchain,...) muss man dort angeben damit es funktioniert? Wähle ich MinGW Makefiles und eben dieses specify toolchain, dann erhalte ich folgende Fehlermeldung: The C compiler identification is unknown The CXX compiler identification is unknown Check for working C compiler: /usr/bin/avr-gcc CMake Error: your C compiler: "/usr/bin/avr-gcc" was not found. Please set CMAKE_C_COMPILER to a valid compiler path or name. CMake Error: Internal CMake error, TryCompile configure of cmake failed Check for working C compiler: /usr/bin/avr-gcc -- broken CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "/usr/bin/avr-gcc" is not able to compile a simple test
Ich mache alles in der Linux Console ohne weitere Hilfsprogramme. Das Beispiel wurde für linux erstellt. Du muss natürlich alle Programmverzeichnisse anpassen bzw. löschen und nur z.B. avr-gcc angeben wenn der Ordner dahin im PATH steht...
Ich habe die Toolchain-avr-gcc.cmake Datei entsprechend geändert. Aber bekomme dann den gleichen Fehler wie bei meinem Projekt: The C compiler identification is GNU 4.3.3 The CXX compiler identification is GNU 4.3.3 Check for working C compiler: C:/WinAVR-20100110/bin/avr-gcc.exe Check for working C compiler: C:/WinAVR-20100110/bin/avr-gcc.exe -- broken CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "C:/WinAVR-20100110/bin/avr-gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/Jonas Hamers/Downloads/cmake_avr/build/CMakeFiles/CMakeTmp Run Build Command:C:/TDM-GCC-64/bin/mingw32-make.exe "cmTryCompileExec2122687935/fast" C:/TDM-GCC-64/bin/mingw32-make.exe -f CMakeFiles\cmTryCompileExec2122687935.dir\build.make CMakeFiles/cmTryCompileExec2122687935.dir/build mingw32-make.exe[1]: Entering directory 'C:/Users/Jonas Hamers/Downloads/cmake_avr/build/CMakeFiles/CMakeTmp' "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_progress_report "C:\Users\Jonas Hamers\Downloads\cmake_avr\build\CMakeFiles\CMakeTmp\CMakeFiles" 1 Building C object CMakeFiles/cmTryCompileExec2122687935.dir/testCCompiler.c.obj C:\WinAVR-20100110\bin\avr-gcc.exe -o CMakeFiles\cmTryCompileExec2122687935.dir\testCCompiler.c.obj -c "C:\Users\Jonas Hamers\Downloads\cmake_avr\build\CMakeFiles\CMakeTmp\testCCompiler.c" Linking C executable cmTryCompileExec2122687935.exe "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E cmake_link_script CMakeFiles\cmTryCompileExec2122687935.dir\link.txt --verbose=1 "C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" -E remove -f CMakeFiles\cmTryCompileExec2122687935.dir/objects.a C:\WinAVR-20100110\bin\avr-ar.exe cr CMakeFiles\cmTryCompileExec2122687935.dir/objects.a @CMakeFiles\cmTryCompileExec2122687935.dir\objects1.rsp C:\WinAVR-20100110\bin\avr-gcc.exe -Wl,--whole-archive CMakeFiles\cmTryCompileExec2122687935.dir/objects.a -Wl,--no-whole-archive -o cmTryCompileExec2122687935.exe -Wl,--out-implib,libcmTryCompileExec2122687935.dll.a -Wl,--major-image-version,0,--minor-image-version,0 c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: unrecognized option '--out-implib' c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/bin/ld.exe: use the --help option for usage information CMakeFiles\cmTryCompileExec2122687935.dir\build.make:91: recipe for target 'cmTryCompileExec2122687935.exe' failed mingw32-make.exe[1]: *** [cmTryCompileExec2122687935.exe] Error 1 mingw32-make.exe[1]: Leaving directory 'C:/Users/Jonas Hamers/Downloads/cmake_avr/build/CMakeFiles/CMakeTmp' Makefile:116: recipe for target 'cmTryCompileExec2122687935/fast' failed mingw32-make.exe: *** [cmTryCompileExec2122687935/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): --------- Ich habe leider heute keine Zeit mehr dafür weiter Dinge zu testen. Vielen Dank nochmal für deine Hilfe bis jetzt. Spätestens Montag werde ich hier wieder rein schauen. Wenn ich es zeitlich schaffe vielleicht auch schon vorher
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.