Skip to content

Commit ce75a21

Browse files
author
Kevin Townsend
committed
Revert "Supervisor REPL support for ports/nrf/boards/feather52"
This reverts commit 92113dd.
1 parent 92113dd commit ce75a21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+355
-1622
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,3 @@
4040
[submodule "tools/usb_descriptor"]
4141
path = tools/usb_descriptor
4242
url = https://github.com/adafruit/usb_descriptor.git
43-
[submodule "lib/nrfutil"]
44-
path = lib/nrfutil
45-
url = git@github.com:adafruit/nRF52_nrfutil.git

lib/nrfutil

Lines changed: 0 additions & 1 deletion
This file was deleted.

ports/nrf/Makefile

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Select the board to build for: if not given on the command line,
2-
# then default to feather52.
3-
BOARD ?= feather52
2+
# then default to pca10040.
3+
BOARD ?= pca10040
44
ifeq ($(wildcard boards/$(BOARD)/.),)
55
$(error Invalid BOARD specified)
66
endif
@@ -11,18 +11,17 @@ SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]')
1111

1212
# TODO: Verify that it is a valid target.
1313

14+
1415
ifeq ($(SD), )
1516
# If the build directory is not given, make it reflect the board name.
1617
BUILD ?= build-$(BOARD)
1718
include ../../py/mkenv.mk
1819
include boards/$(BOARD)/mpconfigboard.mk
19-
-include mpconfigport.mk
2020
else
2121
# If the build directory is not given, make it reflect the board name.
2222
BUILD ?= build-$(BOARD)-$(SD_LOWER)
2323
include ../../py/mkenv.mk
2424
include boards/$(BOARD)/mpconfigboard_$(SD_LOWER).mk
25-
-include mpconfigport.mk
2625

2726
include drivers/bluetooth/bluetooth_common.mk
2827
endif
@@ -35,9 +34,10 @@ FROZEN_MPY_DIR = freeze
3534
# include py core make definitions
3635
include ../../py/py.mk
3736

38-
include $(TOP)/supervisor/supervisor.mk
3937

4038
FATFS_DIR = lib/oofatfs
39+
MPY_CROSS = ../../mpy-cross/mpy-cross
40+
MPY_TOOL = ../../tools/mpy-tool.py
4141

4242
CROSS_COMPILE = arm-none-eabi-
4343

