-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
port to milkv duo and lpi4a #2
base: riscv
Are you sure you want to change the base?
Conversation
你好, 在验证期间遇到一些问题:
|
你好, 此img由同一份源码在最新的debian unstableg系统中编译而得。
目前工具链等只测过debian unstable更新到最新后再apt-get install riscv64-linux-gnu-gcc genimage
建议测试发行版系统自带
这个问题大概率由于所用工具链产生img大小不够优化,开发时为加速开发把FSSIZE改小,可以尝试如上一样的编译环境(debian unstable最新)和如下的补丁恢复默认的FSSIZE:
|
PS: 为了通用性,本porting理论上不依赖toolchain,但只测过发行版中apt安装的toolchain和genimage,各toolchain生成img大小有差异,而改动过的FSSIZE恰好卡线,不妨打上上述补丁恢复默认img大小再编译测试 |
研究了下比较奇怪,目前FSSIZE是有空间的足够, 故而上面的补丁不用测试。我测试用的gcc版本如下, 能否用同样的gcc版本测试下呢?
|
非常奇怪,刚本地测试了duo sdk自带的toolchain和genimage,debian的gcc12都不能重现你的这个问题,包括FSSIZE=1500, FSSIZE=2000等各种组合都不能重现,checking。。。 |
发现问题:我本地开发仓库打补丁到rvspoc仓库时有个改动missing,麻烦试下如下改动:
|
1 similar comment
发现问题:我本地开发仓库打补丁到rvspoc仓库时有个改动missing,麻烦试下如下改动:
|
感谢,恢复默认的 FSSIZE 之后,我遇到的问题解决了 |
好的,我这边加上了,遇到的问题也解决了 |
尊敬的参赛选手,您好。 |
验证结果表格内容确认无误。不过下面的验证步骤有些编辑原因比如把adc log放在启动log中,adc下面的写的是pwm的输出 ;) |
xv6 ports to real riscv platforms 18:56:52 [57/9793]
port xv6 to Sophgo CV1800B platforms such as Milkv Duo, Sophgo SG00X platforms
such as Milkv-duo256, milkv Duo-S and T-HEAD TH1520 platforms such as Sipeed
Lichee Pi 4A. While Milkv Duo holds the highest priority porting effort.
Currently, peripherals such as uart, gpio, adc, pwm, i2c and spi are well
supported for milkv duo. Qemu and TH1520 only support uart. I also wrote
some userspace tools to demo the peripherals usage. Check below.
Build for milkv duo:
./build_for_milkv_duo.sh
the built img will be duo-imgtools/milkv-duo_sdcard.img, then burn it
to tf card on PC:
dd if=milkv-duo_sdcard.img of=/dev/sdX (take care "sdX" must be the
tfcard appeared on your PC, you have been warned!)
*gpio demo:
$ ./blink 5 //will link 5 loops
*adc demo:
ADC1 is used. Connect GP26 to GND
$ ./adc
$ adc raw: 0
then connect GP26 to 3v3(out).
$ ./adc
$ adc raw: 4095
*pwm demo:
PWM6 is used for demo. Connect a Light Emitting Diode(don't forget
proper resistance, I use a 100 ohm) to GP5, another peer connects to GND.
$ ./pwm 1000000 900000
$ ./pwm 1000000 800000
$ ./pwm 1000000 600000
$ ./pwm 1000000 500000
$ ./pwm 1000000 300000
$ ./pwm 1000000 200000
$ ./pwm 1000000 100000
and so on. The Diode light changes each time you modify the duty cycles...
*i2c demo: 18:56:52 [16/9793]
I2C0 is used for demo. I used max30102 sensor for demo. If you use different
I2C device, check the device manual for read and write details.
Connect GP0 to its SCL pin and GP1 to its SDA pin, don't forget GND and
VCC(connect to 3V3(out)
$ ./i2c 0x57 0xff
$ 0x15
$ ./i2c 0x57 0x21 1
$ ./i2c 0x57 0x1f
0xF
$ ./i2c 0x57 0x20
0x3
The integer temperature is 15, frac temperature is 0x3, so the tempearture
is about 15.19 centigrade. (plz check max30102 TRM for details)
*spi demo:
SPI2 is used for demo. I will demo external spi loop back test, this is
simliar as the spidev_test under linux. The demo will print the received
contents.
$ ./spi
$ 0 0 0 0 0 0 0 0 ...
Then connect GP7 and GP8
$ ./spi
$ 1 2 3 4 5 6 7 8 ...
Build for qemu:
git checkout kernel/config.h
make
make kernel/kernel.bin
Build for TH1520:
cp kernel/config.h.th1520 kernel/config.h
make
make kernel/kernel.bin
Build for SG200X:
Just replace the fip.bin then build as milkv duo ;)