Hi3516DV300踩坑笔记
资料
-
使用Visual Studio 利用WinGDB编译和远程调试嵌入式Linux的程序
不知道这种能不能用Clion配置
gdb 和交叉编译环境在一台服务器上, 远程调试在另外一台机器上, 这台机器可以是arm linux 也可以是其他支持gdbserver 的机器。
-
HI3516DV300笔记(三)安装SSH和SFTP 这个比较好⭐
命令
1 |
|
疑问
-
swann下有的命令root下没有arm-xxx。
-
编译uboot时,一直出现xxx文件不存在的错误,竟然是因为文件路径名长度的原因???!!!
-
HI3516DV300 HITOOL 等待boot启动超时,单板上无fastboot或当前fastboot无法启动
原来是厂商给的uboot有问题呀😅
-
Hitools烧写时,uImage能通过网口烧写,rootfs不行。原因是hitool软件bug,烧完uImage依旧占用69TFTP端口。
-
TFTP服务器启动失败,端口69可能被占用!
由于Clion使用了远程开发功能,把Clion关闭解决问题。。
-
出厂镜像是imx325.。。。imx335需要自己编译
-
rtsp-live555
-
编译freetype和stl时出现
1
2
3
4
5
6
7
8../../src/freetype_stl_ttl/lib/libSDL_ttf.a(SDL_ttf.o): In function `Load_Glyph':
/home/swann/Desktop/freetype-SDL-SDL_TTL-master/SDL_ttf-2.0.11/SDL_ttf.c:593: undefined reference to `FT_Load_Glyph'
/home/swann/Desktop/freetype-SDL-SDL_TTL-master/SDL_ttf-2.0.11/SDL_ttf.c:655: undefined reference to `FT_Outline_Transform'
/home/swann/Desktop/freetype-SDL-SDL_TTL-master/SDL_ttf-2.0.11/SDL_ttf.c:661: undefined reference to `FT_Get_Glyph'
/home/swann/Desktop/freetype-SDL-SDL_TTL-master/SDL_ttf-2.0.11/SDL_ttf.c:662: undefined reference to `FT_Stroker_New'
/home/swann/Desktop/freetype-SDL-SDL_TTL-master/SDL_ttf-2.0.11/SDL_ttf.c:678: undefined reference to `FT_Render_Glyph'
/home/swann/Desktop/freetype-SDL-SDL_TTL-master/SDL_ttf-2.0.11/SDL_ttf.c:879: undefined reference to `FT_Done_Glyph'
/home/swann/Desktop/freetype-SDL-SDL_TTL-master/SDL_ttf-2.0.11/SDL_ttf.c:591: undefined reference to `FT_Get_Char_Index'改变CMake顺序
1
2
3
4
5${CMAKE_SOURCE_DIR}/src/freetype_stl_ttl/lib/libSDL_ttf.a
${CMAKE_SOURCE_DIR}/src/freetype_stl_ttl/lib/libfreetype.a
${CMAKE_SOURCE_DIR}/src/freetype_stl_ttl/lib/libSDL.a
${CMAKE_SOURCE_DIR}/src/freetype_stl_ttl/lib/libSDLmain.
${CMAKE_SOURCE_DIR}/src/freetype_stl_ttl/lib/libSDL_ttf.a -
编译和安装 openssl 时出错,POD document had syntax errors
installing man1/smime.1
smime.pod around line 272: Expected text after =item, not a number
smime.pod around line 276: Expected text after =item, not a number
smime.pod around line 280: Expected text after =item, not a number
smime.pod around line 285: Expected text after =item, not a number
smime.pod around line 289: Expected text after =item, not a number
POD document had syntax errors at /usr/bin/pod2man line 71.
make: *** [install_docs] 错误 255
原因分析:这是由于 OpenSSL 1.0.1e 与 perl5.18 不兼容。
解决方法:
1、有人验证 安装 perl 5.16 可以兼容,安排低版本 perl 5.16 可以解决问题。
2、删除 pod2man 文件:
sudo rm /usr/bin/pod2man
TMD 解决方式hi3516 内核开启UART支持
1 |
|
解决方法: 另外hi3516dv300的uart3有个bug,缺少对UART3时钟的配置 kernel/linux-4.9.y/
vi drivers/clk/hisilicon/clk-hi3516dv300.c
文件中
static struct hisi_gate_clock hi3516dv300_gate_clks[] 在132行 添加一项:
1 |
|
如下所示
1 |
|
笔记
1.OSD库
HH_OSD_Init //进行一些初始化并实现内容的显示
HH_OSD_SetOsdPosDefault //设置osd的坐标的,使用默认的位置
HH_OSD_GetOrg //获取进行显示位置的的坐标
HH_OSD_GetColor //获取颜色
HH_OSD_GetTitle //获取要显示的内容
HI_Create_Osd //创建一个显示logo,实例化一个用于显示的logo变量
HI_OSD_Build //创建osd结构体,创建位图,直接显示
HI_OSD_Parse_OsdTitle //解析osd字符,更新字符相关属性
HI_OSD_Get_BmpSize //根据ip_config配置的视频源的大小,来配置pOsdLogo中记录的OSD的字母的宽高、x,y坐标等
HI_Create_Osd_Reg //首先申请了OSD的bmp图片的内存buf,然后调用海思的RGN API来初始化overlay
HI_MPI_RGN_Create //创建osd
HI_MPI_RGN_AttachToChn //将osd与venc的通道绑定
HI_OSD_Create_Bitmap根据pOsdLogo记录的OSD要显示的内容,来生成bmp图片数据,然后调用HI_MPI_RGN_SetBitMap将这张BMP图片显示到OSD中
HI_OSD_CreateBMP // 用字库来生成bmp文件的
HI_MPI_RGN_SetBitMap // 真正设置osd显示的API
HI_OSD_Set_Show //根据传参show为true或者false来开启或关闭OSD的显示
HI_MPI_RGN_GetDisplayAttr //获取区域的通道显示属性
HI_MPI_RGN_SetDisplayAttr //设置区域的通道显示属性
HH_OSD_All_Refresh //手动去刷新显示的内容,实现时间的变化
HH_OSD_AllTime_Refresh
HH_OSD_ChnTime_Refresh
HH_OSD_ChName_Refresh
HH_OSD_GetLogoHandle
HH_OSD_GetTitle //获取显示的内容
HI_OSD_Parse_OsdTitle 解析osd的字符,更新字符相关属性
HI_OSD_Get_BmpSize
HI_OSD_Create_Bitmap
HI_OSD_CreateBMP
HI_MPI_RGN_SetBitMap
HH_OSD_Show_Refresh
HH_OSD_GetLogoHandle
HH_OSD_GetShow
HI_OSD_Set_Show //根据传参show为true或者false来开启或关闭OSD的显示
HH_OSD_AllName_Refresh
-
开机同步时间
调用ntpdate 函数
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <time.h>
#include <string.h>
int get_yue(char *secons);
void ntpdate();
#include <iostream>
using namespace std;
string getFormatTime(int year, int mon, int day, int hour, int min, int sec, int type);
void get_alarm_time();
int main()
{
ntpdate();
return 0;
}
void ntpdate()
{
//char *hostname=(char *)"163.117.202.33";
//char *hostname=(char *)"pool.ntp.br";
char *hostname = (char *)"200.20.186.76";
int portno = 123; //NTP is port 123
int maxlen = 1024; //check our buffers
int i; // misc var i
unsigned char msg[48] = {010, 0, 0, 0, 0, 0, 0, 0, 0}; // the packet we send
unsigned long buf[maxlen]; // the buffer we get back
//struct in_addr ipaddr; //
struct protoent *proto; //
struct sockaddr_in server_addr;
int s; // socket
long tmit; // the time -- This is a time_t sort of
//use Socket;
//
//#we use the system call to open a UDP socket
//socket(SOCKET, PF_INET, SOCK_DGRAM, getprotobyname("udp")) or die "socket: $!";
proto = getprotobyname("udp");
s = socket(PF_INET, SOCK_DGRAM, proto->p_proto);
perror("socket");
//
//#convert hostname to ipaddress if needed
//$ipaddr = inet_aton($HOSTNAME);
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = inet_addr(hostname);
//argv[1] );
//i = inet_aton(hostname,&server_addr.sin_addr);
server_addr.sin_port = htons(portno);
//printf("ipaddr (in hex): %x\n",server_addr.sin_addr);
/*
* build a message. Our message is all zeros except for a one in the
* protocol version field
* msg[] in binary is 00 001 000 00000000
* it should be a total of 48 bytes long
*/
// send the data
//printf("sending data..\n");
i = sendto(s, msg, sizeof(msg), 0, (struct sockaddr *)&server_addr, sizeof(server_addr));
perror("sendto");
// get the data back
struct sockaddr saddr;
socklen_t saddr_l = sizeof(saddr);
i = recvfrom(s, buf, 48, 0, &saddr, &saddr_l);
perror("recvfr:");
//We get 12 long words back in Network order
/*
for(i=0;i<12;i++) {
//printf("%d\t%-8x\n",i,ntohl(buf[i]));
long tmit2=ntohl((time_t)buf[i]);
std::cout << "Round number " << i << " time is " << ctime(&tmit2) << std::endl;
}
*/
/*
* The high word of transmit time is the 10th word we get back
* tmit is the time in seconds not accounting for network delays which
* should be way less than a second if this is a local NTP server
*/
//tmit=ntohl((time_t)buf[10]); //# get transmit time
tmit = ntohl((time_t)buf[4]); //# get transmit time是将一个无符号长整形数从网络字节顺序转换为主机字节顺序
//printf("tmit=%d\n",tmit);
/*
* Convert time to unix standard time NTP is number of seconds since 0000
* UT on 1 January 1900 unix time is seconds since 0000 UT on 1 January
* 1970 There has been a trend to add a 2 leap seconds every 3 years.
* Leap seconds are only an issue the last second of the month in June and
* December if you don't try to set the clock then it can be ignored but
* this is importaint to people who coordinate times with GPS clock sources.
*/
tmit -= 2208988800U;
//printf("tmit=%d\n",tmit);
/* use unix library function to show me the local time (it takes care
* of timezone issues for both north and south of the equator and places
* that do Summer time/ Daylight savings time.
*/
//#compare to system time
//printf("Time: %s",ctime(&tmit));
// 一月JAN
// 二月FEB
// 三月MAR
// 四月APR
// 五月MAY
// 六月JUN
// 七月JUL
// 八月AUG
// 九月SEP
// 十月OCT
// 十一月NOV
// 十二月DEC
//Thu Mar 19 05:43:42 2020
//std::cout << "time is " << ctime(&tmit) << std::endl;
char *gTime = ctime(&tmit);
char time_str[32] = {0};
char year[5] = {0};
char secons[3] = {0};
char day[3] = {0};
char s1[3] = {0};
char f[3] = {0};
char m[3] = {0};
int tmp = 0;
//年
year[0] = gTime[20];
year[1] = gTime[21];
year[2] = gTime[22];
year[3] = gTime[23];
//月
secons[0] = gTime[4];
secons[1] = gTime[5];
secons[2] = gTime[6];
get_yue(secons);
printf("get_yue:%s\n", secons);
//日
day[0] = gTime[8];
day[1] = gTime[9];
//时
s1[0] = gTime[11];
s1[1] = gTime[12];
tmp = atoi(s1);
tmp += 8; //调整时区到东八区。
if (tmp >= 24)
tmp %= 24;
sprintf(s1, "%d", tmp);
//分
f[0] = gTime[14];
f[1] = gTime[15];
//秒
m[0] = gTime[17];
m[1] = gTime[18];
//date -s "2020-03-24 17:03:50"
sprintf(time_str, "date -s \"%s-%s-%s %s:%s:%s\"", year, secons, day, s1, f, m);
printf("%s -----%s\n", time_str, gTime);
system(time_str);
}
int get_yue(char *secons)
{
printf("secons %s\n", secons);
int seconss = -1;
if (strncmp(secons, "Jan", 3) == 0)
{
secons[0] = '0';
secons[1] = '1';
}
else if (strncmp(secons, "Feb", 3) == 0)
{
secons[0] = '0';
secons[1] = '2';
}
else if (strncmp(secons, "Mar", 3) == 0)
{
secons[0] = '0';
secons[1] = '3';
}
else if (strncmp(secons, "Apr", 3) == 0)
{
secons[0] = '0';
secons[1] = '4';
}
else if (strncmp(secons, "May", 3) == 0)
{
secons[0] = '0';
secons[1] = '5';
}
else if (strncmp(secons, "Jun", 3) == 0)
{
secons[0] = '0';
secons[1] = '6';
}
else if (strncmp(secons, "Jul", 3) == 0)
{
secons[0] = '0';
secons[1] = '7';
}
else if (strncmp(secons, "Aug", 3) == 0)
{
secons[0] = '0';
secons[1] = '8';
}
else if (strncmp(secons, "Sep", 3) == 0)
{
secons[0] = '0';
secons[1] = '9';
}
else if (strncmp(secons, "Oct", 3) == 0)
{
secons[0] = '1';
secons[1] = '0';
}
else if (strncmp(secons, "Nov", 3) == 0)
{
secons[0] = '1';
secons[1] = '1';
}
else if (strncmp(secons, "Dec", 3) == 0)
{
secons[0] = '1';
secons[1] = '2';
}
else
{
printf("Error!\n");
}
seconss = 1;
secons[2] = 0;
return seconss;
}
void get_alarm_time()
{
time_t time_seconds = time(0);
struct tm now_time;
localtime_r(&time_seconds, &now_time);
string alarmTimeAsName = getFormatTime(now_time.tm_year + 1900, now_time.tm_mon + 1, now_time.tm_mday, now_time.tm_hour, now_time.tm_min, now_time.tm_sec, 0);
string alarmTimeAsDate = getFormatTime(now_time.tm_year + 1900, now_time.tm_mon + 1, now_time.tm_mday, now_time.tm_hour, now_time.tm_min, now_time.tm_sec, 1);
}
std::string getFormatTime(int year, int mon, int day, int hour, int min, int sec, int type)
{
std::string yearStr = std::to_string(year);
std::string monStr, dayStr, hourStr, minStr, secStr;
if (mon >= 10)
monStr = std::to_string(mon);
else
monStr = "0" + std::to_string(mon);
if (day >= 10)
dayStr = std::to_string(day);
else
dayStr = "0" + std::to_string(day);
if (hour >= 10)
hourStr = std::to_string(hour);
else
hourStr = "0" + std::to_string(hour);
if (min >= 10)
minStr = std::to_string(min);
else
minStr = "0" + std::to_string(min);
if (sec >= 10)
secStr = std::to_string(sec);
else
secStr = "0" + std::to_string(sec);
if (!type)
return (yearStr + monStr + dayStr + hourStr + minStr + secStr);
if (type == 1)
return (yearStr + "-" + monStr + "-" + dayStr + "%20" + hourStr + ":" + minStr + ":" + secStr);
} -
变量命名
1、定义枚举类型,注意字母后面的E。
typedef enum hiHI_MPP_WDR_MODE_E
{
HI_MPP_WDR_MODE_NONE = 0,
HI_MPP_WDR_MODE_BUILT_IN,
HI_MPP_WDR_MODE_2To1_LINE,
HI_MPP_WDR_MODE_2To1_FRAME,
HI_MPP_WDR_MODE_2To1_FRAME_FULL_RATE,
HI_MPP_WDR_MODE_3To1_LINE,
HI_MPP_WDR_MODE_3To1_FRAME,
HI_MPP_WDR_MODE_3To1_FRAME_FULL_RATE,
HI_MPP_WDR_MODE_4To1_LINE,
HI_MPP_WDR_MODE_4To1_FRAME,
HI_MPP_WDR_MODE_4To1_FRAME_FULL_RATE,
HI_MPP_WDR_MODE_BUTT}HI_MPP_WDR_MODE_E;
定义枚举类型的变量,注意变量前面的en,应试enum的缩写。
HI_MPP_WDR_MODE_E enWdrMode;
2、定义结构体类型。
typedef struct hiHI_MPP_SENSOR_ATTR_S
{undefined
HI_S32 s32FrameRate;
HI_MPP_RESOLUTION_S stResolution;
HI_MPP_WDR_MODE_E enWdrMode;
} HI_MPP_SENSOR_ATTR_S;注意定义结构体变量时在变量的前面加上“st” ,应是struct的缩写吧。
HI_MPP_SENSOR_ATTR_S stSensorAttr;
3、定义基本类型的别名。
typedef unsigned char HI_U8;
typedef unsigned short HI_U16;
typedef unsigned int HI_U32;typedef signed char HI_S8;
typedef short HI_S16;
typedef int HI_S32;HI_S32 s32Ret;//define a int variable,notify “s32”
-
自启–
etc/inittab
-
换源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
# 使用脚本
```bash
# 开机大于10s检测 Welcome to HiLinux.
ifconfig eth0 192.168.1.10 netmask 255.255.255.0
#2s内返回 link becomes ready
route add default gw 192.168.1.1
#无返回
/sample_venc_osd_rtsp
Hi3516DV300踩坑笔记