Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an tbf parsing crate #1 #2

Closed
wants to merge 0 commits into from
Closed

Create an tbf parsing crate #1 #2

wants to merge 0 commits into from

Conversation

mihai-negru
Copy link

@mihai-negru mihai-negru commented Nov 27, 2022

Pull Request Overview

The idea of this pull request is to set the foundation for building a rust version of tockloader. The arguments for this are:

  • pip is not very portable when it comes to installing commands, it sometimes works just with pip, otherwise it needs pip --user or sudo.
  • unifying the tools and libraries used for tock, so that we do not use two programming languages

Created a new workspace

  • Workspace at the root level
  • Two containing members elf2tab and tbfparser

Modifications in the elf2tab

  • Removed the header.rs file and added to a new created crate
  • Removed the utils.rs file because it can be found at the tbfparser library
  • Modified Cargo.toml dependencies by adding the new created crate, the path is specified relative to the root project folder.
  • Replaced the header file to tbfparser package.

Creating the new library crate tbfparser

  • Created a library cargo crate.
  • Moved header.rs to the lib.rs.
  • Copied utils.rs in the src folder of the current crate.

Testing Strategy

This pull request was tested by compiling.
Copiled the project in the workspace using cargo build, resulting in elf2tab elf file.

TODO or Help Wanted

N/A

Documentation Updated

Added a new subsubsection in the elf2tabDetails to describe the project's structure. (workflow)

@alexandruradovici
Copy link

The tbf parser should be in its own crate, different from elf2tab. I would create a wrokspace in the root folder (https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html) and place the two crates, elf2tab and tbfparser, in the workspace. Adapt the readme to this.

@mihai-negru
Copy link
Author

The tbf parser should be in its own crate, different from elf2tab. I would create a wrokspace in the root folder (https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html) and place the two crates, elf2tab and tbfparser, in the workspace. Adapt the readme to this.

I have created the workspace and moved both crates into the workspace. Also updated the readme file for compilation instructions.

Copy link

@alexandruradovici alexandruradovici left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move the workspace to the root.

@mihai-negru
Copy link
Author

mihai-negru commented Dec 5, 2022

I would move the workspace to the root.

I have moved the workspace to the root level and removed the utils.rs from the elf2tab crate, to remove code duplication (utils.rs can be also found in the tbfparser crate as a public module). However I do not find something in the README file to modify, should I create a new section to write explicity that the repository contains one workspace with two crates?

P.S: I have also edited the PR overview

tbfparser/src/lib.rs Outdated Show resolved Hide resolved
tbfparser/src/util.rs Outdated Show resolved Hide resolved
@alexandruradovici
Copy link

alexandruradovici commented Dec 5, 2022

However I do not find something in the README file to modify, should I create a new section to write explicity that the repository contains one workspace with two crates?

I think this is a good solution.

@mihai-negru
Copy link
Author

However I do not find something in the README file to modify, should I create a new section to write explicity that the repository contains one workspace with two crates?

I think this is a good solution.

I created a subsubsection under the Details section from the README and described very shortly how the project is structured.

README.md Outdated Show resolved Hide resolved
tbfparser/src/lib.rs Outdated Show resolved Hide resolved
tbfparser/src/lib.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
elf2tab/Cargo.toml Outdated Show resolved Hide resolved
@alexandruradovici
Copy link

Formatting fails, please run cargo fmt on all the crates.

@mihai-negru
Copy link
Author

Formatting fails, please run cargo fmt on all the crates.

Running cargo fmt --check on my machine seems to work
image

@alexandruradovici
Copy link

Please open a pull request to the upstream repository and post here a link.

@alexandruradovici alexandruradovici linked an issue Dec 9, 2022 that may be closed by this pull request
@mihai-negru
Copy link
Author

Sorry for the question, how can I open the pull request from a fork that is forked from the main repository? Or it should be merged to this upstream firstly and then to the main repository. Thanks for the answer

@alexandruradovici
Copy link

Open a new pull request and select the upstream (original) repository. You should have a dropdown there.

@mihai-negru
Copy link
Author

Link to the pull request : tock#62

@mihai-negru
Copy link
Author

mihai-negru commented Dec 16, 2022

Hello, sorry for the question. I wanted to ask if is anything more to do on this pull request, I do not seem to understand what I should do next by reading the bradjc's comment from the main stream. Thanks in advice!

@alexandruradovici
Copy link

What Brad was suggesting is that you take a look at tock-tbf crate and see if we can merge this. This may or not be possible, as tock-tbf does not depend on the std crate (#[no-std]) and is not able to use memory allocation.

alexandruradovici pushed a commit that referenced this pull request Jan 4, 2023
Program header load replacing section placement guesses.
@alexandruradovici
Copy link

Any update here?

@mihai-negru
Copy link
Author

Any update here?

I have looked over the tock-tbf and revised the tbfparser and for me, it seems impossible to modify the tbfparser code in order no to use the standard library (#no-std), as suggested bradjc creating a separate repository just for the tbfparser would make the deal.

@alexandruradovici alexandruradovici added the upstream This pull request was opened in the upstream reposiotry label Jan 9, 2023
@alexandruradovici
Copy link

One approach would be to use the data types from the tbf crate defined in tock instead of redefining them. What about adding the crate in the tock repository, next to the tbf parser?

@mihai-negru
Copy link
Author

mihai-negru commented Jan 23, 2023

I closed the last pull request and I will work on the new idea that you have suggested, on using the types defined in the tock/libraries/tbfparser

One approach would be to use the data types from the tbf crate defined in tock instead of redefining them. What about adding the crate in the tock repository, next to the tbf parser?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream This pull request was opened in the upstream reposiotry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create an tbf parsing crate
2 participants