1.1.1. KeilÈí¼þ°²×°ÒÔ¼°Ð½¨¹¤³Ì
(1) Èí¼þ°²×°
STM32ʹÓÃKeil±àÒëÆ÷£¬Keil5.15
¢Ù°²×°MDK£ºMDK515.exe
×¢ÒâÊÂÏ
a£©°²×°Â·¾¶²»ÔÊÐíÓÐÖÐÎÄ·¾¶
b£©Èç¹û֮ǰ°²×°¹ýC51°æ±¾£¬MDKºÍC51±ØÐëÔÚͬһ¸öÎļþ¼Ð¡£
¢Ú°Ñ.DownloadÎļþ¼ÐÉϵÄоƬ°ü×ÊÁϸ´ÖƵ½Èí¼þ°²×°Ä¿Â¼¡£
·¾¶£º..\ARM\Pack\.Download
¢Û°²×°Ð¾Æ¬°ü¡£Ñ¡ÔñÐèҪʹÓõľßÌåоƬÐͺŵÄоƬ°ü£¬Ë«»÷°²×°¡£
Keil.STM32F4xx_DFP.1.0.8.pack
(2) ÆƽâÈí¼þ£ºKEIL_Lic.exe
¢ÙÀûÓùÜÀíÔ±Éí·Ý´ò¿ª°²×°ºÃµÄKeilÈí¼þ
¢Ú°ÑFile ---- License ManagementÖеÄCID number¸´ÖƵ½ÆƽâÈí¼þÖÐ
¢ÛÑ¡ÔñÆƽâģʽΪARM
¢Üµã»÷Éú²úÐòÁкÅ
¢Ý°ÑÉú²úµÄÐòÁкŸ´ÖƵ½New License ID Code(LIC)¿òÖУ¬È»ºóµã»÷ADD LIC
¢ÞÆƽâ³É¹¦±êÖ¾£ºÈí¼þµ½ÆÚʱ¼äΪx.2020
(3) °²×°ST-LINKµ÷ÊÔÆ÷Çý¶¯£¬°²×°µçÄÔϵͳ°æ±¾°²×°¶ÔÓ¦µÄÇý¶¯
·¾¶£º\Cortex-M4ѧϰ×ÊÁÏ\Èí¼þ°²×°\MDK\ST-LINKÇý¶¯
(4) ´®¿ÚоƬÇý¶¯
·¾¶£º\Cortex-M4ѧϰ×ÊÁÏ\Èí¼þ°²×°\MDK\CH340_CH341
(5) н¨¹¤³Ì
Cortex-MϵÁй¤³ÌÓÐÁ½¸ö°æ±¾Ñùʽ£¬·Ö±ðÊÇ¡°¼Ä´æÆ÷¡±°æºÍ¡°¿âº¯Êý¡±°æ¡£
¡°¼Ä´æÆ÷¡±°æ£ºÔÚ¹¤³ÌÉè¼ÆÖÐÖ±½Ó²Ù×÷µ×²ãµÄ¼Ä´æÆ÷ȥʵÏÖÇý¶¯Ð¾Æ¬µÄ¸÷¸öÍâÉèÄ£¿é¡£
¡°¿âº¯Êý¡±°æ£ºµ÷ÓÃST¹«Ë¾ÌṩµÄÇý¶¯º¯Êý£¬Í¨¹ýµ÷ÓÃÏà¹ØµÄº¯ÊýȥʵÏֵײã¼Ä´æÆ÷µÄÇý¶¯¡£
¢Ù¡°¼Ä´æÆ÷¡±°æн¨¹¤³Ì
µÚÒ»²½£ºÐ½¨Ò»¸ö¹¤³ÌÎļþ¼Ð£¬²¢¶Ô¹¤³ÌÎļþ¼ÐÃüÃû(ÃüÃû×Ô¶¨Òå)¡£
µÚ¶þ²½£ºÔÚн¨¹¤³ÌÎļþ¼ÐÉÏ£¬ÔÙ½¨Á¢Á½¸öÎļþ¼Ð£¬
Ò»¸öÖ÷Òª´æ·ÅÓû§×Ô¼º±àдµÄ³ÌÐòÎļþ(.cºÍ.h)£¬
Îļþ¼ÐÃüÃû×Ô¶¨Ò壬½¨ÒéÃüÃûΪUser¡£
ÁíÒ»¸öÎļþ¼ÐÖ÷Òª´æ·ÅCortex-MϵÁÐÄں˽ӿÚÇý¶¯Îļþ£¬Îļþ¼ÐÃüÃû×Ô¶¨Ò壬
½¨ÒéÃüÃûΪCMSIS¡£È»ºóÔÚ´æ·ÅÓû§±àдµÄ³ÌÐòÎļþ¼ÐÏÂÔÙ½¨Á¢Á½¸ö×ÓÎļþ¼Ð£¬
Õâ¸öÁ½¸öÎļþ¼Ð·Ö±ð´æ·Å³ÌÐòµÄ.cÎļþºÍ.hÎļþ¡£½¨ÒéÃüÃûΪsrcºÍinc¡£
µÚÈý²½£º×¼±¸Ïà¹Ø¹¤³ÌÎļþ
¢Ù°Ñ¹Ì¼þ¿âϵÄCMSISÎļþ¼ÐÖеÄIncludeÎļþ¼Ð¸´ÖƵ½¹¤³ÌÎļþ¼Ð´æ·ÅCortex-MϵÁÐÄں˽ӿÚÇý¶¯ÎļþµÄÎļþ¼Ð(CMSIS)ÏÂ
·¾¶£ºCortex-M4ѧϰ×ÊÁÏ\STM32F4xx¹Ì¼þ¿â\STM32F4xx_DSP_StdPeriph_Lib_V1.4.0\Libraries\CMSIS
¢Ú°ÑSTM32F4xx_DSP_StdPeriph_Lib_V1.4.0\Libraries\CMSIS\Device\ST\STM32F4xx\IncludeÏÂ
µÄÁ½¸öÍ·Îļþ¸´ÖƵ½Cortex-MϵÁÐÄں˽ӿÚÇý¶¯ÎļþµÄÎļþ¼Ð(CMSIS)ϵÄIncludeÎļþ¼ÐÖС£
stm32f4xx.h ---- STM32F40xоƬͷÎļþ
system_stm32f4xx.h ---- STM32F40xоƬϵͳʱÖÓÍ·Îļþ
¢Û°ÑSTM32F4xx_DSP_StdPeriph_Lib_V1.4.0\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates\arm
ÎļþÏÂstartup_stm32f40_41xxx.sÎļþ¸´ÖÆCortex-MϵÁÐÄں˽ӿÚÇý¶¯ÎļþµÄÎļþ¼Ð(CMSIS)Ï¡£
startup_stm32f40_41xxx.s --- STM32F40xоƬÆô¶¯´úÂë
¢Ü°ÑSTM32F4xx_DSP_StdPeriph_Lib_V1.4.0\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates
Îļþ¼ÐÏÂsystem_stm32f4xx.cÎļþ¸´ÖÆCortex-MϵÁÐÄں˽ӿÚÇý¶¯ÎļþµÄÎļþ¼Ð(CMSIS)Ï¡£
system_stm32f4xx.c ---- STM32F40xоƬϵͳʱÖÓ³ÌÐòÎļþ
µÚËIJ½£º´ò¿ªKeil ---- project --- Nwe ¦ÌVision project
µÚÎå²½£º°Ñн¨µÄ¹¤³Ì±£´æÔÚ¹¤³ÌÎļþ¼ÐÏ£¬²¢ÃüÃû¡£
µÚÁù²½£ºÑ¡ÔñоƬÐźŠ---- STM32F407ZG
µÚÆß²½£ºÅäÖù¤³Ì --- µã»÷Æ·×ÖÐΰ´Å¥
¢ÙµÚÒ»ÁУº¹¤³ÌÃû³Æ£¬Ë«»÷¿ÉÒÔ¸ü¸Ä¹¤³ÌÃû
¢ÚµÚ¶þÁУº¹¤³Ì×é±ð£¬µã»÷мӰ´Å¥ÉèÖÃÁ½¸ö¹¤³Ì×é±ð£¬Ö÷ÒªÊÇ°ÑÄÚºËÎļþºÍÓû§³ÌÐòÎļþ¹ØÁªµ½Ð½¨¹¤³ÌÖС£¹¤³Ì×é±ðÃû³Æ×Ô¶¨Ò壬½¨ÒéÃüÃûΪCMSIS(ÄÚºË×é)ºÍUSER(Óû§×é)
¢Û°Ñ¶ÔÓ¦µÄ¹ØÁªÎļþÌí¼Óµ½ÏàÓ¦µÄ¹¤³Ì×é±ðÖÐ
CMSIS(ÄÚºË×é)£º
¹ØÁª¹¤³ÌÎļþ¼ÐCortex-MϵÁÐÄں˽ӿÚÇý¶¯ÎļþµÄÎļþ¼Ð(CMSIS)ϵÄ
startup_stm32f40_41xxx.sºÍsystem_stm32f4xx.c
µÚ°Ë²½£ºÉèÖù¤³Ì ---- µã»÷ħ·¨°ô°´Å¥
¢ÙOutPutÑ¡Ï£º°ÑÉú²úHEX File¹´Ñ¡ÉÏ
¢ÚC/C++Ñ¡Ï£º
a£©ÔÚDefineÀ¸ÖÐÌîÈ룺STM32F40_41xxx
b£©ÔÚInclude PathsÀ¸ÖÐÌí¼ÓÍ·Îļþ·¾¶
.\Cortex-MϵÁÐÄں˽ӿÚÇý¶¯Îļþ¼Ð\Include
.\Óû§³ÌÐòÎļþ¼Ð\inc
c£©DebugÑ¡Ï£ºÑ¡ÔñÓ²¼þµ÷ÊÔÆ÷ÀàÐÍ --- ST_LINK
d£©UtilitiesÑ¡Ï£ºÈ¥µô¹´Ñ¡¡°Ê¹ÓÃÈí¼þ·ÂÕ桱£¬²¢Ñ¡ÔñÓ²¼þµ÷ÊÔÆ÷ÀàÐÍ¡£
¢Ú¡°¿âº¯Êý¡±°æн¨¹¤³Ì
µÚÒ»²½£ºÐ½¨Ò»¸ö¹¤³ÌÎļþ¼Ð
µÚ¶þ²½£ºÔÚн¨¹¤³ÌÎļþ¼ÐϽ¨Á¢1¸ö×ÓÎļþ¼Ð£¬ÓÃÓÚ´æ·ÅÓû§±àдµÄ³ÌÐòÎļþ£¬
È»ºóÔÚÓû§³ÌÐòÎļþ¼ÐÏÂÔÙ½¨Á¢2¸ö×ÓÎļþ¼Ð£¬ÓÃÓÚ´æ·Å³ÌÐòÎļþµÄ.cºÍ.hÎļþ¡£
µÚÈý²½£º×¼±¸Ïà¹Ø¿âÎļþ
¢Ù°Ñ¹Ì¼þ¿âÎļþ¼ÐϵÄLibrariesÎļþ¼Ð¸´ÖƵ½¹¤³ÌÎļþ¼ÐĿ¼ÏÂ
¢Ú°ÑSTM32F4xx_DSP_StdPeriph_Lib_V1.4.0\Project\STM32F4xx_StdPeriph_TemplatesÎļþ¼Ð
ϵÄstm32f4xx_conf.h¸´ÖƵ½´æ·ÅÓû§³ÌÐòÎļþ¼ÐÏ´æ·ÅÍ·ÎļþµÄÎļþ¼ÐÖС£
stm32f4xx_conf.h ---- ST¹«Ë¾ÌṩµÄËùÓп⺯ÊýµÄÍ·Îļþ
µÚËIJ½£º´ò¿ªKeil ---- project --- Nwe ¦ÌVision project
µÚÎå²½£º°Ñн¨µÄ¹¤³Ì±£´æÔÚ¹¤³ÌÎļþ¼ÐÏ£¬²¢ÃüÃû¡£
µÚÁù²½£ºÑ¡ÔñоƬÐźŠ---- STM32F407ZG
µÚÆß²½£ºÅäÖù¤³Ì --- µã»÷Æ·×ÖÐΰ´Å¥
¢ÙµÚÒ»ÁУº¹¤³ÌÃû³Æ£¬Ë«»÷¿ÉÒÔ¸ü¸Ä¹¤³ÌÃû
¢ÚµÚ¶þÁУº¹¤³Ì×é±ð£¬µã»÷мӰ´Å¥ÉèÖÃÈý¸ö¹¤³Ì×é±ð£¬·Ö±ðÊÇÄÚºË×éCmsis¡¢Óû§×éUser¡¢¹Ì¼þ¿âº¯Êý×éStd_Lib
¢Û¹ØÁªÏà¹ØÎļþµ½¶ÔÓ¦×é±ð
ÄÚºË×éCmsis£º
a£©\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates\arm\startup_stm32f40_41xxx.s
b£©\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c
¹Ì¼þ¿âº¯Êý×éStd_Lib£º
\Libraries\STM32F4xx_StdPeriph_Driver\srcÏÂËùÓеÄÍâÉè¿âº¯ÊýÎļþ£¬»òÕßÊÇÓõ½ÄǸöÍâÉè¿âº¯ÊýÎļþ¾ÍÌí¼ÓÄǸö¿âº¯ÊýÎļþ¡£
×¢Ò⣺stm32f4xx_fmc.cÕâ¸öÍâÉè¿âº¯ÊýÎļþÊÇSTM32F42ºÍ43ϵÁвÅʹÓõ½£¬ËùÒÔÔÚ40ºÍ41ϵÁÐÖÐÐèÒª°ÑËüɾ³ý¡£
µÚ°Ë²½£ºÉèÖù¤³Ì ---- µã»÷ħ·¨°ô°´Å¥
¢ÙOutPutÑ¡Ï£º°ÑÉú²úHEX File¹´Ñ¡ÉÏ
¢ÚC/C++Ñ¡Ï£º
a£©ÔÚDefineÀ¸ÖÐÌîÈ룺STM32F40_41xxx,USE_STDPERIPH_DRIVER
b£©ÔÚInclude PathsÀ¸ÖÐÌí¼ÓÍ·Îļþ·¾¶
.\Libraries\CMSIS\Device\ST\STM32F4xx\Include ---- ϵͳʱÖÓÍ·Îļþ
.\Libraries\CMSIS\Include ---- Äں˽ӿÚÇý¶¯Í·Îļþ
.\Libraries\STM32F4xx_StdPeriph_Driver\inc ---- ST¹«Ë¾ÍâÉè¿âº¯ÊýÍ·Îļþ
.\User\inc ---- Óû§³ÌÐòÍ·Îļþ
c£©DebugÑ¡Ï£ºÑ¡ÔñÓ²¼þµ÷ÊÔÆ÷ÀàÐÍ --- ST_LINK
d£©UtilitiesÑ¡Ï£ºÈ¥µô¹´Ñ¡¡°Ê¹ÓÃÈí¼þ·ÂÕ桱£¬²¢Ñ¡ÔñÓ²¼þµ÷ÊÔÆ÷ÀàÐÍ¡£
6£©Ð½¨¹¤³ÌÎļþ
µÚÒ»²½£ºµã»÷н¨ÎļþÃüÁîн¨Ò»¸ö±à³ÌÎļþ
µÚ¶þ²½£º°Ñн¨µÄ³ÌÐòÎļþÃüÃû²¢±£´æÔÚÓû§³ÌÐòÎļþ¼ÐÏ´æ·Å.cÎļþµÄÎļþ¼ÐÏ¡£
×¢Ò⣺Õâ¸öÎļþÊdzÌÐòÎļþ£¬ËùÓÐÐèÒªºó׺Ãû.c
µÚÈý²½£º°Ñн¨µÄ³ÌÐòÎļþ¹ØÁªµ½¹¤³ÌÖС£