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

some tiny improvements and way more comments #162

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

SimonWaldherr
Copy link

pull request changed to "develop"-branch as requested by @will-v-pi (#160)

Copy link

@will-v-pi will-v-pi left a comment

Choose a reason for hiding this comment

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

Thanks, these changes look good - there are a couple things I'd want changed, but probably worth a review from @lurch too?

*
* @param abs_block_loc Target address for the absolute block.
* @return Generated UF2 block.
*/

Choose a reason for hiding this comment

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

It would probably be good to mention Errata E10 in this comment and the one below - it's not just any absolute block, it's an absolute block required to work around Errata E10 in the datasheet

@@ -204,10 +304,12 @@ int bin2uf2(std::shared_ptr<std::iostream> in, std::shared_ptr<std::iostream> ou
if (size <= 0) {
fail_read_error();
}
in->seekg(0, in->beg); // Reset to beginning

Choose a reason for hiding this comment

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

This isn't actually required, as the function that reads the file (realize_page) seeks to the appropriate place in the file before reading

elf2uf2/elf2uf2.cpp Outdated Show resolved Hide resolved
// Define the page size for UF2 (256 Bytes)
// These definitions are already present in the header file and should not be redefined here.
// #define LOG2_PAGE_SIZE 8u
// #define UF2_PAGE_SIZE (1u << LOG2_PAGE_SIZE)

Choose a reason for hiding this comment

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

These lines can be removed - the definitions had already been removed from this cpp file

*
* @param valid_ranges Valid address ranges.
* @param addr Physical address to check.
* @param vaddr Virtual address.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could add " (only used in verbose mode)" ?

* @param vaddr Virtual address.
* @param size Size of the area to check.
* @param uninitialized Flag indicating if the area is uninitialized.
* @param ar Reference to an address_range that will be set on success.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Reference to the valid_range that the provided (addr + size) fits inside" ?

return ERROR_INCOMPATIBLE;
}

/**
* @brief Checks ELF-32 program header entries and populates the page fragments map.
Copy link
Contributor

Choose a reason for hiding this comment

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

@will-v-pi Is this hyphenation of "ELF-32" correct? 🤷‍♂️

Choose a reason for hiding this comment

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

I think it should be un-hyphenated, so ELF32

};

/**
* @brief Checks if an address is within the valid ranges.
Copy link
Contributor

Choose a reason for hiding this comment

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

It checks both addr and addr + size, so perhaps this should say "Checks if a region is within the valid ranges." ?

*
* @param entries Vector of ELF-32 program header entries.
* @param valid_ranges Valid address ranges.
* @param pages Map of pages with their fragments.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Reference to the page fragments map", to make it more obvious that this is "the page fragments map" to which the @brief is referring?

* @param out Output stream for UF2 data.
* @param address Start address in the target memory.
* @param family_id Family ID for UF2.
* @param abs_block_loc Optional absolute block location.
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is optional, what special value indicates "don't use this"?

Comment on lines +342 to +343
* @param package_addr Optional packaging address.
* @param abs_block_loc Optional absolute block location.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same questions about "Optional"

return true;
}

/**
* @brief Generates an absolute UF2 block. The absolute block is required to work around Errata E10 in the RP2040 datasheet.
Copy link
Contributor

Choose a reason for hiding this comment

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

Signed-off-by: Simon Waldherr <[email protected]>
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.

3 participants