Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Rehad-Orca-ROM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
REHAD
Rehad-Orca-ROM
Commits
5545057d
Commit
5545057d
authored
5 years ago
by
Yuxiao Mao
Browse files
Options
Downloads
Patches
Plain Diff
build : rom rdtime
parent
2c1cac0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+16
-5
16 additions, 5 deletions
Makefile
link.ld
+13
-11
13 additions, 11 deletions
link.ld
main.c
+18
-4
18 additions, 4 deletions
main.c
tools/bin2mem.c
+0
-1
0 additions, 1 deletion
tools/bin2mem.c
with
47 additions
and
21 deletions
Makefile
+
16
−
5
View file @
5545057d
...
...
@@ -3,26 +3,37 @@ CC = $(CROSS_COMPILER)gcc
LD
=
$(
CROSS_COMPILER
)
ld
OBJCOPY
=
$(
CROSS_COMPILER
)
objcopy
# -O0
CCFLAGS
=
TOOLS
=
tools/
BIN2MEM
=
$(
TOOLS
)
bin2mem
################### RULES ###################
all
:
$(BIN2MEM) rom
all
:
$(BIN2MEM)
debug
rom
# Tools
$(BIN2MEM)
:
$(BIN2MEM).c
gcc
$<
-o
$@
# Debug
debug
:
main.s
%.s
:
%.c
$(
CC
)
-o
$@
-c
$<
-S
$(
CCFLAGS
)
# Main
rom
:
main.bin
$(
BIN2MEM
)
$<
%
.bin
:
%
.elf
main
.bin
:
main
.elf
$(
OBJCOPY
)
-I
elf32-little
-O
binary
$<
$@
%.elf
:
%.o
%.elf
:
%.o
link.ld
$(
LD
)
-o
$@
-T
link.ld
$<
%.o
:
%.
c
$(
CC
)
-o
$@
-c
$<
-O0
%.o
:
%.
s
$(
CC
)
-o
$@
-c
$<
$(
CCFLAGS
)
clean
:
rm
-f
*
.s
*
.o
*
.elf
*
.bin
*
.hex
This diff is collapsed.
Click to expand it.
link.ld
+
13
−
11
View file @
5545057d
...
...
@@ -14,7 +14,9 @@
OUTPUT_ARCH( "riscv" )
MEMORY
{
MEM : ORIGIN = 0x0, LENGTH = 32K
IMEM : ORIGIN = 0x0, LENGTH = 16K
DMEM : ORIGIN = 16K, LENGTH = 16K
FMEM : ORIGIN = 32K, LENGTH = 200K
}
/*----------------------------------------------------------------------*/
/* Sections */
...
...
@@ -25,42 +27,42 @@ SECTIONS
{
/* text: test code section */
. = 0x
0
00;
. = 0x
1
00;
.text.init . :
{
*(.text.init)
}>MEM
}>
I
MEM
.text :
{
*(.text)
}>MEM
}>
I
MEM
/* data segment */
.data : { *(.data) }>MEM
.rodata : { *(.rodata) }>MEM
.data : { *(.data) }>
D
MEM
.rodata : { *(.rodata) }>
F
MEM
.sdata : {
_gp = . + 0x800;
*(.srodata.cst16) *(.srodata.cst8) *(.srodata.cst4) *(.srodata.cst2) *(.srodata*)
*(.sdata .sdata.* .gnu.linkonce.s.*)
}>MEM
}>
D
MEM
/* bss segment */
.sbss : {
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
}>MEM
.bss : { *(.bss) }>MEM
}>
D
MEM
.bss : { *(.bss) }>
D
MEM
/* thread-local data segment */
.tdata :
{
_tls_data = .;
*(.tdata)
}>MEM
}>
D
MEM
.tbss :
{
*(.tbss)
}>MEM
}>
D
MEM
...
...
This diff is collapsed.
Click to expand it.
main.c
+
18
−
4
View file @
5545057d
int
main
()
{
int
a
=
5
,
b
=
13
;
int
c
=
a
+
b
;
return
0
;
int
main
(
void
)
{
static
int
data1
=
20
;
static
int
data2
=
5
;
static
int
result
;
result
=
data1
*
data2
;
// Store the value in a6
asm
volatile
(
"mv a6,%0
\n\t
"
"rdtime a5"
:
:
"r"
(
result
)
:
"a6"
);
while
(
1
)
;
return
0
;
}
This diff is collapsed.
Click to expand it.
tools/bin2mem.c
+
0
−
1
View file @
5545057d
...
...
@@ -59,7 +59,6 @@ int main(int argc, char *argv[])
}
while
(
1
)
{
if
(
fread
(
w
,
4
,
1
,
fdi
)
<=
0
)
break
;
// fdo just for easy humain read
fprintf
(
fdo
,
"%02hhx%02hhx%02hhx%02hhx
\n
"
,
w
[
0
],
w
[
1
],
w
[
2
],
w
[
3
]);
fprintf
(
fdo0
,
"%02hhx
\n
"
,
w
[
0
]);
fprintf
(
fdo1
,
"%02hhx
\n
"
,
w
[
1
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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