726dcdb60a
I have a function where it should be impossible to reach the end, so I put in a safe-mode reset at the bottom: ``` int find_unused_slot(void) { // precondition: you already verified that a slot was available for (int i=0; i<NUM_SLOTS; i++) { if( slot_free(i)) { return i; } } safe_mode_reset(MICROPY_FATAL_ERROR); } ``` However, the compiler still gave a diagnostic, because safe_mode_reset was not declared NORETURN. So I started by teaching the compiler that reset_into_safe_mode never returned. This leads at least one level deeper due to reset_cpu needing to be a NORETURN function. Each port is a little different in this area. I also marked reset_to_bootloader as NORETURN. Additional notes: * stm32's reset_to_bootloader was not implemented, but now does a bare reset. Most stm32s are not fitted with uf2 bootloaders anyway. * ditto cxd56 * esp32s2 did not implement reset_cpu at all. I used esp_restart(). (not tested) * litex did not implement reset_cpu at all. I used reboot_ctrl_write. But notably this is what reset_to_bootloader already did, so one or the other must be incorrect (not tested). reboot_ctrl_write cannot be declared NORETURN, as it returns unless the special value 0xac is written), so a new unreachable forever-loop is added. * cxd56's reset is via a boardctl() call which can't generically be declared NORETURN, so a new unreacahble "for(;;)" forever-loop is added. * In several places, NVIC_SystemReset is redeclared with NORETURN applied. This is accepted just fine by gcc. I chose this as preferable to editing the multiple copies of CMSIS headers where it is normally declared. * the stub safe_mode reset simply aborts. This is used in mpy-cross. |
||
---|---|---|
.. | ||
boards | ||
common-hal | ||
configs/circuitpython | ||
mkspk | ||
spresense-exported-sdk@752c4cd56d | ||
supervisor | ||
tools | ||
.gitignore | ||
Makefile | ||
README.md | ||
alloca.h | ||
background.c | ||
background.h | ||
fatfs_port.c | ||
mpconfigport.h | ||
mpconfigport.mk | ||
mphalport.c | ||
mphalport.h | ||
qstrdefsport.h |
README.md
CircuitPython port to Spresense
This directory contains the port of CircuitPython to Spresense. It is a compact development board based on Sony’s power-efficient multicore microcontroller CXD5602.
Board features:
- Integrated GPS
- The embedded GNSS with support for GPS, QZSS and GLONASS enables applications where tracking is required.
- Hi-res audio output and multi mic inputs
- Advanced 192kHz/24 bit audio codec and amplifier for audio output, and support for up to 8 mic input channels.
- Multicore microcontroller
- Spresense is powered by Sony's CXD5602 microcontroller (ARM® Cortex®-M4F × 6 cores), with a clock speed of 156 MHz.
Currently, Spresense port does not support Audio and Multicore.
Refer to developer.sony.com/develop/spresense/ for further information about this board.
Prerequisites
Linux
Add user to dialout
group:
$ sudo usermod -a -G dialout <user-name>
Windows
Download and install USB serial driver
macOS
Download and install USB serial driver
Build instructions
Pull all submodules into your clone:
$ git submodule update --init --recursive
Build the MicroPython cross-compiler:
$ make -C mpy-cross
Change directory to cxd56:
$ cd ports/cxd56
To build circuitpython image run:
$ make BOARD=spresense
USB connection
Connect the Spresense main board
to the PC via the USB cable.
Flash the bootloader
The correct bootloader is required for the Spresense board to function.
Bootloader information:
-
The bootloader has to be flashed the very first time the board is used.
-
You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary.
Download the spresense binaries zip archive from: Spresense firmware v2-0-000
Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/
To flash the bootloader run the command:
$ make BOARD=spresense flash-bootloader
Flash the circuitpython image
To flash the firmware run the command:
$ make BOARD=spresense flash
Accessing the board
Connect the Spresense extension board
to the PC via the USB cable.
Once built and deployed, access the CircuitPython REPL (the Python prompt) via USB. You can run:
$ screen /dev/ttyACM0 115200