Nordic nrf51 sdk sources. Mirrored from https://github.com/ARMmbed/nrf51-sdk.

Dependents:   nRF51822 nRF51822

Revision:
24:2aea0c1c57ee
Parent:
22:67a8d2c0bbbf
Child:
27:0fe148f1bca3
--- a/source/nordic_sdk/components/libraries/bootloader_dfu/dfu_types.h	Thu Apr 07 17:37:48 2016 +0100
+++ b/source/nordic_sdk/components/libraries/bootloader_dfu/dfu_types.h	Thu Apr 07 17:37:49 2016 +0100
@@ -44,32 +44,32 @@
 #define DFU_TYPES_H__
 
 #include <stdint.h>
-#include "nrf51.h"
+#include "nrf_sdm.h"
+#include "nrf.h"
 #include "app_util.h"
 
-/**@brief Structure holding SoftDevice information to be used by the Bootloader/DFU. 
- *        Only size field is used.
- */
-typedef struct
-{
-    uint8_t  info_size;                                                                                 /**< Not used. */
-    uint8_t  reserved1[3];                                                                              /**< Not used. */
-    uint32_t magic_number;                                                                              /**< Not used. */
-    uint32_t softdevice_size;                                                                           /**< Size field containing the size of installed SoftDevice. */
-    uint16_t firmware_id;                                                                               /**< Firmware id. */
-    uint8_t  reserved2[2];                                                                                 /**< Not used. */
-} SOFTDEVICE_INFORMATION_Type;
-
-#define SOFTDEVICE_INFORMATION_BASE     0x0003000                                                       /**< Location in the SoftDevice image which holds the SoftDevice informations. */
-#define SOFTDEVICE_INFORMATION          ((SOFTDEVICE_INFORMATION_Type *) SOFTDEVICE_INFORMATION_BASE)   /**< Make SoftDevice information accessible through the structure. */
-
 #define NRF_UICR_BOOT_START_ADDRESS     (NRF_UICR_BASE + 0x14)                                          /**< Register where the bootloader start address is stored in the UICR register. */
 
-#define CODE_REGION_1_START             SOFTDEVICE_INFORMATION->softdevice_size                         /**< This field should correspond to the size of Code Region 0, (which is identical to Start of Code Region 1), found in UICR.CLEN0 register. This value is used for compile safety, as the linker will fail if application expands into bootloader. Runtime, the bootloader will use the value found in UICR.CLEN0. */
+#define CODE_REGION_1_START             SD_SIZE_GET(MBR_SIZE)                                           /**< This field should correspond to the size of Code Region 0, (which is identical to Start of Code Region 1), found in UICR.CLEN0 register. This value is used for compile safety, as the linker will fail if application expands into bootloader. Runtime, the bootloader will use the value found in UICR.CLEN0. */
+#define SOFTDEVICE_REGION_START         MBR_SIZE                                                        /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
 
-#define SOFTDEVICE_REGION_START         0x00001000                                                      /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
+#ifdef NRF51
+#ifdef SIGNING
+#define BOOTLOADER_REGION_START         0x00039C00                                                    /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
+#define BOOTLOADER_SETTINGS_ADDRESS     0x0003D800                                                    /**< The field specifies the page location of the bootloader settings address. */
+#else
 #define BOOTLOADER_REGION_START         0x0003C000                                                      /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
 #define BOOTLOADER_SETTINGS_ADDRESS     0x0003FC00                                                      /**< The field specifies the page location of the bootloader settings address. */
+#endif
+
+#define CODE_PAGE_SIZE                  0x0400                                                          /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */
+#elif NRF52
+#define BOOTLOADER_REGION_START         0x0003B000                                                      /**< This field should correspond to start address of the bootloader, found in UICR.RESERVED, 0x10001014, register. This value is used for sanity check, so the bootloader will fail immediately if this value differs from runtime value. The value is used to determine max application size for updating. */
+#define BOOTLOADER_SETTINGS_ADDRESS     0x0007F000                                                      /**< The field specifies the page location of the bootloader settings address. */
+#define CODE_PAGE_SIZE                  0x1000                                                          /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */
+#else
+#error No target defined
+#endif
 
 #define DFU_REGION_TOTAL_SIZE           (BOOTLOADER_REGION_START - CODE_REGION_1_START)                 /**< Total size of the region between SD and Bootloader. */
 
@@ -85,7 +85,6 @@
 #define DFU_BANK_0_REGION_START         CODE_REGION_1_START                                             /**< Bank 0 region start. */
 #define DFU_BANK_1_REGION_START         (DFU_BANK_0_REGION_START + DFU_IMAGE_MAX_SIZE_BANKED)           /**< Bank 1 region start. */
 
-#define CODE_PAGE_SIZE                  0x0400                                                          /**< Size of a flash codepage. Used for size of the reserved flash space in the bootloader region. Will be runtime checked against NRF_UICR->CODEPAGESIZE to ensure the region is correct. */
 #define EMPTY_FLASH_MASK                0xFFFFFFFF                                                      /**< Bit mask that defines an empty address in flash. */
 
 #define INVALID_PACKET                  0x00                                                            /**< Invalid packet identifies. */