8000 Add support for nRF52810 (#46) · h2zero/n-able-Arduino@bd7d6c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit bd7d6c2

Browse files
positron96h2zero
andauthored
Add support for nRF52810 (#46)
* Add support for nRF52810 --------- Co-authored-by: h2zero <powell.rg@gmail.com>
1 parent 6728e57 commit bd7d6c2

File tree

13 files changed

+1679
-12
lines changed

13 files changed

+1679
-12
lines changed

boards.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,3 +1953,58 @@ Waveshare_BLE400.menu.cppDbgLvl.debug.build.cpp_debug=4
19531953
Waveshare_BLE400.menu.bootloader.none=No bootloader
19541954
Waveshare_BLE400.menu.bootloader.none.bootloader.flags=
19551955
Waveshare_BLE400.menu.bootloader.none.build.bootloader.file=tools/none_bootloader.hex
1956+
1957+
# nRF52810 variants
1958+
###################
1959+
1960+
Generic_nRF52810.name=Generic nRF52810
1961+
1962+
Generic_nRF52810.upload.tool=openocd
1963+
Generic_nRF52810.upload.target=nrf52
1964+
Generic_nRF52810.upload.jlink_device=nRF52810_xxAA
1965+
Generic_nRF52810.upload.maximum_size=180224
1966+
1967+
Generic_nRF52810.bootloader.tool=openocd
1968+
1969+
Generic_nRF52810.build.mcu=cortex-m4
1970+
Generic_nRF52810.build.f_cpu=64000000
1971+
Generic_nRF52810.build.board=GENERIC
1972+
Generic_nRF52810.build.core=nRF5
1973+
Generic_nRF52810.build.variant=Generic
1974+
Generic_nRF52810.build.variant_system_lib=
1975+
Generic_nRF52810.build.float_flags=
1976+
Generic_nRF52810.build.ldscript=nRF52810_xxaa.ld
1977+
Generic_nRF52810.build.extra_flags=-DNRF52_SERIES -DnRF52810_XXAA {bootloader.flags} -DCONFIG_NIMBLE_CPP_LOG_LEVEL={build.cpp_debug} {build.nimble_flags}
1978+
1979+
Generic_nRF52810.menu.lfclk.lfxo=Crystal Oscillator
1980+
Generic_nRF52810.menu.lfclk.lfxo.build.lfclk_flags=-DUSE_LFXO
1981+
Generic_nRF52810.menu.lfclk.lfrc=RC Oscillator
1982+
Generic_nRF52810.menu.lfclk.lfrc.build.lfclk_flags=-DUSE_LFRC
1983+
Generic_nRF52810.menu.lfclk.lfsynt=Synthesized
1984+
Generic_nRF52810.menu.lfclk.lfsynt.build.lfclk_flags=-DUSE_LFSYNT
1985+
1986+
Generic_nRF52810.menu.role.all=All
1987+
Generic_nRF52810.menu.role.all.build.nimble_flags=
1988+
Generic_nRF52810.menu.role.periph=Peripheral
1989+
Generic_nRF52810.menu.role.periph.build.nimble_flags=-DCONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED -DCONFIG_BT_NIMBLE_ROLE_OBSERVER_DISABLED
1990+
Generic_nRF52810.menu.role.adv=Advertiser
1991+
Generic_nRF52810.menu.role.adv.build.nimble_flags=-DCONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED -DCONFIG_BT_NIMBLE_ROLE_OBSERVER_DISABLED -DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED
1992+
Generic_nRF52810.menu.role.scan=Scanner
1993+
Generic_nRF52810.menu.role.scan.build.nimble_flags=-DCONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED -DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED -DCONFIG_BT_NIMBLE_ROLE_CENTRAL_DISABLED
1994+
Generic_nRF52810.menu.role.central=Client
1995+
Generic_nRF52810.menu.role.central.build.nimble_flags=-DCONFIG_BT_NIMBLE_ROLE_PERIPHERAL_DISABLED -DCONFIG_BT_NIMBLE_ROLE_BROADCASTER_DISABLED
1996+
1997+
Generic_nRF52810.menu.cppDbgLvl.none=None
1998+
Generic_nRF52810.menu.cppDbgLvl.none.build.cpp_debug=0
1999+
Generic_nRF52810.menu.cppDbgLvl.error=Error
2000+
Generic_nRF52810.menu.cppDbgLvl.error.build.cpp_debug=1
2001+
Generic_nRF52810.menu.cppDbgLvl.warn=Warn
2002+
Generic_nRF52810.menu.cppDbgLvl.warn.build.cpp_debug=2
2003+
Generic_nRF52810.menu.cppDbgLvl.info=Info
2004+
Generic_nRF52810.menu.cppDbgLvl.info.build.cpp_debug=3
2005+
Generic_nRF52810.menu.cppDbgLvl.debug=Debug
2006+
Generic_nRF52810.menu.cppDbgLvl.debug.build.cpp_debug=4
2007+
2008+
Generic_nRF52810.menu.bootloader.none=No bootloader
2009+
Generic_nRF52810.menu.bootloader.none.bootloader.flags=
2010+
Generic_nRF52810.menu.bootloader.none.build.bootloader.file=tools/none_bootloader.hex

cores/nRF5/Uart.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121
#include "Arduino.h"
2222
#include "wiring_private.h"
2323

24+
// these nRF52s have different UART PSEL definition
25+
#if defined(NRF52810_XXAA) || defined(NRF52805_XXAA) \
26+
|| defined(NRF52811_XXAA) || defined(NRF52833_XXAA) \
27+
|| defined(NRF52840_XXAA)
28+
#define PSELTXD PSEL.TXD
29+
#define PSELRXD PSEL.RXD
30+
#define PSELCTS PSEL.CTS
31+
#define PSELRTS PSEL.RTS
32+
#endif
2433

2534
void serialEventRun(void)
2635
{

cores/nRF5/freertos/port.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,11 @@ void xPortPendSVHandler( void )
205205
" ldr r3, =pxCurrentTCB \n" /* Get the location of the current TCB. */
206206
" ldr r2, [r3] \n"
207207
" \n"
208+
#if (__FPU_PRESENT == 1U)
208209
" tst r14, #0x10 \n" /* Is the task using the FPU context? If so, push high vfp registers. */
209210
" it eq \n"
210211
" vstmdbeq r0!, {s16-s31} \n"
212+
#endif
211213
" \n"
212214
" stmdb r0!, {r4-r11, r14} \n" /* Save the core registers. */
213215
" \n"
@@ -228,9 +230,11 @@ void xPortPendSVHandler( void )
228230
" \n"
229231
" ldmia r0!, {r4-r11, r14} \n" /* Pop the core registers. */
230232
" \n"
233+
#if (__FPU_PRESENT == 1U)
231234
" tst r14, #0x10 \n" /* Is the task using the FPU context? If so, pop 9E88 the high vfp registers too. */
232235
" it eq \n"
233236
" vldmiaeq r0!, {s16-s31} \n"
237+
#endif
234238
" \n"
235239
" msr psp, r0 \n"
236240
" isb \n"

cores/nRF5/freertos/port_nrf52.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636
#include "app_util_platform.h"
3737
#endif
3838

39-
#if !(__FPU_USED) && !(__LINT__)
40-
#error This port can only be used when the project options are configured to enable hardware floating point support.
41-
#endif
39+
//* see https://devzone.nordicsemi.com/f/nordic-q-a/30103/freertos-on-nrf52810
40+
// #if !(__FPU_USED) && !(__LINT__)
41+
// #error This port can only be used when the project options are configured to enable hardware floating point support.
42+
// #endif
4243

4344
#if configMAX_SYSCALL_INTERRUPT_PRIORITY == 0
4445
#error configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0. See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
@@ -227,8 +228,10 @@ BaseType_t xPortStartScheduler( void )
227228
/* Ensure the VFP is enabled - it should be anyway. */
228229
vPortEnableVFP();
229230

231+
#if (__FPU_PRESENT == 1U)
230232
/* Lazy save always. */
231233
FPU->FPCCR |= FPU_FPCCR_ASPEN_Msk | FPU_FPCCR_LSPEN_Msk;
234+
#endif
232235

233236
/* Finally this port requires SEVONPEND to be active */
234237
SCB->SCR |= SCB_SCR_SEVONPEND_Msk;

cores/nRF5/freertos/port_nrf52_systick.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,15 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime )
242242
else
243243
#endif
244244
{
245+
#if (__FPU_PRESENT == 1U)
245246
// Fix ERRATA 87 (https://infocenter.nordicsemi.com/index.jsp?topic=%252Fcom.nordic.infocenter.sdk5.v11.0.0%252Findex.html&cp=4_0_0)
246247
// Clear FPU interrupt before going to sleep. This prevent unexpected wake-up.
247248
#define FPU_EXCEPTION_MASK 0x0000009F
248249
/* Clear exceptions and PendingIRQ from the FPU unit */
249250
__set_FPSCR(__get_FPSCR() & ~(FPU_EXCEPTION_MASK));
250251
(void) __get_FPSCR();
251252
NVIC_ClearPendingIRQ(FPU_IRQn);
253+
#endif
252254

253255
/* No SD - we would just block interrupts globally.
254256
* BASEPRI cannot be used for that because it would prevent WFE from wake up.

cores/nRF5/nimble_config/ext_nimble_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#if defined(NRF51)
22
#include "nrf51_nimconfig.h"
3+
#elif defined(NRF52810_XXAA)
4+
#include "nrf52810_nimconfig.h"
35
#elif defined(NRF52832_XXAA) || defined(NRF52832_XXAB)
46
#include "nrf52832_nimconfig.h"
57
#elif defined(NRF52833_XXAA)

0 commit comments

Comments
 (0)
0