Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
FSMC_FMC_外扩总线
LCD
RT-Thread Studio移植TFTLCD(FSMC)
发布于 2022-07-12 22:40:19 浏览:670
订阅该版
移植步骤: 1、将裸板上的LCD程序复制到新建的工程文件中,与main放在一起,并修改lcd.c、lcd.h,然后编译通过。   2、然后添加cubemx生成的文件。 CUBEMX设置如图:  将cubemx生成的文件中的main.c中的MX_FSMC_Init添加到rtt生成的applications的main.c中  将cubemx生成的文件中的stm32f1xx_hal_msp.c中的HAL_FSMC_MspInit复制到rtt生成的board.c中。  将cubemx生成的文件中的Drivers\STM32F1xx_HAL_Driver\Src文件中的stm32f1xx_ll_fsmc.c文件和stm32f1xx_hal_sram.c文件复制到rtt生成的libraries\STM32F1xx_HAL_Driver\Src文件夹中,并加入编译。  3、在mian.c中添加下面代码 ```c static int lcd_display(void) { rt_uint8_t x=0; rt_uint8_t lcd_id[12]; //存放LCD ID字符串 LCD_Init(); //初始化LCD FSMC接口 POINT_COLOR=RED; //画笔颜色:红色 sprintf((char*)lcd_id,"LCD ID:%04X",lcddev.id);//将LCD ID打印到lcd_id数组。 while(1) { switch(x) { case 0:LCD_Clear(WHITE);break; case 1:LCD_Clear(BLACK);break; case 2:LCD_Clear(BLUE);break; case 3:LCD_Clear(RED);break; case 4:LCD_Clear(MAGENTA);break; case 5:LCD_Clear(GREEN);break; case 6:LCD_Clear(CYAN);break; case 7:LCD_Clear(YELLOW);break; case 8:LCD_Clear(BRRED);break; case 9:LCD_Clear(GRAY);break; case 10:LCD_Clear(LGRAY);break; case 11:LCD_Clear(BROWN);break; } POINT_COLOR=RED; LCD_ShowString(30,40,210,24,24,"Explorer STM32F4"); LCD_ShowString(30,70,200,16,16,"TFTLCD TEST"); LCD_ShowString(30,90,200,16,16,"RT-thread"); LCD_ShowString(30,110,200,16,16,lcd_id); //显示LCD ID LCD_ShowString(30,130,200,12,12,"2014/5/4"); x++; if(x==12)x=0; rt_pin_write(LED0_PIN, PIN_HIGH); rt_thread_mdelay(500); rt_pin_write(LED0_PIN, PIN_LOW); rt_thread_mdelay(500); } } MSH_CMD_EXPORT(lcd_display, lcd_display samole); ``` 以上是我的移植过程,最后编译报错: ```c ../applications/main.c: In function 'MX_FSMC_Init': ../applications/main.c:27:3: error: unknown type name 'FSMC_NORSRAM_TimingTypeDef' FSMC_NORSRAM_TimingTypeDef Timing = {0}; ^ ../applications/main.c:35:3: error: 'hsram4' undeclared (first use in this function) hsram4.Instance = FSMC_NORSRAM_DEVICE; ^ ../applications/main.c:35:3: note: each undeclared identifier is reported only once for each function it appears in ../applications/main.c:35:21: error: 'FSMC_NORSRAM_DEVICE' undeclared (first use in this function) hsram4.Instance = FSMC_NORSRAM_DEVICE; ^ ../applications/main.c:36:21: error: 'FSMC_NORSRAM_EXTENDED_DEVICE' undeclared (first use in this function) hsram4.Extended = FSMC_NORSRAM_EXTENDED_DEVICE; ^ ../applications/main.c:38:24: error: 'FSMC_NORSRAM_BANK4' undeclared (first use in this function) hsram4.Init.NSBank = FSMC_NORSRAM_BANK4; ^ ../applications/main.c:39:32: error: 'FSMC_DATA_ADDRESS_MUX_DISABLE' undeclared (first use in this function) hsram4.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE; ^ ../applications/main.c:40:28: error: 'FSMC_MEMORY_TYPE_SRAM' undeclared (first use in this function) hsram4.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM; ^ ../applications/main.c:41:33: error: 'FSMC_NORSRAM_MEM_BUS_WIDTH_16' undeclared (first use in this function) hsram4.Init.MemoryDataWidth = FSMC_NORSRAM_MEM_BUS_WIDTH_16; ^ ../applications/main.c:42:33: error: 'FSMC_BURST_ACCESS_MODE_DISABLE' undeclared (first use in this function) hsram4.Init.BurstAccessMode = FSMC_BURST_ACCESS_MODE_DISABLE; ^ ../applications/main.c:43:36: error: 'FSMC_WAIT_SIGNAL_POLARITY_LOW' undeclared (first use in this function) hsram4.Init.WaitSignalPolarity = FSMC_WAIT_SIGNAL_POLARITY_LOW; ^ ../applications/main.c:44:26: error: 'FSMC_WRAP_MODE_DISABLE' undeclared (first use in this function) hsram4.Init.WrapMode = FSMC_WRAP_MODE_DISABLE; ^ ../applications/main.c:45:34: error: 'FSMC_WAIT_TIMING_BEFORE_WS' undeclared (first use in this function) hsram4.Init.WaitSignalActive = FSMC_WAIT_TIMING_BEFORE_WS; ^ ../applications/main.c:46:32: error: 'FSMC_WRITE_OPERATION_ENABLE' undeclared (first use in this function) hsram4.Init.WriteOperation = FSMC_WRITE_OPERATION_ENABLE; ^ ../applications/main.c:47:28: error: 'FSMC_WAIT_SIGNAL_DISABLE' undeclared (first use in this function) hsram4.Init.WaitSignal = FSMC_WAIT_SIGNAL_DISABLE; ^ ../applications/main.c:48:30: error: 'FSMC_EXTENDED_MODE_DISABLE' undeclared (first use in this function) hsram4.Init.ExtendedMode = FSMC_EXTENDED_MODE_DISABLE; ^ ../applications/main.c:49:34: error: 'FSMC_ASYNCHRONOUS_WAIT_DISABLE' undeclared (first use in this function) hsram4.Init.AsynchronousWait = FSMC_ASYNCHRONOUS_WAIT_DISABLE; ^ ../applications/main.c:50:28: error: 'FSMC_WRITE_BURST_DISABLE' undeclared (first use in this function) hsram4.Init.WriteBurst = FSMC_WRITE_BURST_DISABLE; ^ ../applications/main.c:52:9: error: request for member 'AddressSetupTime' in something not a structure or union Timing.AddressSetupTime = 15; ^ ../applications/main.c:53:9: error: request for member 'AddressHoldTime' in something not a structure or union Timing.AddressHoldTime = 15; ^ ../applications/main.c:54:9: error: request for member 'DataSetupTime' in something not a structure or union Timing.DataSetupTime = 255; ^ ../applications/main.c:55:9: error: request for member 'BusTurnAroundDuration' in something not a structure or union Timing.BusTurnAroundDuration = 15; ^ ../applications/main.c:56:9: error: request for member 'CLKDivision' in something not a structure or union Timing.CLKDivision = 16; ^ ../applications/main.c:57:9: error: request for member 'DataLatency' in something not a structure or union Timing.DataLatency = 17; ^ ../applications/main.c:58:9: error: request for member 'AccessMode' in something not a structure or union Timing.AccessMode = FSMC_ACCESS_MODE_A; ^ ../applications/main.c:58:23: error: 'FSMC_ACCESS_MODE_A' undeclared (first use in this function) Timing.AccessMode = FSMC_ACCESS_MODE_A; ^ ../applications/main.c:61:7: warning: implicit declaration of function 'HAL_SRAM_Init' [-Wimplicit-function-declaration] if (HAL_SRAM_Init(&hsram4, &Timing, NULL) != HAL_OK) ^ ../applications/main.c:61:48: error: 'HAL_OK' undeclared (first use in this function) if (HAL_SRAM_Init(&hsram4, &Timing, NULL) != HAL_OK) ^ ../applications/main.c:63:5: warning: implicit declaration of function 'Error_Handler' [-Wimplicit-function-declaration] Error_Handler( ); ^ ../applications/main.c: In function 'lcd_display': ../applications/main.c:80:5: warning: implicit declaration of function 'LCD_Init' [-Wimplicit-function-declaration] LCD_Init(); //鍒濆鍖朙CD FSMC鎺ュ彛 ^ ../applications/main.c:81:5: error: 'POINT_COLOR' undeclared (first use in this function) POINT_COLOR=RED; //鐢荤瑪棰滆壊锛氱孩鑹? ^ ../applications/main.c:81:17: error: 'RED' undeclared (first use in this function) POINT_COLOR=RED; //鐢荤瑪棰滆壊锛氱孩鑹? ^ ../applications/main.c:82:5: warning: implicit declaration of function 'sprintf' [-Wimplicit-function-declaration] sprintf((char*)lcd_id,"LCD ID:%04X",lcddev.id);//灏哃CD ID鎵撳嵃鍒發cd_id鏁扮粍銆? ^ ../applications/main.c:82:5: warning: incompatible implicit declaration of built-in function 'sprintf' ../applications/main.c:82:5: note: include '
' or provide a declaration of 'sprintf' ../applications/main.c:82:41: error: 'lcddev' undeclared (first use in this function) sprintf((char*)lcd_id,"LCD ID:%04X",lcddev.id);//灏哃CD ID鎵撳嵃鍒發cd_id鏁扮粍銆? ^ ../applications/main.c:87:20: warning: implicit declaration of function 'LCD_Clear' [-Wimplicit-function-declaration] case 0:LCD_Clear(WHITE);break; ^ ../applications/main.c:87:30: error: 'WHITE' undeclared (first use in this function) case 0:LCD_Clear(WHITE);break; ^ ../applications/main.c:88:30: error: 'BLACK' undeclared (first use in this function) case 1:LCD_Clear(BLACK);break; ^ ../applications/main.c:89:30: error: 'BLUE' undeclared (first use in this function) case 2:LCD_Clear(BLUE);break; ^ ../applications/main.c:91:30: error: 'MAGENTA' undeclared (first use in this function) case 4:LCD_Clear(MAGENTA);break; ^ ../applications/main.c:92:30: error: 'GREEN' undeclared (first use in this function) case 5:LCD_Clear(GREEN);break; ^ ../applications/main.c:93:30: error: 'CYAN' undeclared (first use in this function) case 6:LCD_Clear(CYAN);break; ^ ../applications/main.c:94:30: error: 'YELLOW' undeclared (first use in this function) case 7:LCD_Clear(YELLOW);break; ^ ../applications/main.c:95:30: error: 'BRRED' undeclared (first use in this function) case 8:LCD_Clear(BRRED);break; ^ ../applications/main.c:96:30: error: 'GRAY' undeclared (first use in this function) case 9:LCD_Clear(GRAY);break; ^ ../applications/main.c:97:31: error: 'LGRAY' undeclared (first use in this function) case 10:LCD_Clear(LGRAY);break; ^ ../applications/main.c:98:31: error: 'BROWN' undeclared (first use in this function) case 11:LCD_Clear(BROWN);break; ^ ../applications/main.c:101:9: warning: implicit declaration of function 'LCD_ShowString' [-Wimplicit-function-declaration] LCD_ShowString(30,40,210,24,24,"Explorer STM32F4"); ^ ../applications/main.c:108:9: warning: implicit declaration of function 'rt_pin_write' [-Wimplicit-function-declaration] rt_pin_write(LED0_PIN, PIN_HIGH); ^ ../applications/main.c:108:22: error: 'LED0_PIN' undeclared (first use in this function) rt_pin_write(LED0_PIN, PIN_HIGH); ^ ../applications/main.c:108:32: error: 'PIN_HIGH' undeclared (first use in this function) rt_pin_write(LED0_PIN, PIN_HIGH); ^ ../applications/main.c:110:32: error: 'PIN_LOW' undeclared (first use in this function) rt_pin_write(LED0_PIN, PIN_LOW); ^ ../applications/main.c:113:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ ../applications/main.c: At top level: ../applications/main.c:20:13: warning: 'MX_FSMC_Init' defined but not used [-Wunused-function] static void MX_FSMC_Init(void) ^ make: *** [applications/subdir.mk:21: applications/main.o] Error 1 make: *** Waiting for unfinished jobs.... "make -j12 all" terminated with exit code 2. Build might be incomplete. ``` 请问是哪些地方有问题?希望大佬给看一下。
查看更多
1
个回答
默认排序
按发布时间排序
出出啊
2022-07-13
恃人不如自恃,人之为己者不如己之自为也
未定义的是一些类型,说明有头文件没加,main.c 里 include rtdevice.h 试试
撰写答案
登录
注册新账号
关注者
0
被浏览
670
关于作者
小李_
这家伙很懒,什么也没写!
提问
4
回答
2
被采纳
0
关注TA
发私信
相关问题
1
RT-Thread Setings没有BSP_USING_LCD选项?
2
晶联讯19264液晶屏字库,可以读取字母、字符和数字,但是汉字读取显示错误
3
rtt studio裸机例程在调取头文件时编译会报错
4
使用littlevgl2rtt软件包实例运行不成功,emwin正常
5
qemu的LCD可以显示1920*720的分辨率?
6
移植潘多拉板子的lcd驱动到芯片上
7
缺少常用的LCD驱动软件包
8
h750XBH6 LCD rt_malloc 分配内存失败
9
rtthread fsmc驱动LCD代码无错误,且背光显示,但是无现象
10
stm32h743 lcd 驱动出现hardfault 问题
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
机器人操作系统 (ROS2) 和 RT-Thread 通信
4
五分钟玩转RT-Thread新社区
5
国产MCU移植系列教程汇总,欢迎查看!
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
github高阶加速,速度可达带宽峰值,测试到146Mbit/s
2
英飞凌携手RT-Thread举办嵌入式网络应用开发沙龙,带你从0到1搭建智能数据网关
3
BL808 RT-Thread Wi-Fi 驱动适配
4
rt-thread 系统运行期改变网卡配置
5
简单的步进电机驱动调试
热门标签
RT-Thread Studio
串口
LWIP
Env
AT
SPI
Bootloader
FinSH
ART-Pi
CAN总线
Hardfault
USB
文件系统
RT-Thread
DMA
SCons
线程
MQTT
RT-Thread Nano
STM32
RTC
ESP8266
rt-smart
flash
ota在线升级
WIZnet_W5500
FAL
I2C
packages_软件包
UART
cubemx
freemodbus
潘多拉开发板_Pandora
定时器
BSP
PWM
ADC
socket
中断
rt_mq_消息队列_msg_queue
keil_MDK
SDIO
Debug
AB32VG1
MicroPython
C++_cpp
编译报错
msh
QEMU
ulog
本月问答贡献
出出啊
1500
个答案
338
次被采纳
小小李sunny
1389
个答案
276
次被采纳
张世争
714
个答案
157
次被采纳
crystal266
522
个答案
153
次被采纳
whj467467222
1216
个答案
146
次被采纳
本月文章贡献
出出啊
1
篇文章
12
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
2
篇文章
1
次点赞
crystal266
2
篇文章
5
次点赞
whj467467222
2
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部