@@ -120,6 +120,7 @@ SRC_HAL = $(addprefix hal/,\
120120
hal_spi.c \
121121
hal_spie.c \
122122
hal_time.c \
123+
hal_rtc.c \
123124
hal_timer.c \
124125
hal_twi.c \
125126
hal_adc.c \
@@ -135,19 +136,17 @@ SRC_HAL += $(addprefix hal/,\
135136
)
136137
endif
137138

138-
139139
SRC_C += \
140+
main.c \
140141
mphalport.c \
141142
help.c \
143+
gccollect.c \
142144
pin_named_pins.c \
143145
fatfs_port.c \
144146
drivers/softpwm.c \
145147
drivers/ticker.c \
146148
drivers/bluetooth/ble_drv.c \
147149
drivers/bluetooth/ble_uart.c \
148-
boards/$(BOARD)/board.c \
149-
lib/utils/context_manager_helpers.c \
150-
fifo.c \
151150

152151
DRIVERS_SRC_C += $(addprefix modules/,\
153152
machine/modmachine.c \
@@ -157,6 +156,7 @@ DRIVERS_SRC_C += $(addprefix modules/,\
157156
machine/adc.c \
158157
machine/pin.c \
159158
machine/timer.c \
159+
machine/rtc.c \
160160
machine/pwm.c \
161161
machine/led.c \
162162
machine/temp.c \
@@ -183,38 +183,13 @@ SRC_C += \
183183
device/$(MCU_VARIANT)/system_$(MCU_SUB_VARIANT).c \
184184
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
185185

186-
187-
SRC_COMMON_HAL += \
188-
board/__init__.c \
189-
digitalio/__init__.c \
190-
digitalio/DigitalInOut.c \
191-
microcontroller/__init__.c \
192-
microcontroller/Pin.c \
193-
microcontroller/Processor.c \
194-
time/__init__.c \
195-
196-
# These don't have corresponding files in each port but are still located in
197-
# shared-bindings to make it clear what the contents of the modules are.
198-
SRC_BINDINGS_ENUMS = \
199-
digitalio/Direction.c \
200-
digitalio/DriveMode.c \
201-
digitalio/Pull.c \
202-
help.c \
203-
math/__init__.c \
204-
util.c
205-
206-
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
207-
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
208-
$(addprefix common-hal/, $(SRC_COMMON_HAL))
209-
210186
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
211187
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
212188

213-
OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
189+
OBJ += $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
214190
OBJ += $(addprefix $(BUILD)/, $(SRC_LIB:.c=.o))
215191
OBJ += $(addprefix $(BUILD)/, $(SRC_HAL:.c=.o))
216192
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
217-
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
218193
OBJ += $(BUILD)/pins_gen.o
219194

220195
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
@@ -270,7 +245,7 @@ $(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
270245
$(Q)$(SIZE) $@
271246

272247
# List of sources for qstr extraction
273-
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_LIB) $(DRIVERS_SRC_C) $(SRC_COMMON_HAL_EXPANDED)
248+
SRC_QSTR += $(SRC_C) $(SRC_MOD) $(SRC_LIB) $(DRIVERS_SRC_C)
274249

275250
# Append any auto-generated sources that are needed by sources listed in
276251
# SRC_QSTR

ports/nrf/boards/board.h

Lines changed: 0 additions & 47 deletions
This file was deleted.

ports/nrf/boards/feather52/README.md

Lines changed: 28 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
# Setup
22

3-
## Installing CircuitPython submodules
4-
5-
Before you can build, you will need to run the following commands once, which
6-
will install the submodules that are part of the CircuitPython ecosystem, and
7-
build the `mpy-cross` tool:
3+
Before you can build, you will need to run the following commands once:
84

95
```
106
$ cd circuitpython
117
$ git submodule update --init
128
$ make -C mpy-cross
139
```
1410

15-
You then need to download the SD and Nordic SDK files via:
11+
You then need to download the SD and Nordic SDK files:
1612

1713
> This script relies on `wget`, which must be available from the command line.
1814
@@ -21,50 +17,47 @@ $ cd ports/nrf
2117
$ ./drivers/bluetooth/download_ble_stack.sh
2218
```
2319

24-
## Installing `nrfutil`
25-
26-
The Adafruit Bluefruit nRF52 Feather ships with a serial and OTA BLE bootloader
27-
that can be used to flash firmware images over a simple serial connection,
28-
using the on-board USB serial converter.
29-
30-
If you haven't installed this command-line tool yet, go to the `/libs/nrfutil`
31-
folder (where nrfutil 0.5.2 is installed as a sub-module) and run the following
32-
commands:
33-
34-
> If you get a 'sudo: pip: command not found' error running 'sudo pip install',
35-
you can install pip via 'sudo easy_install pip'
36-
37-
```
38-
$ cd libs/nrfutil
39-
$ sudo pip install -r requirements.txt
40-
$ sudo python setup.py install
41-
```
42-
4320
# Building and flashing firmware images
4421

45-
## Building CircuitPython binaries
22+
## Building CircuitPython
4623

4724
#### REPL over UART (default settings)
4825

4926
To build a CircuitPython binary with default settings for the
5027
`feather52` target enter:
5128

52-
> **NOTE:** `BOARD=feather52` is the default option and isn't stricly required.
53-
5429
```
5530
$ make BOARD=feather52 V=1
5631
```
5732

58-
#### REPL over BLE support
33+
#### REPL over BLE UART (AKA `NUS`)
5934

60-
To build a CircuitPython binary with BLE support (S132) include `SD=s132`
61-
as part of the build process:
35+
To build a CircuitPython binary with REPL over BLE UART, edit
36+
`bluetooth_conf.h` with the following values (under
37+
`#elif (BLUETOOTH_SD == 132)`):
38+
39+
```
40+
#define MICROPY_PY_BLE (1)
41+
#define MICROPY_PY_BLE_NUS (1)
42+
#define BLUETOOTH_WEBBLUETOOTH_REPL (1)
43+
```
44+
45+
Then build the CircuitPython binary, including `SD=s132`
46+
to enable BLE support in the build process:
6247

6348
```
6449
$ make BOARD=feather52 V=1 SD=s132
6550
```
6651

67-
## Flashing binaries with `nrfutil`
52+
## Flashing with `nrfutil`
53+
54+
The Adafruit Bluefruit nRF52 Feather ships with a serial and OTA BLE bootloader
55+
that can be used to flash firmware images over a simple serial connection,
56+
using the on-board USB serial converter.
57+
58+
These commands assume that you have already installed `nrfutil`, as described
59+
in the [learning guide](https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/arduino-bsp-setup)
60+
for the Arduino variant of the board.
6861

6962
### 1. **Update bootloader** to single-bank version
7063

@@ -95,7 +88,7 @@ To enable BLE5 support and the latest S132 release, flash the v5.0.0 bootloader
9588
$ make BOARD=feather52 SERIAL=/dev/tty.SLAB_USBtoUART SOFTDEV_VERSION=5.0.0 boot-flash
9689
```
9790

98-
### 2. Generate and flash a CircuitPython DFU .zip package over serial
91+
### 2. Generate a CircuitPython DFU .zip package and flash it over serial
9992

10093
The following command will package and flash the CircuitPython binary using the
10194
appropriate bootloader mentionned above.
@@ -109,49 +102,9 @@ image, as described earlier in this readme.
109102
$ make BOARD=feather52 SERIAL=/dev/tty.SLAB_USBtoUART dfu-gen dfu-flash
110103
```
111104

112-
If you built your CircuitPython binary with **BLE** support you will need to
113-
add the `SD=s132` flag as shown below:
105+
If you built your CircuitPython binary with **BLE UART** support you will
106+
need to add the `SD=s132` flag as shown below:
114107

115108
```
116109
$ make BOARD=feather52 SERIAL=/dev/tty.SLAB_USBtoUART SD=s132 dfu-gen dfu-flash
117110
```
118-
119-
## Working with CircuitPython
120-
121-
### Running local files with `ampy`
122-
123-
[ampy](https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy)
124-
is a command-line tool that can be used with the nRF52 Feather to transfer
125-
local python files to the nRF52 for execution, rather than having to enter
126-
the REPL manually, enter paste mode, and paste the code yourself.
127-
128-
> **IMPORTANT**: You must have `ampy` version **1.0.3** or higher to use `ampy`
129-
with the nRF52. The bootloader on the nRF52 requires a delay between the
130-
HW reset, and the moment when the command sequance is sent to enter raw
131-
mode. This required `-d/--delay` flag was added in release 1.0.3.
132-
133-
134-
Save the following file as `test.py`:
135-
136-
```
137-
import board
138-
import digitalio
139-
import time
140-
141-
led = digitalio.DigitalInOut(board.LED2)
142-
led.direction = digitalio.Direction.OUTPUT
143-
144-
while True:
145-
led.value = True
146-
time.sleep(0.5)
147-
led.value = False
148-
time.sleep(0.5)
149-
```
150-
151-
Then run the saved file via ampy, updating the serial port as required:
152-
153-
```
154-
$ ampy -p /dev/tty.SLAB_USBtoUART -d 1.5 run test.py
155-
```
156-
157-
This should give you blinky at 1 Hz on LED2 (the blue LED on the nRF52 Feather).

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy