rt-thread: [Bug] Not compiled for Allwinner D1H.

RT-Thread Version

master, v5.1.0, v5.0.2

Hardware Type/Architectures

Sipeed Lichee RV board

Develop Toolchain

riscv64-linux-musleabi_for_x86_64-pc-linux-gnu

Describe the bug

I like this project but can’t build for Allwinner D1H on Sipeed Lichee RV board

I use compiler https://github.com/RT-Thread/toolchains-ci/releases/download/v1.7/riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2

I was trying:

On Master or v5.1.0:

  1. bsp/allwinner/d1/ - not compiled looks outdated
board/board.c:45:5: error: unknown type name 'rt_mmu_info'
   45 |     rt_mmu_info mmu_info;
      |     ^~~~~~~~~~~
  1. bsp/allwinner/d1s/ - not compiled
/mnt/hgfs/allwinner_d1/rt-thread/components/dfs/dfs_v2/filesystems/devfs/devfs.c:68:30: error: 'struct rt_device' has no member named 'ops'; did you mean 'fops'?
   68 |             else if (device->ops && file->vnode->ref_count == 1)
      |                              ^~~
      |                              fops

On v5.0.2:

  1. bsp/allwinner/d1/ - not compiled looks outdated
board/board.c:45:5: error: unknown type name 'rt_mmu_info'
   45 |     rt_mmu_info mmu_info;
      |     ^~~~~~~~~~~
  1. bsp/allwinner/d1s/ - compiled, but no output to UART.

After I forked v5.0.2 and added:

After this changes board started and shown out to UART. But loading frosen in rt_thread_mdelay function in files

  • bsp/allwinner/libraries/drivers/sdmmc/drv_sdmmc.c
  • bsp/allwinner/libraries/sunxi-hal/include/hal/sdmmc/osal/RT-Thread/_os_time.h

Chnage it to rt_hw_us_delay and is finnaly looks like works:

 \ | /
- RT -     Thread Smart Operating System
 / | \     5.0.2 build Jun  9 2024 17:11:05
 2006 - 2022 Copyright by RT-Thread team
hal_sdc_create 0
card_detect insert
Initial card success. capacity :15200MB
sdmmc bytes_per_secotr:200, sector count:1db0000
not found partition of mbr, construct sd0 at offset 8M, size:0xffffffffb5800000
[D/FAL] (fal_flash_init:47) Flash device |                  sdcard0 | addr: 0x00000000 | len: 0xb6000000 | blk_size: 0x00000200 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name       | flash_dev |   offset   |    length  |
[I/FAL] -------------------------------------------------------------
[I/FAL] | download   | sdcard0   | 0x00800000 | 0x00800000 |
[I/FAL] | easyflash  | sdcard0   | 0x01000000 | 0x00100000 |
[I/FAL] | filesystem | sdcard0   | 0x01100000 | 0x00c00000 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer initialize success.
Hello RISC-V
msh />Mount "sd0p0" on "/" fail
msh />
msh />

This my changes https://github.com/RT-Thread/rt-thread/commit/ec2c0f10894bca703354e7e1d4c23fbaed5a034b

Please could you make it compiled properly in master and figure out what happened with SDMMC driver?

Other additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

Hi, @polarvid,

If you remember our conversation about RTT and D1H. Sorry I comment in closed issue.

“And I read your notes which is incredibly insightful to me. They can be edited and posted to the forum to benefit others in the community if you would love to 😃”

I create series of articles covering the knowledge and experience I’ve gained: https://github.com/ylyamin/RT-Thread-on-Allwinner-D1H/blob/master/documentation/D1_0_index.md

And share this in forum: https://club.rt-thread.org/ask/article/b66f7db40179a81b.html, https://club.rt-thread.io/ask/article/18.html

However with my D1H project - I still stuck with the USB driver. It can detect device connections, but communication has not started.

@ylyamin

And I read your notes on https://github.com/ylyamin/RT-Thread-on-Allwinner-D1H/blob/master/documentation/Code_changes.md, which is incredibly insightful to me. They can be edited and posted to the forum to benefit others in the community if you would love to 😃

Hi 😄@ylyamin

