页次: 1
儿童节给大家的礼物,f1c200s,TF卡启动RTT的spl
http://whycan.com/t_4606.html
(出处:哇酷开发者社区【全志 V3S/F1C100s/X3】)
https://gitee.com/chenxiahuaxu/RDA8910_CSDK
在这个最原始版本的TOOL中有,研发用下载工具
app_start.c添加代码,否则host口无调试输出
srvUsbInit();
srvPmRun();
#ifdef CONFIG_HAIER_APP
extern void haier_appimg_enter(void);
haier_appimg_enter();
#endif
//app_start.c添加此段代码,否则host口无调试输出
drvDebugPortMode_t dhost_mode = {
.protocol = DRV_DEBUG_PROTOCOL_HOST,
.trace_enable = true,
.cmd_enable = true,
.bs_enable = true,
};
drvDebugPort_t *dhost_port = drvDhostCreate(dhost_mode);
drvHostCmdEngineCreate(dhost_port);
//app_start.c添加此段代码,否则host口无调试输出
// wait a while for PM source created
osiThreadSleep(10);
osiPmStart();
https://gitee.com/zkaijing/haier_8910dm_cat1?_from=gitee_search
无意中发现这个更像原厂SDK,组件,底层驱动,第三方都有,编译下载到合宙724UG模块中发现不能附着网络,求高手指导。
#include <rtthread.h>
struct calibration {
int x[5];
int y[5];
int xfb[5];
int yfb[5];
int a[7];
};
struct calibration cal;
int perform_calibration(struct calibration *cal) {
int j;
float n, x, y, x2, y2, xy, z, zx, zy;
float det, a, b, c, e, f, i;
float scaling = 65536.0;
// Get sums for matrix
n = x = y = x2 = y2 = xy = 0;
for(j = 0; j < 5; j++) {
n += 1.0;
x += (float)cal->x[j];
y += (float)cal->y[j];
x2 += (float)(cal->x[j]*cal->x[j]);
y2 += (float)(cal->y[j]*cal->y[j]);
xy += (float)(cal->x[j]*cal->y[j]);
}
// Get determinant of matrix -- check if determinant is too small
det = n*(x2*y2 - xy*xy) + x*(xy*y - x*y2) + y*(x*xy - y*x2);
if(det < 0.1 && det > -0.1) {
rt_kprintf("ts_calibrate: determinant is too small -- %f\n",det);
return 0;
}
// Get elements of inverse matrix
a = (x2*y2 - xy*xy)/det;
b = (xy*y - x*y2)/det;
c = (x*xy - y*x2)/det;
e = (n*y2 - y*y)/det;
f = (x*y - n*xy)/det;
i = (n*x2 - x*x)/det;
// Get sums for x calibration
z = zx = zy = 0;
for(j=0;j<5;j++) {
z += (float)cal->xfb[j];
zx += (float)(cal->xfb[j]*cal->x[j]);
zy += (float)(cal->xfb[j]*cal->y[j]);
}
// Now multiply out to get the calibration for framebuffer x coord
cal->a[0] = (int)((a*z + b*zx + c*zy)*(scaling));
cal->a[1] = (int)((b*z + e*zx + f*zy)*(scaling));
cal->a[2] = (int)((c*z + f*zx + i*zy)*(scaling));
// rt_kprintf("%f %f %f\n",(a*z + b*zx + c*zy),(b*z + e*zx + f*zy),(c*z + f*zx + i*zy));
// Get sums for y calibration
z = zx = zy = 0;
for(j=0;j<5;j++) {
z += (float)cal->yfb[j];
zx += (float)(cal->yfb[j]*cal->x[j]);
zy += (float)(cal->yfb[j]*cal->y[j]);
}
// Now multiply out to get the calibration for framebuffer y coord
cal->a[3] = (int)((a*z + b*zx + c*zy)*(scaling));
cal->a[4] = (int)((b*z + e*zx + f*zy)*(scaling));
cal->a[5] = (int)((c*z + f*zx + i*zy)*(scaling));
//rt_kprintf("%f %f %f\n",(a*z + b*zx + c*zy),(b*z + e*zx + f*zy),(c*z + f*zx + i*zy));
// If we got here, we're OK, so assign scaling to a[6] and return
cal->a[6] = (int)scaling;
/*校准参数*/
rt_kprintf("%d %d %d %d %d %d %d\n",cal->a[0],cal->a[1],cal->a[2],cal->a[3],
cal->a[4],cal->a[5],(int)cal->a[6]);
/*测试下效果 x=2062 y=2109*/
rt_kprintf("x %d\n", (cal->a[0] + cal->a[1]*2062 + cal->a[2]*2109 ) / cal->a[6]);
rt_kprintf("y %d\n", (cal->a[3] + cal->a[4]*2062 + cal->a[5]*2109 ) / cal->a[6]);
return 1;
}
int tscal(void)
{
/*TP 5点采集值*/
cal.x[0] = 677;
cal.y[0] = 1032;
cal.x[1] = 3431;
cal.y[1] = 1040;
cal.x[2] = 3432;
cal.y[2] = 3209;
cal.x[3] = 672;
cal.y[3] = 3172;
cal.x[4] = 2062;
cal.y[4] = 2109;
/*期望对应到哪些点*/
cal.xfb[0] = 100;
cal.yfb[0] = 100;
cal.xfb[1] = 700;
cal.yfb[1] = 100;
cal.xfb[2] = 700;
cal.yfb[2] = 380;
cal.xfb[3] = 100;
cal.yfb[3] = 380;
cal.xfb[4] = 400;
cal.yfb[4] = 240;
perform_calibration(&cal);
return 0;
}
MSH_CMD_EXPORT(tscal,tscal);
网上有现成的代码,感谢原作者。
1 TF卡格式化为fat32格式
2 用winhex复制boot.bin到0x2000位置
3 拷贝文件rtthread.bin到TF卡根目录
4 reset,引导程序会将rtthread.bin拷贝到0x80000000开始运行
从此PCB不再需要那个spiflash芯片,空出一路spi接口,开心。。。
tiny200 f1c200s
01-01 00:00:15.503 I/NO_TAG tshell: cp 128K used 1077 us whit for-circle-enCache,err 0
01-01 00:00:15.517 I/NO_TAG tshell: cp 128K used 1824 us whit DMA-disCache,err 0
01-01 00:00:15.525 I/NO_TAG tshell: cp 128K used 2037 us whit DMA-enCache,err 0
01-01 00:00:15.539 I/NO_TAG tshell: cp 128K used 5877 us whit for-circle-disCaches,err 0
periph_get_pll_clk:600000000
cpu_get_clk:408000000
ahb_get_clk:200000000
apb_get_clk:100000000
ddr_pll_get_clk:480000000
01-01 00:00:11.440 I/NO_TAG tshell: cp 128K used 1088 us whit for-circle-enCache,err 0
01-01 00:00:11.454 I/NO_TAG tshell: cp 128K used 1674 us whit DMA-disCache,err 0
01-01 00:00:11.462 I/NO_TAG tshell: cp 128K used 1888 us whit DMA-enCache,err 0
01-01 00:00:11.476 I/NO_TAG tshell: cp 128K used 5878 us whit for-circle-disCaches,err 0
periph_get_pll_clk:600000000
cpu_get_clk:408000000
ahb_get_clk:300000000
apb_get_clk:150000000
ddr_pll_get_clk:480000000
01-01 00:00:12.966 I/NO_TAG tshell: cp 128K used 1098 us whit for-circle-enCache,err 0
01-01 00:00:12.980 I/NO_TAG tshell: cp 128K used 1568 us whit DMA-disCache,err 0
01-01 00:00:12.987 I/NO_TAG tshell: cp 128K used 1781 us whit DMA-enCache,err 0
01-01 00:00:12.001 I/NO_TAG tshell: cp 128K used 5867 us whit for-circle-disCaches,err 0
periph_get_pll_clk:600000000
cpu_get_clk:408000000
ahb_get_clk:600000000
apb_get_clk:300000000
ddr_pll_get_clk:480000000
01-01 00:00:17.937 I/NO_TAG tshell: cp 128K used 1056 us whit for-circle-enCache,err 0
01-01 00:00:17.952 I/NO_TAG tshell: cp 128K used 1568 us whit DMA-disCache,err 0
01-01 00:00:17.959 I/NO_TAG tshell: cp 128K used 1674 us whit DMA-enCache,err 0
01-01 00:00:17.972 I/NO_TAG tshell: cp 128K used 5590 us whit for-circle-disCaches,err 0
periph_get_pll_clk:600000000
cpu_get_clk:600000000
ahb_get_clk:600000000
apb_get_clk:300000000
ddr_pll_get_clk:480000000
NDMA通道手册上最大传输128K,其实最大256K-1都可以,因为寄存器有18位,我试过暂时没有问题
感谢您的关注!
最近,我为桌面游戏机版本的旋转立方体修改了程序!
该控制台可通过编程方式绘制3D图形!
https://www.youtube.com/watch?v=NrAwHHGjqS4
https://whycan.cn/files/members/706/cube.png
该计划的来源: https://vrtp.ru/index.php?act=Attach&type=post&id=812670
可以在此论坛的主题中下载资源: https://vrtp.ru/index.php?showtopic=30775&st=0
在此之前,他在STM32H743上做了另一个EMU-Pocket游戏机:
https://vrtp.ru/index.php?showtopic=30174在这两个主题中,Keil ARM MDK和CCS v.6的源代码
你们国家的创意和游戏机呢? 只有少数人与我们一起从事这项工作,他们都是爱人!
我一直想做游戏机,2D像素风格,类似SFC
技术上可以做到。
MMU映射时,1:1映射1片无CACHE的空间。
这样正常出来的内存地址,做一下地址转换就行了。参考
const struct mem_desc platform_mem_desc[] = { {0x00000000, 0x03FFFFFF, 0x00000000, NORMAL_MEM}, /* DDR 64M */ {0x10000000, 0x13FFFFFF, 0x00000000, DEVICE_MEM}, /* 加这行 DDR 64M non-cache */ {0xB0000000, 0xB3FFFFFF, 0xB0000000, DEVICE_MEM}, /* IO 64M */ {0xFFF00000, 0xFFFFFFFF, 0xFFF00000, DEVICE_MEM}, /* SYS 1M */ };
但是
内存操作带CACHE,再刷cache.性能远远高于无cache直接操作的。
这个方法不错,但是要定义变量地址,该咋操作哦。
看看前几天写的,不过是RTT用的
https://whycan.cn/t_3984.html
你的需求似乎Cortex-M架构上的MPU模块能满足,通过定义一个连续的地址片为MPU_ACCESS_NOT_CACHEABLE来实现。
一旦定义后,也无需OS进行什么特殊操作,普通malloc即可。但至于F1C100s的ARM926EJ-S内核,应该只有MMU可用,好像没有类似的功能。
还是要在驱动里手动调用诸如:mmu_invalidate_dcache()、mmu_clean_dcache()等函数来操作cache。总之,上述功能应该不是OS的API范畴,与CPU架构关系很大。具体可以参考RTT的libcpu/arm/arm926里的相关实现。
谢谢你的建议,我似乎找到一个办法,就是单独定义一个地址区域,在mmu初始化时,这个区域不在管理范围内。
页次: 1