Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple VME FMC Carrier SVEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
14
Issues
14
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Simple VME FMC Carrier SVEC
Commits
a17d25bb
Commit
a17d25bb
authored
Aug 16, 2023
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tool: use getopt in svec-flasher
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
e30926af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
23 deletions
+39
-23
svec-flasher.c
software/tools/vme-flasher/svec-flasher.c
+39
-23
No files found.
software/tools/vme-flasher/svec-flasher.c
View file @
a17d25bb
...
...
@@ -427,6 +427,13 @@ static void bitstream_buffer_free(struct bitstream *bitstream)
}
static
void
help
(
const
char
*
name
)
{
printf
(
"usage: %s slot bitstream.bin [-b]
\n
"
,
name
);
printf
(
" -b: updates the bootloader itself
\n
"
);
printf
(
" -f: loads the bitstream straight to the Application FPGA (without programming the flash)
\n
"
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
struct
bitstream
bitstream
;
...
...
@@ -438,38 +445,47 @@ int main(int argc, char *argv[])
int
direct_boot
=
0
;
int
rv
;
int
err
;
if
(
argc
<
3
)
{
printf
(
"usage: %s slot bitstream.bin [-b]
\n
"
,
argv
[
0
]);
printf
(
" -b: updates the bootloader itself
\n
"
);
printf
(
" -f: loads the bitstream straight to the Application FPGA (without programming the flash)
\n
"
);
return
0
;
char
opt
;
while
((
opt
=
getopt
(
argc
,
argv
,
"h?bf"
))
!=
-
1
)
{
switch
(
opt
)
{
default:
case
'h'
:
case
'?'
:
help
(
argv
[
0
]);
exit
(
EXIT_SUCCESS
);
break
;
case
'b'
:
program_boot
=
1
;
break
;
case
'f'
:
direct_boot
=
1
;
break
;
}
}
if
(
argc
>
3
&&
!
strcmp
(
argv
[
3
],
"-b"
))
{
program_boot
=
1
;
}
else
if
(
argc
>
3
&&
!
strcmp
(
argv
[
3
],
"-f"
))
{
direct_boot
=
1
;
}
bitstream
.
path
=
argv
[
2
];
err
=
bitstream_buffer_alloc_and_fill
(
&
bitstream
);
if
(
err
)
{
fprintf
(
stderr
,
"Can't read bitstream '%s'. %s"
,
bitstream
.
path
,
strerror
(
errno
));
return
-
1
;
if
(
argc
-
optind
!=
2
)
{
help
(
argv
[
0
]);
exit
(
EXIT_FAILURE
);
}
rv
=
sscanf
(
argv
[
1
],
"%i"
,
&
slot
);
rv
=
sscanf
(
argv
[
optind
],
"%i"
,
&
slot
);
if
(
!
rv
)
{
rv
=
sscanf
(
argv
[
1
],
"VME.%i"
,
&
slot
);
rv
=
sscanf
(
argv
[
optind
],
"VME.%i"
,
&
slot
);
if
(
!
rv
)
{
fprintf
(
stderr
,
"Can't parse slot '%s'
\n
"
,
argv
[
1
]);
fprintf
(
stderr
,
"Can't parse slot '%s'
\n
"
,
argv
[
optind
]);
return
-
1
;
}
}
optind
++
;
bitstream
.
path
=
argv
[
optind
];
err
=
bitstream_buffer_alloc_and_fill
(
&
bitstream
);
if
(
err
)
{
fprintf
(
stderr
,
"Can't read bitstream '%s'. %s"
,
bitstream
.
path
,
strerror
(
errno
));
return
-
1
;
}
init_vme
(
slot
);
enter_bootloader
();
...
...
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