able to build

This commit is contained in:
hathach
2018-02-09 23:06:27 +07:00
parent 7de0b11529
commit 342eaaee10
99 changed files with 31620 additions and 5052 deletions

View File

@ -33,7 +33,7 @@
#define IRQ_ENABLED 0x01 /**< Field identifying if an interrupt is enabled. */
#ifdef NRF52
#if defined(NRF52832_XXAA) || defined(NRF52840_XXAA)
#define MAX_NUMBER_INTERRUPTS 39
#else
#define MAX_NUMBER_INTERRUPTS 32 /**< Maximum number of interrupts available. */

View File

@ -31,7 +31,7 @@ __root const uint32_t m_uicr_bootloader_start_address @ NRF_UICR_BOOT_START_A
#endif
#if defined ( NRF52 )
#if defined(NRF52832_XXAA) || defined(NRF52840_XXAA)
#if defined ( __CC_ARM )
uint8_t m_mbr_params_page[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS))) __attribute__((used)); /**< This variable reserves a codepage for mbr parameters, to ensure the compiler doesn't locate any code or variables at his location. */
@ -50,7 +50,7 @@ __no_init uint8_t m_mbr_params_page[CODE_PAGE_SIZE] @ BOOTLOADER_MBR_PARAMS_
__root const uint32_t m_uicr_mbr_params_page_address @ NRF_UICR_MBR_PARAMS_PAGE_ADDRESS = BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS; /**< This variable ensures that the linker script will write the bootloader start address to the UICR register. This value will be written in the HEX file and thus written to UICR when the bootloader is flashed into the chip. */
#endif
#endif //defined ( NRF52 )
#endif // defined(NRF52832_XXAA) || defined(NRF52840_XXAA)
void bootloader_util_settings_get(const bootloader_settings_t ** pp_bootloader_settings)

View File

@ -705,6 +705,12 @@ static void advertising_start(void)
// Initialize advertising parameters (used when starting advertising).
memset(&m_adv_params, 0, sizeof(m_adv_params));
m_adv_params.properties.connectable = 1;
m_adv_params.properties.scannable = 1;
m_adv_params.properties.legacy_pdu = 1;
m_adv_params.properties.tx_power = 1;
if (m_ble_peer_data_valid)
{
ble_gap_irk_t empty_irk = {{0}};
@ -712,11 +718,11 @@ static void advertising_start(void)
if (memcmp(m_ble_peer_data.irk.irk, empty_irk.irk, sizeof(empty_irk.irk)) == 0)
{
advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE);
m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND;
m_adv_params.p_peer_addr = &m_ble_peer_data.addr;
m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
m_adv_params.interval = 0;
m_adv_params.timeout = 0;
m_adv_params.properties.directed = 1;
m_adv_params.p_peer_addr = &m_ble_peer_data.addr;
m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
m_adv_params.interval = 0;
m_adv_params.duration = 0;
}
else
{
@ -734,24 +740,24 @@ static void advertising_start(void)
APP_ERROR_CHECK(err_code);
advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND;
m_adv_params.fp = BLE_GAP_ADV_FP_FILTER_CONNREQ;
m_adv_params.interval = APP_ADV_INTERVAL;
m_adv_params.timeout = APP_ADV_TIMEOUT_IN_SECONDS;
m_adv_params.properties.directed = 0;
m_adv_params.fp = BLE_GAP_ADV_FP_FILTER_CONNREQ;
m_adv_params.interval = APP_ADV_INTERVAL;
m_adv_params.duration = APP_ADV_TIMEOUT_IN_SECONDS;
}
}
else
{
advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
m_adv_params.type = BLE_GAP_ADV_TYPE_ADV_IND;
m_adv_params.p_peer_addr = NULL;
m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
m_adv_params.interval = APP_ADV_INTERVAL;
m_adv_params.timeout = APP_ADV_TIMEOUT_IN_SECONDS;
m_adv_params.properties.directed = 0;
m_adv_params.p_peer_addr = NULL;
m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
m_adv_params.interval = APP_ADV_INTERVAL;
m_adv_params.duration = APP_ADV_TIMEOUT_IN_SECONDS;
}
err_code = sd_ble_gap_adv_start(&m_adv_params, BLE_CONN_CFG_HIGH_BANDWIDTH);
err_code = sd_ble_gap_adv_start(BLE_GAP_ADV_SET_HANDLE_DEFAULT, &m_adv_params, BLE_CONN_CFG_HIGH_BANDWIDTH);
APP_ERROR_CHECK(err_code);
// led_on(ADVERTISING_LED_PIN_NO);
@ -769,7 +775,7 @@ static void advertising_stop(void)
{
uint32_t err_code;
err_code = sd_ble_gap_adv_stop();
err_code = sd_ble_gap_adv_stop(BLE_GAP_ADV_SET_HANDLE_DEFAULT);
APP_ERROR_CHECK(err_code);
// led_off(ADVERTISING_LED_PIN_NO);
@ -1123,7 +1129,7 @@ uint32_t dfu_transport_ble_update_start(void)
conn_params_init();
sec_params_init();
sd_ble_gap_tx_power_set(4); // maximum power
sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, 0, 4); // maximum power
advertising_start();
return NRF_SUCCESS;

View File

@ -31,7 +31,7 @@
#define NRF_UICR_BOOT_START_ADDRESS (NRF_UICR_BASE + 0x14) /**< Register where the bootloader start address is stored in the UICR register. */
#if defined(NRF52)
#if defined(NRF52832_XXAA) || defined(NRF52840_XXAA)
#define NRF_UICR_MBR_PARAMS_PAGE_ADDRESS (NRF_UICR_BASE + 0x18) /**< Register where the mbr params page is stored in the UICR register. (Only in use in nRF52 MBR).*/
#endif
@ -56,7 +56,7 @@
#elif defined(NRF52)
#elif defined(NRF52832_XXAA)
#define BOOTLOADER_REGION_START 0x00074000 /**< 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. */
@ -64,6 +64,14 @@
#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. */
#elif defined(NRF52840_XXAA)
#define BOOTLOADER_REGION_START 0x000F4000 /**< 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 0x000FF000 /**< The field specifies the page location of the bootloader settings address. */
#define BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS 0x000FE000 /**< The field specifies the page location of the mbr params page 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