I tested the bringup and filesystem in sd on my D1s board, with the branch forked from the latest kernel (on #9142). And to summarize, besides the compiling failure, the sd driver works just fine with me.

cee1656f8e4fb92d3dfce461e8e886c2

My log is here:


 \ | /
- RT -     Thread Smart Operating System
 / | \     5.2.0 build Jul  6 2024 13:41:01
 2006 - 2024 Copyright by RT-Thread team
hal_sdc_create 0
card_detect insert
Initial card success. capacity :121MB
sdmmc bytes_per_secotr:200, sector count:3c800
found part[0], begin: 8388608, size: 90.0MB
found partition:sd0 of mbr at offset 0x0000000000004000, size:0x000000000002d000
found part[1], begin: 102760448, size: 23.0MB
found partition:sd1 of mbr at offset 0x0000000000031000, size:0x000000000000b800
hal_sdc_create 1
card_detect insert
Initial card success. capacity :29818MB
sdmmc bytes_per_secotr:200, sector count:3a3d000
found part[0], begin: 4194304, size: 256.0MB
found partition:sd0 of mbr at offset 0x0000000000002000, size:0x0000000000080000
found part[1], begin: 272629760, size: 1.716GB
found partition:sd1 of mbr at offset 0x0000000000082000, size:0x0000000000366000
found part[2], begin: 2097152000, size: 27.169GB
part_count1:2
found partition:sd2 of mbr at offset 0x00000000003e8000, size:0x0000000003654800
[D/FAL] (fal_flash_init:47) Flash device |                  sdcard0 | addr: 0x00000000 | len: 0x07900000 | blk_size: 0x00000200 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name       | flash_dev |   offset   |    length  |
[I/FAL] -------------------------------------------------------------
[I/FAL] | download   | sdcard0   | 0x00800000 | 0x00800000 |
[I/FAL] | easyflash  | sdcard0   | 0x01000000 | 0x00100000 |
[I/FAL] | filesystem | sdcard0   | 0x01100000 | 0x00c00000 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer initialize success.
Hello RISC-V
msh />[W/time] Cannot find a RTC device!
Mount "sd0p0" on "/" success
[E/DFS.fs] mount point (/) already mounted!
Mount "sd0p1" on "/data" fail
hal_sdc_create 1
[os E] OS_MutexCreate():42, handle 0x4055c040
card_detect insert
card_detect not eixst
sdmmc bytes_per_secotr:200, sector count:3a3d000
found part[0], begin: 4194304, size: 256.0MB
found partition:sd0 of mbr at offset 0x0000000000002000, size:0x0000000000080000
found part[1], begin: 272629760, size: 1.716GB
found partition:sd1 of mbr at offset 0x0000000000082000, size:0x0000000000366000
found part[2], begin: 2097152000, size: 27.169GB
part_count1:2
found partition:sd2 of mbr at offset 0x00000000003e8000, size:0x0000000003654800
Mount "sd1p0" on "/mnt" success

msh />
msh />ls
Directory /:
system              <DIR>
download            <DIR>
mnt                 <DIR>
data                <DIR>
entries.log         110303
smart-ksymtbl.txt   154545
dev                 <DIR>
msh />
msh />cat smart-ksymtbl.txt
0x00000000404033e6 hal_hw_pin_init
0x0000000040403410 hal_pin_irq_enable
0x0000000040403496 hal_pin_detach_irq
0x000000004040350e hal_pin_attach_irq
0x00000000404035aa hal_pin_read
0x00000000404035d6 hal_pin_write
0x00000000404035f4 hal_pin_mode
0x0000000040403688 _uart_putc
0x00000000404036cc _uart_getc

Thank you for updating me on your progress. I’m truly impressed by the amount of work you’ve accomplished👍

I think bsp/allwinner/d1/ folder - looks very old and I believe it can be deleted, bsp/allwinner/d1s/ can be one folder for D1s and D1H

Agree

Host driver initiated but the thread is suspended and nothing happens.

you could try the backtrace() to find out where thread suspended or dump more status on it for debugging

Besides, please feel free to share any details or updates whenever you can. And I do believe that will be valuable to any others who are interested in it.

Hi, @polarvid It would be great if you could fix the compiling of bsp/allwinner/d1s/ on Master, to keep D1 BSP updated in Master. Thank you for interest. (I think bsp/allwinner/d1/ folder - looks very old and I believe it can be deleted, bsp/allwinner/d1s/ can be one folder for D1s and D1H)

About sdhci yes looks like needs experts, but with my dirty fix it works, I can do PR. Want to say actually right now I achieved working LCD RGB and MIPI DCI Display with D1H and RTT, but completely stuck on how to up USB Host function. Host driver initiated but the thread is suspended and nothing happens.