Add nrf51 to supported mcu
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/826d3a57 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/826d3a57 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/826d3a57 Branch: refs/heads/master Commit: 826d3a575350a2e7cdc6ac0d4c6973e680d3725c Parents: b18f692 Author: wes3 <w...@micosa.io> Authored: Sun Jan 31 22:16:31 2016 -0800 Committer: wes3 <w...@micosa.io> Committed: Sun Jan 31 22:28:15 2016 -0800 ---------------------------------------------------------------------- hw/mcu/nordic/nrf51xxx/egg.yml | 5 + .../nrf51xxx/include/mcu/compiler_abstraction.h | 142 + hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h | 22 + hw/mcu/nordic/nrf51xxx/include/mcu/nrf.h | 76 + hw/mcu/nordic/nrf51xxx/include/mcu/nrf51.h | 1299 ++++ .../nrf51xxx/include/mcu/nrf51422_peripherals.h | 132 + .../nrf51xxx/include/mcu/nrf51822_peripherals.h | 132 + .../nrf51xxx/include/mcu/nrf51_bitfields.h | 6894 ++++++++++++++++++ .../nrf51xxx/include/mcu/nrf51_deprecated.h | 454 ++ hw/mcu/nordic/nrf51xxx/include/mcu/nrf51_hal.h | 51 + .../nordic/nrf51xxx/include/mcu/system_nrf51.h | 85 + hw/mcu/nordic/nrf51xxx/src/hal_cputime.c | 585 ++ hw/mcu/nordic/nrf51xxx/src/hal_gpio.c | 591 ++ hw/mcu/nordic/nrf51xxx/src/hal_system.c | 26 + hw/mcu/nordic/nrf51xxx/src/hal_uart.c | 295 + 15 files changed, 10789 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/826d3a57/hw/mcu/nordic/nrf51xxx/egg.yml ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/nrf51xxx/egg.yml b/hw/mcu/nordic/nrf51xxx/egg.yml new file mode 100644 index 0000000..812b029 --- /dev/null +++ b/hw/mcu/nordic/nrf51xxx/egg.yml @@ -0,0 +1,5 @@ +egg.name: "hw/mcu/nordic/nrf52xxx" +egg.deps: + - hw/hal + - libs/cmsis-core + - compiler/arm-none-eabi-m4 http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/826d3a57/hw/mcu/nordic/nrf51xxx/include/mcu/compiler_abstraction.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/nrf51xxx/include/mcu/compiler_abstraction.h b/hw/mcu/nordic/nrf51xxx/include/mcu/compiler_abstraction.h new file mode 100755 index 0000000..54eb9aa --- /dev/null +++ b/hw/mcu/nordic/nrf51xxx/include/mcu/compiler_abstraction.h @@ -0,0 +1,142 @@ +/** + * Copyright (c) 2016 Runtime Inc. + * + * 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. + */ + +/* Copyright (c) 2015, Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * 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 written permission. + * + * 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 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON 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 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +#ifndef _COMPILER_ABSTRACTION_H +#define _COMPILER_ABSTRACTION_H + +/*lint ++flb "Enter library region" */ + +#if defined ( __CC_ARM ) + + #ifndef __ASM + #define __ASM __asm + #endif + + #ifndef __INLINE + #define __INLINE __inline + #endif + + #ifndef __WEAK + #define __WEAK __weak + #endif + + #ifndef __ALIGN + #define __ALIGN(n) __align(n) + #endif + + #define GET_SP() __current_sp() + +#elif defined ( __ICCARM__ ) + + #ifndef __ASM + #define __ASM __asm + #endif + + #ifndef __INLINE + #define __INLINE inline + #endif + + #ifndef __WEAK + #define __WEAK __weak + #endif + + /* Not defined for IAR since it requires a new line to work, and C preprocessor does not allow that. */ + #ifndef __ALIGN + #define __ALIGN(n) + #endif + + #define GET_SP() __get_SP() + +#elif defined ( __GNUC__ ) + + #ifndef __ASM + #define __ASM __asm + #endif + + #ifndef __INLINE + #define __INLINE inline + #endif + + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + + #ifndef __ALIGN + #define __ALIGN(n) __attribute__((aligned(n))) + #endif + + #define GET_SP() gcc_current_sp() + + static inline unsigned int gcc_current_sp(void) + { + register unsigned sp __ASM("sp"); + return sp; + } + +#elif defined ( __TASKING__ ) + + #ifndef __ASM + #define __ASM __asm + #endif + + #ifndef __INLINE + #define __INLINE inline + #endif + + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + + #ifndef __ALIGN + #define __ALIGN(n) __align(n) + #endif + + #define GET_SP() __get_MSP() + +#endif + +/*lint --flb "Leave library region" */ + +#endif http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/826d3a57/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h b/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h new file mode 100644 index 0000000..ccb57d5 --- /dev/null +++ b/hw/mcu/nordic/nrf51xxx/include/mcu/cortex_m0.h @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2016 Runtime Inc. + * + * 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 __MCU_CORTEX_M0_H__ +#define __MCU_CORTEX_M0_H__ + +#include "mcu/nrf51.h" + +#endif /* __MCU_CORTEX_M0_H__ */ http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/826d3a57/hw/mcu/nordic/nrf51xxx/include/mcu/nrf.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/nrf51xxx/include/mcu/nrf.h b/hw/mcu/nordic/nrf51xxx/include/mcu/nrf.h new file mode 100755 index 0000000..ac18cd9 --- /dev/null +++ b/hw/mcu/nordic/nrf51xxx/include/mcu/nrf.h @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2016 Runtime Inc. + * + * 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. + */ + +/* Copyright (c) 2015, Nordic Semiconductor ASA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * 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 written permission. + * + * 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 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON 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 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef NRF_H +#define NRF_H + +#if defined(_WIN32) + /* Do not include nrf51 specific files when building for PC host */ +#elif defined(__unix) + /* Do not include nrf51 specific files when building for PC host */ +#elif defined(__APPLE__) + /* Do not include nrf51 specific files when building for PC host */ +#else + + /* Family selection for family includes. */ + #if defined (NRF51) + #include "nrf51.h" + #include "nrf51_bitfields.h" + #include "nrf51_deprecated.h" + #elif defined (NRF52) + #include "nrf52.h" + #include "nrf52_bitfields.h" + #include "nrf51_to_nrf52.h" + #else + #error "Device family must be defined. See nrf.h." + #endif /* NRF51, NRF52 */ + + #include "compiler_abstraction.h" + +#endif /* _WIN32 || __unix || __APPLE__ */ + +#endif /* NRF_H */ +