注意! 此處所列說明可能尚不完整。 編譯 Code::Blocks 和 emIDE 基本上都要參照 [[http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows|Installing Code::Blocks from source on Windows]]。 ====== 編譯 ====== - 安裝 Code::Blocks 和 MinGW 工具鏈 ([[http://sourceforge.net/projects/codeblocks/files/Binaries/13.12/Windows/codeblocks-13.12mingw-setup.exe|codeblocks-13.12mingw-setup.exe]])。 - 下載並編譯 [[https://www.wxwidgets.org/|wxWidgets]] ([[http://prdownloads.sourceforge.net/wxwindows/wxMSW-2.8.12.zip|wxMSW-2.8.12.zip]])。 set path=C:\Program Files (x86)\CodeBlocks\MinGW\bin;C:\Program Files (x86)\CodeBlocks\MinGW\mingw32\bin cd wxMSW-2.8.12\build\msw # 修改 config.gcc 底下內容,避免因為目的檔過大導致鏈結失敗。 # # CFLAGS ?= -fno-keep-inline-dllexport # # CXXFLAGS ?= -fno-keep-inline-dllexport # mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 clean mingw32-make -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 * [[http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#wxWidgets|1.3 wxWidgets]] * [[http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#Compile_wxWidgets_in_Unicode_mode|2.1 Compile wxWidgets in Unicode mode]] * 注意! 編譯完後必須確認 wxMSW-2.8.12_build\lib\gcc_dll 目錄底下有函式庫存在。 - 下載 Code::Blocks 或是 emIDE 代碼。 * [[http://www.codeblocks.org/downloads/25|Code::Blocks]] * [[http://www.emide.org/download.php|emIDE]] - 用安裝好的 Code::Blocks 開啟 Code::Blocks 或 emIDE 代碼。 * [[http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#Open_project|2.2.1 Open project]]。 - Code::Blocks * [[https://forums.wxwidgets.org/viewtopic.php?t=37676|About wxmsw28u_gcc_custom.dll]] * 拷貝 wxMSW-2.8.12\lib\gcc_dll\wxmsw28u_gcc_custom.dll 到 codeblocks-13.12\src\devel 目錄底下,和 codeblocks.exe 執行檔放在同一個目錄。 - emIDE * libstdc++-6.dll * 從 MinGW bin 目錄底下拷貝所需的函式庫到 emIDE.exe 所在目錄。 * [[http://stackoverflow.com/questions/11127156/codeblocks-how-can-i-link-libstdc-dynamically|CodeBlocks: how can I link libstdc++ dynamically?]] * [[http://stackoverflow.com/questions/18138635/mingw-exe-requires-a-few-gcc-dlls-regardless-of-the-code|MinGW .exe requires a few gcc dll's regardless of the code?]] * [[http://stackoverflow.com/questions/18668003/the-procedure-entry-point-gxx-personality-v0-could-not-be-located-in-the-dnyam|the procedure entry point __gxx_personality_v0 could not be located in the dnyamic link libarry libstdc++6]] * ''-static-libgcc'' ''-static-libstdc++'' * [[https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html|3.13 Options for Linking]] * [[http://www.cplusplus.com/forum/lounge/63615/|code::blocks - random crashes]] * ''--no-chrash-handler'' 用於產生除錯日誌。 * [[http://pcsupport.about.com/od/commandlinereference/a/redirect-command-output-to-file.htm|How To Redirect Command Output to a File]] * 用於將命令行輸出存到文本,以供後續分析。 ====== Code::Blocks ====== * [[http://www.codeblocks.org/docs/main_codeblocks_en.html|CodeBlocks Manual]] * Settings -> Compiler -> Build options -> Number of processes for parallel builds * 視平台上的處理器個數調整,可以有效加速。 * 可能不能和 ccache 混用,又整體效果是否有加成需要實驗觀察。目前來看,單獨使用平行編譯效果最顯著。 * 比較第一次 Build,和第二次 Rebuild 的時間。 * [[http://stackoverflow.com/questions/3095901/difference-between-build-solution-rebuild-solution-and-clean-solution-in-visua|Difference between Build Solution, Rebuild Solution, and Clean Solution in Visual Studio?]] * [[http://wiki.codeblocks.org/index.php?title=Code::Blocks_and_Makefiles|Code::Blocks and Makefiles]] * 預設使用 .cbp 檔 (XML 格式的設定檔) 控制編譯流程。 * [[http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_My_project_should_be_compiled_with_a_custom_makefile._Is_it_possible_with_Code::Blocks.3F|My project should be compiled with a custom makefile. Is it possible with Code::Blocks?]] * 可以手寫 Makefile,或是透過 [[http://sourceforge.net/projects/cbp2make/|cbp2make]] 將 .cbp 檔轉換成 Makefile。 * [[http://forums.codeblocks.org/index.php?topic=13675.0|cbp2make - makefile generation tool]] * 編譯相關代碼 * plugins\compilergcc\compilergcc.cpp * 加速編譯 * [[GNU Automake]] * Windows 平台上的做法請參考 [[http://forums.codeblocks.org/index.php/topic,12285.msg85321.html#msg85321|Re: ccache to speed up builds]] * 下載 ccache ([[https://code.google.com/p/ccache-win32/|ccache-win32]] 或 [[https://android.googlesource.com/platform/prebuilt/+/6c89c6601a699707500003b782406482c4c3050b/windows/ccache/|android ccache]]) 到 mingw32-gcc.exe 和 mingw32-g++.exe 所在目錄。 * 將下面兩個檔案 (適用於 [[https://code.google.com/p/ccache-win32/|ccache-win32]]) 放到 mingw32-gcc.exe 和 mingw32-g++.exe 所在目錄。 @echo off ccache.exe ""mingw32-gcc.exe %*" @echo off ccache.exe ""mingw32-g++.exe %*" * 可以觀察到 C:\Users\{username}\AppData\Roaming\.ccache 目錄有所變化。 * [[http://wiki.codeblocks.org/index.php?title=Precompiled_headers|Precompiled headers]] * [[http://forums.codeblocks.org/index.php?topic=17834.0|Topic: How to change the gcc build error messages format in codeblocks?]] * GNU ld 輸出的訊息較沒有規則性,必須手工調整訊息過濾機制。 * 參考 [[http://www.network-theory.co.uk/docs/gccintro/gccintro_95.html|13.3 Linker error messages]]。 * Settinngs -> Compiler -> Global compiler settings -> GNU GCC Compiler -> Other settings -> Advanced options -> Output parsing ====== emIDE ====== * [[http://www.emide.org/|emIDE]] 衍生自 [[http://www.codeblocks.org/|Code::Blocks]] --------------------------- ------------------ | TCP/IP | | | | gdb <--------> OpenOCD | <---> J-Link <----> | debugee | | | USB JTAG | | | (Host PC) | | (Target Board) | --------------------------- ------------------ * [[https://launchpad.net/gcc-arm-embedded|GNU Tools for ARM Embedded Processors]] * [[http://openocd.sourceforge.net/|OpenOCD]] * [[http://elk.informatik.fh-augsburg.de/pub/stm32lab/docs/oocd-2006.pdf|Open On-Chip Debugger – OpenOCD –]] * [[https://www.segger.com/jlink-debug-probes.html|J-Link]] + [[http://www.st.com/web/catalog/mmc/FM141/SC1169/SS1031/LN1565/PF164495?sc=internet/mcu/product/164495.jsp|STM32F103ZE]] * [[http://blog.csdn.net/smarxx/article/details/8486052|Ubuntu下使用OpenOCD通过Jlink烧写HEX到STM32]] * [[http://www.flamingoeda.com/2009/06/06/stm32%E7%8E%AF%E5%A2%83%E5%87%86%E5%A4%87%EF%BC%9Ajlink-openocd/|STM32环境准备:JLink + OpenOCD]] $ openocd -s ../share/openocd/scripts/ -f interface/jlink.cfg -f board/stm3210e_eval.cfg $ cat openocd.cfg source [find interface/jlink.cfg] source [find target/stm32f1x.cfg] $ openocd -f openocd.cfg $ telnet localhsot 4444 * [[http://zyanczy.blogspot.tw/2013/11/hello-world.html|第二關: 自己手動 HELLO WORLD]] * Windows 環境下,原有 J-Link 驅動似乎不能被 OpenOCD 辨識 ([[http://openocd.sourceforge.net/doc/html/Debug-Adapter-Configuration.html|8 Debug Adapter Configuration]])。 Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED Error: Cannot find jlink Interface! Please check connection and permissions. * [[https://forum.sparkfun.com/viewtopic.php?f=18&t=40163&sid=901a94827025ea8750987afbde4d3ba9|jlink libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED]] * 如果原有驅動無法使用,可以透過 [[http://zadig.akeo.ie/|Zadig]] 安裝其它版本的 USB 驅動。 * [[http://gnuarmeclipse.livius.net/blog/openocd-install/|OpenOCD install]] * [[https://forum.sparkfun.com/viewtopic.php?f=18&t=11221|How to build OpenOCD for windows]] * [[http://yhhuang1966.blogspot.tw/2014/05/java-telnet.html|Java 的 Telnet 實作]] * [[https://l3net.wordpress.com/2012/12/09/a-simple-telnet-client/|A Simple Telnet Client]] ====== 外部連結 ====== * [[http://www.codeblocks.org/|Code::Blocks]] * [[http://www.emide.org/|emIDE]]