Skip to content

Commit

Permalink
[EFR32] Adjust the internal flash layout (project-chip#19523)
Browse files Browse the repository at this point in the history
* Do not initialize the certificate pointer in ApplicationProperties_t

The certificate pointer is updated when the certificate is actually injected into the image, there is no need to initialize it at compile time

* Reserve the last page of the flash for the manufacturing tokens

* Remove merge artifacts
  • Loading branch information
selissia authored Jun 13, 2022
1 parent 0e9b2cc commit 634519e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
25 changes: 4 additions & 21 deletions examples/platform/efr32/OTAConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@
#include "platform/bootloader/api/application_properties.h"
#include <app/server/Server.h>

#define BOOTLOADER_SUPPORT_CERTIFICATES 1
#define APPLICATION_CERTIFICATE_VERSION (1UL)

#if defined(BOOTLOADER_SUPPORT_CERTIFICATES)
const ApplicationCertificate_t sl_app_certificate = {
.structVersion = APPLICATION_CERTIFICATE_VERSION,
.flags = { 0U },
.key = { 0U },
.version = 0,
.signature = { 0U },
};
#endif

// Header used for building the image GBL file
#define APP_PROPERTIES_VERSION 1
#define APP_PROPERTIES_ID \
Expand Down Expand Up @@ -71,15 +58,11 @@ __attribute__((used)) ApplicationProperties_t sl_app_properties = {
/// Unique ID (e.g. UUID/GUID) for the product this application is built for
.productId = APP_PROPERTIES_ID,
},
#if defined(BOOTLOADER_SUPPORT_CERTIFICATES)
// If certificate based boot chain is enabled, the bootloader binary will be provided with
// a certificate that does not contain any key.
// A valid certificate needs to be injected to the bootloader images using Simplicity Commander.
// Simplicity Commander will replace this certificate.
.cert = (ApplicationCertificate_t *)&sl_app_certificate,
#else

/// Pointer to information about the certificate
.cert = NULL,
#endif

/// Pointer to Long Token Data Section
.longTokenSectionAddress = NULL,
};

Expand Down
1 change: 1 addition & 0 deletions examples/platform/efr32/ldscripts/efr32mg12.ld
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ SECTIONS
KEEP(*(.simee*))
} > FLASH

/* Last page of flash is reserved for the manufacturing token space */
linker_nvm_end = __main_flash_end__ - 2048;
linker_nvm_begin = linker_nvm_end - SIZEOF(.nvm);
linker_nvm_size = SIZEOF(.nvm);
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/efr32/ldscripts/efr32mg24.ld
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ SECTIONS
KEEP(*(.simee*))
} > FLASH

linker_nvm_end = __main_flash_end__;
/* Last page of flash is reserved for the manufacturing token space */
linker_nvm_end = __main_flash_end__ - 8192;
linker_nvm_begin = linker_nvm_end - SIZEOF(.nvm);
linker_nvm_size = SIZEOF(.nvm);
__nvm3Base = linker_nvm_begin;
Expand Down

0 comments on commit 634519e

Please sign in to comment.