Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
17455cd3
Commit
17455cd3
authored
Aug 22, 2011
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: changed zpu-loader to lm32-loader, added lm32 memory dumping support
parent
c767fa35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
6 deletions
+52
-6
Makefile
tools/Makefile
+4
-4
lm32-loader.c
tools/lm32-loader.c
+48
-2
No files found.
tools/Makefile
View file @
17455cd3
...
...
@@ -10,12 +10,12 @@ STRIP = $(CROSS_COMPILE)strip
OBJCOPY
=
$(CROSS_COMPILE)
objcopy
OBJDUMP
=
$(CROSS_COMPILE)
objdump
all
:
zpu
-loader genraminit vuart_console
all
:
lm32
-loader genraminit vuart_console
OBJS_LOADER
=
zpu
-loader.o rr_io.o
OBJS_LOADER
=
lm32
-loader.o rr_io.o
zpu
-loader
:
$(OBJS_LOADER)
${
CC
}
-o
zpu
-loader
$(OBJS_LOADER)
lm32
-loader
:
$(OBJS_LOADER)
${
CC
}
-o
lm32
-loader
$(OBJS_LOADER)
genraminit
:
genraminit.o
${
CC
}
-o
genraminit genraminit.o
...
...
tools/
zpu
-loader.c
→
tools/
lm32
-loader.c
View file @
17455cd3
...
...
@@ -35,21 +35,29 @@ int rst_zpu(int spec, int rst);
int
copy
(
int
spec
,
int
srcbin
,
unsigned
int
baseaddr
);
int
verify
(
int
spec
,
int
srcbin
,
unsigned
int
baseaddr
);
int
conv_endian
(
int
x
);
int
dump_to_file
(
int
spec
,
char
*
filename
,
unsigned
int
baseaddr
);
int
main
(
int
argc
,
char
**
argv
)
{
unsigned
int
addr
=
0x80000
;
int
spec
,
srcbin
;
unsigned
int
bytes
;
char
*
dumpfile
=
NULL
;
if
(
argc
<
2
)
{
fprintf
(
stderr
,
"No parameters specified !
\n
"
);
fprintf
(
stderr
,
"Usage:
\n\t
./loadsw <binary file> [base address]
\n
"
);
fprintf
(
stderr
,
"Usage:
\n\t
./%s [-r] <binary file> [base address]
\n
"
,
argv
[
0
]);
fprintf
(
stderr
,
"-r options dumps the memory contents to a given file.
\n\n
"
);
return
-
1
;
}
if
(
argc
==
3
)
if
(
!
strcmp
(
argv
[
1
],
"-r"
))
dumpfile
=
argv
[
2
];
else
if
(
argc
==
3
)
addr
=
atoi
(
argv
[
2
]);
spec
=
open
(
DEVNAME
,
O_RDWR
);
if
(
spec
<
0
)
...
...
@@ -58,6 +66,12 @@ int main(int argc, char **argv)
return
-
1
;
}
if
(
dumpfile
)
{
dump_to_file
(
spec
,
dumpfile
,
addr
);
return
0
;
}
srcbin
=
open
(
argv
[
1
],
O_RDONLY
);
if
(
srcbin
<
0
)
{
...
...
@@ -124,6 +138,38 @@ int copy(int spec, int srcbin, unsigned int baseaddr)
return
bytes
;
}
int
dump_to_file
(
int
spec
,
char
*
filename
,
unsigned
int
baseaddr
)
{
unsigned
int
bytes
,
word
;
struct
rr_iocmd
iocmd
;
int
ret
;
FILE
*
f
=
fopen
(
filename
,
"wb"
);
if
(
!
f
)
return
-
1
;
bytes
=
0
;
while
(
bytes
<
0x10000
)
{
iocmd
.
address
=
baseaddr
+
bytes
;
// bytes += ret; //address shift for next write
iocmd
.
address
|=
__RR_SET_BAR
(
0
);
//bar0
iocmd
.
datasize
=
4
;
iocmd
.
data32
=
0
;
ret
=
ioctl
(
spec
,
RR_READ
,
&
iocmd
);
word
=
conv_endian
(
iocmd
.
data32
);
fwrite
(
&
word
,
4
,
1
,
f
);
bytes
+=
4
;
}
fclose
(
f
);
}
int
verify
(
int
spec
,
int
srcbin
,
unsigned
int
baseaddr
)
{
unsigned
int
wbin
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment