mirror of https://github.com/ARMmbed/mbed-os.git
Fix astyle issues
parent
ec9d647c31
commit
0212fde7fb
|
@ -26,19 +26,19 @@
|
||||||
* Override the subtarget sdk init startup hook (specific to nRF2)
|
* Override the subtarget sdk init startup hook (specific to nRF2)
|
||||||
* This will configure the internal regulator to operate at 3.3V
|
* This will configure the internal regulator to operate at 3.3V
|
||||||
*/
|
*/
|
||||||
void subtarget_sdk_init(void) {
|
void subtarget_sdk_init(void)
|
||||||
|
{
|
||||||
|
|
||||||
if (NRF_UICR->REGOUT0 != UICR_REGOUT0_VOUT_3V3)
|
if (NRF_UICR->REGOUT0 != UICR_REGOUT0_VOUT_3V3) {
|
||||||
{
|
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
|
||||||
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
|
||||||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
NRF_UICR->REGOUT0 = UICR_REGOUT0_VOUT_3V3;
|
||||||
NRF_UICR->REGOUT0 = UICR_REGOUT0_VOUT_3V3;
|
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
|
||||||
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
|
||||||
while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
|
|
||||||
|
|
||||||
// Trigger a soft reset so that the settings take effect
|
// Trigger a soft reset so that the settings take effect
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
#if MBED_CONF_EP_ATLAS_ENABLE_USB_STDIO_CONSOLE
|
#if MBED_CONF_EP_ATLAS_ENABLE_USB_STDIO_CONSOLE
|
||||||
|
|
||||||
/* Retarget stdio to USBSerial */
|
/* Retarget stdio to USBSerial */
|
||||||
mbed::FileHandle *mbed::mbed_target_override_console(int fd) {
|
mbed::FileHandle *mbed::mbed_target_override_console(int fd)
|
||||||
|
{
|
||||||
static USBSerial usb_serial;
|
static USBSerial usb_serial;
|
||||||
return &usb_serial;
|
return &usb_serial;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016 Nordic Semiconductor ASA
|
* Copyright (c) 2016 Nordic Semiconductor ASA
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
* are permitted provided that the following conditions are met:
|
* are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list
|
* 1. Redistributions of source code must retain the above copyright notice, this list
|
||||||
* of conditions and the following disclaimer.
|
* of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
|
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
|
||||||
* integrated circuit in a product or a software update for such product, must reproduce
|
* integrated circuit in a product or a software update for such product, must reproduce
|
||||||
* the above copyright notice, this list of conditions and the following disclaimer in
|
* the above copyright notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the distribution.
|
* the documentation and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
|
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
|
||||||
* used to endorse or promote products derived from this software without specific prior
|
* used to endorse or promote products derived from this software without specific prior
|
||||||
* written permission.
|
* written permission.
|
||||||
*
|
*
|
||||||
* 4. This software, with or without modification, must only be used with a
|
* 4. This software, with or without modification, must only be used with a
|
||||||
* Nordic Semiconductor ASA integrated circuit.
|
* Nordic Semiconductor ASA integrated circuit.
|
||||||
*
|
*
|
||||||
* 5. Any software provided in binary or object form under this license must not be reverse
|
* 5. Any software provided in binary or object form under this license must not be reverse
|
||||||
* engineered, decompiled, modified and/or disassembled.
|
* engineered, decompiled, modified and/or disassembled.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
@ -33,9 +33,9 @@
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nrf.h"
|
#include "nrf.h"
|
||||||
#include "cmsis_nvic.h"
|
#include "cmsis_nvic.h"
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
|
@ -48,13 +48,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ARMCC_VERSION)
|
#if defined(__ARMCC_VERSION)
|
||||||
__attribute__ ((section(".bss.nvictable")))
|
__attribute__((section(".bss.nvictable")))
|
||||||
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
|
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
__attribute__ ((section(".nvictable")))
|
__attribute__((section(".nvictable")))
|
||||||
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
|
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
|
||||||
#elif defined(__ICCARM__)
|
#elif defined(__ICCARM__)
|
||||||
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS] @ ".nvictable";
|
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS] @ ".nvictable";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "platform/mbed_toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
|
@ -73,11 +73,11 @@ extern uint32_t __Vectors[];
|
||||||
void nrf_reloc_vector_table(void)
|
void nrf_reloc_vector_table(void)
|
||||||
{
|
{
|
||||||
// Copy and switch to dynamic vectors
|
// Copy and switch to dynamic vectors
|
||||||
uint32_t *old_vectors = VECTORS_FLASH_START;
|
uint32_t *old_vectors = VECTORS_FLASH_START;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i = 0; i< NVIC_NUM_VECTORS; i++) {
|
for (i = 0; i < NVIC_NUM_VECTORS; i++) {
|
||||||
nrf_dispatch_vector[i] = old_vectors[i];
|
nrf_dispatch_vector[i] = old_vectors[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SOFTDEVICE_PRESENT)
|
#if defined(SOFTDEVICE_PRESENT)
|
||||||
|
|
||||||
|
@ -85,9 +85,9 @@ void nrf_reloc_vector_table(void)
|
||||||
* Before setting the new vector table address in the SoftDevice the MBR must be initialized.
|
* Before setting the new vector table address in the SoftDevice the MBR must be initialized.
|
||||||
* If no bootloader is present the MBR will be initialized automatically.
|
* If no bootloader is present the MBR will be initialized automatically.
|
||||||
* If a bootloader is present nrf_dfu_mbr_init_sd must be called once and only once.
|
* If a bootloader is present nrf_dfu_mbr_init_sd must be called once and only once.
|
||||||
*
|
*
|
||||||
* By resetting the MBR and SoftDevice VTOR address first, it becomes safe to initialize
|
* By resetting the MBR and SoftDevice VTOR address first, it becomes safe to initialize
|
||||||
* the MBR again regardless of how the application was started.
|
* the MBR again regardless of how the application was started.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Reset MBR VTOR to original state before calling MBR init. */
|
/* Reset MBR VTOR to original state before calling MBR init. */
|
||||||
|
@ -101,7 +101,7 @@ void nrf_reloc_vector_table(void)
|
||||||
/* Set SCB->VTOR to go through MBR to trap SoftDevice service calls. */
|
/* Set SCB->VTOR to go through MBR to trap SoftDevice service calls. */
|
||||||
SCB->VTOR = 0x0;
|
SCB->VTOR = 0x0;
|
||||||
|
|
||||||
/* Initialize MBR so SoftDevice service calls are being trapped correctly.
|
/* Initialize MBR so SoftDevice service calls are being trapped correctly.
|
||||||
* This call sets MBR_VTOR_ADDRESS to point to the SoftDevice's VTOR at address 0x1000.
|
* This call sets MBR_VTOR_ADDRESS to point to the SoftDevice's VTOR at address 0x1000.
|
||||||
*/
|
*/
|
||||||
nrf_dfu_mbr_init_sd();
|
nrf_dfu_mbr_init_sd();
|
||||||
|
@ -112,18 +112,18 @@ void nrf_reloc_vector_table(void)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* No SoftDevice is present. Set all interrupts to vector table in RAM. */
|
/* No SoftDevice is present. Set all interrupts to vector table in RAM. */
|
||||||
SCB->VTOR = (uint32_t) nrf_dispatch_vector;
|
SCB->VTOR = (uint32_t) nrf_dispatch_vector;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbed_sdk_init(void)
|
void mbed_sdk_init(void)
|
||||||
{
|
{
|
||||||
if (STDIO_UART_RTS != NC) {
|
if (STDIO_UART_RTS != NC) {
|
||||||
gpio_t rts;
|
gpio_t rts;
|
||||||
gpio_init_out(&rts, STDIO_UART_RTS);
|
gpio_init_out(&rts, STDIO_UART_RTS);
|
||||||
/* Set STDIO_UART_RTS as gpio driven low */
|
/* Set STDIO_UART_RTS as gpio driven low */
|
||||||
gpio_write(&rts, 0);
|
gpio_write(&rts, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
subtarget_sdk_init();
|
subtarget_sdk_init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "subtarget_init.h"
|
#include "subtarget_init.h"
|
||||||
#include "platform/mbed_toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
MBED_WEAK void subtarget_sdk_init(void) {
|
MBED_WEAK void subtarget_sdk_init(void)
|
||||||
|
{
|
||||||
/* Do nothing by default */
|
/* Do nothing by default */
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ extern "C" {
|
||||||
* Since Mbed's `mbed_sdk_init` hook is used by the NRF52 family code, this
|
* Since Mbed's `mbed_sdk_init` hook is used by the NRF52 family code, this
|
||||||
* initialization hook is provided so subtargets may implement their own startup
|
* initialization hook is provided so subtargets may implement their own startup
|
||||||
* initialization code, if necessary.
|
* initialization code, if necessary.
|
||||||
*
|
*
|
||||||
* By default, it is a blank function that is declared a "weak" symbol
|
* By default, it is a blank function that is declared a "weak" symbol
|
||||||
*/
|
*/
|
||||||
void subtarget_sdk_init(void);
|
void subtarget_sdk_init(void);
|
||||||
|
|
Loading…
Reference in New Issue