|
1. ÄÄÆÄÀÏ·¯ ¼³Ä¡
1.1 ARM EABI GCC°¡ Æ÷ÇÔµÈ CodeSourcery G++ Lite
(1) http://www.codesourcery.com/sgpp/lite/arm/portal/subscription3053 ¿¡ Á¢¼ÓÇؼ account È®ÀÎÈÄ¿¡ "Lite Edition À» ´Ù¿î·Îµå ÇÑ´Ù.
(2) ´Ù¿î¹ÞÀº arm-2013.05-23-arm-none-eabi.exe ÆÄÀÏ ¼³Ä¡. ÆÄÀÏ À̸§Àº ´Ù¿î·Îµå ¹ÞÀº ³¯Â¥¿¡ µû¶ó¼ ´Þ¶óÁú ¼ö ÀÖ´Ù.
¼³Ä¡°¡ ¸ðµÎ ¿Ï·áµÇ¾ú ´Ù¸é À©µµ¿ì µµ½º ÇÁ·ÒÇÁÆ®(¸í·É ÇÁ·ÒÇÁÆ®) ¿¡¼ "arm-none-eabi-gcc -v" ¶ó°í ¸í·ÉÀ» ½ÇÇà ÇßÀ»¶§ ¾Æ·¡ ±×¸²°ú °°ÀÌ gcc version ÀÌ ¿Ã¹Ù¸£°Ô Ç¥½Ã µÇ¾î¾ß ÇÑ´Ù. cortex-m3 ¸¦ ¿Ã¹Ù¸£°Ô Áö¿øÇϱâ À§Çؼ´Â gcc ¹öÁ¯ 4.6.1 ÀÌ»óÀÌ ¼³Ä¡ µÇ¾î ÀÖ¾î¾ß ÇÑ´Ù.
1.2 ÀÌŬ¸³½º IDE ¼³Ä¡
(1) ÀÚ¹Ù JDK ¼³Ä¡( Download and install latest J2SE )
(2) ´Ù¿î·Îµå ¹ÞÀº jdk-7u25-windows-i586.exe ÆÄÀÏÀ» ¼³Ä¡ ÇÑ´Ù. ÆÄÀÏ À̸§Àº ´Ù¿î·Îµå ¹ÞÀº ¹öÁ¯¿¡ µû¶ó¼ ´Þ¶ó Áú ¼ö ÀÖ´Ù.
(2) ÀÌŬ¸³½º ¼³Ä¡( Download and unpack Eclipse)
°³¹ßÀÚÀÇ À©µµ ȯ°æ¿¡ µû¶ó¼ Windows 32-bit or Windows 64-bit ¹öÁ¯À» ´Ù¿î·Îµå ÇÑ´Ù.
ÀÌŬ¸³½º ÇÁ·Î±×·¥Àº º°µµÀÇ ¼³Ä¡ °úÁ¤Àº ÇÊ¿ä ÇÏÁö ¾Ê´Ù. ´Ù¿î¹ÞÀº zip ÆÄÀÏÀ» ¾ÐÃà ÇØÁ¦ÇÏ°í eclipse Æú´õÀÇ "eclipse.exe" ÆÄÀÏÀ» °ð¹Ù·Î ½ÇÇàÇÏ¸é µÈ´Ù.
2. Configuration Eliipse for STM32F4
2.1 Eclipse ȯ°æ¼³Á¤
(1) CDT Plugin ¼³Ä¡
ÀÌŬ¸³½º¸¦ óÀ½ ½ÇÇàÇÏ¸é ¾Æ·¡ ±×¸²°ú °°ÀÌ Workspace¸¦ ¼³Á¤Ç϶ó´Â âÀÌ ³ª¿Â´Ù. ¾Æ¹« Æú´õ³ª ÁöÁ¤Çصµ µÇÁö¸¸ ÇÁ·ÎÁ§Æ® °ü¸®¸¦ ü°èÀûÀ¸·Î ÇϱâÀ§Çؼ´Â ÃøÁ¤ ÀÛ¾÷ Æú´õ¸¦ »ý¼ºÇؼ Çϴ°ÍÀÌ ÁÁ´Ù.
ÇÊÀÚ´Â "D:\svn\eclipse_work" Æú´õ¿¡ »ý¼º ÇÏ¿´´Ù.
ÀÌŬ¸³½º°¡ óÀ½ ½ÇÇàµÈ ȸéÀÌ´Ù.
ÀÌŬ¸³½º ¸Þ´º¿¡¼ "Help/Install New Software .." ¸Þ´ºÀ» ¼±Åà ÇÑ´Ù.
"Available Software Sites" ¸¦ ¼±ÅÃÇؼ "http://download.eclipse.org/tools/cdt/releases/helios" »çÀÌÆ®¸¦ Ãß°¡ÇÑ´Ù.
"Work With" ¿¡ "-- All Available Sites --" ¸¦ ¼±ÅÃÇÏ¸é ¿Â¶óÀο¡¼ Áö¿ø °¡´ÉÇÑ Eclipse Ç÷¯±×ÀεéÀÌ ¸®½ºÆ® µÈ´Ù. ¾Æ·¡ ±×¸²¿¡¼ ´ÙÀ½°ú °°Àº 6°³ÀÇ Ç׸ñÀ» ¼±Åà ÇÑ´Ù.
"C/C++ Development Tools",
"C/C++ Development Platform",
"C/C++ GCC Cross Compiler Support",
"C/C++ GDB Hardware Debugging",
"C/C++ GNU Toolchain Build Support",
"C/C++ GNU Toolchain Debug Support"
¼³Ä¡°¡ ¿Ï·áµÈ ÈÄ¿¡ ¹Ýµå½Ã "Restart Now" ¸¦ ¼±ÅÃÇؼ ÀÌŬ¸³½º °³¹ßȯ°æÀ» ´Ù½Ã ½ÃÀÛ ÇØ¾ß ÇÑ´Ù.
¸¸¾à À§¿Í °°ÀÌ ¿Â¶óÀÎÀ» ÅëÇؼ Á÷Á¢ ¼³Ä¡°¡ µÇÁö ¾Ê´Â´Ù¸é Á÷Á¢ ´Ù¿îÀ» ¹Þ¾Æ¼ ¼³Ä¡ ÇÒ ¼öµµ ÀÖ´Ù. ÇÊÀÚÀÇ PCÀÇ °æ¿ì¿¡´Â À§¿Í °°ÀÌ ¼³Ä¡ÇÏ¸é¼ ¿¡·¯°¡ ¹ß»ý ÇÏ¿´´Ù.
(2) ¿ÀÇÁ¶óÀÎÀ» ÅëÇÑ CDT Plugin ¼³Ä¡
À§ÀÇ (1) ¹øÀÇ ¹æ¹ý´ë·Î ¿Â¶óÀÎÀ¸·Î Á÷Á¢ ¼³Ä¡°¡ Àß µÇ¾ú´Ù¸é À̹ø ÀåÀº ±×³É ³Ñ¾î°¡¾ß ÇÏ´Ù. ÀÎÅͳݿ¡ Á¢¼ÓÇÏ¿© Á÷Á¢ CDT PluginÀ» ´Ù¿î·Îµå ÇÑ´Ù. CDT Plugin ´Ù¿î·Îµå(http://download.eclipse.org/tools/cdt/releases/helios/)
ÀÌŬ¸³½º ¸Þ´º¿¡¼ "Help/Install New Software .." ¸Þ´ºÀ» ¼±Åà ÇÑ´Ù.
"Add" ¹öÆ°À» ´·¯¼ Local Æú´õ¿¡ ´Ù¿î¹ÞÀº CDT Plugin À» Ãß°¡ÇÑ´Ù.
¾Æ·¡ ±×¸²¿¡¼ ´ÙÀ½°ú °°Àº 6°³ÀÇ Ç׸ñÀ» ¼±Åà ÇÑ´Ù.
"C/C++ Development Tools",
"C/C++ Development Platform",
"C/C++ GCC Cross Compiler Support",
"C/C++ GDB Hardware Debugging",
"C/C++ GNU Toolchain Build Support",
"C/C++ GNU Toolchain Debug Support"
ÀÌÈÄÀÇ ÀýÂ÷´Â ¿Â¶óÀÎÀ¸·Î ¼³Ä¡ÇÏ´Â °úÁ¤°ú ¿ÏÀüÈ÷ µ¿ÀÏÇÏ´Ù.
2.2 STM32F4 ÇÁ·ÎÁ§Æ® »ý¼º
ÀÌÀü ±îÁö ÀÌŬ¸³½º °³¹ßȯ°æ ¼³Ä¡¿¡ ´ëÇؼ´Â ¸¶¹«¸®°¡ µÇ¾ú°í ÀÌÁ¦ ºÎÅÍ´Â STM32 °³¹ßÀ» À§ÇÑ ÇÁ·ÎÁ§Æ® »ý¼º¿¡¼ ºÎÅÍ È¯°æ ¼³Á¤¿¡ ´ëÇÑ ºÎºÐÀ» ¾Ë¾Æº¸ÀÚ.
(1) STM32 ÇÁ·ÎÁ§Æ® »ý¼º
ÀÌŬ¸³½º ¸Þ´º¿¡¼ "File/New/Project .." ¸Þ´ºÀ» ½ÇÇàÇÏ°í, "C/C++ - C Project" ¸¦ ¼±ÅÃÇÑ´Ù.
Cortex-M4 STM32F407VGT6 °³¹ßÀ» À§ÇÑ È¯°æÀ» ¼³Á¤ÇÒ °ÍÀÌ´Ù.
- Project name : stm32f4_dragon
- Location : D:\svn\google_code\jk-stm32f4-dragon\sw\led\prj\GCC
ÇÁ·ÎÁ§Æ® Á¾·ù´Â "Executable/Cross-Compile Project" ¸¦ ¼±ÅÃÇÏ°í Toolchains ´Â "Cross GCC" ¸¦ ¼±ÅÃÇÑ´Ù.
"C/C++ perspective" ¸¦ Áö¿øÇÏ°Ú´Â³Ä°í ´ëÈâÀÌ ³ª¿À¸é "Yes" ¸¦ ¼±ÅÃÇÑ´Ù.
Empty C/C++ Project °¡ »ý¼ºµÈ ȸé ÀÌ´Ù.
(2) STM32 SDK Library ´Ù¿î·Îµå
STM32¿¡ °ü·ÃµÈ ÀÚ·á°¡ °¡Àå ¸¹ÀÌ ÀÖ´Â °÷Àº ¿ª½Ã Á¦Á¶»ç ȨÆäÀÌÁö ÀÌ´Ù. ST»ç¿¡¼ Á¦°øÇÏ°í ÀÖ´Â STM32¿ë SDK¶óÀ̺귯¸®¸¦ ´Ù¿î·Îµå ÇÑ´Ù.
- ST»ç ȨÆäÀÌÁö¿¡ Á¢¼Ó
- SDK ¶óÀ̺귯¸® ´Ù¿î·Îµå
- ´Ù¿î·Îµå ¹ÞÀº SDK ¶óÀ̺귯¸® ¾ÐÃà ÇØÁ¦
(3) Import
»õ·Î »ý¼ºÇÑ ÇÁ·ÎÁ§Æ®¿¡ STM32 SDK ¶óÀ̺귯¸®¿Í UserÆÄÀÏ(main.c, stm32f4xx_it.c) À» Ãß°¡ÇÑ´Ù. STM32 SDK ¶óÀ̺귯¸®ÀÇ À§Ä¡¿Í ÇÁ·ÎÁ§Æ®ÀÇ ÀüüÀûÀÎ ±¸Á¶´Â ¾Æ·¡ ±×¸²°ú °°½À´Ï´Ù.
- ÇÁ·ÎÁ§Æ®¿¡ ÇÊ¿äÇÑ ÆÄÀϵé
$ÇÁ·ÎÁ§Æ® °æ·Î$ ( D:\svn\google_code\jk-stm32f4-dragon\sw ) |
\led\prj\GCC |
GCC ÇÁ·ÎÁ§Æ®
stm32f407_flash.ld |
\led |
main.c
stm32f4xx_it.c |
$Cortex-M3/M4 ¶óÀ̺귯¸®$ ( $ÇÁ·ÎÁ§Æ® °æ·Î$ + \lib\STM32_USB-Host-Device_Lib_V2.1.0 ) |
\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates\TrueSTUDIO |
startup_stm32f4xx.s |
\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates |
system_stm32f4xx.c |
\Libraries\STM32F4xx_StdPeriph_Driver\src |
misc.c
stm32f4xx_gpio.c
stm32f4xx_rcc.c
stm32f4xx_syscfg.c |
ÇÁ·ÎÁ§Æ®ÀÇ ·çÆ®Æú´õ¿¡¼ ¿À¸¥ÂÊ ¸¶¿ì½º Ŭ¸¯ÈÄ¿¡ "Import" ¸Þ´ºÀ» ¼±ÅÃ
ImportÇÒ Á¾·ù¸¦ "File System" À» ¼±ÅÃ
led Æú´õ¿¡¼ ¾Æ·¡ ±×¸²°ú °°Àº ÆÄÀϵéÀ» Ãß°¡. ¿©±â¼ À¯ÀÇ ÇؾßÇÒ »çÇ×Àº "Advanced" ¿¡¼ ¹Ýµå½Ã
"Create links in workspace", "Create virtual folders", "Create link locations relative to : ECLIPSE_HOME" À» ¼±Åà ÇØ¾ß ÇÑ´Ù. ±×·¸Áö ¾ÊÀ¸¸é ½ÇÁ¦ ÆÄÀÏ°ú Æú´õµéÀÌ ÀÌŬ¸³½º ÇÁ·ÎÁ§Æ® Æú´õ³»¿¡ »ý¼ºÀÌ µÈ´Ù.
ÇÁ·ÎÁ§Æ®¿¡ led Æú´õ³»ÀÇ ÆÄÀϵéÀÌ Ãß°¡µÈ ȸé
À§¿Í °°Àº ¹æ¹ýÀ¸·Î À̹ø¿¡´Â "D:\svn\google_code\jk-stm32f4-dragon\sw\lib\STM32_USB-Host-Device_Lib_V2.1.0\Libraries" °æ·ÎÀÇ STM32 SDK ¶óÀ̺귯¸®µéÀ» Import ÇÑ´Ù.STM32F4°ü·ÃµÈ ¶óÀ̺귯¸®µé¸¸ Ãß°¡ÇÏ¸é µÈ´Ù.
¸¶Áö¸·À¸·Î ÇÁ·ÎÁ§Æ® ·çÆ®¿¡ "D:\svn\google_code\jk-stm32f4-dragon\sw\led\prj\GCC\stm32f407_flash.ld" ¸µÅ© ½ºÅ©¸³Æ® ÆÄÀÏÀ» Ãß°¡ÇÏ¸é µÈ´Ù. ¸ðµç ÆÄÀϵéÀÌ Ãß°¡µÇ¾úÀ¸¸é ¿ì¸®°¡ ÇÁ·ÎÁ§Æ®¿¡¼ ²À ÇÊ¿äÇÑ ÆÄÀϵéÀ» Á¦¿ÜÇÏ°í ³ª¸ÓÁö´Â ¸ðµÎ ÄÄÆÄÀÏ¿¡¼ Á¦¿ÜÇÏ´Â ÀÛ¾÷À» ÇÑ´Ù.
TrueSTUDIO startup ÆÄÀÏÀ» Á¦¿ÜÇÑ ³ª¸ÓÁö ÇÁ·ÎÁ§Æ® startup ÆÄÀϵéÀ» Á¦¿ÜÇÑ´Ù.
TrueSTUDIO startup ÆÄÀÏÀ» Á¦¿ÜÇÑ ³ª¸ÓÁö ÇÁ·ÎÁ§Æ® startup ÆÄÀϵéÀ» Á¦¿ÜµÈ ȸé.
¿©±â¼ ÇÑ°¡Áö ÁÖÀÇ ÇؾßÇÒ »çÇ×ÀÌ Àִµ¥ startup_stm32f4xx.s ÆÄÀÏÀÇ È®ÀåÀÚ ".s" °¡ ¼Ò¹®ÀڷΠǥ±âµÇ¾î ÀÖÀ¸¸é Á¤»óÀûÀ¸·Î ¾î¼ÀºíÀÌ µÇÁö ¾Ê´Â ¹ö±×°¡ ÀÖ´Â°Í °°´Ù. ¹Ýµå½Ã ¾î¼Àºí¸®¾î ÆÄÀÏÀ» ImportÇϱâÀü¿¡ Ž»ö±â µî¿¡¼ ".s" ¼Ò¹®ÀÚ¸¦ ".S" ´ë¹®ÀÚ·Î ¹Ù²Û ´ÙÀ½¿¡ Import¸¦ Çϵµ·Ï ÇÏÀÚ. ÀÌ¹Ì Import ÀÛ¾÷À» ¼öÇà Çß´Ù¸é ÇÁ·ÎÁ§Æ®¿¡¼ ¾î¼Àºí¸®¾î ÆÄÀÏÀ» Á¦°ÅÇÏ°í ".s" È®ÀåÀÚ¸¦ ´ë¹®ÀÚ·Î ¼öÁ¤ÇÑ ´ÙÀ½ ´Ù½Ã Import¸¦ ÇÏ¸é µÈ´Ù.
2.3 STM32F4 ÇÁ·ÎÁ§Æ® ¼³Á¤
Cortex-M4 ÄÚ¾î ÄÄÆÄÀÏÀ» À§ÇÑ ÀÌŬ¸³½º ÇÁ·ÎÁ§Æ® ¼³Á¤À» Cortex-M4 Äھ ¸Â°Ô ¼³Á¤À» ÇØ¾ß ÇÑ´Ù.
(1) C/C++ Build/Environment
CWD : "${ProjDirPath}"\Debug
PWD : "${ProjDirPath}"\Debug
À§ÀÇ Path ¼³Á¤¿¡¼ "${ProjDirPath}" ÀÇ ½ÇÁ¦ÀûÀÎ À©µµ Æú´õÀÇ À§Ä¡´Â "D:\svn\google_code\jk-stm32f4-dragon\sw\led\prj\GCC" °¡ µÈ´Ù.
(2) Settings/Cross Settings
Prefix : arm-none-eabi-
Path : C:\Program Files\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_EABI\bin
(3) Settings/Cross GCC Compiler/Symbols
USE_STDPERIPH_DRIVER
STM32F4XX
Âü°í·Î STM32F10x ½Ã¸®Áî¿¡¼´Â ¾Æ·¡¿Í °°ÀÌ ¼³Á¤ÇÑ´Ù.
USE_STDPERIPH_DRIVER
STM32F10X_HD --> Device density ¿¡ µû¶ó¼ STM32F10X_MD or STM32F10X_CL µîÀ¸·Î ¹Ù²Ù¾î¼ ¼³Á¤ÇÑ´Ù.
(4) Settings/Cross GCC Compiler/Includes
"${ProjDirPath}/../../../lib\STM32_USB-Host-Device_Lib_V2.1.0\Libraries\CMSIS\Device\ST\STM32F4xx\Include"
"${ProjDirPath}/../../../lib\STM32_USB-Host-Device_Lib_V2.1.0\Libraries\STM32_USB_Device_Library\Core\inc"
"${ProjDirPath}/../../../lib\STM32_USB-Host-Device_Lib_V2.1.0\Libraries\STM32_USB_Device_Library\Class\hid\inc"
"${ProjDirPath}/../../../lib\STM32_USB-Host-Device_Lib_V2.1.0\Libraries\STM32F4xx_StdPeriph_Driver\inc"
"${ProjDirPath}/../../../led"
"${ProjDirPath}/../../../lib/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/CMSIS/Include"
(5) Settings/Cross GCC Compiler/Miscellaneous/Oter flags
Other flags : -c -v -mthumb -mcpu=cortex-m4 -fmessage-length=0
Âü°í·Î stm32f10x ½Ã¸®Áî¿¡¼´Â "-c -v -mthumb -mcpu=cortex-m3 -fmessage-length=0" ·Î ¼³Á¤
(6) Settings/Cross GCC Linker/Miscellaneous/Linker flags
Linker flags : -T "${ProjDirPath}\stm32f407_flash.ld" -mthumb -mcpu=cortex-m4 -Wl,-Map=linker.map -Wl,-cref -Wl,--gc-sections
Cortex-M3 ÀÇ °æ¿ì¿¡´Â flasts ¿¡¼ cortex-m4 ¸¦ cortex-m3 ·Î ¼öÁ¤ÇÑ´Ù.
(7) Settings/GCC Assembler
Command : arm-none-eabi-as
(8) Settings/GCC Assembler/General
Assembler flags : -mthumb -mcpu=cortex-m4
Cortex-M3 ÀÇ °æ¿ì¿¡´Â flasts ¿¡¼ cortex-m4 ¸¦ cortex-m3 ·Î ¼öÁ¤ÇÑ´Ù.
* Âü°í·Î ¼Ò½º³»¿¡¼ sqrt µîÀÇ ¼öÇÐ ÇÔ¼ö¸¦ »ç¿ëÇÏ´Â °æ¿ì¿¡´Â gccÀÇ math ¶óÀ̺귯¸®¸¦ Ãß°¡ÇØ ÁÖ¾î¾ß ÇÑ´Ù.
Library search path (-L) : "C:\Program Files\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_EABI\arm-none-eabi\lib\thumb2"
ÀÌÁ¦ µåµð¾î ¸ðµç ÄÄÆÄÀÏ È¯°æ ¼³Á¤ÀÌ ¿Ï·áµÇ¾ú´Ù. ÀÌŬ¸³½º¿¡¼ "Ctrl+B" ¸¦ ´©¸£¸é ÄÄÆÄÀÏÀÌ ½ÃÀ۵ȴÙ.
3. Configuration Eliipse for ST-Link/V2
3.1 Eclipse ´Ù¿î·Îµå ȯ°æ¼³Á¤
(1) External Tools Configurations
Create New launch
STM32 ST-LINK Utility.exe À§Ä¡ÇÑ °æ·Î¸¦ ÁöÁ¤ÇØ ÁØ´Ù.
Âü°í·Î ST-Link Utility°¡ ¼³Ä¡µÇÁö ¾Ê¾Ò´Ù¸ç ¾Æ·¡ °æ·Î¿¡¼ ´Ù¿î·Îµå ¹Þ¾Æ¼ ¼³Ä¡ ÇÒ ¼ö ÀÖ´Ù.
- ST-Link Utility ´Ù¿î·Îµå
- ST-Link »ç¿ëÀÚ ¸Þ´º¾ó(»õâ)
3.2 Eclipse ST-Link µð¹ö±ë ȯ°æ¼³Á¤
(1) External Tools Configurations
4. Open Existing Project
4.1 Open Existing Project
3 Àý¿¡¼´Â ÇÁ·ÎÁ§Æ®¸¦ óÀ½ºÎÅÍ »ý¼ºÇÏ´Â °úÁ¤À» »ìÆì º¸¾Ò´Ù. ÇÏÁö¸¸ ÀÌ¹Ì »ý¼ºÇØ ³õÀº ÇÁ·ÎÁ§Æ® ÆÄÀÏÀÌ ÀÖ´Ù¸é ½±°Ô ÀÌŬ¸³½º ȯ°æÀ¸·Î Import ÇÏ¿© »ç¿ëÇÒ ¼ö ÀÖ´Ù.
ÀÌŬ¸³½º¸¦ óÀ½ ½ÇÇàÇÏ¸é ¾Æ·¡¿Í °°Àº ȸéÀÌ ³ª¿À´Âµ¥ ¿©±â¿¡¼ Workbench ¾ÆÀÌÄÜÀ» ´·¯¼ Project Workbench·Î À̵¿ ÇÑ´Ù.
"File/Import" ¸Þ´º¸¦ ½ÇÇà ÇÑ´Ù.
Import ȸ鿡¼ "Existing Projects into Workspace" ¸¦ ¼±ÅÃÇÑ´Ù.
STM32 GCC ÇÁ·ÎÁ§Æ®°¡ ÀÖ´Â Æú´õ¸¦ ÁöÁ¤ ÇÑ´Ù.
ÁöÁ¤ÇÑ Æú´õ¿¡ GCC ÇÁ·ÎÁ§Æ®°¡ ÀÖ´Ù¸é ¾Æ·¡ ±×¸²°ú °°ÀÌ Projects ¸®½ºÆ® â¿¡ ³ªÅ¸³´Ù.
ÇÁ·ÎÁ§Æ® Import °¡ ¿Ï·áµÈ ȸé ÀÌ´Ù.
|