Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
troll-rs
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
2xs
The Pip protokernel
troll-rs
Commits
08fa245d
Commit
08fa245d
authored
10 months ago
by
Michael Hauspie
Browse files
Options
Downloads
Patches
Plain Diff
Fix some names following crate rename
parent
f3b06a87
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/lib.rs
+6
-7
6 additions, 7 deletions
src/lib.rs
src/link.rs
+1
-1
1 addition, 1 deletion
src/link.rs
src/new.rs
+10
-11
10 additions, 11 deletions
src/new.rs
with
17 additions
and
19 deletions
src/lib.rs
+
6
−
7
View file @
08fa245d
...
@@ -12,22 +12,21 @@ use clap::{Parser, Subcommand};
...
@@ -12,22 +12,21 @@ use clap::{Parser, Subcommand};
#[command(version,
about,
long_about
=
None)]
#[command(version,
about,
long_about
=
None)]
pub
struct
Opts
{
pub
struct
Opts
{
#[command(subcommand)]
#[command(subcommand)]
command
:
PipToo
lSubcommand
,
command
:
Trol
lSubcommand
,
}
}
#[derive(Subcommand,
Debug)]
#[derive(Subcommand,
Debug)]
pub
enum
PipToo
lSubcommand
{
pub
enum
Trol
lSubcommand
{
/// Generate a new
pip partition
project
/// Generate a new project
New
(
new
::
Opts
),
New
(
new
::
Opts
),
/// Link elf files together and generate a binary blob ready to be
/// Link elf files together and generate a Troll binary blob ready to be flashed/loaded
/// flashed/loaded
Link
(
link
::
Opts
),
Link
(
link
::
Opts
),
}
}
pub
fn
execute
(
opts
:
Opts
)
->
Result
<
()
>
{
pub
fn
execute
(
opts
:
Opts
)
->
Result
<
()
>
{
match
opts
.command
{
match
opts
.command
{
PipToo
lSubcommand
::
New
(
opts
)
=>
new
::
generate
(
opts
)
?
,
Trol
lSubcommand
::
New
(
opts
)
=>
new
::
generate
(
opts
)
?
,
PipToo
lSubcommand
::
Link
(
opts
)
=>
link
::
link
(
opts
)
?
,
Trol
lSubcommand
::
Link
(
opts
)
=>
link
::
link
(
opts
)
?
,
}
}
Ok
(())
Ok
(())
}
}
This diff is collapsed.
Click to expand it.
src/link.rs
+
1
−
1
View file @
08fa245d
...
@@ -62,7 +62,7 @@ pub struct Opts {
...
@@ -62,7 +62,7 @@ pub struct Opts {
/// Dump the binary content of the given sections to the output file.
/// Dump the binary content of the given sections to the output file.
///
///
/// It returns the number of bytes writen
/// It returns the number of bytes writen
fn
dump_sections
<
's
,
T
:
Write
>
(
fn
dump_sections
<
T
:
Write
>
(
elf
:
&
elf
::
ElfBytes
<
AnyEndian
>
,
elf
:
&
elf
::
ElfBytes
<
AnyEndian
>
,
section_names
:
&
[
&
str
],
section_names
:
&
[
&
str
],
output
:
&
mut
T
,
output
:
&
mut
T
,
...
...
This diff is collapsed.
Click to expand it.
src/new.rs
+
10
−
11
View file @
08fa245d
...
@@ -8,23 +8,22 @@ use std::path::PathBuf;
...
@@ -8,23 +8,22 @@ use std::path::PathBuf;
#[derive(Parser,
Debug)]
#[derive(Parser,
Debug)]
pub
struct
Opts
{
pub
struct
Opts
{
/// The path where to generate your
crate
/// The path where to generate your
project
crate
_path
:
PathBuf
,
project
_path
:
PathBuf
,
/// The name of the generated project. If omitted, deduced from
/// The name of the generated project. If omitted, deduced from
/// the
crate_path
parameter
/// the
PROJECT_PATH
parameter
#[arg(long,
short)]
#[arg(long,
short)]
crate
_name
:
Option
<
String
>
,
project
_name
:
Option
<
String
>
,
}
}
const
PIP_MPU_TEMPLATE_PATH
:
&
str
=
const
PIP_MPU_TEMPLATE_PATH
:
&
str
=
"https://gitlab.univ-lille.fr/2xs/pip/troll-template.git"
;
"https://gitlab.univ-lille.fr/2xs/pip/troll-template.git"
;
pub
fn
generate
(
opts
:
Opts
)
->
Result
<
()
>
{
pub
fn
generate
(
opts
:
Opts
)
->
Result
<
()
>
{
let
crate
_name
=
match
opts
.
crate
_name
{
let
project
_name
=
match
opts
.
project
_name
{
Some
(
name
)
=>
name
,
Some
(
name
)
=>
name
,
None
=>
opts
None
=>
opts
.
crate
_path
.
project
_path
.file_name
()
.file_name
()
.unwrap
()
.unwrap
()
.to_os_string
()
.to_os_string
()
...
@@ -33,10 +32,10 @@ pub fn generate(opts: Opts) -> Result<()> {
...
@@ -33,10 +32,10 @@ pub fn generate(opts: Opts) -> Result<()> {
};
};
let
scaffold_opts
=
cargo_scaffold
::
Opts
::
builder
(
PIP_MPU_TEMPLATE_PATH
)
let
scaffold_opts
=
cargo_scaffold
::
Opts
::
builder
(
PIP_MPU_TEMPLATE_PATH
)
.parameters
(
vec!
[
format!
(
"
crate
_name={}"
,
crate
_name
)])
.parameters
(
vec!
[
format!
(
"
project
_name={}"
,
project
_name
)])
.force
(
true
)
.force
(
true
)
.project_name
(
crate
_name
)
.project_name
(
project
_name
)
.target_dir
(
opts
.
crate
_path
);
.target_dir
(
opts
.
project
_path
);
cargo_scaffold
::
ScaffoldDescription
::
new
(
scaffold_opts
)
?
.scaffold
()
cargo_scaffold
::
ScaffoldDescription
::
new
(
scaffold_opts
)
?
.scaffold
()
}
}
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