-
Notifications
You must be signed in to change notification settings - Fork 106
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
base: develop
Are you sure you want to change the base?
some tiny improvements and way more comments #162
Conversation
There was a problem hiding this 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. | ||
*/ |
There was a problem hiding this comment.
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
elf2uf2/elf2uf2.cpp
Outdated
@@ -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 |
There was a problem hiding this comment.
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
// 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) |
There was a problem hiding this comment.
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
elf2uf2/elf2uf2.cpp
Outdated
* | ||
* @param valid_ranges Valid address ranges. | ||
* @param addr Physical address to check. | ||
* @param vaddr Virtual address. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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" ?
elf2uf2/elf2uf2.cpp
Outdated
return ERROR_INCOMPATIBLE; | ||
} | ||
|
||
/** | ||
* @brief Checks ELF-32 program header entries and populates the page fragments map. |
There was a problem hiding this comment.
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? 🤷♂️
There was a problem hiding this comment.
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
elf2uf2/elf2uf2.cpp
Outdated
}; | ||
|
||
/** | ||
* @brief Checks if an address is within the valid ranges. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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"?
* @param package_addr Optional packaging address. | ||
* @param abs_block_loc Optional absolute block location. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same questions about "Optional"
Co-authored-by: will-v-pi <[email protected]>
elf2uf2/elf2uf2.cpp
Outdated
return true; | ||
} | ||
|
||
/** | ||
* @brief Generates an absolute UF2 block. The absolute block is required to work around Errata E10 in the RP2040 datasheet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect you meant the RP2350 datasheet here, not RP2040?
https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf
https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf
Signed-off-by: Simon Waldherr <[email protected]>
pull request changed to "develop"-branch as requested by @will-v-pi (#160)