- 博客(61)
- 资源 (13)
- 收藏
- 关注
原创 用STM32做一个USB-TTL工具吧
某宝1分钱白嫖一个STM32C6T6的板子,然后手里的CH340挂了。那么自己做一个吧。串口没有使用DMA空闲中断等等机制,有兴趣的加上了call我炒一下。
2024-09-11 14:48:30
568
原创 debian-arm64-docker 笔记
core-image-bsp-smarc-rzg2l.tar.bz2 为yocto生成的rootfs镜像,也可以自己制作,如使用busybox啥的。至此arm64宿主机docker已经安装完成,可以把SD卡下的跟文件系统打包备份了。2)删除所有的容器(只删除单个时把后面的变量改为container id即可)这里需要啥工具就安装啥工具,最后可以考虑把apt工具禁用.板子SD卡启动方式,最后把最终的SD文件打包发布。默认运行 CMD [“/bin/bash”]1)首先需要停止所有的容器。
2023-05-16 16:08:21
840
1
原创 STM32MP157A-DK1 初探-buildroot构建最小Linux系统
STM32MP157A-DK1 buildroot最小linux系统构建
2022-11-07 22:05:11
646
原创 记录一次与autorun.inf病毒的较量
不久之前遇到过一次autorun病毒,不过它的版本较低很快就解决了,这次遇到的比较顽固。能解决也是巧合吧。现象1.大约15秒左右,硬盘CDEF根目录产生一个xxxx.exe然后消失2.U盘等移动盘就一直产生不同的xxxx.exe,不会消失3.xxxx.exe 大小97k确诊方法1.进入cmd命令行C:\Users\name>e:E:\>attrib如果出现了 E:\autorun.inf那就确诊了清除del_autorun.BATattrib C:\autor
2022-04-26 21:02:35
1338
原创 tcp-server-echo epull
直接上代码#include <stdio.h>#include <stdlib.h>#include <fcntl.h>#include <unistd.h>#include <string.h>#include <sys/stat.h> #include <sys/ioctl.h>#include <sys/types.h>#include <sys/socket.h>#in
2022-04-12 13:18:16
2573
原创 inet_ntop6 源码
#if defined(_WIN32) || defined(_WIN64)//Windows includes#include <ws2tcpip.h>#include <string.h>#include <stdio.h>#include "inet_ntop.h"#ifdef __cplusplus // extern "C" {#endifstatic const char *inet_ntop4 (const u_char *src, c.
2022-03-20 15:21:44
659
原创 windows下inet_ntop报错
下面的连接有,实际在QT中用MinGW构建却报错没有,于是用WSAAddressToStringA来实现inet_ntop function (ws2tcpip.h)inet_ntop function (ws2tcpip.h) - Win32 apps | Microsoft DocsPCSTR WSAAPI inet_ntop(INT Family,const VOID *pAddr,PSTR pStringBuf, size_t StringBufSize){ if(pSt..
2022-03-19 23:01:32
1434
原创 使用Udev设置U盘自动挂载
这里写自定义目录标题使用Udev设置U盘自动挂载UDEV规则配置创建挂载卸载脚本使用Udev设置U盘自动挂载记录操作方法UDEV规则配置挂载规则vim /etc/udev/rules.d/11-add-usb.rules内容如下ACTION!="add",GOTO="farsight"KERNEL=="sd[a-z][0-9]",RUN+="/opt/usb/mountusb.sh %K"KERNEL=="sd[a-z]",RUN+="/opt/usb/mountusb.sh %K"LA
2022-03-02 18:36:11
2134
原创 mysql 基础操作
MariaDB安装配置简介MariaDB 是mysql的开源免费分支,命令兼容环境centos7.9安装 启动 开机启动yum install mariadb-serversystemctl start mariadb systemctl enable mariadb 查看启动结果ps -aux | grep mysqld/bin/sh /usr/bin/mysqld_safe --basedir=/usr/usr/libexec/mysqld --basedir=/usr --
2022-01-28 10:31:34
1354
原创 LNMP环境搭建
LNMP环境搭建linux centos7.9 腾讯云FTP配置yum install vsftpduseradd -d /usr/share/nginx/html/wordpress wordpressvim /etc/vsftpd/vsftpd.conf chroot_local_user=YES #所有用户限制在自己home目录 allow_writeable_chroot=YES重启生效systemctl restart vsftpdSFTP服务配置创建用户us
2022-01-28 10:27:12
3724
原创 vscode添加linux头文件
1.找出c头文件执行 arm-none-linux-gnueabi-gcc -v -E -x c -输出如下#include "..." search starts here:#include <...> search starts here: /opt/arm-201305-gnueabi/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/include /opt/arm-201305-gnueabi/bin/../lib/gcc/a
2022-01-20 10:15:43
2498
原创 通用makefile C/C++
编译连接makefile同级目录下*.c *.cpp 并生成目录同名可执行文件后续有需求在弄其他COMPLITE=arm-none-linux-gnueabi-CC=$(COMPLITE)gccCXX=$(COMPLITE)g++LD=$(COMPLITE)ldCFLAGS=-I./CPPFLAGS=-I./LDFLAGS=-L./LIBS=#-Wall -fPIC -sharedC_FILES := $(wildcard *.c)CPP_FILES := $(wil
2022-01-19 11:27:17
627
原创 文件共享FTP SFTP SAMBA一次讲清楚
大抵是为了文件共享吧工具树莓派服务端配置用户配置创建一个sftptest 用户,不可用于登陆#建议用root用户登陆或者pi用户登陆由加sudo执行cd /homeuseradd -d /home/sftptest -s /bin/false sftptestpasswd sftptest //12345678mkdir -p sftptest/get sftptest/putchown root:sftptest sftptest/chmod 755 sftpte
2022-01-17 16:40:02
2351
原创 linux文件夹大小计算<递归>
#include <sys/stat.h>#include <stdio.h>#include <dirent.h>#include <libgen.h>#include <string.h>#include <stdlib.h>/*仅仅计算 d_type == DT_REG 的文件大小文件绝对路径名超过1024 的统计/a/b/c ... 1024*512 内存空间*/unsigned long _di.
2022-01-04 14:58:00
843
原创 简单打印到文件 记录
char buffer[1024];static FILE *web_fd=NULL;int log_init(){ web_fd = fopen(WERSVR_LOG_FILE,"w+"); if(fd = NULL) { return -1; } return 0;}void log_close(){ if(web_fd) { fclose(web_fd) web_fd = NULL; }}int log(char *format,...){ va_li.
2021-11-09 15:32:45
59
原创 ARM字节序交换
试用前请查看内核手册是否支持 REV 和 REV16 命令//eg a=0x12345678 b=0x78563412inline uint32_t arm_rev32(register uint32_t a){ uint32_t b; __ASM { REV b, a } return b;}//eg a=0x1234 ,b=0x3412 inline uint16_t arm_rev16(register uint.
2021-06-01 11:55:15
710
原创 ghostscript9.26交叉编译
ghostscript9.26交叉编译测试命令./gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=a4 -r300x300 -sDEVICE=pbmraw -sOutputFile=output.pbm iuput.pdf交叉编译步骤下载解压找到需要的版本https://github.com/ArtifexSoftware/ghostpdl-downloads/releases下载源代码mkdir ~/gsgzip -d ghosts
2021-04-28 14:45:43
667
原创 PYTHON3.7.6交叉编译&本地编译
1.准备号依赖库 如zlib readline openssl ncurses等等2.修改setup.py文件 搜索lib_dirs和inc_dirs添加依赖路径lib_dirs.append('xxxxx/lib')inc_dirs.append('xxxx/include')#!/bin/bashset -eROOT_DIR=/home/xxx/test/ins_py3BASE_BATH=/home/xxx/test/usrexport CC=arm-fsl...
2021-04-25 17:55:32
562
原创 meson 工具使用 glib-2.68.1交叉编译
需要python meson ninja,安装方法百度即可meson手册https://mesonbuild.com/Manual.html防止忘记,仅仅记录如下#!/bin/bashset -eDEVEL=/home/username/build_root/develif [ -d _build ];thenrm -r _buildfimkdir _buildarch='arm-linux-gnueabi-'sys_root='/home/username/bui..
2021-04-12 17:46:24
3449
1
原创 Makefile 实现以编译时间作为版本控制
1.Make file 如下修改添加:BUILD_STRING = $(shell date +"%x %T")__BUILD_STRING__="\"$(BUILD_STRING)\""目标修改 最后添加一个del_version 用来删除对应得.o文件 使得每次make都重新编译获取最新时间all: $(TARGET) del_versiondel_version: rm version.o在原来基础上添加-D__BUILD_STRING__...
2021-02-25 17:28:26
1288
原创 移植kfifo.c 记录
#include "rkfifo.h"#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))static uint32_t CLZ_32(uint32_t n){ int ret=0; uint32_t tmp = ~n; while(tmp&0x80000000) { tmp <<= 1; ret++; ..
2021-02-24 10:55:52
676
原创 记录opencv3.1.0交叉编译
因为gcc4.6.2编译高版本opencv有问题gcc-4.6.2 opencv-3.1.0cd opencv-3.1.0mkdir build.shmkdir installcmake-gui 1.设置路径 Where is thr source code: [***/opencv-3.1.0] Where to build the binaries: [***/opencv-3.1.0/build] 2.点击 "Configure" ...
2021-02-22 15:43:26
309
原创 c readline 实现
做一个无情的造轮子者int readline(char *buf,int offset,char *line,int line_len){ int i=0; int len=0; if(buf==NULL || line== NULL) return -1; len = strlen(buf); if(offset>len) return -1; char *t=buf+offset; fo.
2021-01-28 16:13:31
1140
原创 C语言字符串分割 trimmed simplified split
#define IS_SPACE_CHAR(ch) (ch==' ' || ch =='\t' || ch == '\n' || ch == '\v' || ch == '\f' || ch == '\r') ? 1:0//返回移除头尾空白符的字符串 需要free释放char *trimmed(char *source){ int i=0,j=0;; char *dest; int len = strlen(source); for(i=0;i<len;...
2021-01-28 15:49:33
361
原创 循环fifo实现
没有实现长拷贝,写这个的目的是为了实现TCP数据流中提取帧r_fifo.c#include "r_fifo.h"r_fifo *new_rfifo(int sizeof_e,int max_num){ uint8_t *buf = NULL; r_fifo *r = NULL; if(sizeof_e == 0 || max_num == 0) return NULL; r=malloc(sizeof(r_fifo)); buf.
2021-01-15 19:00:03
319
原创 网络字节序和主机字节序ntohs htons 实现
#define BigLittleSwap16(A) ((((unsigned short int)(A) & 0xff00) >> 8) | (((unsigned short int)(A) & 0x00ff) << 8)) #define BigLittleSwap32(A) ((((unsigned int)(A) & 0xff000000) >> 24) | (((unsigned int)(A) & ...
2021-01-08 14:27:36
330
原创 socks5代理基于epoll实现
socks5基于epoll实现单线程事件循环server.c#include <stdio.h>#include <stdlib.h>#include <fcntl.h>#include <unistd.h>#include <string.h>#include <sys/stat.h>#include <sys/ioctl.h>#include <sys/types.h>#in
2020-11-25 12:25:42
502
原创 C语言链表demo
main.c#include "list.h"typedef struct t_e{ char key;/*可以是自定义类型 和data_compare_func配合即可*/ char *b;}data_t;/* 返回值 0:1==2 1:1>2 -1:1<2 key值比较,列表中不会有相同的key值 */int data_compare_func(void *first,void *second){ data_t *a=first
2020-10-30 18:27:40
270
原创 linux c 字符串替换
参考https://www.linuxidc.com/Linux/2010-12/30741.htm修改了一个bug 如 respacestr("123456","123","1234") 会逻辑卡死/********************************************************************************** fine name :respacestr* description : respace some characters..
2020-10-12 19:38:37
408
原创 debian for arm 搭建 + ghostscript-9.26编译
网上ghostscript大多是9.04的编译过程,发现在9.26以后就行不通了 之前的版本未测试交叉应该是可以的,不过我没弄出来,就只好在debian for arm上编译了环境Ubuntu16.041.环境安装sudo apt-get install binfmt-support qemu qemu-user-static debootstrap2.下载文件sudo debootstrap --arch=armhf --foreign stretch stretch http..
2020-08-22 11:55:37
712
原创 交叉编译pyobject2.28.7
无他最大的问题在于这东西不能交叉编译依赖的gobject-introspection-1.46也不能交叉编译所以,qemu-arm-static模拟一个arm32环境装上ubuntu编译咯或者树莓派上编译
2020-08-12 21:06:52
233
原创 python2.7.18编译脚本
2.7.18 源码官网下载第三方依赖编译安装在BASE_PATH下 如zlib readline 等等#!/bin/bashset -eif [ ! -f "hostpython" ];then ./configure make python Parser/pgen mv python hostpython mv Parser/pgen Parser/hostpgen make distcleanfiBASE_PATH="/opt/print"export CC.
2020-08-12 20:33:04
501
一个简单地socks5代理服务器,支持IPV4和V6
2022-11-24
socks5.tar
2020-11-29
ghostscript-9.26-bin
2020-10-12
单片机运行器
2018-09-20
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人