一.起步阶段,参考帖子如下:
尝试从零构建F1C100s开发环境» 2019-11-03 13:34:50 » 作者:LinjieGuo
荔枝派nano f1c100s 开发板入坑记录 » 2018-09-10 16:17:24 » 作者:晕哥
离线
如果屏的大小分辨大于2m需要修改Uboot,下面内容引自坛友"无情一刀"
那个fbuffer会报错 就是因为如果是启动出现CONFIG_SUNXI_MAX_FB_SIZE的内存不够修改u-boot/include/configs/sunxi-common.h/CONFIG_SUNXI_MAX_FB_SIZE的中的大小 uboot默认设置为2M 我已修改为4M(在309 行)
#ifndef CONFIG_MACH_SUN8I_V3S
#define CONFIG_SUNXI_MAX_FB_SIZE (16 << 20)
#else
#define CONFIG_SUNXI_MAX_FB_SIZE (2 << 20)
#endif缓冲区不够,还有在代码里面修改为4M就可以"
____________________________________________________________________________________
本人屏1024*600*3<2m不做修改
离线
u-boot/include/configs/sunxi-common.h
设置了默认的kernel,fdt存放地址.
#elif defined(CONFIG_MACH_SUNIV)
/*
* 32M RAM minus 1MB heap + 8MB for u-boot, stack, fb, etc.
* 8M uncompressed kernel, 4M compressed kernel, 512K fdt,
* 512K script, 512K pxe and the ramdisk at the end.
*/
#define BOOTM_SIZE __stringify(0x1700000)
#define KERNEL_ADDR_R __stringify(SDRAM_OFFSET(0500000))
#define FDT_ADDR_R __stringify(SDRAM_OFFSET(0C00000))
#define SCRIPT_ADDR_R __stringify(SDRAM_OFFSET(0C50000))
#define PXEFILE_ADDR_R __stringify(SDRAM_OFFSET(0D00000))
#define RAMDISK_ADDR_R __stringify(SDRAM_OFFSET(0D50000))
其中SDRAM_OFFSET宏位置\u-boot\include\configs\sunxi-common.h
#elif defined(CONFIG_MACH_SUNIV)
#define SDRAM_OFFSET(x) 0x8##x
KERNEL_ADDR_R =0x80500000
设置部分代码
#define MEM_LAYOUT_ENV_SETTINGS \
"bootm_size=" BOOTM_SIZE "\0" \
"kernel_addr_r=" KERNEL_ADDR_R "\0" \
"fdt_addr_r=" FDT_ADDR_R "\0" \
"scriptaddr=" SCRIPT_ADDR_R "\0" \
"pxefile_addr_r=" PXEFILE_ADDR_R "\0" \
"ramdisk_addr_r=" RAMDISK_ADDR_R "\0"
最近编辑记录 nice (2022-11-03 13:18:17)
离线
1.Uboot
在uboot源码目录下 进入 ./include/configs/,修改 suniv.h
#define CONFIG_BOOTCOMMAND "sf probe 0 50000000; " \
"sf read 0x80C00000 0x30000 0x4000; " \
"sf read 0x80008000 0x40000 0x260000; " \
"bootz 0x80008000 - 0x80C00000"
不要在sunxi-common.h添加
因为suniv.h 中#include <configs/sunxi-common.h>
注:精简参考:F1C100S/F1C200S-减少开机时间、uboot、内核、根文件系统裁减优化问题 » 2020-01-29 23:22:57 » 作者:颜水花生
2.linux
Github下载的zip用unzip出错,改用:7z x 压缩文件名
linux屏驱动使用simple-panel,
linux 自带的屏的具体见文件.\linux\drivers\gpu\drm\panel\panel-simple.c
找到兼容的屏,修改设备书中的,panel
panel: panel {
compatible = "tianma,tm070jdhg30", "simple-panel";
#address-cells = <1>;
#size-cells = <0>;
enable-gpios = <&pio 4 6 GPIO_ACTIVE_HIGH>;
修改./linux/Makefile
把ARCH,和CROSS_COMPILE设置上.并将找来的.config拷贝到./linux下面.
离线
参考链接基于荔枝派Nano学习Buildroot的构建过程
应用程序如动态链接方式,动态库的提供依赖于交叉编译工具链最好使用同一个交叉编译工具链。
buildroot2007先下载,make menuconfig设置内部编译器为7.x,make一下,再把虚拟机的arm-gcc定位到:/buildroot-2017.08/output/host/bin/arm-linux-gcc,再编译u-boot,linux.
离线
linux屏幕反色修改
From adbe5b4615ed355fdd76465b0e6b89de2e9f19a4 Mon Sep 17 00:00:00 2001
From: jiangming1399 <jiangming1399@163.com>
Date: Tue, 7 Apr 2020 16:51:31 +0800
Subject: [PATCH] [drm] sun4i: add swap red and blue on tcon0
---
drivers/gpu/drm/sun4i/sun4i_tcon.c | 13 +++++++++++++
drivers/gpu/drm/sun4i/sun4i_tcon.h | 3 +++
2 files changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index ce9846c91..b024312b3 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -419,6 +419,12 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
SUN4I_TCON0_CTL_CLK_DELAY_MASK,
SUN4I_TCON0_CTL_CLK_DELAY(clk_delay));
+ if (tcon->swap_red_blue) {
+ regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
+ SUN4I_TCON0_CTL_SWAP,
+ SUN4I_TCON0_CTL_SWAP);
+ }
+
/*
* This is called a backporch in the register documentation,
* but it really is the back porch + hsync
@@ -498,6 +504,12 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
SUN4I_TCON0_CTL_CLK_DELAY_MASK,
SUN4I_TCON0_CTL_CLK_DELAY(clk_delay));
+ if (tcon->swap_red_blue) {
+ regmap_update_bits(tcon->regs, SUN4I_TCON0_CTL_REG,
+ SUN4I_TCON0_CTL_SWAP,
+ SUN4I_TCON0_CTL_SWAP);
+ }
+
/*
* This is called a backporch in the register documentation,
* but it really is the back porch + hsync
@@ -1103,6 +1115,7 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
tcon->dev = dev;
tcon->id = engine->id;
tcon->quirks = of_device_get_match_data(dev);
+ tcon->swap_red_blue = of_property_read_bool(dev->of_node, "swap-red-blue");
tcon->lcd_rst = devm_reset_control_get(dev, "lcd");
if (IS_ERR(tcon->lcd_rst)) {
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h
index f9f1fe80b..fe8953fe0 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.h
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h
@@ -53,6 +53,7 @@
#define SUN4I_TCON0_CTL_TCON_ENABLE BIT(31)
#define SUN4I_TCON0_CTL_IF_MASK GENMASK(25, 24)
#define SUN4I_TCON0_CTL_IF_8080 (1 << 24)
+#define SUN4I_TCON0_CTL_SWAP BIT(23)
#define SUN4I_TCON0_CTL_CLK_DELAY_MASK GENMASK(8, 4)
#define SUN4I_TCON0_CTL_CLK_DELAY(delay) ((delay << 4) & SUN4I_TCON0_CTL_CLK_DELAY_MASK)
#define SUN4I_TCON0_CTL_SRC_SEL_MASK GENMASK(2, 0)
@@ -259,6 +260,8 @@ struct sun4i_tcon {
/* Associated crtc */
struct sun4i_crtc *crtc;
+ bool swap_red_blue;
+
int id;
/* TCON list management */
--
2.26.0
上面不行,则修改/drivers/gpu/drm/sun4i/sun4i_backend.c
int sun4i_backend_update_layer_formats(struct sun4i_backend *backend,
int layer, struct drm_plane *plane)
{
struct drm_plane_state *state = plane->state;
struct drm_framebuffer *fb = state->fb;
bool interlaced = false;
u32 val;
int ret;
if (plane->state->crtc)
interlaced = plane->state->crtc->state->adjusted_mode.flags
& DRM_MODE_FLAG_INTERLACE;
regmap_update_bits(backend->engine.regs, SUN4I_BACKEND_MODCTL_REG,
SUN4I_BACKEND_MODCTL_ITLMOD_EN,
interlaced ? SUN4I_BACKEND_MODCTL_ITLMOD_EN : 0);
DRM_DEBUG_DRIVER("Switching display backend interlaced mode %s\n",
interlaced ? "on" : "off");
ret = sun4i_backend_drm_format_to_layer(plane, fb->format->format,
&val);
if (ret) {
DRM_DEBUG_DRIVER("Invalid format\n");
return ret;
}
regmap_update_bits(backend->engine.regs,
SUN4I_BACKEND_ATTCTL_REG1(layer),
SUN4I_BACKEND_ATTCTL_REG1_LAY_FBFMT, val);
regmap_update_bits(backend->engine.regs,
SUN4I_BACKEND_ATTCTL_REG1(layer),
1<<2, 1<<2);
return 0;
}
最近编辑记录 nice (2022-11-10 16:12:01)
离线
基于f1c200s运行linux的学习记录.
https://whycan.com/t_9092.html#p84399
再把虚拟机的arm-gcc定位到:/buildroot-2017.08/output/host/bin/arm-linux-gcc
sudo vim /etc/bash.bashrc
添加
PATH="$PATH:/home/home/f1c100s/buildroot-2017.08/output/host/bin"
或者使用:
开源 全志f1c100s(200s)所有IO都引出
https://whycan.com/t_7651.html#p73430
合并编译器-采用buildroot外部编译器
进入buildroot 目录,make menuconfig
设置如下:
Toolchain --->
Toolchain type (External toolchain) ---> //选择外部工具链
Toolchain (Custom toolchain) ---> //定制工具链
(/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi) Toolchain path
($(ARCH)-linux-gnueabi) Toolchain prefix
External toolchain gcc version (7.x) --->//根据实际外部工具链gcc 定
查看下gcc 版本
External toolchain kernel headers series (4.10.x)
External toolchain C library (glibc/eglibc) --->
failed to create symbolic link '/home/jonsen/f1c100s/buildroot-2017.08/output/host/arm-buildroot-linux-gnueabi/sysroot/usr/lib': No such file or directory
提示 没有路径
手动到该目录下 建立路径
cd output/host/arm-buildroot-linux-gnueabi/sysroot/
ls
mkdir usr
/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/7.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find crt1.o: No such file or directory
/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin/../lib/gcc/arm-linux-gnueabi/7.2.1/../../../../arm-linux-gnueabi/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [example] Error 1
make[1]: *** [/home/home/f1c100s/buildroot-2017.08/output/build/zlib-1.2.11/.stamp_built] Error 2
make: *** [_all] Error 2
交叉编译错误 cannot find crt1.o:错误
home@ubuntu:~$ arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin/../libexec/gcc/arm-linux-gnueabi/7.2.1/lto-wrapper
Target: arm-linux-gnueabi
Configured with: 。。。 --prefix=/home/tcwg-buildslave/workspace/tcwg-make-release/builder_arch/amd64/label/tcwg-x86_64-build/target/arm-linux-gnueabi/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: posix
gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)
查找发现根本没有/home/tcwg-buildslave这目录
网上找到的方法:
把crt1.o crti.o crtn.o 拷贝到你链接的SYSROOT/USR/BIN/
实际操作使用vim编辑
sudo vim /etc/bash.bashrc
-->.在文件末尾 添加以下内容:
LIBRARY_PATH="$PATH:/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc/usr/lib"
-->.使路径生效
source /etc/bash.bashrc
export LIBRARY_PATH="/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc/usr/lib"
export PATH=/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc/usr/lib:$PATH
以上命令具体哪个生效,不清楚。
出错参考关于buildroot
https://whycan.com/t_3177.html#p27090
再回到buildroot根目录 make
最近编辑记录 nice (2023-01-30 10:55:47)
离线
linux 目录下,
先make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
再make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH="../buildroot-2017.08/output/target/"
如果存在修改
find ../buildroot-2017.08/output/target/ -name "*.ko" |xargs rm -rf
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH="../buildroot-2017.08/output/target/"
离线
busybox 支持depmod 的方法
如果是buildroot 的话,就在package/busybox/busybox.config 的里找个 CONFIG_DEPMOD ,设置成 CONFIG_DEPMOD=y 就可以了。
buildroot中busybox版本是固定的,以上修改会更新busybox,会出错
最近编辑记录 nice (2023-01-30 09:03:09)
离线
rootMk.sh内容如下
#!/bin/bash
if [ ! -d "rootfs" ];then
mkdir rootfs
else
rm -rf rootfs/*
fi
cp ./buildroot-2017.08/output/images/rootfs.tar ./rootfs/
cd rootfs
tar -vxf rootfs.tar
rm rootfs.tar
cd ..
BuildMyImage.sh内容如下 :
#!/bin/sh
dd if=/dev/zero of=f1c100s_spiflash_16M.bin bs=1M count=16 &&\
dd if=u-boot/u-boot-sunxi-with-spl.bin of=f1c100s_spiflash_16M.bin bs=1K conv=notrunc &&\
dd if=linux-f1c100s/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dtb of=f1c100s_spiflash_16M.bin bs=1K seek=192 conv=notrunc &&\
dd if=linux-f1c100s/arch/arm/boot/zImage of=f1c100s_spiflash_16M.bin bs=1K seek=256 conv=notrunc &&\
mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o rootfs.jffs2 &&\
dd if=rootfs.jffs2 of=f1c100s_spiflash_16M.bin bs=1k seek=4352 conv=notrunc &&\
sync
命令参考链接
Linux 下的dd命令使用详解
linux jffs2 格式化,mkfs.jffs2使用方法
一、dd命令的解释
dd:用指定大小的块拷贝一个文件,并在拷贝的同时进行指定的转换。
注意:指定数字的地方若以下列字符结尾,则乘以相应的数字:b=512;c=1;k=1024;w=2
参数注释:
1. if=文件名:输入文件名,缺省为标准输入。即指定源文件。< if=input file >
2. of=文件名:输出文件名,缺省为标准输出。即指定目的文件。< of=output file >
3. ibs=bytes:一次读入bytes个字节,即指定一个块大小为bytes个字节。
obs=bytes:一次输出bytes个字节,即指定一个块大小为bytes个字节。
bs=bytes:同时设置读入/输出的块大小为bytes个字节。
4. cbs=bytes:一次转换bytes个字节,即指定转换缓冲区大小。
5. skip=blocks:从输入文件开头跳过blocks个块后再开始复制。
6. seek=blocks:从输出文件开头跳过blocks个块后再开始复制。
注意:通常只用当输出文件是磁盘或磁带时才有效,即备份到磁盘或磁带时才有效。
7. count=blocks:仅拷贝blocks个块,块大小等于ibs指定的字节数。
8. conv=conversion:用指定的参数转换文件。
ascii:转换ebcdic为ascii
ebcdic:转换ascii为ebcdic
ibm:转换ascii为alternate ebcdic
block:把每一行转换为长度为cbs,不足部分用空格填充
unblock:使每一行的长度都为cbs,不足部分用空格填充
lcase:把大写字符转换为小写字符
ucase:把小写字符转换为大写字符
swab:交换输入的每对字节
noerror:出错时不停止
notrunc:不截短输出文件
sync:将每个输入块填充到ibs个字节,不足部分用空(NUL)字符补齐。
最近编辑记录 nice (2023-01-31 09:18:40)
离线
linux长期支持版本下载https://www.kernel.org/
linux4.19下载地址:
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.271.tar.xz
tar -xvf linux-4.19.271.tar.xz
打上补丁链接
网友 @chong 大神提供的f1c100s mainline linux usb 补丁包,支持usb otg(host & device)
https://whycan.com/t_1672.html#p10579
make sunxi_defconfig生成.config
再make menuconfig修改
YACC scripts/kconfig/zconf.tab.c
/bin/sh: 1: bison: not found 这一行表明 出错原因是缺少bison
安装 bison 即可避免错误
安装bison: sudo apt-get install flex bison命令
最近编辑记录 nice (2023-01-31 16:03:45)
离线
adb参考
分享个licheepi nano镜像,支持adb调试
https://whycan.com/t_2794.html#p22739
原linux的config文件按帖子配置出错
# install_listener('tcp:5037','*smartsocket*')
[ 62.563118] read descriptors
[ 62.566072] read strings
[ 62.568693] udc-core: couldn't find an available UDC - added [g_ffs] to list of pending drivers
参考链接:https://www.jianshu.com/p/d341022167b4
发现没有musb_hdrc
参考下贴的config(修改后的config文件使用,出现提示类似(N/m/y)时,直接回车用默认的)
终于搞好了荔枝派nano linux uboot瘦身 + usb gadget hid + gt911触控 + littlevgl demo
https://whycan.com/t_2688.html#p21453
对比log
发现启动缺少musb-hdrc.1.auto
修改.config
出错变成
# sh adb.sh
[ 17.357434] file system registered
# install_listener('tcp:5037','*smartsocket*')
[ 21.803710] read descriptors
[ 21.806665] read strings
[ 21.809611] using random self ethernet address
[ 21.814076] using random host ethernet address
[ 21.818608] using random self ethernet address
[ 21.823135] using random host ethernet address
[ 21.828983] usb0: HOST MAC de:ce:81:cb:df:5c
[ 21.833560] usb0: MAC 32:c6:c7:a5:db:e1
[ 21.837708] g_ffs gadget: g_ffs ready
[ 38.085937] g_ffs gadget: high-speed config #1: FunctionFS + RNDIS
high-speed config #1: FunctionFS + RNDIS
电脑识别成com口,继续找原因
分享个licheepi nano镜像,支持adb调试
https://whycan.com/t_2794.html#p30104
最近编辑记录 nice (2023-02-07 13:13:29)
离线
严重支持,自己这些日子正在学习Linux,一直还没有搞明白。现在自己的板子还在调试。希望多出些针对小白的入门文章。
离线
离线
pcb没有USB id脚,DTS修改
&usb_otg {
dr_mode = "peripheral"; /* otg host peripheral */
status = "okay";
};
&usbphy {
//usb0_id_det-gpio = <&pio 4 2 GPIO_ACTIVE_HIGH>; /* PE2 */
status = "okay";
};
测试可用ADB的.config文件
adb_ok_linux.zip
参考链接:ubuntu下配置adb模块进入adb shell
Windows下安装使用ADB,简单易懂教程
最近编辑记录 nice (2023-02-07 14:29:54)
离线
adb-windows下载地址adb-platform-tools_windows.zip
顺便附上kicad7.0的下载地址:https://mirrors.nju.edu.cn/kicad/windows/stable/kicad-7.0.0-x86_64.exe
最近编辑记录 nice (2023-02-13 17:55:57)
离线
lVGL移植:
1.https://github.com/lvgl/lv_port_linux_frame_buffer
下载linux下用LVGL,从CSDN的镜象下载:git clone --recursive https://gitcode.net/mirrors/lvgl/lv_port_linux_frame_buffer.git
2.解压
3.修改main.c
disp_drv.hor_res = 1024;
disp_drv.ver_res = 600;
去除输入和光标,我不用触屏
4.修改lv_conf.h
/*0: Light mode; 1: 使用黑色背景*/
#define LV_THEME_DEFAULT_DARK 1
/*使用FreeType */
#define LV_USE_FREETYPE 1
5.下载freetype,解压
参考链接:https://blog.csdn.net/qq981378640/article/details/116169348
a.执行如下命令:(没有用于图片字体,禁止了zlib,png)
./configure CC=arm-linux-gnueabihf-gcc --host=arm-linux --prefix=$PWD/library --with-zlib=no --with-png=no
make
make install
拷贝部分不要操作,执行下面修改makefile
6.修改LVGL的makefile
CC ?=arm-linux-gcc
...
FREERTYPE_INCDIR ?= ../freetype-2.12.1/library/include/freetype2
FREERTYPE_LINK ?= ../freetype-2.12.1/library/lib
CFLAGS ?= -O3 -g0 -std=c99 -I$(LVGL_DIR)/ -I$(FREERTYPE_INCDIR)/
...
#LDFLAGS ?= -lSDL2 -lm -L$(FREERTYPE_LINK) -lfreetype
LDFLAGS ?= -lm -L$(FREERTYPE_LINK) -lfreetype
#CSRCS +=$(LVGL_DIR)/mouse_cursor_icon.c
7.main.c中加入lv_example_freetype_1()
8.虚拟机中$: adb push libfreetype.so.6 /lib
最近编辑记录 nice (2023-02-24 11:17:24)
离线
启用spi-slave的方法,
1.修改芯片spi控制器驱动
相关文件位置..\linux\drivers\spi\spi-sun6i.c
a.修改从设备树判断为slave,注册slave类
b.设置相关寄存器,
c.增加slave_abort函数和相关结构体变量,传送等待修改成wait_for_completion_interruptible
2.修改设备树
a.增加spi-slave逻辑值
b.增加slave子节点
离线