https://github.com/isometimes/rpi4-osdev
AArch64 bare-metal target (aarch64-none-elf)
下载工具链
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
gdb在ubuntu2204上无法使用:安装python3.8后解决。
https://community.arm.com/support-forums/f/compilers-and-libraries-forum/52805/gcc-arm-11-2-2022-02-x86_64-arm-none-eabi-gdb-fails-on-ubuntu/178088#178088)
https://community.arm.com/support-forums/f/compilers-and-libraries-forum/53996/arm-gnu-toolchain-12-2-rel1-x86_64-arm-none-eabi-gdb-fails-on-ubuntu-22-04
https://community.arm.com/support-forums/f/compilers-and-libraries-forum/55079/aarch64-none-linux-gnu-gdb-version-12-3-cannot-run-with-python-errors
编译和配置u-boot
https://zhuanlan.zhihu.com/p/92689086
sudo apt install gcc-aarch64-linux-gnu
git clone https://github.com/u-boot/u-boot
cd u-boot
# 使用刚才下载的交叉工具链
export CROSS_COMPILE=aarch64-linux-gnu-
make distclean
make rpi_4_defconfig
make -j4
设置u-boot ip地址
setenv ipaddr 192.168.1.2
setenv netmask 255.255.255.0
setenv serverip 192.168.1.1
ping 192.168.1.1
成果ping通 则返回:
U-Boot> ping 192.168.1.1
Using ethernet@7d580000 device
host 192.168.1.1 is alive
保存saveenv
启动
tftp 0x80000 kernel8.img
go 0x80000
Auxiliaries(AUX)辅助设备
The BCM2711 device has three Auxiliary peripherals: One mini UART
(UART1) and two SPI masters (SPI1 & SPI2). These three peripherals are
grouped together as they share the same area in the peripheral
register map and they share a common interrupt. Also all three are
controlled by the Auxiliary enable register. The Auxiliary register
base address is 0x7e215000.
BCM2711 具有三个辅助外设:一个迷你 UART (UART1) 和两个 SPI 主设备(SPI1 和 SPI2)。 这三个外设被分组在一起,因为它们在外设寄存器映射中共享相同的区域并且共享公共中断。 此外,所有三个都由辅助使能寄存器控制。 辅助寄存器基址是0x7e215000。
一些组成原理相关知识回顾
https://www.cnblogs.com/yikoulinux/p/16364948.html
关于此文章,一个显而易见的问题:
此处单位用 bit 不太妥当,应当使用 byte。
https://www.zhihu.com/question/22471643
64位CPU,数据总线一定是64位,地址总线不是64位。
一般处理器多少位是指的寄存器的长度,当然数据线需要与之相同,地址线则不需要与之相等的。
串口
串口的中断和轮询:
https://blog.csdn.net/QWERTYzxw/article/details/125304956
汇编实现串口:
https://blog.csdn.net/dai_xiangjun/article/details/118990467
debug
在vscode gdb中查看 FR Register:
-exec x/1th 0xFE201418