Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
educg-net-12100-765609
UCore-SMP
Commits
23550cf9
Commit
23550cf9
authored
4 years ago
by
TianhuaTao
Browse files
Options
Download
Patches
Plain Diff
remove file
parent
319a60c8
main
dev
feature-sd-drv
fu740
label-riscv
submit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
os/Makefile
+0
-80
os/Makefile
os/kernelld.py
+0
-69
os/kernelld.py
os/pack.py
+0
-42
os/pack.py
with
0 additions
and
191 deletions
+0
-191
os/Makefile
deleted
100644 → 0
+
0
−
80
View file @
319a60c8
SRCS
=
$(
wildcard
*
.S
*
.c
)
OBJS
=
$(
addsuffix .o,
$(
basename
$(
SRCS
)))
ifeq
(,$(findstring link_app.o,$(OBJS)))
OBJS
+=
link_app.o
endif
# Try to infer the correct TOOLPREFIX if not set
TOOLPREFIX
=
riscv64-unknown-elf-
CC
=
$(
TOOLPREFIX
)
gcc
AS
=
$(
TOOLPREFIX
)
gas
LD
=
$(
TOOLPREFIX
)
ld
OBJCOPY
=
$(
TOOLPREFIX
)
objcopy
OBJDUMP
=
$(
TOOLPREFIX
)
objdump
PY
=
python3
GDB
=
$(
TOOLPREFIX
)
gdb
ifndef
CPUS
CPUS
:=
8
endif
CFLAGS
=
-Wall
-Werror
-O
-fno-omit-frame-pointer
-ggdb
CFLAGS
+=
-MD
CFLAGS
+=
-mcmodel
=
medany
CFLAGS
+=
-ffreestanding
-fno-common
-nostdlib
-mno-relax
CFLAGS
+=
-I
.
CFLAGS
+=
-DNCPU
=
$(
CPUS
)
CFLAGS
+=
$(
shell
$(
CC
)
-fno-stack-protector
-E
-x
c /dev/null
>
/dev/null 2>&1
&&
echo
-fno-stack-protector
)
# Disable PIE when possible (for Ubuntu 16.10 toolchain)
ifneq
($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]no-pie'),)
CFLAGS
+=
-fno-pie
-no-pie
endif
ifneq
($(shell $(CC) -dumpspecs 2>/dev/null | grep -e '[^f]nopie'),)
CFLAGS
+=
-fno-pie
-nopie
endif
LDFLAGS
=
-z
max-page-size
=
4096
link_app.o
:
link_app.S
link_app.S
:
pack.py
@$(
PY
)
pack.py
kernel_app.ld
:
kernelld.py
@$(
PY
)
kernelld.py
kernel
:
$(OBJS) kernel_app.ld link_app.S
$(
LD
)
$(
LDFLAGS
)
-T
kernel_app.ld
-o
kernel
$(
OBJS
)
$(
OBJDUMP
)
-S
kernel
>
kernel.asm
$(
OBJDUMP
)
-t
kernel |
sed
'1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d'
>
kernel.sym
clean
:
rm
-f
*
.o
*
.d kernel
*
.sym
*
.asm link_app.S kernel_app.ld
# BOARD
BOARD
?=
qemu
SBI
?=
rustsbi
#BOOTLOADER := ../bootloader/$(SBI)-$(BOARD).bin
BOOTLOADER
:=
../bootloader/fw_jump.bin
QEMU
=
qemu-system-riscv64
QEMUOPTS
=
\
-nographic
\
-smp
$(
CPUS
)
\
-machine
virt
\
-bios
$(
BOOTLOADER
)
\
-kernel
kernel
run
:
kernel
$(
QEMU
)
$(
QEMUOPTS
)
# QEMU's gdb stub command line changed in 0.11
QEMUGDB
=
$(
shell
if
$(
QEMU
)
-help
|
grep
-q
'^-gdb'
;
\
then
echo
"-gdb tcp::15234"
;
\
else
echo
"-s -p 15234"
;
fi
)
debug
:
kernel .gdbinit
$(
QEMU
)
$(
QEMUOPTS
)
-S
$(
QEMUGDB
)
&
sleep
1
$(
GDB
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
os/kernelld.py
deleted
100644 → 0
+
0
−
69
View file @
319a60c8
import
os
TARGET_DIR
=
"../user/target/bin/"
if
__name__
==
'__main__'
:
f
=
open
(
"kernel_app.ld"
,
mode
=
"w"
)
apps
=
os
.
listdir
(
TARGET_DIR
)
f
.
write
(
'''OUTPUT_ARCH(riscv)
ENTRY(_entry)
BASE_ADDRESS = 0x80200000;
SECTIONS
{
. = BASE_ADDRESS;
skernel = .;
s_text = .;
.text : {
*(.text.entry)
*(.text .text.*)
. = ALIGN(0x1000);
*(trampsec)
. = ALIGN(0x1000);
}
. = ALIGN(4K);
e_text = .;
s_rodata = .;
.rodata : {
*(.rodata .rodata.*)
}
. = ALIGN(4K);
e_rodata = .;
s_data = .;
.data : {
*(.data)
'''
)
for
(
idx
,
_
)
in
enumerate
(
apps
):
f
.
write
(
' . = ALIGN(0x1000);
\n
'
)
f
.
write
(
' *(.data.app{})
\n
'
.
format
(
idx
))
f
.
write
(
'''
. = ALIGN(0x1000);
*(.data.*)
*(.sdata .sdata.*)
}
. = ALIGN(4K);
e_data = .;
.bss : {
*(.bss.stack)
s_bss = .;
*(.bss .bss.*)
*(.sbss .sbss.*)
}
. = ALIGN(4K);
e_bss = .;
ekernel = .;
/DISCARD/ : {
*(.eh_frame)
}
}
'''
)
f
.
close
()
This diff is collapsed.
Click to expand it.
os/pack.py
deleted
100644 → 0
+
0
−
42
View file @
319a60c8
import
os
TARGET_DIR
=
"../user/target/bin/"
if
__name__
==
'__main__'
:
f
=
open
(
"link_app.S"
,
mode
=
"w"
)
apps
=
os
.
listdir
(
TARGET_DIR
)
apps
.
sort
()
f
.
write
(
''' .align 4
.section .data
.global _app_num
_app_num:
.quad {}
'''
.
format
(
len
(
apps
))
)
for
(
idx
,
_
)
in
enumerate
(
apps
):
f
.
write
(
' .quad app_{}_start
\n
'
.
format
(
idx
))
f
.
write
(
' .quad app_{}_end
\n
'
.
format
(
len
(
apps
)
-
1
))
f
.
write
(
'''
.global _app_names
_app_names:
'''
);
for
app
in
apps
:
app
=
app
[:
app
.
find
(
'.'
)]
f
.
write
(
" .string
\"
"
+
app
+
"
\"\n
"
)
for
(
idx
,
app
)
in
enumerate
(
apps
):
f
.
write
(
'''
.section .data.app{0}
.global app_{0}_start
app_{0}_start:
.incbin "{1}"
'''
.
format
(
idx
,
TARGET_DIR
+
app
)
)
f
.
write
(
'app_{}_end:
\n\n
'
.
format
(
len
(
apps
)
-
1
))
f
.
close
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets