esp-idf-sys icon indicating copy to clipboard operation
esp-idf-sys copied to clipboard

Building bindings to bootloader_support component

Open voteblake opened this issue 3 years ago • 3 comments
trafficstars

Adds the includes from the bootloader_support component and builds them by default. My main interest is access to the bootloader_random.h methods detailed in the Random Number Generation system API's. I thought it could be useful to add the rest of the bootloader support component while I was there.

I've tried to keep this inline with similar changes but it is my first contribution here, sorry if I've missed any conventions.

voteblake avatar Apr 28 '22 06:04 voteblake

Hm, something is NOK with the includes of this PR. Check the CI build output.

ivmarkov avatar Apr 29 '22 05:04 ivmarkov

Rebasing on the new release. I've taken a look at the CI workflows ~~and am not getting the same Clippy errors locally while building on Windows. I will try to replicate the environment as closely as possible in a Linux container to see if I can get the same errors as we encountered on CI.~~ am now seeing the same Clippy errors locally.

voteblake avatar May 03 '22 23:05 voteblake

The conflicting generated definition only appears in the pio build:

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ets_secure_boot_signature_t {
    _unused: [u8; 0],
}

Both the pio and native builds contain:

pub type ets_secure_boot_signature_t = ets_secure_boot_signature;

Which I believe is generated from the corresponding target-specific rom/secure_boot.h, e.g esp32c3/rom/secure_boot.h:

typedef struct ets_secure_boot_signature ets_secure_boot_signature_t;

The CI job for both native and pio use --target riscv32imc-esp-espidf, so I'm not sure where the difference is coming from. The only target I see that does not define ets_secure_boot_signature_t as a typedef is esp32:

/* Multiple key block support */
typedef struct {
    ets_secure_boot_sig_block_t block[SECURE_BOOT_MAX_APPENDED_SIGN_BLOCKS_TO_IMAGE];
    uint8_t _padding[4096 - (sizeof(ets_secure_boot_sig_block_t) * SECURE_BOOT_MAX_APPENDED_SIGN_BLOCKS_TO_IMAGE)];
} ets_secure_boot_signature_t;

This should only be getting included if CONFIG_IDF_TARGET_ESP32 is set.

voteblake avatar May 04 '22 05:05 voteblake

I've now included bootloader_common.h in the build. Do you need something else included?

ivmarkov avatar Sep 17 '22 15:09 ivmarkov

I've now included bootloader_common.h in the build. Do you need something else included?

Could we include #include "bootloader_random.h"?

reinismu avatar Jul 28 '23 20:07 reinismu