Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 80 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,7 @@ axsync = { path = "modules/axsync" }
axtask = { path = "modules/axtask" }
axdma = { path = "modules/axdma" }

allocator = { git = "https://github.com/arceos-org/allocator.git", tag = "v0.1.1" }

[profile.release]
lto = true
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ APP_NAME := $(shell basename $(APP))
LD_SCRIPT := $(TARGET_DIR)/$(TARGET)/$(MODE)/linker_$(PLAT_NAME).lds
OUT_ELF := $(OUT_DIR)/$(APP_NAME)_$(PLAT_NAME).elf
OUT_BIN := $(OUT_DIR)/$(APP_NAME)_$(PLAT_NAME).bin
OUT_ASM := $(OUT_DIR)/$(APP_NAME)_$(PLAT_NAME).asm

all: build

Expand All @@ -142,6 +143,8 @@ ifeq ($(PLAT_NAME), aarch64-raspi4)
include scripts/make/raspi4.mk
else ifeq ($(PLAT_NAME), aarch64-bsta1000b)
include scripts/make/bsta1000b-fada.mk
else ifeq ($(PLATFORM_NAME), aarch64-rk3588j)
include scripts/make/rk3588.mk
endif

defconfig: _axconfig-gen
Expand All @@ -150,7 +153,7 @@ defconfig: _axconfig-gen
oldconfig: _axconfig-gen
$(call oldconfig)

build: $(OUT_DIR) $(OUT_BIN)
build: $(OUT_DIR) $(OUT_BIN) $(OUT_ASM)

disasm:
$(OBJDUMP) $(OUT_ELF) | less
Expand Down
3 changes: 3 additions & 0 deletions api/axfeat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ driver-ramdisk = ["axdriver?/ramdisk", "axfs?/use-ramdisk"]
driver-ixgbe = ["axdriver?/ixgbe"]
driver-bcm2835-sdhci = ["axdriver?/bcm2835-sdhci"]

#Hypervisor support
hv = ["axhal/hv"]

# Logging
log-level-off = ["axlog/log-level-off"]
log-level-error = ["axlog/log-level-error"]
Expand Down
68 changes: 68 additions & 0 deletions configs/platforms/aarch64-rk3588j.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Architecture identifier.
arch = "aarch64"
# Platform identifier.
platform = "aarch64-rk3588j"
# Platform family.
family = "aarch64-rk3588j"

# Base address of the whole physical memory.
phys-memory-base = "0x20_0000"
# Size of the whole physical memory.
phys-memory-size = "0x800_0000" # 128M
# Base physical address of the kernel image.
kernel-base-paddr = "0x48_0000"
# Base virtual address of the kernel image.
kernel-base-vaddr = "0x0000_0000_0048_0000"
# Linear mapping offset, for quick conversions between physical and virtual
# addresses.
phys-virt-offset = "0xffff_0000_0000_0000"
# Kernel address space base.
kernel-aspace-base = "0xffff_0000_0000_0000"
# Kernel address space size.
kernel-aspace-size = "0x0000_ffff_ffff_f000"
# MMIO regions with format (`base_paddr`, `size`).
mmio-regions = [
# ["0x0900_0000", "0x1000"], # PL011 UART
# ["0x0800_0000", "0x5_0000"], # GICv2 with Virtualization (GICV@0x0803_0000, GICH@0x0804_0000)
# ["0x0a00_0000", "0x4000"], # VirtIO
# ["0x1000_0000", "0x2eff_0000"], # PCI memory ranges (ranges 1: 32-bit MMIO space)
# ["0x40_1000_0000", "0x1000_0000"], # PCI config space
["0xfeb50000", "0x1000"], # uart8250 UART0
["0xfe600000", "0x10000"], # gic-v3 gicd
["0xfe680000", "0x100000"], # gic-v3 gicr
["0xa41000000", "0x400000"],
["0xa40c00000", "0x400000"],
["0xf4000000","0x1000000"],
["0xf3000000","0x1000000"],
]
# VirtIO MMIO regions with format (`base_paddr`, `size`).
virtio-mmio-regions = []

# Base physical address of the PCIe ECAM space.
pci-ecam-base = "0xf4000000"
# End PCI bus number (`bus-range` property in device tree).
pci-bus-end = "0xff"
# PCI device memory ranges (`ranges` property in device tree).
pci-ranges = []
# UART Address
uart-paddr = "0xfeb5_0000"
uart-irq = "0x14d"

# GICC Address
gicd-paddr = "0xfe600000"
# GICR Address
gicc-paddr = "0xfe680000"
gicr-paddr = "0xfe680000"

# PSCI
psci-method = "smc"

