This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Custom DFU init packet

This is a kind of continuation to: devzone.nordicsemi.com/.../

I'm modifying the bootloader_secure sample to implement encryption.

I'm now at the step where I need to change the init packet, so I followed advice and in particular this: infocenter.nordicsemi.com/.../nrfutil_customizing.html

However, I come across a few issues after changing the .proto file. I reverted back to original files, but then, running "protoc -odfu-cc.pb dfu-cc.proto" gives me an error message that I need a syntax defintion, fair enough, it's proto compiler v3, so I add again 'syntax = "proto2";' at the top of the proto file, run the command again, all good.

Then I run the nanopb_generator, but when trying to compile, I get lots of error. The generated files do not seem compatible at all with the sample code, with for example:

typedef PB_BYTES_ARRAY_T(64) dfu_signed_command_signature_t;
typedef struct {
    dfu_command_t command;
    dfu_signature_type_t signature_type;
    dfu_signed_command_signature_t signature;
/* @@protoc_insertion_point(struct:dfu_signed_command_t) */
} dfu_signed_command_t;

turning into:

typedef struct {
    dfu_command_t command;
    dfu_signature_type_t signature_type;
    pb_callback_t signature;
/* @@protoc_insertion_point(struct:dfu_signed_command_t) */
} dfu_signed_command_t;

(this is done by the nanopb_generator bundled with the SDK)

So signature is now a pb_callback type, which doesn't have a "size" member, unlike PB_BYTES_ARRAY_T.

Does anyone know how to re-create those dfu-cc.pb.h/.c identical to the one that ships with the example?

Parents
  • Hi Hung, Thanks for your answer! I created another fresh copy of the SDK I'm using (12.2), and did the generation again, same issue. Now, the proto compiler is not coming from the SDK and it's v3.5 (and requires me to add "syntax" to the proto file). Could you tell me which version of the proto compiler you're using?

Reply
  • Hi Hung, Thanks for your answer! I created another fresh copy of the SDK I'm using (12.2), and did the generation again, same issue. Now, the proto compiler is not coming from the SDK and it's v3.5 (and requires me to add "syntax" to the proto file). Could you tell me which version of the proto compiler you're using?

Children
No Data
Related