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

WIP: Initial support for UF2 file format #io #23117

Merged
merged 8 commits into from
Jul 13, 2024
Merged

Conversation

aviciano
Copy link
Contributor

@aviciano aviciano commented Jul 10, 2024

  • Mark this if you consider it ready to merge
  • I've added tests (optional)
  • I wrote some lines in the book (optional)

Description
Initial uf2:// io plugin.
Many functionalities still need to be implemented (write, checksum validation, file container, ...)

@aviciano aviciano changed the title Initial support for UF2 file format #io WIP: Initial support for UF2 file format #io Jul 10, 2024
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
@trufae
Copy link
Collaborator

trufae commented Jul 11, 2024

You cant use anal or core from io. Use the coreb struct or so

_r_core_cmdf, referenced from:
___open in io_uf2.o
___open in io_uf2.o
___open in io_uf2.o
_r_meta_set_string, referenced from:
___open in io_uf2.o

}

static bool uf2_read(RIO *io, RBuffer *rbuf, char *buf) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

empty line

}

comment = r_str_newf ("uf2 block #%02d (%d bytes @ 0x%08x)\n", block.blockNo, block.payloadSize, block.targetAddr);
r_meta_set_string (core->anal, R_META_TYPE_COMMENT, block.targetAddr, comment);
Copy link
Collaborator

Choose a reason for hiding this comment

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

use io->coreb.cmdf (core, comment);

Copy link
Collaborator

Choose a reason for hiding this comment

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

where comment must start with "CC ... aka contain the command that adds a comment

return -1;
}

static void process_family_id(RCore *core, ut32 family_id) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
static void process_family_id(RCore *core, ut32 family_id) {
static void process_family_id(RIO *io, ut32 family_id) {

pass io, this way the function have also access to the RCoreBind struct and call io->coreb.cmdf(io->coreb.core, ...)

Copy link
Collaborator

@trufae trufae left a comment

Choose a reason for hiding this comment

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

fixed some code injection bugs

libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
libr/io/p/io_uf2.c Outdated Show resolved Hide resolved
@trufae trufae merged commit 19cf58b into radareorg:master Jul 13, 2024
38 checks passed
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