基于CubeMX 5.0的TouchGFX移植教程

所需积分/C币:8 2018-12-04 08:56:19 1.32MB PDF
收藏 收藏 1
举报

基于CubeMX 5.0的TouchGFX移植教程,带截图,有工程代码
TIM2 A TIM3 Reset Configuration A TM4 A TIM5 User Constants ● NVIC Settings O DMA Settings TIM6 ② Parameter Settings TIM7 Configure the below parameters: A TIMe TIM9 QISearch (CIt/+F TIM10 TIM1 Counter Settings TIM12 Prescaler(PSC -16 bits value 89 TIM13 Counter Mode TIM14 Up Counter Period (AutoReload Registe. 999 Internal Clock Division(CKD) No Division Connectivity v Trigger Output (IRGO)Parameters Master/slave Mode(MSM bit Disable (Trigger input effect not delayed) Multimedia Trigger Event selection Reset (UG bit from TIMX EGR) 6、勾选 FreeRtos,有2个注意点,需要打开 USE APPLICATION TASK TAG功能, 分配给GFX的任务内存要大点,不然死机 a Search (Crt/月⊙ C omputing USE MUTEXES Enabled USE RECURSIVE MUTEXES Disabled USE COUNTING SEMAPHORES Disabled QUEUE REGISTRY SIZE Middleware USE APPLICATION TASK TAG Enabled ENABLE BACKWARD COMPATIBIL Enabled FATES USE PORT OPTIMISED TASK SE Enabled ∠ FREERT0s USE TICKLESS IDLE Disabled GRAPHICS USE TASK NOTIFICATIONS Enabled LIBJPEG Memory management settings dit Task Task Name SysTask Priorty os PriontyNormal Stack Size(Words) 512 Entry Function Start SysTask Code Generation Option Default Parameter 儿L location Dynamic Buffer Name Control Block Name K Cancel 7、使能 TouchEⅩ,修改分辨率,切换 TouchGEX选项, Options GRAPHICS Mode and Configuration CategoriesA->Z Mode A TM4 Graphics Framework Touch GF. A TM5 TM6 Display Interface Display Parallel Interface using LTDC TIM7 △TM8 TIM9 TIM10 TIM11 TIM12 TIM13 TIM14 Configuration Reset Configuration Connectivity ● TouchGFX e User Constants Platform Settings e Parameter Settings Multimedia Configure the below parameters Securit Q Search+月⑧ Dine I uchitA Computing v Physical Dis play Size Width V CRC Height 480 ˇ Frame Buffer LTDC Pixel Format(Set in LTDC) LTDC PIXEL FORMAT RGB888 Middleware Frame Buffer Color Format RGB888 Color Frame Buffer Depth FATFS Color Frame Buffer Start Address(S. 0XC0000000 FREERTOS Buffers count Double Buffered GRAPHICS LIBJPEG Bitmap Cache Settings Bitmap cache Address MBFDT S 西A,L 选择GFX的设计器 Options GRAPHICS Mode and Configuration Categories.>Z M node △TM4 Graphics Framework TouchGFX △TM5 TIM6 Display Interface Display Parallel Interface using LTDC TIM A TM8 TIM9 TIM10 TIM11 TIM12 TIM13 TIM14 Confiquration Reset Configuration Connectivity o TouchGFX ● User Constants△ Platform Settings ● Parameter Settings Multimedia Configure the below parameters Security Q⑤ea+月 Execute v External application info Computing Name TouchGFX Designer Version V4.10.0 CRC Locatio Executable full name G \Touch/4. 10. 0\designerTouch GFXDesi Middleware Inputs Physical Display X Size 800 Physical Display Y size 480 FATFS FREERTOS GRAPHICS LIBJPEG LWIP MREDT S 8、工程配置,勾选生成的外设生成c和h文件,这样方便管理工程 Pinout Configuration Clock Configuration Project Manager STM32Cube Firmware Library Package O Copy all used libranes into the project folder Project O Copy only the necessary library files O Add necessary library files as reference in the toolchain project configuration file M Generate peripheral initialization as a pair of c/ h files per peripheral a Backup previously generated files when re-generating Code Generator U Keep User Code when re-generating v Delete previously generated files when not re-generated HAL Settings a Set all free pins as analog(to optimize the power consumption 口 Enable Full Assert Advanced Settings Select a template to generate customized code Setting: 9、生成工程代码,点YES MX Warning: Code Generation △ WARNINGS The HAL timebase source can be changed from the Pinout tab under sr ase source other than the Systie When FreeRTOS is used, it is strongly recommended to use a HaL timba These IPs still have some not configured or wrong parameter values [FATFS, GRAPHICS Do you still want to generate code Yes N 这时候编译工程会发现很多错误 compiling oSWrappers cpp ./Middlewares/ST/TouchGEXtouchgfx/os/osWrapperscpp(1): error: #5: cannot open source input file"touchgfx/hal ⊥nc⊥ude< touchgfx/na1/ WRAppers,rpp /Middlewares/sT/TouchGEX/touchgfx/os/0SWrappers cpp: o warnings, 1 error compiling port. C. compiling cmsis 0s.c " TouchGFX DEMO\TouchGEX DEMO, axfn-7 Error(3), 1 Warning(s) Target not created. Build Time Elapsed: 00: 00: 27 切换回 CUBEMX,在 CUBEMX下启动GFX的设计器 Computing Configuration Middleware Reset configuration V FATES 9 TouchGFX User Constants ▲ Platform Settings FREERTOS 9 Parameter Setting ∠ GRAPHICS Configure the below parameters LIBJPEG LWiP MBEDTLS Q[ Search(CrtH月⑧⊙ Execute PDM2PCM V External application info USB DEVICE Name Touch GFX Designer USe HOST Version V4.10.0 Location Application Executable full name G: \ TouchGFX14 10.0ldesignenTouchGFXDes. Input 使用设计器设计一个界面,再点击生成代码 TouchGFX DesIGNER Hello TouchGFX 查看生成日志,如下表示完成 E TouchGFX Designer Notifications 000504/12-2018 make -f simulator/gcc/Makefile -110 00:0504/12-2018 Wrote G: \STM32\STM32 Project\TouchGFX DEMO\TouchGEX/generated/gui generated/include/gui generated/s Alpha 00:0504/12-2018 Wrote G: \STM32\STM32_Project\TouchGFX DEMO\ TouchGEX/ generated/gui generated/gre/screenl_screen/Scre 00: 04/12-2018 make -f simulator/gcc/Makefile assets-3l0 00.05 04/12-2018 tcuchgEx update project --pzoject-file=.WNDK-ARM TouchGIX DEMD uvpzojx--gui-gzoup-name=Applicatic MIXINS 00-05 04/12-2018 make -f simulator/gcc/Makefile-j10 00: 04/12-2018 Wrote G: \STM32\ STM32 Project\TouchCFX DEMO\TouchGEX/ generated/gui generated/include/gui_ generated/s 005042.208owrte:\sms2smspreetirourhrxporouchsrx/ganerate/gu9enarated/sre/sereenlserenscre 0005 04/12-2016 make-f simulator/gcc/Makefile assets-110 00: 04/12-2018P tauchgEx update project --project-files.. \MDK-ARMA TouchGEX DEMO uvpzojx --gui-gzoup-name=Applicatio 00:0504/12-2018 make -f simulator/gcc/Makefile-110 0005 04/12-2018 P make -f simulator/gee/Makefile assets-j10 0005 04/12-2018 touchgfx update_project--project-file=--AMDK-AR TouchGEX_DEMO. uvpzojx--gui-gzoup-name=Applicatio 0005 04/12-2018 P make -f simulator/gcc/Makefile-j10 000504/12-2018 Gererating code 00:0504/12-2018 P make -f simulator/gcc/Makefile assets-j10 000s 04/12-20180 touchgEx update_projeat--pzoject-file-.MDX-ARMA TouchGEX_DEMD.uvprojx-gui-gzoup-name-Applicatic 0005 04/12-2018 Code generation complete 00:0604/12-2018P make -f simulator/gee/Makefile assets -j10 48 000604/12-2018 tcuchgEx update project--project-files..\MDK-ARMATouchGEXDEMO uvprojx--gui-group -AppLIcatIo 00.0604/12-2018 make-f simulator/gcc/Makefile-j10 a、再切换回MDK,发现要重新载入工程,点YES,再编译,发现上百个错误,这是 因为没有添加G「X的ib文件,其实这时候MX已经把需要的GFX文件都拷贝到工程下 b、添加i文件后重新编译,还有错误 TouchGEX DEMO\ TouchGEX DEMO axf L6218E: Undefined symbol MX FREERTOS Inito (referred from main. o) TouchGEX DEMO\TouchGEX DEMO axf ExxOX L6218E: Undefined symbol GRAPHICS MainTask (referred from freertos. o) TouchGEX DEMO\ TouchGEX DEMO axf: Error: L6218E: Undefined symbol IOE Init (referred from exc7200.o) TouchGEX DEMO\ TouchGEX DEMO axf: Error: L6218E: Undefined symbol IOE ReadMultiple (referred from exc7200. o) TouchGEX DEMO\ TouchGEX DEMO axf: Error: L6218E: Undefined symbol IoE Delay (referred from stmpe811. o) TouchGEX DEMO\ TouchGEX DEMO axf: Error: L6218E: Undefined symbol IOE ITConfig (referred from stmpe811. o) TouchGEX DEMO\ TouchGEX DEMO axf: Error: L6218E: Undefined symbol IOE Read (referred from stmpe 811 o) TouchGEX DEMO\TouchGEX DEMO axf: Error: L6218E: Undefined symbol IOE Write (referred from stmpe811. o) TouchGEX DEMOVTouchGEX DEMO axf: Error: L6218E: Undefined symbol IOE WriteMultiple (referred from ta3510.0). Not enough information to list image symbols Not enough information to 11st load addresses in the image map Finished: 2 information, 0 warning and 9 error messages "TouchGEX DEMO\ TouchGFX DEMO. axf-9 Error(s),1 Warning (s) C、这是因为MX乱添加了几个BSP文件 日添 Touch GFX DEMO □ Application/ MDK-ARM 由□ Application/ TUser B-D Drivers/BSP/Components exc7200. c 田tmpe81 由口ts3510.c Drivers/STM32F4x HAL Driver 2 Drivers/CMSIS d、都去掉,然后再编译,发现只有2个错误了 Bula cargetOuCn9EX DENO linking.. TouchGEX DEMO\TouchGEX DEMO axf: Error: L6218E: Undefined symbol MX FREERTOS Inito(referred from main. o) TouchGEX DEMO\ TouchGEX DEMO axf: Error: L6218E: Undefined symbol GRAPHICS MainTask (referred from freertos. o) Not enough information to list image symbols Not enough information to list Icad addresses in the image map Fn1Bhed:2inf。 eatlon,0 warning anc2exx。 r message吕 "TouchGEX DEMO\ TouchGEX DEMO axf"- 2 Error(s), 0 Warning(s) e、这是因为C文件调用CPP文件中的函数,或是CPP文件调用C文件中的函数导致, GFX官方有说明, 如C文件调用CPP文件中的函数,那么CPP文件中的原函数要加 extern"C"前辍,如 extern C void GRAPHICs MainTask(void) touchgfx:: HAL:: getInstance ()->taskEntry (i 如CPP文件调用C文件中的函数,那么CPP文件中要加 extern"C"前辍声明这是C函 数,如下。 9 0/* Private function prototypes 1 extern c void systemClock Config(void); 2 extern c void MX FREERTOS Init(void); 3 extern void GRAPHICs HW Init(void); 再次编译工程,发现没有错误了,下载程序,显示正常 OK ooeosee0e0 最后触摸移植,触摸相关其实已经在工程文件上了,修改内容也简单 GPIO. cpp STMB2F4DMA. cpp STMB2F4Touch Controller cpp freertos. c BoardConfiguration.cpp B maincpp/L STM32F4Touch Controllercpp B i2c.c 3/* USER CODE BEGIN BSP user includes f 4 extern "c" void GT811 Init(void); 5 extern "C" bool GT811_ReadOnePiont (uint16_t *px, uint16_t *py): 6 7 USER CODE END BSP user includes + 9 extern hch 10曰 11 12 uint 32 t LCD Getxsize (); 13uint32 t LCD GetYsize(); 15 16 using name space touchgfx; 17 18 void sTM32F4Touch controller:: init o 19日 20 A USER CODE BEGIN F4TouchController init * 22 / Add code for touch controller Initialization*/ 23 CD GetXsize(), LCD GetYsize(): 24 GT811 Init() 25 USER CODE END F4TouchController init * 261 28 bool STM32F4TouchController: sampleTouch (int32 t& x, int32 t& y) 29日 30/USER CODE BEGIN F4Touchcontroller_sampleTouch * 31 32 /*Is StateTypeDef state: 33 BSE TS Getstate(&state): 34 if(state. TouchDetected) 35 36 state. x: 37 y= state y. 38 return truer 39 40 uint16 t sx, sy; 41 bool ok GT811 ReadonePiont (&sx, &3y)i 42 sXH 43 y= sy 44 return。k 45 46/. USER CODE END F4Touchcontroller_sampleTouch 再编译工程并下载程序,触摸也正常了,总结了下,只要注意上面红色的地方,应该 都能移植成功,希望对各位有帮助。 Ie:https:/pan,baiducom/s/100sjphsy15ab2-zttskgq

...展开详情
试读 10P 基于CubeMX 5.0的TouchGFX移植教程
立即下载 低至0.43元/次 身份认证VIP会员低至7折
一个资源只可评论一次,评论内容不能少于5个字
又没吃饭 还不错,可以使用
2020-07-21
回复
hustchx UI开发必备
2019-07-06
回复
jimeixuehua 无参考价值
2019-04-03
回复
cjltch 只能打开前面6页
2019-02-23
回复
OceanHeart2008 还行,继续关注
2019-02-22
回复
晟懿睿瑾 还不错,希望能出个更详细的教程
2019-01-17
回复
kongming2liya 多谢分享,学习学习
2019-01-04
回复
topmax501 GRAPHICS的platform settings,忽略它直接生成代码不是一个明智的做法。
2019-01-04
回复
zhu_weihua 谢谢分享,参考一下。
2018-12-17
回复
wbyypp 还不错,希望能出个更详细的教程
2018-12-11
回复
  • 分享精英

    成功上传11个资源即可获取
关注 私信 TA的资源
上传资源赚积分,得勋章
最新推荐
基于CubeMX 5.0的TouchGFX移植教程 8积分/C币 立即下载
1/10
基于CubeMX 5.0的TouchGFX移植教程第1页
基于CubeMX 5.0的TouchGFX移植教程第2页

试读结束, 可继续读1页

8积分/C币 立即下载 >