Skip to content

Commit 3bb4551

Browse files
committed
add feather52840 board
1 parent 4f32732 commit 3bb4551

10 files changed

Lines changed: 515 additions & 6 deletions

File tree

ports/nrf/boards/feather52/board.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@
3535
#define BOOTLOADER_VERSION_REGISTER NRF_TIMER2->CC[0]
3636
uint32_t bootloaderVersion = 0;
3737

38-
void board_init(void)
38+
void board_init (void)
3939
{
40-
// Retrieve bootloader version
41-
bootloaderVersion = BOOTLOADER_VERSION_REGISTER;
40+
// Retrieve bootloader version
41+
bootloaderVersion = BOOTLOADER_VERSION_REGISTER;
4242
}
4343

4444
// Check the status of the two buttons on CircuitPlayground Express. If both are
4545
// pressed, then boot into user safe mode.
46-
bool board_requests_safe_mode(void) {
46+
bool board_requests_safe_mode (void)
47+
{
4748
// gpio_set_pin_function(PIN_PA14, GPIO_PIN_FUNCTION_OFF);
4849
// gpio_set_pin_direction(PIN_PA14, GPIO_DIRECTION_IN);
4950
// gpio_set_pin_pull_mode(PIN_PA14, GPIO_PULL_DOWN);
@@ -57,10 +58,11 @@ bool board_requests_safe_mode(void) {
5758
// reset_pin(PIN_PA28);
5859
// return safe_mode;
5960

60-
return false;
61+
return false;
6162
}
6263

63-
void reset_board(void) {
64+
void reset_board (void)
65+
{
6466
// uint8_t empty[30];
6567
// memset(empty, 0, 30);
6668
// digitalio_digitalinout_obj_t neopixel_pin;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
GNU linker script for NRF52 w/ s132 5.0.0 SoftDevice
3+
4+
MEMORY MAP
5+
------------------------------------------------------------------------
6+
START ADDR END ADDR SIZE DESCRIPTION
7+
---------- ---------- ------- -----------------------------------------
8+
0x000FF000..0x000FFFFF ( 4KB) Bootloader Settings
9+
0x000FE000..0x000FEFFF ( 4KB) Master Boot Record Params
10+
0x000F4000..0x000FDFFF ( 40KB) Serial + OTA Bootloader
11+
12+
0x000F3000..0x000F3FFF ( 4KB ) Private Config Data (Bonding, Keys, etc.)
13+
0x000F2000..0x000F2FFF ( 4KB ) User NVM data
14+
0x000D9000..0x000F1FFF ( 100KB) User Filesystem
15+
16+
0x00025000..0x000D8FFF (720KB) Application Code (including ISR vector)
17+
0x00001000..0x00024FFF (144KB) SoftDevice
18+
0x00000000..0x00000FFF (4KB) Master Boot Record
19+
*/
20+
21+
/* Specify the memory areas (S132 5.0.0) */
22+
MEMORY
23+
{
24+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000
25+
26+
FLASH_ISR (rx) : ORIGIN = 0x00025000, LENGTH = 0x001000
27+
FLASH_TEXT (rx) : ORIGIN = 0x00026000, LENGTH = 0x0B3000
28+
FLASH_FATFS (r) : ORIGIN = 0x000D9000, LENGTH = 0x019000
29+
30+
/* 0x2000000 - RAM:ORGIGIN is reserved for Softdevice */
31+
RAM (xrw) : ORIGIN = 0x20004000, LENGTH = 0x20040000 - 0x20004000
32+
}
33+
34+
/* produce a link error if there is not this amount of RAM for these sections */
35+
_minimum_stack_size = 2K;
36+
_minimum_heap_size = 0 /*16K Circuit Python use static variable for HEAP */;
37+
38+
/* top end of the stack */
39+
40+
/*_stack_end = ORIGIN(RAM) + LENGTH(RAM);*/
41+
_estack = ORIGIN(RAM) + LENGTH(RAM);
42+
43+
/* RAM extents for the garbage collector */
44+
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
45+
_heap_end = 0x20007000; /* tunable */
46+
47+
INCLUDE "boards/common.ld"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include <string.h>
28+
#include <stdbool.h>
29+
30+
#include "nrf.h"
31+
32+
#include "boards/board.h"
33+
34+
void board_init(void) {
35+
36+
}
37+
38+
bool board_requests_safe_mode(void) {
39+
return false;
40+
}
41+
42+
void reset_board(void) {
43+
44+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2016 Glenn Ruben Bakke
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#define PCA10056
28+
29+
#define MICROPY_HW_BOARD_NAME "PCA10056"
30+
#define MICROPY_HW_MCU_NAME "NRF52840"
31+
#define MICROPY_PY_SYS_PLATFORM "nrf52840-PDK"
32+
33+
#define MICROPY_PY_MACHINE_HW_PWM (1)
34+
#define MICROPY_PY_MACHINE_HW_SPI (1)
35+
#define MICROPY_PY_MACHINE_TIMER (1)
36+
#define MICROPY_PY_MACHINE_RTC (1)
37+
#define MICROPY_PY_MACHINE_I2C (1)
38+
#define MICROPY_PY_MACHINE_ADC (1)
39+
#define MICROPY_PY_MACHINE_TEMP (1)
40+
41+
#define MICROPY_HW_HAS_LED (1)
42+
#define MICROPY_HW_HAS_SWITCH (0)
43+
#define MICROPY_HW_HAS_FLASH (0)
44+
#define MICROPY_HW_HAS_SDCARD (0)
45+
#define MICROPY_HW_HAS_MMA7660 (0)
46+
#define MICROPY_HW_HAS_LIS3DSH (0)
47+
#define MICROPY_HW_HAS_LCD (0)
48+
#define MICROPY_HW_ENABLE_RNG (0)
49+
#define MICROPY_HW_ENABLE_RTC (0)
50+
#define MICROPY_HW_ENABLE_TIMER (0)
51+
#define MICROPY_HW_ENABLE_SERVO (0)
52+
#define MICROPY_HW_ENABLE_DAC (0)
53+
#define MICROPY_HW_ENABLE_CAN (0)
54+
55+
#define MICROPY_HW_LED_COUNT (4)
56+
#define MICROPY_HW_LED_PULLUP (1)
57+
58+
#define MICROPY_HW_LED1 (13) // LED1
59+
#define MICROPY_HW_LED2 (14) // LED2
60+
#define MICROPY_HW_LED3 (15) // LED3
61+
#define MICROPY_HW_LED4 (16) // LED4
62+
63+
// UART config
64+
#define MICROPY_HW_UART1_RX (pin_A8)
65+
#define MICROPY_HW_UART1_TX (pin_A6)
66+
#define MICROPY_HW_UART1_CTS (pin_A7)
67+
#define MICROPY_HW_UART1_RTS (pin_A5)
68+
#define MICROPY_HW_UART1_HWFC (1)
69+
70+
// SPI0 config
71+
#define MICROPY_HW_SPI0_NAME "SPI0"
72+
73+
#define MICROPY_HW_SPI0_SCK (pin_B15)
74+
#define MICROPY_HW_SPI0_MOSI (pin_B13)
75+
#define MICROPY_HW_SPI0_MISO (pin_B14)
76+
77+
#define MICROPY_HW_PWM0_NAME "PWM0"
78+
#define MICROPY_HW_PWM1_NAME "PWM1"
79+
#define MICROPY_HW_PWM2_NAME "PWM2"
80+
#if 0
81+
#define MICROPY_HW_PWM3_NAME "PWM3"
82+
#endif
83+
84+
#define HELP_TEXT_BOARD_LED "1,2,3,4"
85+
86+
#define PORT_HEAP_SIZE (128*1024)
87+
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
MCU_SERIES = m4
2+
MCU_VARIANT = nrf52
3+
MCU_SUB_VARIANT = nrf52840
4+
SOFTDEV_VERSION ?= 6.0.0-6.alpha
5+
6+
LD_FILE = boards/nrf52840_1M_256k.ld
7+
8+
NRF_DEFINES += -DNRF52840_XXAA
9+
10+
ifeq ($(SD), )
11+
INC += -Idrivers/bluetooth/s140_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/s140_$(MCU_SUB_VARIANT)_$(SOFTDEV_VERSION)_API/include
12+
INC += -Idrivers/bluetooth/s140_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/s140_$(MCU_SUB_VARIANT)_$(SOFTDEV_VERSION)_API/include/$(MCU_VARIANT)
13+
endif
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
MCU_SERIES = m4
2+
MCU_VARIANT = nrf52
3+
MCU_SUB_VARIANT = nrf52840
4+
SOFTDEV_VERSION ?= 6.0.0-6.alpha
5+
6+
LD_FILE = boards/nrf52840_1M_256k_s140_$(SOFTDEV_VERSION).ld
7+
8+
NRF_DEFINES += -DNRF52840_XXAA
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef NRF52_HAL_CONF_H__
2+
#define NRF52_HAL_CONF_H__
3+
4+
#define HAL_UART_MODULE_ENABLED
5+
#define HAL_SPI_MODULE_ENABLED
6+
#define HAL_TIME_MODULE_ENABLED
7+
#define HAL_PWM_MODULE_ENABLED
8+
#define HAL_RTC_MODULE_ENABLED
9+
#define HAL_TIMER_MODULE_ENABLED
10+
#define HAL_TWI_MODULE_ENABLED
11+
#define HAL_ADCE_MODULE_ENABLED
12+
#define HAL_TEMP_MODULE_ENABLED
13+
#define HAL_RNG_MODULE_ENABLED
14+
// #define HAL_UARTE_MODULE_ENABLED
15+
// #define HAL_SPIE_MODULE_ENABLED
16+
// #define HAL_TWIE_MODULE_ENABLED
17+
18+
#endif // NRF52_HAL_CONF_H__

0 commit comments

Comments
 (0)