Skip to content

Add script to generate json containing information to run fwuploader tool #38

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

Merged
merged 5 commits into from
May 26, 2021

Conversation

silvanocerza
Copy link
Contributor

@silvanocerza silvanocerza commented May 25, 2021

The generator.py script creates a board_index.json file that will be used by the FirmwareUploader tool to gather all the information necessary to run correctly, list of firmwares for each supported board, upload command to run, binary to loader Sketch. It also copies the necessary firmware and loader Sketch binaries in structured folders ready to be uploaded in the download server.

As of now it uses a raw_board.json file that has been created using some information obtained using the --get_available_for flag that returns all available firmware for all each supported board.

In the future we can use the board_index.json currently in use as a base and add new information if necessary.

The script assumes the Arduino CLI is installed and all supported boards' core too, it fails in case neither is found.

The script can be easily run like this:

cd generator
python generator.py -a <path_to_arduino_cli>

It must be run inside the generator folder where the raw_boards.json file is stored. All generated folders and files will be saved in that same folder.

@silvanocerza silvanocerza requested a review from a team May 25, 2021 10:32
@silvanocerza silvanocerza self-assigned this May 25, 2021


# Generate and copy all firmware binary data for specified board
def create_firmware_data(simple_fqbn, binary, module, version):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def create_firmware_data(simple_fqbn, binary, module, version):
def create_firmware_data(binary, module, version):

not used

Comment on lines 85 to 90
for l in boards_txt:
board_id = fqbn.split(":")[2]
if l.startswith(f"{board_id}.upload"):
(k, v) = l.strip().split("=", maxsplit=1)
k = ".".join(k.split(".", maxsplit=1)[1:])
board_upload_data[k] = v
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this and code L98-102 could be put in a function since is basically the same code?

Copy link
Contributor

@umbynos umbynos left a comment

Choose a reason for hiding this comment

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

LGTM 🚗

@silvanocerza silvanocerza merged commit 52c673d into main May 26, 2021
@silvanocerza silvanocerza deleted the scerza/boards-json-generator branch May 26, 2021 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants