Merge remote-tracking branch 'adafruit/master' into es_lang
This commit is contained in:
commit
2b003477df
|
@ -7,7 +7,6 @@
|
|||
*.bin
|
||||
*.map
|
||||
*.hex
|
||||
!ports/nrf/**/bootloader/**/*.hex
|
||||
*.dis
|
||||
*.exe
|
||||
|
||||
|
|
|
@ -30,7 +30,8 @@ env:
|
|||
- TRAVIS_BOARD=pirkey_m0
|
||||
- TRAVIS_BOARD=gemma_m0
|
||||
- TRAVIS_BOARD=hallowing_m0_express
|
||||
- TRAVIS_BOARD=feather52832
|
||||
- TRAVIS_BOARD=feather_nrf52832
|
||||
- TRAVIS_BOARD=feather_nrf52840_express
|
||||
|
||||
addons:
|
||||
artifacts:
|
||||
|
@ -54,7 +55,7 @@ before_script:
|
|||
- ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
|
||||
|
||||
# For nrf builds
|
||||
- ([[ $TRAVIS_BOARD != "feather52832" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
|
||||
- ([[ $TRAVIS_BOARD != "feather_nrf52832" && $TRAVIS_BOARD != "feather_nrf52840_express" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
|
||||
# For huzzah builds
|
||||
- if [[ $TRAVIS_BOARD = "feather_huzzah" ]]; then wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar xavf xtensa-lx106-elf-standalone.tar.gz; PATH=$(readlink -f xtensa-lx106-elf/bin):$PATH; fi
|
||||
# For coverage testing (upgrade is used to get latest urllib3 version)
|
||||
|
|
|
@ -320,7 +320,7 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
|
|||
} else {
|
||||
mode |= MP_S_IFREG;
|
||||
}
|
||||
mp_int_t seconds = timeutils_seconds_since_2000(
|
||||
mp_uint_t seconds = timeutils_seconds_since_epoch(
|
||||
1980 + ((fno.fdate >> 9) & 0x7f),
|
||||
(fno.fdate >> 5) & 0x0f,
|
||||
fno.fdate & 0x1f,
|
||||
|
@ -335,9 +335,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
|
|||
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
|
||||
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
|
||||
t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
|
||||
t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
|
||||
t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
|
||||
t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
|
||||
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
|
||||
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
|
||||
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime
|
||||
|
||||
return MP_OBJ_FROM_PTR(t);
|
||||
}
|
||||
|
|
|
@ -158,6 +158,17 @@ mp_uint_t timeutils_seconds_since_2000(mp_uint_t year, mp_uint_t month,
|
|||
+ (year - 2000) * 31536000;
|
||||
}
|
||||
|
||||
void timeutils_seconds_since_epoch_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm) {
|
||||
t -= EPOCH1970_EPOCH2000_DIFF_SECS;
|
||||
timeutils_seconds_since_2000_to_struct_time(t, tm);
|
||||
}
|
||||
|
||||
mp_uint_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month, mp_uint_t date,
|
||||
mp_uint_t hour, mp_uint_t minute, mp_uint_t second) {
|
||||
mp_uint_t t = timeutils_seconds_since_2000(year, month, date, hour, minute, second);
|
||||
return t + EPOCH1970_EPOCH2000_DIFF_SECS;
|
||||
}
|
||||
|
||||
mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
|
||||
mp_int_t hours, mp_int_t minutes, mp_int_t seconds) {
|
||||
|
||||
|
@ -211,5 +222,5 @@ mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
|
|||
year++;
|
||||
}
|
||||
}
|
||||
return timeutils_seconds_since_2000(year, month, mday, hours, minutes, seconds);
|
||||
return timeutils_seconds_since_epoch(year, month, mday, hours, minutes, seconds);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#ifndef MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
|
||||
#define MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
|
||||
|
||||
#define EPOCH1970_EPOCH2000_DIFF_SECS 946684800
|
||||
|
||||
typedef struct _timeutils_struct_time_t {
|
||||
uint16_t tm_year; // i.e. 2014
|
||||
uint8_t tm_mon; // 1..12
|
||||
|
@ -48,6 +50,11 @@ void timeutils_seconds_since_2000_to_struct_time(mp_uint_t t,
|
|||
mp_uint_t timeutils_seconds_since_2000(mp_uint_t year, mp_uint_t month,
|
||||
mp_uint_t date, mp_uint_t hour, mp_uint_t minute, mp_uint_t second);
|
||||
|
||||
void timeutils_seconds_since_epoch_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm);
|
||||
|
||||
mp_uint_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month, mp_uint_t date,
|
||||
mp_uint_t hour, mp_uint_t minute, mp_uint_t second);
|
||||
|
||||
mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
|
||||
mp_int_t hours, mp_int_t minutes, mp_int_t seconds);
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7b35cd0203bc409d7c1aefc075672103cb4a913e
|
||||
Subproject commit 583326e535454f16b06ebdb9cc06869602a5564c
|
|
@ -28,8 +28,13 @@
|
|||
#include "py/runtime.h"
|
||||
#include "lib/oofatfs/ff.h" /* FatFs lower layer API */
|
||||
#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */
|
||||
#include "lib/timeutils/timeutils.h"
|
||||
#include "shared-bindings/rtc/RTC.h"
|
||||
|
||||
DWORD get_fattime(void) {
|
||||
// TODO(tannewt): Support the RTC.
|
||||
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
|
||||
timeutils_struct_time_t tm;
|
||||
common_hal_rtc_get_time(&tm);
|
||||
|
||||
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
|
||||
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
|
||||
}
|
||||
|
|
|
@ -36,9 +36,9 @@ the following links:
|
|||
> **NOTE**: These board specific readmes may be more up to date than the
|
||||
generic board-neutral documentation further down.
|
||||
|
||||
* Adafruit [Feather nRF52](boards/feather52/README.md): 512KB Flash, 64KB SRAM
|
||||
* Adafruit [Feather nRF52840](boards/feather52840/README.md): 1MB Flash, 256KB SRAM
|
||||
* Nordic PCA10056 see [Feather nRF52840](boards/feather52840/README.md)
|
||||
* Adafruit [Feather nRF52](boards/feather_nrf52832/README.md): 512KB Flash, 64KB SRAM
|
||||
* Adafruit [Feather nRF52840](boards/feather_nrf52840_express/README.md): 1MB Flash, 256KB SRAM
|
||||
* Nordic PCA10056 see [Feather nRF52840](boards/pca10056/README.md)
|
||||
|
||||
For all other board targets, see the generic notes below.
|
||||
|
||||
|
@ -74,12 +74,12 @@ Note: further tuning of features to include in bluetooth or even setting up the
|
|||
|
||||
## Target Boards and Make Flags
|
||||
|
||||
Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Flash Util
|
||||
---------------------|-------------------------|------------------------|-------------------------------
|
||||
pca10040 | s132 | Peripheral and Scanner | [Segger](#segger-targets)
|
||||
feather52832 | s132 | Peripheral and Scanner | [UART DFU](#dfu-targets)
|
||||
pca10056 | s140 | Peripheral and Scanner | [Segger](#segger-targets)
|
||||
feather52840 | s140 | Peripheral and Scanner | [UART DFU](#dfu-targets)
|
||||
Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Flash Util
|
||||
-------------------------|-------------------------|------------------------|-------------------------------
|
||||
pca10040 | s132 | Peripheral and Scanner | [Segger](#segger-targets)
|
||||
pca10056 | s140 | Peripheral and Scanner | [Segger](#segger-targets)
|
||||
feather_nrf52832 | s132 | Peripheral and Scanner | [UART DFU](#dfu-targets)
|
||||
feather_nrf52840_express | s140 | Peripheral and Scanner | UF2 bootloader
|
||||
|
||||
## Segger Targets
|
||||
|
||||
|
@ -107,10 +107,10 @@ run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Ada
|
|||
* dfu-gen: Generates a Firmware zip to be used by the DFU flash application.
|
||||
* dfu-flash: Triggers the DFU flash application to upload the firmware from the generated Firmware zip file.
|
||||
|
||||
Example on how to generate and flash feather52832 target:
|
||||
Example on how to generate and flash feather_nrf52832 target:
|
||||
|
||||
make BOARD=feather52832 SD=s132
|
||||
make BOARD=feather52832 SD=s132 dfu-gen dfu-flash
|
||||
make BOARD=feather_nrf52832 SD=s132
|
||||
make BOARD=feather_nrf52832 SD=s132 dfu-gen dfu-flash
|
||||
|
||||
## Bluetooth LE REPL
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
GNU linker script for NRF52840 w/S140 6.0.0 SoftDevice
|
||||
GNU linker script for NRF52840 w/S140 6.x.x SoftDevice
|
||||
|
||||
MEMORY MAP
|
||||
------------------------------------------------------------------------
|
||||
|
@ -17,7 +17,7 @@
|
|||
0x00000000..0x00000FFF (4KB) Master Boot Record
|
||||
*/
|
||||
|
||||
/* Specify the memory areas (S140 6.0.0) */
|
||||
/* Specify the memory areas (S140 6.x.x) */
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
MCU_SERIES = m4
|
||||
MCU_VARIANT = nrf52
|
||||
MCU_SUB_VARIANT = nrf52
|
||||
SD ?= s132
|
||||
SOFTDEV_VERSION ?= 2.0.1
|
||||
|
||||
LD_FILE = boards/feather52832/custom_nrf52832_dfu_app_$(SOFTDEV_VERSION).ld
|
||||
|
||||
BOOT_SETTING_ADDR = 0x7F000
|
||||
NRF_DEFINES += -DNRF52832_XXAA
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FEATHER52840
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Feather52840"
|
||||
#define MICROPY_HW_MCU_NAME "nRF52840"
|
||||
#define MICROPY_PY_SYS_PLATFORM "Feather52840"
|
||||
|
||||
#define MICROPY_HW_UART_RX NRF_GPIO_PIN_MAP(0, 8)
|
||||
#define MICROPY_HW_UART_TX NRF_GPIO_PIN_MAP(0, 6)
|
||||
#define MICROPY_HW_UART_HWFC (0)
|
||||
|
||||
#define PORT_HEAP_SIZE (128 * 1024)
|
||||
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
|
|
@ -38,12 +38,12 @@ run following command to install [adafruit-nrfutil](https://github.com/adafruit/
|
|||
#### REPL over UART (default settings)
|
||||
|
||||
To build a CircuitPython binary with default settings for the
|
||||
`feather52832` target enter:
|
||||
`feather_nrf52832` target enter:
|
||||
|
||||
> **NOTE:** `BOARD=feather52832` is the default option and isn't stricly required.
|
||||
> **NOTE:** `BOARD=feather_nrf52832` is the default option and isn't stricly required.
|
||||
|
||||
```
|
||||
$ make BOARD=feather52832 V=1
|
||||
$ make BOARD=feather_nrf52832 V=1
|
||||
```
|
||||
|
||||
#### REPL over BLE UART (AKA 'NUS')
|
||||
|
@ -113,7 +113,7 @@ image, as described earlier in this readme.
|
|||
> The name of the serial port target will vary, depending on your OS.
|
||||
|
||||
```
|
||||
$ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART dfu-gen dfu-flash
|
||||
$ make BOARD=feather_nrf52832 SERIAL=/dev/tty.SLAB_USBtoUART dfu-gen dfu-flash
|
||||
```
|
||||
|
||||
By default, CircuitPython will build with **BLE** support enabled using
|
||||
|
@ -121,7 +121,7 @@ By default, CircuitPython will build with **BLE** support enabled using
|
|||
SD family or version you can enter the optional fields as shown below:
|
||||
|
||||
```
|
||||
$ make BOARD=feather52832 SERIAL=/dev/tty.SLAB_USBtoUART SD=s132 SOFTDEV_VERSION=5.0.0 dfu-gen dfu-flash
|
||||
$ make BOARD=feather_nrf52832 SERIAL=/dev/tty.SLAB_USBtoUART SD=s132 SOFTDEV_VERSION=5.0.0 dfu-gen dfu-flash
|
||||
```
|
||||
|
||||
## Working with CircuitPython
|
|
@ -0,0 +1,11 @@
|
|||
MCU_SERIES = m4
|
||||
MCU_VARIANT = nrf52
|
||||
MCU_SUB_VARIANT = nrf52
|
||||
SD ?= s132
|
||||
SOFTDEV_VERSION ?= 2.0.1
|
||||
|
||||
LD_FILE = boards/feather_nrf52832/custom_nrf52832_dfu_app_$(SOFTDEV_VERSION).ld
|
||||
BOOT_FILE = boards/feather_nrf52832/bootloader/feather52_bootloader_$(SOFTDEV_VERSION)_s132_single
|
||||
|
||||
BOOT_SETTING_ADDR = 0x7F000
|
||||
NRF_DEFINES += -DNRF52832_XXAA
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2016 Glenn Ruben Bakke
|
||||
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define FEATHER52840
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Feather nRF52840 Express"
|
||||
#define MICROPY_HW_MCU_NAME "nRF52840"
|
||||
#define MICROPY_PY_SYS_PLATFORM "Feather52840"
|
||||
|
||||
// #define MICROPY_HW_NEOPIXEL NRF_GPIO_PIN_MAP(0, 13)
|
||||
|
||||
// #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 9)
|
||||
// #define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 11)
|
||||
// #define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 12)
|
||||
// #define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 14)
|
||||
// #define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 8)
|
||||
// #define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 8)
|
||||
|
||||
// #define MICROPY_HW_UART_RX NRF_GPIO_PIN_MAP(0, 8)
|
||||
// #define MICROPY_HW_UART_TX NRF_GPIO_PIN_MAP(0, 6)
|
||||
// #define MICROPY_HW_UART_HWFC (0)
|
||||
|
||||
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
|
||||
|
||||
// If you change this, then make sure to update the linker scripts as well to
|
||||
// make sure you don't overwrite code
|
||||
#define PORT_HEAP_SIZE (128 * 1024)
|
||||
// TODO #define CIRCUITPY_INTERNAL_NVM_SIZE 8192
|
||||
|
||||
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
|
||||
|
||||
// TODO #include "external_flash/devices.h"
|
||||
|
||||
#define EXTERNAL_FLASH_DEVICE_COUNT 1
|
||||
#define EXTERNAL_FLASH_DEVICES GD25Q16C
|
||||
|
||||
#define EXTERNAL_FLASH_QSPI_DUAL
|
||||
|
||||
// TODO include "external_flash/external_flash.h"
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 1
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL NRF_GPIO_PIN_MAP(1, 11)
|
||||
#define DEFAULT_I2C_BUS_SDA NRF_GPIO_PIN_MAP(1, 12)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK NRF_GPIO_PIN_MAP(0, 20)
|
||||
#define DEFAULT_SPI_BUS_MOSI NRF_GPIO_PIN_MAP(0, 23)
|
||||
#define DEFAULT_SPI_BUS_MISO NRF_GPIO_PIN_MAP(0, 22)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX NRF_GPIO_PIN_MAP(1, 0)
|
||||
#define DEFAULT_UART_BUS_TX NRF_GPIO_PIN_MAP(0, 24)
|
|
@ -2,7 +2,7 @@ MCU_SERIES = m4
|
|||
MCU_VARIANT = nrf52
|
||||
MCU_SUB_VARIANT = nrf52840
|
||||
SD ?= s140
|
||||
SOFTDEV_VERSION ?= 6.0.0
|
||||
SOFTDEV_VERSION ?= 6.1.0
|
||||
|
||||
BOOT_SETTING_ADDR = 0xFF000
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "py/obj.h"
|
||||
#include "py/mphal.h"
|
||||
#include "pin.h"
|
||||
#include "nrf_pin.h"
|
||||
|
||||
#define PIN(p_name, p_port, p_pin, p_adc_channel) \
|
||||
{ \
|
||||
|
|
|
@ -2,7 +2,7 @@ MCU_SERIES = m4
|
|||
MCU_VARIANT = nrf52
|
||||
MCU_SUB_VARIANT = nrf52840
|
||||
SD ?= s140
|
||||
SOFTDEV_VERSION ?= 6.0.0
|
||||
SOFTDEV_VERSION ?= 6.1.0
|
||||
|
||||
BOOT_SETTING_ADDR = 0xFF000
|
||||
|
||||
|
|
|
@ -25,4 +25,4 @@
|
|||
*/
|
||||
|
||||
// Pins aren't actually defined here. They are in the board specific directory
|
||||
// such as boards/feather52832/pins.csv
|
||||
// such as boards/feather_nrf52832/pins.csv
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_MICROCONTROLLER_PIN_H
|
||||
#define MICROPY_INCLUDED_NRF_COMMON_HAL_MICROCONTROLLER_PIN_H
|
||||
|
||||
#include "pin.h"
|
||||
#include "nrf_pin.h"
|
||||
#include "py/mphal.h"
|
||||
|
||||
#define mcu_pin_obj_t pin_obj_t
|
||||
|
|
|
@ -35,18 +35,16 @@ function download_s132_nrf52_5_0_0
|
|||
cd -
|
||||
}
|
||||
|
||||
function download_s140_nrf52_6_0_0
|
||||
function download_s140_nrf52_6_1_0
|
||||
{
|
||||
echo ""
|
||||
echo "####################################"
|
||||
echo "### Downloading s140_nrf52_6.0.0 ###"
|
||||
echo "### Downloading s140_nrf52_6.1.0 ###"
|
||||
echo "####################################"
|
||||
echo ""
|
||||
|
||||
mkdir -p "${1}/s140_nrf52_6.0.0"
|
||||
cd "${1}/s140_nrf52_6.0.0"
|
||||
|
||||
wget https://www.nordicsemi.com/eng/nordic/download_resource/60624/20/49271410/116072
|
||||
mkdir -p "${1}/s140_nrf52_6.1.0"
|
||||
cd "${1}/s140_nrf52_6.1.0"
|
||||
wget https://www.nordicsemi.com/eng/nordic/download_resource/60624/25/88218841/116072
|
||||
mv 116072 temp.zip
|
||||
unzip -u temp.zip
|
||||
rm temp.zip
|
||||
|
@ -59,15 +57,15 @@ if [ $# -eq 0 ]; then
|
|||
echo "No Bluetooth LE stack defined, downloading all."
|
||||
download_s132_nrf52_2_0_1 "${SCRIPT_DIR}"
|
||||
download_s132_nrf52_5_0_0 "${SCRIPT_DIR}"
|
||||
download_s140_nrf52_6_0_0 "${SCRIPT_DIR}"
|
||||
download_s140_nrf52_6_1_0 "${SCRIPT_DIR}"
|
||||
else
|
||||
case $1 in
|
||||
"s132_nrf52_2_0_1" )
|
||||
download_s132_nrf52_2_0_1 "${SCRIPT_DIR}" ;;
|
||||
"s132_nrf52_5_0_0" )
|
||||
download_s132_nrf52_5_0_0 "${SCRIPT_DIR}" ;;
|
||||
"s140_nrf52_6_0_0" )
|
||||
download_s140_nrf52_6_0_0 "${SCRIPT_DIR}" ;;
|
||||
"s140_nrf52_6_1_0" )
|
||||
download_s140_nrf52_6_1_0 "${SCRIPT_DIR}" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "ble_uart.h"
|
||||
#else
|
||||
#include "nrf_gpio.h"
|
||||
#include "pin.h"
|
||||
#include "nrf_pin.h"
|
||||
#endif
|
||||
|
||||
#if !defined( NRF52840_XXAA) || ( defined(CFG_HWUART_FOR_SERIAL) && CFG_HWUART_FOR_SERIAL == 1 )
|
||||
|
|
|
@ -58,7 +58,7 @@ void usb_init(void) {
|
|||
|
||||
sd_power_usbregstatus_get(&usb_reg);
|
||||
}else
|
||||
#else
|
||||
#endif
|
||||
{
|
||||
// Power module init
|
||||
const nrfx_power_config_t pwr_cfg = { 0 };
|
||||
|
@ -72,7 +72,6 @@ void usb_init(void) {
|
|||
|
||||
usb_reg = NRF_POWER->USBREGSTATUS;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( usb_reg & POWER_USBREGSTATUS_VBUSDETECT_Msk ) {
|
||||
tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_DETECTED);
|
||||
|
@ -82,6 +81,21 @@ void usb_init(void) {
|
|||
tusb_hal_nrf_power_event(NRFX_POWER_USB_EVT_READY);
|
||||
}
|
||||
|
||||
// create serial number based on device unique id
|
||||
extern uint16_t usb_desc_str_serial[1 + 16];
|
||||
|
||||
char nibble_to_hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
uint8_t nibble = (NRF_FICR->DEVICEID[i] >> j * 4) & 0xf;
|
||||
|
||||
// Invert order since it is LE, +1 for skipping descriptor header
|
||||
uint8_t const idx = (15 - (i * 8 + j)) + 1;
|
||||
usb_desc_str_serial[idx] = nibble_to_hex[nibble];
|
||||
}
|
||||
}
|
||||
|
||||
tusb_init();
|
||||
|
||||
#if MICROPY_KBD_EXCEPTION
|
||||
|
|
|
@ -78,6 +78,8 @@ enum {
|
|||
// STRING DESCRIPTORS
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
uint16_t usb_desc_str_serial[1+16] = { TUD_DESC_STR_HEADER(16) };
|
||||
|
||||
// array of pointer to string descriptors
|
||||
uint16_t const * const string_desc_arr [] =
|
||||
{
|
||||
|
@ -91,7 +93,7 @@ uint16_t const * const string_desc_arr [] =
|
|||
TUD_DESC_STRCONV('C','i','r','c','u','i','t','P','y',' ','n','R','F','5','2'),
|
||||
|
||||
// 3 Serials TODO use chip ID
|
||||
TUD_DESC_STRCONV('1', '2', '3', '4', '5'),
|
||||
usb_desc_str_serial,
|
||||
|
||||
// 4 CDC Interface
|
||||
TUD_DESC_STRCONV('C','i','r','c','u','i','t','P','y',' ','S','e','r','i','a','l'),
|
||||
|
|
2
py/vm.c
2
py/vm.c
|
@ -136,7 +136,7 @@ mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp
|
|||
#define ENTRY(op) entry_##op
|
||||
#define ENTRY_DEFAULT entry_default
|
||||
#else
|
||||
#define DISPATCH() goto dispatch_loop
|
||||
#define DISPATCH() break
|
||||
#define DISPATCH_WITH_PEND_EXC_CHECK() goto pending_exception_check
|
||||
#define ENTRY(op) case op
|
||||
#define ENTRY_DEFAULT default
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
#include "shared-bindings/time/__init__.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
#define EPOCH1970_EPOCH2000_DIFF_SECS 946684800
|
||||
|
||||
//| :mod:`time` --- time and timing related functions
|
||||
//| ========================================================
|
||||
//|
|
||||
|
@ -142,9 +140,9 @@ const mp_obj_namedtuple_type_t struct_time_type_obj = {
|
|||
|
||||
mp_obj_t struct_time_from_tm(timeutils_struct_time_t *tm) {
|
||||
timeutils_struct_time_t tmp;
|
||||
mp_uint_t secs = timeutils_seconds_since_2000(tm->tm_year, tm->tm_mon, tm->tm_mday,
|
||||
mp_uint_t secs = timeutils_seconds_since_epoch(tm->tm_year, tm->tm_mon, tm->tm_mday,
|
||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
timeutils_seconds_since_2000_to_struct_time(secs, &tmp);
|
||||
timeutils_seconds_since_epoch_to_struct_time(secs, &tmp);
|
||||
tm->tm_wday = tmp.tm_wday;
|
||||
tm->tm_yday = tmp.tm_yday;
|
||||
|
||||
|
@ -202,9 +200,9 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) {
|
|||
STATIC mp_obj_t time_time(void) {
|
||||
timeutils_struct_time_t tm;
|
||||
struct_time_to_tm(rtc_get_time_source_time(), &tm);
|
||||
mp_uint_t secs = timeutils_seconds_since_2000(tm.tm_year, tm.tm_mon, tm.tm_mday,
|
||||
mp_uint_t secs = timeutils_seconds_since_epoch(tm.tm_year, tm.tm_mon, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
return mp_obj_new_int_from_uint(secs + EPOCH1970_EPOCH2000_DIFF_SECS);
|
||||
return mp_obj_new_int_from_uint(secs);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
|
||||
|
||||
|
@ -228,7 +226,7 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
|
|||
mp_raise_msg(&mp_type_OverflowError, translate("timestamp out of range for platform time_t"));
|
||||
|
||||
timeutils_struct_time_t tm;
|
||||
timeutils_seconds_since_2000_to_struct_time(secs - EPOCH1970_EPOCH2000_DIFF_SECS, &tm);
|
||||
timeutils_seconds_since_epoch_to_struct_time(secs, &tm);
|
||||
|
||||
return struct_time_from_tm(&tm);
|
||||
}
|
||||
|
@ -262,7 +260,7 @@ STATIC mp_obj_t time_mktime(mp_obj_t t) {
|
|||
|
||||
mp_uint_t secs = timeutils_mktime(mp_obj_get_int(elem[0]), mp_obj_get_int(elem[1]), mp_obj_get_int(elem[2]),
|
||||
mp_obj_get_int(elem[3]), mp_obj_get_int(elem[4]), mp_obj_get_int(elem[5]));
|
||||
return mp_obj_new_int_from_uint(secs + EPOCH1970_EPOCH2000_DIFF_SECS);
|
||||
return mp_obj_new_int_from_uint(secs);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(time_mktime_obj, time_mktime);
|
||||
#endif // MICROPY_LONGINT_IMPL
|
||||
|
|
|
@ -5,7 +5,7 @@ statvfs: (512, 512, 16, 16, 16, 0, 0, 0, 0, 255)
|
|||
getcwd: /
|
||||
True
|
||||
[('foo_file.txt', 32768, 0, 6)]
|
||||
stat root: (16384, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
stat root: (16384, 0, 0, 0, 0, 0, 0, 946684800, 946684800, 946684800)
|
||||
stat file: (32768, 0, 0, 0, 0, 0, 6)
|
||||
True
|
||||
True
|
||||
|
|
|
@ -2,7 +2,31 @@ rm -rf ports/atmel-samd/build*
|
|||
rm -rf ports/esp8266/build*
|
||||
rm -rf ports/nrf/build*
|
||||
|
||||
ATMEL_BOARDS="arduino_zero circuitplayground_express circuitplayground_express_crickit feather_radiofruit_zigbee feather_m0_basic feather_m0_adalogger itsybitsy_m0_express itsybitsy_m4_express feather_m0_rfm69 feather_m0_rfm9x feather_m0_express feather_m0_express_crickit feather_m4_express metro_m0_express metro_m4_express pirkey_m0 trinket_m0 gemma_m0 feather52832 feather_huzzah pca10056 hallowing_m0_express"
|
||||
HW_BOARDS="\
|
||||
arduino_zero \
|
||||
circuitplayground_express \
|
||||
circuitplayground_express_crickit \
|
||||
feather_huzzah \
|
||||
feather_m0_adalogger \
|
||||
feather_m0_basic \
|
||||
feather_m0_express \
|
||||
feather_m0_express_crickit \
|
||||
feather_m0_rfm69 \
|
||||
feather_m0_rfm9x \
|
||||
feather_m4_express \
|
||||
feather_nrf52832 \
|
||||
feather_nrf52840_express \
|
||||
pca10056 \
|
||||
feather_radiofruit_zigbee \
|
||||
gemma_m0 \
|
||||
hallowing_m0_express \
|
||||
itsybitsy_m0_express \
|
||||
itsybitsy_m4_express \
|
||||
metro_m0_express \
|
||||
metro_m4_express \
|
||||
pirkey_m0 \
|
||||
trinket_m0 \
|
||||
"
|
||||
ROSIE_SETUPS="rosie-ci"
|
||||
|
||||
PARALLEL="-j 5"
|
||||
|
@ -11,7 +35,7 @@ if [ "$TRAVIS" == "true" ]; then
|
|||
fi
|
||||
|
||||
if [ -z "$TRAVIS_BOARD" ]; then
|
||||
boards=$ATMEL_BOARDS
|
||||
boards=$HW_BOARDS
|
||||
else
|
||||
boards=$TRAVIS_BOARD
|
||||
fi
|
||||
|
@ -41,16 +65,21 @@ for board in $boards; do
|
|||
(( exit_status = exit_status || $? ))
|
||||
temp_filename=ports/esp8266/build/firmware-combined.bin
|
||||
extension=bin
|
||||
elif [ $board == "feather52832" ]; then
|
||||
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather52832
|
||||
elif [ $board == "feather_nrf52832" ]; then
|
||||
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather_nrf52832
|
||||
(( exit_status = exit_status || $? ))
|
||||
temp_filename=ports/nrf/build-$board-s132/firmware.bin
|
||||
extension=bin
|
||||
elif [ $board == "feather_nrf52840_express" ]; then
|
||||
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=feather_nrf52840_express SD=s140
|
||||
(( exit_status = exit_status || $? ))
|
||||
temp_filename=ports/nrf/build-$board-s140/firmware.uf2
|
||||
extension=uf2
|
||||
elif [ $board == "pca10056" ]; then
|
||||
make $PARALLEL -C ports/nrf TRANSLATION=$language BOARD=pca10056 SD=s140
|
||||
(( exit_status = exit_status || $? ))
|
||||
temp_filename=ports/nrf/build-$board-s140/firmware.bin
|
||||
extension=bin
|
||||
temp_filename=ports/nrf/build-$board-s140/firmware.uf2
|
||||
extension=uf2
|
||||
else
|
||||
time make $PARALLEL -C ports/atmel-samd TRANSLATION=$language BOARD=$board
|
||||
(( exit_status = exit_status || $? ))
|
||||
|
|
Loading…
Reference in New Issue