-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4423d02
Showing
440 changed files
with
62,253 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# cargo config | ||
os/Cargo.lock | ||
user/Cargo.lock | ||
os/src/linker.ld | ||
os/new_cmd | ||
|
||
# IDE config | ||
.idea/ | ||
.vscode/ | ||
|
||
# kernel build | ||
os/target/ | ||
|
||
# user programs build | ||
user/riscv64/ | ||
user/target/ | ||
|
||
# Gathering place of images | ||
easy-fs-fuse/ | ||
|
||
# a copy of user programs debug build in "user/target/*"(for gdb) | ||
os/user/ | ||
|
||
#gdb script | ||
os/gdb_script | ||
|
||
# developing, should be invisible in main branch | ||
os/src/fs/fatfs/* | ||
|
||
# unsorted | ||
os/output.txt | ||
os/logs/ | ||
os/src/link_app.S | ||
os/last-* | ||
tools/ | ||
user/.ccls-cache/ | ||
|
||
# Doc .org & .tex | ||
Doc/**/*.org | ||
Doc/**/*.tex | ||
Doc/**/*.jpg | ||
Doc/**/*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# 2K1000上板过程问题 | ||
|
||
## UART地址设置 | ||
|
||
UART0寄存器(映射)基址:0x8000_0000_1fe2_0000 | ||
|
||
出处:U-Boot源码解析(龙芯版)章节5.3.2。指向U-Boot源码:u-boot-2022.04-2k1000 | ||
```asm | ||
/arch/loongarch/mach-loongson/ls2k100/lowlevel_init.S:394 | ||
#define UART_REF_CLK 125000000 | ||
#define UART_DIV_HI (((UART_REF_CLK + (115200*8)) / (115200*16)) >> 8) | ||
#define UART_DIV_LO (((UART_REF_CLK + (115200*8)) / (115200*16)) & 0xff) | ||
ENTRY(init_serial) | ||
or a4, ra, zero /*返回地址写入a4*/ | ||
li.d a0, CONSOLE_BASE_ADDR | ||
/*UART0寄存器(映射)基址:0x8000_0000_1fe2_0000*/ | ||
/*/include/configs/loongson_2k1000.h*/ | ||
/*/arch/loongarch/mach-loongson/include/mach/ls2k1000/ls2k1000.h*/ | ||
``` | ||
|
||
## NAND_BASE与DMA_ADDR | ||
|
||
NAND_BASE: usize = 0x1fe2_6000 | HIGH_BASE_EIGHT; | ||
DMA_ADDR: usize = 0x1fe0_0c00 | HIGH_BASE_EIGHT; | ||
|
||
出处:U-Boot源码解析(龙芯版)章节9.5.1。 | ||
|
||
通过搜索NAND找到的,在U-Boot源码中也得到了验证,观察其中的reg项可以找到地址。 | ||
|
||
在2K500: | ||
``` | ||
arch/loongarch/dts/ls2k500.dtsi | ||
577行: | ||
nand: nand-controller@1ff58000 { | ||
compatible = "loongson,ls-nand"; | ||
reg = <0 0x1ff58000 0 0x4000>; | ||
pinctrl-names = "default"; | ||
pinctrl-0 = <&nand_pins>; | ||
dmas = <&dma0 0>; | ||
dma-names = "nand-rw"; | ||
nand-cs-origin = <0>; | ||
nand-ecc-algo = "bch"; // "bch", "none" | ||
nand-ecc-strength = <4>; | ||
status = "disabled"; | ||
}; | ||
342行: | ||
dma0: dma@1fe10c00 { | ||
compatible = "loongson,ls2k500-dma"; | ||
reg = <0 0x1fe10c00 0 0x4>; | ||
dma-cfg = <&dmacfg 0 LS_DMA_OWNER_NAND>; // arg[0]: channel id arg[1]: dma owner | ||
#dma-cells = <1>; | ||
dma-channels = <1>; | ||
dma-requests = <1>; | ||
}; | ||
``` | ||
在2K1000: | ||
``` | ||
arch/loongarch/dts/ls2k1000.dtsi | ||
505行: | ||
nand: nand-controller@1fe26000 { | ||
compatible = "loongson,ls-nand"; | ||
reg = <0 0x1fe26000 0 0x44>; | ||
pinctrl-names = "default"; | ||
pinctrl-0 = <&pinmux_nand_nand>; | ||
dmas = <&dma0 0>; | ||
dma-names = "nand-rw"; | ||
nand-cs-origin = <2>; | ||
nand-ecc-algo = "bch"; // "bch", "none" | ||
nand-ecc-strength = <4>; | ||
status = "disabled"; | ||
}; | ||
379行: | ||
dma0: dma@1fe00c00 { | ||
compatible = "loongson,ls2k1000-dma"; | ||
reg = <0 0x1fe00c00 0 0x8>; | ||
dma-cfg = <&dmacfg 0 LS_DMA_OWNER_NAND>; // arg[0]: channel id arg[1]: dma owner | ||
#dma-cells = <1>; | ||
dma-channels = <1>; | ||
dma-requests = <1>; | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
1. version `GLIBC_2.34‘ not found 报错 | ||
|
||
检查版本: | ||
``` shell | ||
strings /lib/x86_64-linux-gnu/libc.so.6 |grep GLIBC_ | ||
``` | ||
显示结果,最高只到GLIBC_2.30,由于使用的系统为ubuntu20.04,已经升级到了系统版本的最高版本了。 | ||
|
||
解决方案:添加一个高级版本系统的源,直接升级libc6。 | ||
|
||
编辑源:在/etc/apt/sources.list文件添加一行: | ||
``` | ||
deb http://th.archive.ubuntu.com/ubuntu jammy main | ||
``` | ||
|
||
运行升级: | ||
``` shell | ||
sudo apt update | ||
sudo apt install libc6 | ||
``` | ||
|
||
参考:https://blog.csdn.net/huazhang_001/article/details/128828999 | ||
|
||
2. /opt/cross-my/libexec/gcc/loongarch64-unknown-linux-gnu/12.2.0/cc1: error while loading shared libraries: libisl.so.23: cannot open shared object file: No such file or directory | ||
|
||
``` shell | ||
sudo apt-get install libisl-dev | ||
``` | ||
|
||
参考:https://stackoverflow.com/questions/33734143/gcc-unable-to-find-shared-library-libisl-so | ||
|
||
3. make: ./la_fat: Command not found | ||
|
||
因为os/la_fat文件开头为#!/usr/bin/expect -f。需要安装expect: | ||
``` shell | ||
sudo apt-get install expect | ||
``` | ||
4. error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory | ||
``` shell | ||
sudo apt-get install openssl | ||
``` | ||
|
||
5. unknown feature | ||
|
||
注释掉: | ||
```rust | ||
// #![feature(btree_drain_filter)] | ||
// #![feature(drain_filter)] | ||
``` | ||
|
||
`rustc` version is `rustc 1.73.0-nightly (32303b219 2023-07-29)` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
1. No module named'serial' | ||
``` | ||
Error while finding module specification for 'serial.tools.list_ports' (ModuleNotFoundError: No module named'serial')` | ||
``` | ||
```bash | ||
pip install pyserial | ||
``` | ||
2. Permission denied: '/dev/ttyUSB0' | ||
```bash | ||
sudo chmod -R 777 /dev/ttyUSB0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# LAQEMU调试 | ||
|
||
## 环境准备 | ||
|
||
### LA GDB安装 | ||
|
||
参考:https://blog.csdn.net/greenmoss/article/details/127800221 | ||
|
||
gdb 12.1版本已经支持LoongArch架构 | ||
|
||
1. 下载安装包 | ||
```bash | ||
wget http://ftp.gnu.org/gnu/gdb/gdb-12.1.tar.gz | ||
``` | ||
若下载过慢,可以在windows系统下直接访问ftp链接通过浏览器下载,拷贝到Ubuntu中。 | ||
|
||
2. 解压安装包 | ||
```bash | ||
tar -zxvf gdb-12.1.tar.gz | ||
``` | ||
|
||
3. 预编译 | ||
```bash | ||
cd gdb-12.1 # 进入文件夹gdb-12.1 | ||
mkdir build # 建立文件夹build | ||
cd build # 进入文件夹build | ||
../configure --prefix=/usr --target=loongarch64-unknown-linux-gnu | ||
``` | ||
|
||
4. 编译 | ||
```bash | ||
make | ||
make install | ||
``` | ||
上述两句均需执行,可能需要较长时间,请耐心等待。 | ||
|
||
在`make install`时若出现权限不足的报错,尝试使用`sudo make install`。 | ||
|
||
成功之后: | ||
``` | ||
See any operating system documentation about shared libraries for | ||
more information, such as the ld(1) and ld.so(8) manual pages. | ||
---------------------------------------------------------------------- | ||
/usr/bin/mkdir -p '/usr/include' | ||
/usr/bin/install -c -m 644 ../../libctf/../include/ctf.h ../../libctf/../include/ctf-api.h '/usr/include' | ||
/usr/bin/mkdir -p '/usr/share/info' | ||
/usr/bin/install -c -m 644 ../../libctf/doc/ctf-spec.info '/usr/share/info' | ||
make[3]: 离开目录“/home/loongson/gdb-12.1/build/libctf” | ||
make[2]: 离开目录“/home/loongson/gdb-12.1/build/libctf” | ||
make[1]: 对“install-target”无需做任何事。 | ||
make[1]: 离开目录“/home/loongson/gdb-12.1/build” | ||
``` | ||
|
||
5. 运行 | ||
```bash | ||
cd /gdb | ||
./gdb | ||
``` | ||
检查升级后的版本: | ||
``` | ||
GNU gdb (GDB) 12.1 | ||
Copyright (C) 2022 Free Software Foundation, Inc. | ||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> | ||
This is free software: you are free to change and redistribute it. | ||
There is NO WARRANTY, to the extent permitted by law. | ||
Type "show copying" and "show warranty" for details. | ||
This GDB was configured as "loongarch64-unknown-linux-gnu". | ||
Type "show configuration" for configuration details. | ||
For bug reporting instructions, please see: | ||
<https://www.gnu.org/software/gdb/bugs/>. | ||
Find the GDB manual and other documentation resources online at: | ||
<http://www.gnu.org/software/gdb/documentation/>. | ||
For help, type "help". | ||
Type "apropos word" to search for commands related to "word". | ||
``` | ||
注意检查,第一行GDB版本为12.1,第七行GDB的config为`loongarch64-unknown-linux-gnu`。 | ||
|
||
### VScode调试配置 | ||
|
||
安装插件 C/C++ ,在工作区下面的 .vscode 目录下新建 launch.json 文件,并写入如下内容: | ||
|
||
```json | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"name": "Attach to gdbserver", | ||
"program": "${workspaceFolder}/os/target/loongarch64-unknown-linux-gnu/debug/os", | ||
"miDebuggerServerAddress": "localhost:1234", | ||
"miDebuggerPath": "path/to/gdb-12.1/build/gdb/gdb", | ||
"cwd": "${workspaceRoot}/os", | ||
} | ||
] | ||
} | ||
``` | ||
|
||
注意修改`miDebuggerPath`中的`path/to`为自己电脑上的路径。 | ||
|
||
## 开始调试 | ||
|
||
在`os`目录下输入`make gdb`命令,回车,进入GDB连接等待。 | ||
|
||
> 如果内核代码已被修改,通过`make new-gdb`命令,会先进行`build`,再进行`GDB`连接等待。 | ||
在内核代码中打上断点,再点击VScode面板中的开始调试(快捷键为F5),之后可以看到内核继续运行,停在所打断点处。 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.