mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14325 from AGlass0fMilk/ep-atlas-reg-init
EP Atlas Target Updatespull/14367/head
commit
f78c24135c
|
@ -28,6 +28,7 @@ target_sources(mbed-nrf52
|
||||||
serial_api.c
|
serial_api.c
|
||||||
sleep.c
|
sleep.c
|
||||||
spi_api.c
|
spi_api.c
|
||||||
|
subtarget_init.c
|
||||||
trng_api.c
|
trng_api.c
|
||||||
us_ticker.c
|
us_ticker.c
|
||||||
watchdog_api.c
|
watchdog_api.c
|
||||||
|
|
|
@ -25,6 +25,13 @@ target_include_directories(mbed-ep-atlas
|
||||||
TARGET_EP_ATLAS
|
TARGET_EP_ATLAS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_sources(mbed-ep-atlas
|
||||||
|
INTERFACE
|
||||||
|
TARGET_EP_ATLAS/ONBOARD_TELIT_ME310.cpp
|
||||||
|
TARGET_EP_ATLAS/usb_stdio.cpp
|
||||||
|
TARGET_EP_ATLAS/atlas_init.c
|
||||||
|
)
|
||||||
|
|
||||||
target_include_directories(mbed-nrf52840-dk
|
target_include_directories(mbed-nrf52840-dk
|
||||||
INTERFACE
|
INTERFACE
|
||||||
TARGET_NRF52840_DK
|
TARGET_NRF52840_DK
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2021 ARM Limited
|
||||||
|
* Copyright (c) 2021 Embedded Planet, Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "subtarget_init.h"
|
||||||
|
|
||||||
|
#include "nrf.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the subtarget sdk init startup hook (specific to nRF2)
|
||||||
|
* This will configure the internal regulator to operate at 3.3V
|
||||||
|
*/
|
||||||
|
void subtarget_sdk_init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (NRF_UICR->REGOUT0 != UICR_REGOUT0_VOUT_3V3) {
|
||||||
|
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
|
||||||
|
NRF_UICR->REGOUT0 = UICR_REGOUT0_VOUT_3V3;
|
||||||
|
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
|
||||||
|
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {}
|
||||||
|
|
||||||
|
// Trigger a soft reset so that the settings take effect
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,17 @@
|
||||||
"help" : "Telit ME310C1 AT#PORTCFG Variant value",
|
"help" : "Telit ME310C1 AT#PORTCFG Variant value",
|
||||||
"macro_name" : "EP_ATLAS_PORT_CONFIGURATION_VARIANT",
|
"macro_name" : "EP_ATLAS_PORT_CONFIGURATION_VARIANT",
|
||||||
"value" : 0
|
"value" : 0
|
||||||
|
},
|
||||||
|
"enable-usb-stdio-console": {
|
||||||
|
"help" : "Enables using USB Serial for the stdio console. If you use USB in your application, you must disable this feature and implement a composite USB device if you require USB serial output. This feature is disabled by default.",
|
||||||
|
"value" : false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"target_overrides": {
|
"target_overrides": {
|
||||||
"EP_ATLAS": {
|
"EP_ATLAS": {
|
||||||
"target.network-default-interface-type": "CELLULAR"
|
"target.network-default-interface-type": "CELLULAR",
|
||||||
|
"target.mbed_app_start": "0x1000",
|
||||||
|
"target.mbed_app_size": "0xDF000"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2021 ARM Limited
|
||||||
|
* Copyright (c) 2021 Embedded Planet, Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "USBSerial.h"
|
||||||
|
#include "platform/mbed_retarget.h"
|
||||||
|
|
||||||
|
#ifndef MBED_CONF_EP_ATLAS_ENABLE_USB_STDIO_CONSOLE
|
||||||
|
#define MBED_CONF_EP_ATLAS_ENABLE_USB_STDIO_CONSOLE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if MBED_CONF_EP_ATLAS_ENABLE_USB_STDIO_CONSOLE
|
||||||
|
|
||||||
|
/* Retarget stdio to USBSerial */
|
||||||
|
mbed::FileHandle *mbed::mbed_target_override_console(int fd)
|
||||||
|
{
|
||||||
|
static USBSerial usb_serial;
|
||||||
|
return &usb_serial;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -48,15 +48,18 @@
|
||||||
#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 "subtarget_init.h"
|
||||||
|
|
||||||
extern uint32_t __Vectors[];
|
extern uint32_t __Vectors[];
|
||||||
|
|
||||||
#define VECTORS_FLASH_START __Vectors
|
#define VECTORS_FLASH_START __Vectors
|
||||||
|
@ -70,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)
|
||||||
|
|
||||||
|
@ -113,13 +116,14 @@ void nrf_reloc_vector_table(void)
|
||||||
#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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2021 ARM Limited
|
||||||
|
* Copyright (c) 2021 Embedded Planet, Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "subtarget_init.h"
|
||||||
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
|
MBED_WEAK void subtarget_sdk_init(void)
|
||||||
|
{
|
||||||
|
/* Do nothing by default */
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2021 ARM Limited
|
||||||
|
* Copyright (c) 2021 Embedded Planet, Inc.
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _NORDIC_SUBTARGET_INIT_
|
||||||
|
#define _NORDIC_SUBTARGET_INIT_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 code, if necessary.
|
||||||
|
*
|
||||||
|
* By default, it is a blank function that is declared a "weak" symbol
|
||||||
|
*/
|
||||||
|
void subtarget_sdk_init(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _NORDIC_SUBTARGET_INIT_ */
|
Loading…
Reference in New Issue