# pl031@9010000 {
# clock-names = "apb_pclk";
# clocks = <0x8000>;
# interrupts = <0x00 0x02 0x04>;
# reg = <0x00 0x9010000 0x00 0x1000>;
# compatible = "arm,pl031\0arm,primecell";
# };
# RTC (PL031) Address
# rtc-paddr = "0x901_0000"
48 changes: 48 additions & 0 deletions configs/platforms/x86_64-qemu-linux.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Architecture identifier.
arch = "x86_64" # str
# Platform identifier.
platform = "x86_64-qemu-linux" # str

#
# Platform configs
#
[plat]
# Platform family.
family = "x86-linux" # str

# Base address of the whole physical memory.
phys-memory-base = "0x4000_0000" # uint
# Size of the whole physical memory. (# 1G)
phys-memory-size = "0x4000_0000" # uint
# Base physical address of the kernel image.
kernel-base-paddr = "0x4000_0000" # uint
# Base virtual address of the kernel image.
kernel-base-vaddr = "0xffff_ff00_0000_0000" # uint
# Linear mapping offset, for quick conversions between physical and virtual
# addresses. (# kernel-base-vaddr - phys-memory-base)
phys-virt-offset = "0xffff_feff_c000_0000" # uint

#
# Device specifications
#
[devices]
# MMIO regions with format (`base_paddr`, `size`).
mmio-regions = [
[0xb000_0000, 0x1000_0000], # PCI config space
[0xfe00_0000, 0xc0_0000], # PCI devices
[0xfec0_0000, 0x1000], # IO APIC
[0xfed0_0000, 0x1000], # HPET
[0xfee0_0000, 0x1000], # Local APIC
[0x380000000000, 0x4000] # PCI devices
] # [(uint, uint)]
# VirtIO MMIO regions with format (`base_paddr`, `size`).
virtio-mmio-regions = [] # [(uint, uint)]
# Base physical address of the PCIe ECAM space (should read from ACPI 'MCFG' table).
pci-ecam-base = 0xb000_0000 # uint
# End PCI bus number.
pci-bus-end = 0xff # uint
# PCI device memory ranges (not used on x86).
pci-ranges = [] # [(uint, uint)]

# Timer interrupt frequencyin Hz. (4.0GHz)
timer-frequency = 4_000_000_000 # uint
1 change: 1 addition & 0 deletions configs/platforms/x86_64-qemu-q35.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ mmio-regions = [
[0xfec0_0000, 0x1000], # IO APIC
[0xfed0_0000, 0x1000], # HPET
[0xfee0_0000, 0x1000], # Local APIC
[0x380000000000, 0x4000] # PCI devices
] # [(uint, uint)]
# VirtIO MMIO regions with format (`base_paddr`, `size`).
virtio-mmio-regions = [] # [(uint, uint)]
Expand Down
Binary file added doc/figures/RKDevTool3.3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions doc/platform_rk3588.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# How to run ArceOS on rk3588

1. Use Command `make ARCH=aarch64 PLATFORM=aarch64-rk3588j A=$(pwd)/examples/helloworld kernel` to build the kernel image `boot.img`.
2. Download the [RKDevTool](https://download.t-firefly.com/product/Board/RK3588/Tool/Window/RKDevTool_Release_v3.31.zip).
>This tool has only been tested on [Pji's](https://www.pji.net.cn/) Electronic Control Unit of RK3588. Other RK3588 development boards require independent testing.
3. Set the path of `boot.img` in **boot** and connect the RK3588 board.
4. Press the `Run` button to flash the image to the RK3588 board.

![RKDevTool](./figures/RKDevTool3.3.png)
26 changes: 25 additions & 1 deletion modules/axalloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,31 @@ impl GlobalAllocator {
/// `align_pow2` must be a power of 2, and the returned region bound will be
/// aligned to it.
pub fn alloc_pages(&self, num_pages: usize, align_pow2: usize) -> AllocResult<usize> {
self.palloc.lock().alloc_pages(num_pages, align_pow2)
let res = self.palloc.lock().alloc_pages(num_pages, align_pow2);

if res.is_err() {
warn!("alloc_pages res {:?}", res);
}

res
}

/// Allocates contiguous pages starting from the given address.
///
/// It allocates `num_pages` pages from the page allocator starting from the
/// given address.
///
/// `align_pow2` must be a power of 2, and the returned region bound will be
/// aligned to it.
pub fn alloc_pages_at(
&self,
start: usize,
num_pages: usize,
align_pow2: usize,
) -> AllocResult<usize> {
self.palloc
.lock()
.alloc_pages_at(start, num_pages, align_pow2)
}

/// Gives back the allocated pages starts from `pos` to the page allocator.
Expand Down
Loading
Loading