导航

    全志在线开发者论坛

    • 注册
    • 登录
    • 搜索
    • 版块
    • 话题
    • 在线文档
    • 社区主页
    1. 主页
    2. tripod9
    T
    • 资料
    • 关注 0
    • 粉丝 2
    • 我的积分 1926
    • 主题 8
    • 帖子 49
    • 最佳 9
    • 群组 0

    tripod9LV 5

    @tripod9

    1926
    积分
    15
    声望
    55
    资料浏览
    49
    帖子
    2
    粉丝
    0
    关注
    注册时间 最后登录

    tripod9 取消关注 关注

    tripod9 发布的最佳帖子

    • 全志R128裸奔工具XFEL开发计划

      xfel工具已支持具体绝大部分全志芯片,现在计划实现对R128芯片的支持。

      1,读写SRAM(已完成)
      2,执行运行在M33核的payload指令(已完成)
      3,读取R128的SID(已完成)
      4,初始化M33核心的jtag接口,此接口跟调试串口复用(已开发,未测试)
      5,实现reset操作(已完成)
      6,初始化LSPRAM以及HSPSRAM(已完成)
      7, 支持启动C906核心,加载并执行通过write命令写入到RAM中的C906程序
      8, 支持启动DSP核心,加载并执行通过write命令写入到RAM中的DSP程序 (优先级低,估计没手段验证)
      9,支持烧写NOR FLASH

      发布在 A Series
      T
      tripod9
    • 全志D1裸奔工具XFEL

      工欲善其事,必先利其器,全志D1沿用传统设计思路,brom里面集成了FEL模式,这个模式是一个很有用的模式,可以烧录,测试,能干的事情很多,本来这种工具也是有成熟的可用,比如:sunxi-fel,基本算裸奔必用的开发工具,但突然来了个RISCV版的FEL,sunxi-fel就无能为力,其深度绑定ARM实现,里面的payload都是arm,根本没有riscv,没有工具,想正向开发,比登天还难。

      仔细分析D1的fel,发现其烧写工具跟原先的一致,没有做任何更新,那也就是说,fel标准协议其实是指令集无关的,有了这个信息就好办了,我们完全也可以创建一个指令集无关的fel工具,阅读sunxi-fel,发现其改造困难,基本深度绑定,没有太多开发的意义,还不如重新开发,轻装上阵,遂有了此工程。

      此工具理论上全志全系列芯片都可以支持,不管是arm32,arm64,riscv64,重点目标是riscv64的D1支持,设计时避免过多hack,增强适应性,最大的特色借用xfel工具可以直接初始化DDR。有了直接能初始化DDR的fel工具,开发裸机就没有任何难度了,当单片机耍。

      xfel(v1.0.1) - https://github.com/xboot/xfel
      usage:
          xfel help                                   - Print this usage
          xfel version                                - Show brom version
          xfel hexdump <address> <length>             - Dumps memory region in hex
          xfel dump <address> <length>                - Binary memory dump to stdout
          xfel exec <address>                         - Call function address
          xfel read32 <address>                       - Read 32-bits value from device memory
          xfel write32 <address> <value>              - Write 32-bits value to device memory
          xfel read <address> <length> <file>         - Read memory to file
          xfel write <address> <file>                 - Write file to memory
          xfel reset                                  - Reset device using watchdog
          xfel sid                                    - Show 128-bits sid information
          xfel jtag                                   - Enable jtag debug
          xfel ddr [type]                             - Initial ddr controller with optional type
          xfel spinor                                 - Detect spi nor flash
          xfel spinor read <address> <length> <file>  - Read spi nor flash to file
          xfel spinor write <address> <file>          - Write file to spi nor flash
          xfel spinand                                - Detect spi nand flash
          xfel spinand read <address> <length> <file> - Read spi nand flash to file
          xfel spinand write <address> <file>         - Write file to spi nand flash
      

      链接文本

      发布在 MR Series
      T
      tripod9
    • D1s运行自制立即式UI框架--XUI

      D1s运行自制立即式UI框架--XUI

      发布在 MR Series
      T
      tripod9
    • 回复: MQ-T113使用xboot驱动GT911时中断无法使用

      @steward 感谢司徒的研究,发现了一个大BUG,中断号偏移计算错误,现已修复,打补丁如下:

      diff --git a/src/arch/arm32/mach-t113s3/romdisk/boot/mangopi.json b/src/arch/arm32/mach-t113s3/romdisk/boot/mangopi.json
      index 0f1f34283..4bc02d253 100644
      --- a/src/arch/arm32/mach-t113s3/romdisk/boot/mangopi.json
      +++ b/src/arch/arm32/mach-t113s3/romdisk/boot/mangopi.json
      @@ -386,12 +386,12 @@
       	"reset-t113@0x02001d0c": { "reset-base": 1184, "reset-count": 32 },
       
       	"irq-gic400@0x03020000": { "interrupt-base": 32, "interrupt-count": 224 },
      -	"irq-t113-gpio@0x02000220": { "interrupt-base": 224, "interrupt-count":  8, "interrupt-parent":  101 },
      -	"irq-t113-gpio@0x02000240": { "interrupt-base": 256, "interrupt-count":  8, "interrupt-parent":  103 },
      -	"irq-t113-gpio@0x02000260": { "interrupt-base": 288, "interrupt-count": 23, "interrupt-parent":  105 },
      -	"irq-t113-gpio@0x02000280": { "interrupt-base": 320, "interrupt-count": 14, "interrupt-parent":  107 },
      -	"irq-t113-gpio@0x020002a0": { "interrupt-base": 352, "interrupt-count":  7, "interrupt-parent":  109 },
      -	"irq-t113-gpio@0x020002c0": { "interrupt-base": 384, "interrupt-count": 16, "interrupt-parent":  111 },
      +	"irq-t113-gpio@0x02000220": { "interrupt-base": 256, "interrupt-count":  8, "interrupt-parent":  101 },
      +	"irq-t113-gpio@0x02000240": { "interrupt-base": 288, "interrupt-count":  8, "interrupt-parent":  103 },
      +	"irq-t113-gpio@0x02000260": { "interrupt-base": 320, "interrupt-count": 23, "interrupt-parent":  105 },
      +	"irq-t113-gpio@0x02000280": { "interrupt-base": 352, "interrupt-count": 14, "interrupt-parent":  107 },
      +	"irq-t113-gpio@0x020002a0": { "interrupt-base": 384, "interrupt-count":  7, "interrupt-parent":  109 },
      +	"irq-t113-gpio@0x020002c0": { "interrupt-base": 416, "interrupt-count": 16, "interrupt-parent":  111 },
       
       	"gpio-t113@0x02000030": { "gpio-base":  32, "gpio-count":  8, "interrupt-offset": 256 },
       	"gpio-t113@0x02000060": { "gpio-base":  64, "gpio-count":  8, "interrupt-offset": 288 },
      

      完整补丁见这个链接
      https://github.com/xboot/xboot/commit/4e502b7ad6e4f589832d36a4513de00f0cb8de07

      发布在 爱搞机专区
      T
      tripod9
    • 利用XFEL直接引导xboot

      在缺乏工具前,都是利用已有的软件,间接开发,现在有了专用工具,就无需像那么折腾了,仅需在板子上电时,按着fel按键,敲一下如下,指令就可以将xboot运行在DDR中,复杂的开发工作,从此变得简单起来。

      sudo xfel ddr ddr3
      sudo xfel write 0x40000000 output/xboot.bin
      sudo xfel exec 0x40000000
      

      补充下,xboot代码的获取与编译,工具链随便了,你想用玄铁的也行,啥都可以的。

      git clone https://github.com/xboot/xboot/ -b test-d1
      CROSS_COMPILE=riscv64-linux-gnu- PLATFORM=riscv64-d1 make -j3
      

      xfel_run_xboot.gif

      借用下晕哥的图,在晕哥的努力下,XFEL现在有了windows版了,方便使用win做开发的同学。

      链接文本

      发布在 MR Series
      T
      tripod9
    • 回复: 全志D1裸奔工具XFEL

      @mangogeek 已添加Winbond SPI NAND的支持,因为华邦的ID是3个字节,其他的SPI NAND芯片是两个字节的ID,现在代码已做了扩展。

      	/* Winbond */
      	{ "W25N512GV",       SPINAND_ID(0xef, 0xaa, 0x20), 2048,  64,  64,  512, 1, 1 },
      	{ "W25N01GV",        SPINAND_ID(0xef, 0xaa, 0x21), 2048,  64,  64, 1024, 1, 1 },
      	{ "W25M02GV",        SPINAND_ID(0xef, 0xab, 0x21), 2048,  64,  64, 1024, 1, 2 },
      	{ "W25N02KV",        SPINAND_ID(0xef, 0xaa, 0x22), 2048, 128,  64, 2048, 1, 1 },
      
      发布在 MR Series
      T
      tripod9
    • 回复: D1s裸奔驱动LCD,并运行xboot的各种风骚APP

      https://www.zhihu.com/column/c_1382754923101081600

      发布在 MR Series
      T
      tripod9
    • D1S内置电阻触摸TSADC,演示效果

      D1s内部含有一个电阻触摸控制器TSADC,可以直接连接标准的电阻触摸,这个控制器基本跟F1C100S的类似,所以编写驱动也就手到擒来,拷贝下,基本就可以了。对于电阻触摸屏,所涉及到的均值滤波,中值滤波,触摸校正参数等,这些xboot里都有成熟的解决方案,就不细说了。

      下面是演示视频,感觉还是比较丝滑的。

      发布在 MR Series
      T
      tripod9
    • 深入研究全志SOC芯片EFUSE,并扩展xfel工具,实现efuse烧写。

      全志的SOC,只要不是太老旧的芯片,里面都集成了2048bit的EFUSE,但此熔丝位的很多细节,并没有相关描述文档,这导致大家很难在实际项目中应用此功能,而且也缺乏灵活的烧写工具,基于此问题,我花了点时间扩展了下XFEL工具。

      现已支持如下芯片的efuse烧写:
      1,D1 / D1s / F133
      2,T113 / R528
      3,V851/ V853

      扩展的烧写命令:

      usage:
          xfel extra efuse dump                     - Dump all of the efuse information
          xfel extra efuse read32 <offset>          - Read 32-bits value from efuse
          xfel extra efuse write32 <offset> <value> - Write 32-bits value to efuse
          xfel extra efuse write <offset> <file>    - Write file to efuse
      

      Dump芯片EFUSE

      xfel extra efuse dump
      chipid:(0x0000 128-bits)
          93406000 0c004814 01426250 48671b4b 
      brom-conf-try:(0x0010 32-bits)
          00000000 
      thermal-sensor:(0x0014 64-bits)
          88fbc11a 01e9080f 
      ft-zone:(0x001c 128-bits)
          898f1919 0f760f6c 3108126c 811a0a0e 
      tvout:(0x002c 32-bits)
          0000028f 
      tvout-gamma:(0x0030 64-bits)
          00000000 00000000 
      oem-program:(0x0038 64-bits)
          00000000 00000000 
      write-protect:(0x0040 32-bits)
          00000000 
      read-protect:(0x0044 32-bits)
          00000000 
      reserved1:(0x0048 64-bits)
          00000000 00000000 
      huk:(0x0050 192-bits)
          00000000 00000000 00000000 00000000 00000000 00000000 
      reserved2:(0x0068 64-bits)
          00000000 00000000 
      rotpk:(0x0070 256-bits)
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
      ssk:(0x0090 256-bits)
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
      rssk:(0x00b0 128-bits)
          00000000 00000000 00000000 00000000 
      hdcp-hash:(0x00c0 128-bits)
          00000000 00000000 00000000 00000000 
      nv1:(0x00d0 32-bits)
          00000000 
      nv2:(0x00d4 32-bits)
          00000000 
      reserved3:(0x00d8 96-bits)
          00000000 00000000 00000000 
      oem-program-secure:(0x00e4 224-bits)
          00000000 00000000 00000000 00000000 00000000 00000000 00000000
      

      完整讨论贴,见坑网
      https://whycan.com/t_9947.html

      发布在 MR Series
      T
      tripod9

    tripod9 发布的最新帖子

    • 深入研究全志SOC芯片EFUSE,并扩展xfel工具,实现efuse烧写。

      全志的SOC,只要不是太老旧的芯片,里面都集成了2048bit的EFUSE,但此熔丝位的很多细节,并没有相关描述文档,这导致大家很难在实际项目中应用此功能,而且也缺乏灵活的烧写工具,基于此问题,我花了点时间扩展了下XFEL工具。

      现已支持如下芯片的efuse烧写:
      1,D1 / D1s / F133
      2,T113 / R528
      3,V851/ V853

      扩展的烧写命令:

      usage:
          xfel extra efuse dump                     - Dump all of the efuse information
          xfel extra efuse read32 <offset>          - Read 32-bits value from efuse
          xfel extra efuse write32 <offset> <value> - Write 32-bits value to efuse
          xfel extra efuse write <offset> <file>    - Write file to efuse
      

      Dump芯片EFUSE

      xfel extra efuse dump
      chipid:(0x0000 128-bits)
          93406000 0c004814 01426250 48671b4b 
      brom-conf-try:(0x0010 32-bits)
          00000000 
      thermal-sensor:(0x0014 64-bits)
          88fbc11a 01e9080f 
      ft-zone:(0x001c 128-bits)
          898f1919 0f760f6c 3108126c 811a0a0e 
      tvout:(0x002c 32-bits)
          0000028f 
      tvout-gamma:(0x0030 64-bits)
          00000000 00000000 
      oem-program:(0x0038 64-bits)
          00000000 00000000 
      write-protect:(0x0040 32-bits)
          00000000 
      read-protect:(0x0044 32-bits)
          00000000 
      reserved1:(0x0048 64-bits)
          00000000 00000000 
      huk:(0x0050 192-bits)
          00000000 00000000 00000000 00000000 00000000 00000000 
      reserved2:(0x0068 64-bits)
          00000000 00000000 
      rotpk:(0x0070 256-bits)
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
      ssk:(0x0090 256-bits)
          00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 
      rssk:(0x00b0 128-bits)
          00000000 00000000 00000000 00000000 
      hdcp-hash:(0x00c0 128-bits)
          00000000 00000000 00000000 00000000 
      nv1:(0x00d0 32-bits)
          00000000 
      nv2:(0x00d4 32-bits)
          00000000 
      reserved3:(0x00d8 96-bits)
          00000000 00000000 00000000 
      oem-program-secure:(0x00e4 224-bits)
          00000000 00000000 00000000 00000000 00000000 00000000 00000000
      

      完整讨论贴,见坑网
      https://whycan.com/t_9947.html

      发布在 MR Series
      T
      tripod9
    • 回复: MQ-T113使用xboot驱动GT911时中断无法使用

      @steward 感谢司徒的研究,发现了一个大BUG,中断号偏移计算错误,现已修复,打补丁如下:

      diff --git a/src/arch/arm32/mach-t113s3/romdisk/boot/mangopi.json b/src/arch/arm32/mach-t113s3/romdisk/boot/mangopi.json
      index 0f1f34283..4bc02d253 100644
      --- a/src/arch/arm32/mach-t113s3/romdisk/boot/mangopi.json
      +++ b/src/arch/arm32/mach-t113s3/romdisk/boot/mangopi.json
      @@ -386,12 +386,12 @@
       	"reset-t113@0x02001d0c": { "reset-base": 1184, "reset-count": 32 },
       
       	"irq-gic400@0x03020000": { "interrupt-base": 32, "interrupt-count": 224 },
      -	"irq-t113-gpio@0x02000220": { "interrupt-base": 224, "interrupt-count":  8, "interrupt-parent":  101 },
      -	"irq-t113-gpio@0x02000240": { "interrupt-base": 256, "interrupt-count":  8, "interrupt-parent":  103 },
      -	"irq-t113-gpio@0x02000260": { "interrupt-base": 288, "interrupt-count": 23, "interrupt-parent":  105 },
      -	"irq-t113-gpio@0x02000280": { "interrupt-base": 320, "interrupt-count": 14, "interrupt-parent":  107 },
      -	"irq-t113-gpio@0x020002a0": { "interrupt-base": 352, "interrupt-count":  7, "interrupt-parent":  109 },
      -	"irq-t113-gpio@0x020002c0": { "interrupt-base": 384, "interrupt-count": 16, "interrupt-parent":  111 },
      +	"irq-t113-gpio@0x02000220": { "interrupt-base": 256, "interrupt-count":  8, "interrupt-parent":  101 },
      +	"irq-t113-gpio@0x02000240": { "interrupt-base": 288, "interrupt-count":  8, "interrupt-parent":  103 },
      +	"irq-t113-gpio@0x02000260": { "interrupt-base": 320, "interrupt-count": 23, "interrupt-parent":  105 },
      +	"irq-t113-gpio@0x02000280": { "interrupt-base": 352, "interrupt-count": 14, "interrupt-parent":  107 },
      +	"irq-t113-gpio@0x020002a0": { "interrupt-base": 384, "interrupt-count":  7, "interrupt-parent":  109 },
      +	"irq-t113-gpio@0x020002c0": { "interrupt-base": 416, "interrupt-count": 16, "interrupt-parent":  111 },
       
       	"gpio-t113@0x02000030": { "gpio-base":  32, "gpio-count":  8, "interrupt-offset": 256 },
       	"gpio-t113@0x02000060": { "gpio-base":  64, "gpio-count":  8, "interrupt-offset": 288 },
      

      完整补丁见这个链接
      https://github.com/xboot/xboot/commit/4e502b7ad6e4f589832d36a4513de00f0cb8de07

      发布在 爱搞机专区
      T
      tripod9
    • 回复: 全志R128开发板来啦!RISC-V C906 + Arm M33有机结合,支持 Wi-Fi/BT

      R128先跑跑xboot

      █████████████████████████████████
      ██ ▄▄▄▄▄ █ ▀███▀ ▄█▀█ ▄█ ▄▄▄▄▄ ██
      ██ █   █ █ ▀▄█▄▄▀▄▀█▄▀ █ █   █ ██
      ██ █▄▄▄█ █▄   ▄▄▀█▄▀█ ▄█ █▄▄▄█ ██
      ██▄▄▄▄▄▄▄█ █ █▄▀▄█▄▀▄▀▄█▄▄▄▄▄▄▄██
      ███▄▄█▄█▄▄▀█ ▀  ▀ ▀  ███ ▀▄ ▄▄ ██
      ██▀  ▄▄ ▄▄█▄▄ ▀  ▄▄▀▄▀▄█ ▀▄▀▄▀▄██
      ██▄▀▄█▄█▄ ▄▄█▀▄▀  ▀  ███ ██ ██ ██
      ███ ▄▄▄▄▄▄ ▄▄▀▀▄▄█▀▀▄▀▄▀▄▀▄▀▄▀▄██
      ██▄▄█▀▄▄▄ ▄ ▀▀▄▄▄▀▄  ███  █ ██ ██
      ██▄▀▄▄█ ▄▀▀▄▀▄ ▄▀▀▄▀▄▀▄▀▄▀▄▀▄▀▄██
      ██▄██▄█▄▄█▀▀▀▄█ ███  █ ▄▄▄  ██ ██
      ██ ▄▄▄▄▄ █▄ ██▀ ▀▀▄▀▄  █▄█ ▀▄▀▄██
      ██ █   █ █▄▀██▀█▄██  ▀▄ ▄▄  █▀ ██
      ██ █▄▄▄█ █ ▀▀▄▄██▀▄▀▄█  █▀▄▀▄▀▄██
      ██▄▄▄▄▄▄▄███▄▄▄▄▄██▄▄█▄█▄█▄▄█▄▄██
      █████████████████████████████████
             _                   _                     
       _  _ | |___ _____ _____ _| |_                   
      \ \/ /|  _  |  _  |  _  |_   _|  (C) 2007-2023   
       )  ( | |_| | |_| | |_| | | |____JIANJUN.JIANG__ 
      /_/\_\|_____|_____|_____| |_____________________|
      V3.0.0 (May 17 2023 - 23:25:28) - [yuzuki][Yuzuki Based On Allwinner R128 SOC]
      [    0.000020]Probe device 'blk-romdisk.0' with blk-romdisk
      [    0.000800]Probe device 'osc48m' with clk-fixed
      [    0.000810]Probe device 'osc32k' with clk-fixed
      [    0.000820]Probe device 'bus-uart0' with clk-fixed
      [    0.000830]Probe device 'wdg' with clk-fixed
      [    0.000840]Probe device 'uart-16550.0' with uart-16550
      [    0.000850]Probe device 'wdg-r128.0' with wdg-r128
      [    0.000860]Probe device 'console-uart.0' with console-uart
      [    0.000970]mount /private with 'ram' filesystem
      Press any key to stop auto boot:  0.330
      xboot: /#  
      
      发布在 A Series
      T
      tripod9
    • 全志R128裸奔工具XFEL开发计划

      xfel工具已支持具体绝大部分全志芯片,现在计划实现对R128芯片的支持。

      1,读写SRAM(已完成)
      2,执行运行在M33核的payload指令(已完成)
      3,读取R128的SID(已完成)
      4,初始化M33核心的jtag接口,此接口跟调试串口复用(已开发,未测试)
      5,实现reset操作(已完成)
      6,初始化LSPRAM以及HSPSRAM(已完成)
      7, 支持启动C906核心,加载并执行通过write命令写入到RAM中的C906程序
      8, 支持启动DSP核心,加载并执行通过write命令写入到RAM中的DSP程序 (优先级低,估计没手段验证)
      9,支持烧写NOR FLASH

      发布在 A Series
      T
      tripod9
    • 回复: d1s meils烧录导致xfel工具烧写失效

      @tripod9 xfel-windows-v1.3.0.7z 试试这个xfel,看是否解决问题了

      发布在 MR Series
      T
      tripod9
    • 回复: DongshanPI-D1s 烧录tina linux到spinor存储器后,无法通过xfel在编程了

      @tripod9 xfel-windows-v1.3.0.7z 试试这个xfel,看是否解决问题了

      发布在 MR Series
      T
      tripod9
    • 回复: DongshanPI-D1s 烧录tina linux到spinor存储器后,无法通过xfel在编程了

      @qinchangzu https://github.com/xboot/xfel/commit/b49c4897f83a4d3981667b305ea0b3ce0a9eb93f

      发布在 MR Series
      T
      tripod9
    • 回复: DongshanPI-D1s 烧录tina linux到spinor存储器后,无法通过xfel在编程了

      @qinchangzu 打这个补丁,可以帮忙测试下,看是否解决问题了

      diff --git a/spinor.c b/spinor.c
      index 7a30307..8cc6e95 100644
      --- a/spinor.c
      +++ b/spinor.c
      @@ -287,6 +287,85 @@ static inline int spinor_info(struct xfel_ctx_t * ctx, struct spinor_pdata_t * p
       	return 0;
       }
       
      +static inline uint8_t spinor_read_sr3(struct xfel_ctx_t * ctx, struct spinor_pdata_t * pdat)
      +{
      +	uint8_t tx[1];
      +	uint8_t rx[1];
      +
      +	tx[0] = 0x15;
      +	rx[0] = 0x0;
      +	fel_spi_xfer(ctx, pdat->swapbuf, pdat->swaplen, pdat->cmdlen, tx, 1, rx, 1);
      +	return rx[0];
      +}
      +
      +static inline int spinor_global_unlock(struct xfel_ctx_t * ctx, struct spinor_pdata_t * pdat)
      +{
      +	uint8_t cbuf[256];
      +	uint32_t clen = 0;
      +	uint8_t sr3 = spinor_read_sr3(ctx, pdat);
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* write enable */
      +	cbuf[clen++] = SPI_CMD_FAST;
      +	cbuf[clen++] = 1;
      +	cbuf[clen++] = pdat->info.opcode_write_enable;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* global block/sector unlock */
      +	cbuf[clen++] = SPI_CMD_FAST;
      +	cbuf[clen++] = 1;
      +	cbuf[clen++] = 0x98;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* wait busy */
      +	cbuf[clen++] = SPI_CMD_SPINOR_WAIT;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* write enable */
      +	cbuf[clen++] = SPI_CMD_FAST;
      +	cbuf[clen++] = 1;
      +	cbuf[clen++] = pdat->info.opcode_write_enable;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* write status 3 and clear wps bit */
      +	cbuf[clen++] = SPI_CMD_FAST;
      +	cbuf[clen++] = 2;
      +	cbuf[clen++] = 0x11;
      +	cbuf[clen++] = sr3 & ~(0x1 << 4);
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* wait busy */
      +	cbuf[clen++] = SPI_CMD_SPINOR_WAIT;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* end */
      +	cbuf[clen++] = SPI_CMD_END;
      +	if(clen <= pdat->cmdlen)
      +	{
      +		fel_chip_spi_run(ctx, cbuf, clen);
      +		return 1;
      +	}
      +	return 0;
      +}
      +
      +
       static int spinor_helper_init(struct xfel_ctx_t * ctx, struct spinor_pdata_t * pdat)
       {
       	uint8_t cbuf[256];
      @@ -370,6 +449,7 @@ static int spinor_helper_init(struct xfel_ctx_t * ctx, struct spinor_pdata_t * p
       		if(clen <= pdat->cmdlen)
       		{
       			fel_chip_spi_run(ctx, cbuf, clen);
      +			spinor_global_unlock(ctx, pdat);
       			return 1;
       		}
       	}
      
      发布在 MR Series
      T
      tripod9
    • 回复: d1s meils烧录导致xfel工具烧写失效

      打这个补丁,可以帮忙测试下。

      diff --git a/spinor.c b/spinor.c
      index 7a30307..8cc6e95 100644
      --- a/spinor.c
      +++ b/spinor.c
      @@ -287,6 +287,85 @@ static inline int spinor_info(struct xfel_ctx_t * ctx, struct spinor_pdata_t * p
       	return 0;
       }
       
      +static inline uint8_t spinor_read_sr3(struct xfel_ctx_t * ctx, struct spinor_pdata_t * pdat)
      +{
      +	uint8_t tx[1];
      +	uint8_t rx[1];
      +
      +	tx[0] = 0x15;
      +	rx[0] = 0x0;
      +	fel_spi_xfer(ctx, pdat->swapbuf, pdat->swaplen, pdat->cmdlen, tx, 1, rx, 1);
      +	return rx[0];
      +}
      +
      +static inline int spinor_global_unlock(struct xfel_ctx_t * ctx, struct spinor_pdata_t * pdat)
      +{
      +	uint8_t cbuf[256];
      +	uint32_t clen = 0;
      +	uint8_t sr3 = spinor_read_sr3(ctx, pdat);
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* write enable */
      +	cbuf[clen++] = SPI_CMD_FAST;
      +	cbuf[clen++] = 1;
      +	cbuf[clen++] = pdat->info.opcode_write_enable;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* global block/sector unlock */
      +	cbuf[clen++] = SPI_CMD_FAST;
      +	cbuf[clen++] = 1;
      +	cbuf[clen++] = 0x98;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* wait busy */
      +	cbuf[clen++] = SPI_CMD_SPINOR_WAIT;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* write enable */
      +	cbuf[clen++] = SPI_CMD_FAST;
      +	cbuf[clen++] = 1;
      +	cbuf[clen++] = pdat->info.opcode_write_enable;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* write status 3 and clear wps bit */
      +	cbuf[clen++] = SPI_CMD_FAST;
      +	cbuf[clen++] = 2;
      +	cbuf[clen++] = 0x11;
      +	cbuf[clen++] = sr3 & ~(0x1 << 4);
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* spi select */
      +	cbuf[clen++] = SPI_CMD_SELECT;
      +	/* wait busy */
      +	cbuf[clen++] = SPI_CMD_SPINOR_WAIT;
      +	/* spi deselect */
      +	cbuf[clen++] = SPI_CMD_DESELECT;
      +
      +	/* end */
      +	cbuf[clen++] = SPI_CMD_END;
      +	if(clen <= pdat->cmdlen)
      +	{
      +		fel_chip_spi_run(ctx, cbuf, clen);
      +		return 1;
      +	}
      +	return 0;
      +}
      +
      +
       static int spinor_helper_init(struct xfel_ctx_t * ctx, struct spinor_pdata_t * pdat)
       {
       	uint8_t cbuf[256];
      @@ -370,6 +449,7 @@ static int spinor_helper_init(struct xfel_ctx_t * ctx, struct spinor_pdata_t * p
       		if(clen <= pdat->cmdlen)
       		{
       			fel_chip_spi_run(ctx, cbuf, clen);
      +			spinor_global_unlock(ctx, pdat);
       			return 1;
       		}
       	}
      
      发布在 MR Series
      T
      tripod9
    • 回复: d1s meils烧录导致xfel工具烧写失效

      @tripod9 spi nor flash的写保护功能,从各种现象推测得出,保护位应该是持久化的,即使断电,重启,都无法改变状态,只要被锁定了,只有被解锁才能再次写入。这个要求也能解释你为何只能跑一次某些rtos,这个rtos肯定自作主张的锁定了spi nor flash,只要运行一次,就被搞了。我手上没有条件试验这个问题,可以在xfel加解锁代码,彻底解决此类问题。

      发布在 MR Series
      T
      tripod9