merge and docs
parent
a89928c13c
commit
2f764ded63
|
@ -131,6 +131,7 @@ jobs:
|
|||
- "arduino_nano_33_iot"
|
||||
- "arduino_zero"
|
||||
- "bast_pro_mini_m0"
|
||||
- "bdmicro_vina_m0"
|
||||
- "capablerobot_usbhub"
|
||||
- "catwan_usbstick"
|
||||
- "circuitbrains_basic_m0"
|
||||
|
@ -279,3 +280,49 @@ jobs:
|
|||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
|
||||
|
||||
build-riscv:
|
||||
runs-on: ubuntu-16.04
|
||||
needs: test
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- "fomu"
|
||||
|
||||
steps:
|
||||
- name: Set up Python 3.5
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.5
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt-get install -y gettext
|
||||
pip install requests sh click setuptools awscli
|
||||
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
|
||||
sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
|
||||
- name: Versions
|
||||
run: |
|
||||
gcc --version
|
||||
riscv64-unknown-elf-gcc --version
|
||||
python3 --version
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true
|
||||
- name: mpy-cross
|
||||
run: make -C mpy-cross -j2
|
||||
- name: build
|
||||
run: python3 -u build_release_files.py
|
||||
working-directory: tools
|
||||
env:
|
||||
BOARDS: ${{ matrix.board }}
|
||||
- uses: actions/upload-artifact@v1.0.0
|
||||
with:
|
||||
name: ${{ matrix.board }}
|
||||
path: bin/${{ matrix.board }}
|
||||
- name: Upload to S3
|
||||
run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1"
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
|
||||
|
|
2
conf.py
2
conf.py
|
@ -123,6 +123,7 @@ exclude_patterns = ["**/build*",
|
|||
"ports/atmel-samd/tools",
|
||||
"ports/cxd56/mkspk",
|
||||
"ports/cxd56/spresense-exported-sdk",
|
||||
"ports/litex/hw",
|
||||
"ports/minimal",
|
||||
"ports/mimxrt10xx/peripherals",
|
||||
"ports/mimxrt10xx/sdk",
|
||||
|
@ -133,6 +134,7 @@ exclude_patterns = ["**/build*",
|
|||
"ports/nrf/peripherals",
|
||||
"ports/nrf/usb",
|
||||
"ports/stm/st_driver",
|
||||
"ports/stm/packages",
|
||||
"ports/stm/peripherals",
|
||||
"ports/stm/ref",
|
||||
"ports/unix",
|
||||
|
|
|
@ -398,6 +398,11 @@ msgstr ""
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, fuzzy, c-format
|
||||
|
|
|
@ -394,6 +394,11 @@ msgstr ""
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, c-format
|
||||
|
|
|
@ -398,6 +398,11 @@ msgstr "Der Puffer muss eine Mindestenslänge von 1 haben"
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, c-format
|
||||
|
|
|
@ -394,6 +394,11 @@ msgstr ""
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, c-format
|
||||
|
|
|
@ -398,6 +398,11 @@ msgstr ""
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, c-format
|
||||
|
|
|
@ -400,6 +400,11 @@ msgstr "Buffer debe ser de longitud 1 como minimo"
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, c-format
|
||||
|
|
|
@ -400,6 +400,11 @@ msgstr "Buffer dapat ay hindi baba sa 1 na haba"
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, fuzzy, c-format
|
||||
|
|
|
@ -404,6 +404,11 @@ msgstr "Le tampon doit être de longueur au moins 1"
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, fuzzy, c-format
|
||||
|
|
|
@ -400,6 +400,11 @@ msgstr "Il buffer deve essere lungo almeno 1"
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, fuzzy, c-format
|
||||
|
|
|
@ -398,6 +398,11 @@ msgstr "잘못된 크기의 버퍼. >1 여야합니다"
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, c-format
|
||||
|
|
|
@ -397,6 +397,11 @@ msgstr "Bufor musi mieć długość 1 lub więcej"
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, c-format
|
||||
|
|
|
@ -397,6 +397,11 @@ msgstr ""
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, fuzzy, c-format
|
||||
|
|
|
@ -403,6 +403,11 @@ msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1"
|
|||
msgid "Buffer too large and unable to allocate"
|
||||
msgstr "huǎn chōng qū tài dà , wú fǎ fēn pèi"
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr ""
|
||||
|
||||
#: ports/atmel-samd/common-hal/displayio/ParallelBus.c
|
||||
#: ports/nrf/common-hal/displayio/ParallelBus.c
|
||||
#, c-format
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Scott Shawcroft 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.
|
||||
*/
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
// struct port_config pin_conf;
|
||||
// port_get_config_defaults(&pin_conf);
|
||||
//
|
||||
// pin_conf.direction = PORT_PIN_DIR_OUTPUT;
|
||||
// port_pin_set_config(MICROPY_HW_LED_TX, &pin_conf);
|
||||
// port_pin_set_output_level(MICROPY_HW_LED_TX, true);
|
||||
//
|
||||
// port_pin_set_config(MICROPY_HW_LED_RX, &pin_conf);
|
||||
// port_pin_set_output_level(MICROPY_HW_LED_RX, true);
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
#define MICROPY_HW_BOARD_NAME "BDMICRO Vina M0"
|
||||
#define MICROPY_HW_MCU_NAME "samd21g18"
|
||||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_PA28)
|
||||
#define MICROPY_HW_LED_TX &pin_PA27
|
||||
#define MICROPY_HW_LED_RX &pin_PA31
|
||||
|
||||
// Clock rates are off: Salae reads 12MHz which is the limit even though we set it to the safer 8MHz.
|
||||
#define SPI_FLASH_BAUDRATE (8000000)
|
||||
|
||||
#define SPI_FLASH_MOSI_PIN &pin_PB22
|
||||
#define SPI_FLASH_MISO_PIN &pin_PB03
|
||||
#define SPI_FLASH_SCK_PIN &pin_PB23
|
||||
#define SPI_FLASH_CS_PIN &pin_PA13
|
||||
|
||||
// These are pins not to reset.
|
||||
#define MICROPY_PORT_A (0)
|
||||
#define MICROPY_PORT_B (0)
|
||||
#define MICROPY_PORT_C (0)
|
||||
|
||||
#define BOARD_HAS_CRYSTAL 0
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_PA23)
|
||||
#define DEFAULT_I2C_BUS_SDA (&pin_PA22)
|
||||
|
||||
#define DEFAULT_SPI_BUS_SCK (&pin_PB11)
|
||||
#define DEFAULT_SPI_BUS_MOSI (&pin_PB10)
|
||||
#define DEFAULT_SPI_BUS_MISO (&pin_PA12)
|
||||
|
||||
#define DEFAULT_UART_BUS_RX (&pin_PA11)
|
||||
#define DEFAULT_UART_BUS_TX (&pin_PA10)
|
||||
|
||||
// USB is always used internally so skip the pin objects for it.
|
||||
#define IGNORE_PIN_PA24 1
|
||||
#define IGNORE_PIN_PA25 1
|
|
@ -0,0 +1,18 @@
|
|||
USB_VID = 0x31e2
|
||||
USB_PID = 0x2002
|
||||
USB_PRODUCT = "Vina M0"
|
||||
USB_MANUFACTURER = "BDMICRO LLC"
|
||||
|
||||
CHIP_VARIANT = SAMD21G18A
|
||||
CHIP_FAMILY = samd21
|
||||
|
||||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICE_COUNT = 1
|
||||
EXTERNAL_FLASH_DEVICES = "MX25L51245G"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CIRCUITPY_BITBANGIO = 0
|
||||
CIRCUITPY_I2CSLAVE = 0
|
||||
|
||||
CFLAGS_INLINE_LIMIT = 60
|
||||
SUPEROPT_GC = 0
|
|
@ -0,0 +1,39 @@
|
|||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_PA00) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RTC_CLK), MP_ROM_PTR(&pin_PA01) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RTC_TS), MP_ROM_PTR(&pin_PA14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA08) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_PGM_LED), MP_ROM_PTR(&pin_PA28) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
|
|
@ -79,7 +79,9 @@ void board_init(void) {
|
|||
&pin_PA28, // Command or data
|
||||
&pin_PA01, // Chip select
|
||||
&pin_PA27, // Reset
|
||||
12000000);
|
||||
12000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
|
|
@ -59,7 +59,9 @@ void board_init(void) {
|
|||
&pin_PB31, // TFT_DC Command or data
|
||||
&pin_PA27, // TFT_CS Chip select
|
||||
&pin_PB30, // TFT_RST Reset
|
||||
60000000);
|
||||
60000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
|
|
@ -60,7 +60,9 @@ void board_init(void) {
|
|||
&pin_PA07, // TFT_DC Command or data
|
||||
&pin_PA06, // TFT_CS Chip select
|
||||
&pin_PA04, // TFT_RST Reset
|
||||
60000000);
|
||||
60000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
|
|
@ -65,7 +65,9 @@ void board_init(void) {
|
|||
&pin_PB05, // EPD_DC Command or data
|
||||
&pin_PB07, // EPD_CS Chip select
|
||||
&pin_PA00, // EPD_RST Reset
|
||||
1000000);
|
||||
1000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_epaperdisplay_obj_t* display = &displays[0].epaper_display;
|
||||
display->base.type = &displayio_epaperdisplay_type;
|
||||
|
|
|
@ -107,7 +107,9 @@ void board_init(void) {
|
|||
&pin_PA16, // TFT_DC Command or data
|
||||
&pin_PA11, // TFT_CS Chip select
|
||||
&pin_PA17, // TFT_RST Reset
|
||||
60000000);
|
||||
60000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
uint32_t cfg0 = lookupCfg(CFG_DISPLAY_CFG0, 0x000000);
|
||||
uint32_t offX = (cfg0 >> 8) & 0xff;
|
||||
|
|
|
@ -82,7 +82,9 @@ void board_init(void) {
|
|||
&pin_PB05, // TFT_DC Command or data
|
||||
&pin_PB07, // TFT_CS Chip select
|
||||
&pin_PA00, // TFT_RST Reset
|
||||
60000000);
|
||||
60000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
|
|
@ -60,7 +60,9 @@ void board_init(void) {
|
|||
&pin_PB05, // TFT_DC Command or data
|
||||
&pin_PB06, // TFT_CS Chip select
|
||||
&pin_PB07, // TFT_RST Reset
|
||||
60000000);
|
||||
60000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
|
|
@ -82,7 +82,9 @@ void board_init(void) {
|
|||
&pin_PB05, // TFT_DC Command or data
|
||||
&pin_PB12, // TFT_CS Chip select
|
||||
&pin_PA00, // TFT_RST Reset
|
||||
60000000);
|
||||
60000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
|
|
@ -60,7 +60,9 @@ void board_init(void) {
|
|||
&pin_PA00, // TFT_DC Command or data
|
||||
&pin_PB15, // TFT_CS Chip select
|
||||
&pin_PB05, // TFT_RST Reset
|
||||
60000000);
|
||||
60000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
|
|
@ -79,7 +79,9 @@ void board_init(void) {
|
|||
&pin_PA09, // Command or data
|
||||
&pin_PA08, // Chip select
|
||||
NULL, // Reset
|
||||
24000000);
|
||||
24000000, // Baudrate
|
||||
0, // Polarity
|
||||
0); // Phase
|
||||
|
||||
displayio_display_obj_t* display = &displays[0].display;
|
||||
display->base.type = &displayio_display_type;
|
||||
|
|
|
@ -0,0 +1,200 @@
|
|||
# This file is part of the MicroPython project, http://micropython.org/
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2019 Scott Shawcroft 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.
|
||||
|
||||
# Select the board to build for.
|
||||
ifeq ($(BOARD),)
|
||||
$(error You must provide a BOARD parameter)
|
||||
else
|
||||
ifeq ($(wildcard boards/$(BOARD)/.),)
|
||||
$(error Invalid BOARD specified)
|
||||
endif
|
||||
endif
|
||||
|
||||
# If the build directory is not given, make it reflect the board name.
|
||||
BUILD ?= build-$(BOARD)
|
||||
|
||||
include ../../py/mkenv.mk
|
||||
# Board-specific
|
||||
include boards/$(BOARD)/mpconfigboard.mk
|
||||
# Port-specific
|
||||
include mpconfigport.mk
|
||||
|
||||
# CircuitPython-specific
|
||||
include $(TOP)/py/circuitpy_mpconfig.mk
|
||||
|
||||
# qstr definitions (must come before including py.mk)
|
||||
QSTR_DEFS = qstrdefsport.h
|
||||
|
||||
# include py core make definitions
|
||||
include $(TOP)/py/py.mk
|
||||
|
||||
include $(TOP)/supervisor/supervisor.mk
|
||||
|
||||
# Include make rules and variables common across CircuitPython builds.
|
||||
include $(TOP)/py/circuitpy_defns.mk
|
||||
|
||||
CROSS_COMPILE = riscv64-unknown-elf-
|
||||
|
||||
#######################################
|
||||
# CFLAGS
|
||||
#######################################
|
||||
|
||||
INC += -I.
|
||||
INC += -I../..
|
||||
INC += -I$(BUILD)
|
||||
INC += -I$(BUILD)/genhdr
|
||||
INC += -I./boards
|
||||
INC += -I./boards/$(BOARD)
|
||||
INC += -I./peripherals
|
||||
INC += -I../../lib/mp-readline
|
||||
INC += -I../../lib/tinyusb/src
|
||||
INC += -I../../supervisor/shared/usb
|
||||
|
||||
|
||||
#Debugging/Optimization
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -ggdb
|
||||
# You may want to enable these flags to make setting breakpoints easier.
|
||||
CFLAGS += -fno-inline -fno-ipa-sra
|
||||
else
|
||||
CFLAGS += -Os -DNDEBUG -ggdb3
|
||||
# TODO: Test with -flto
|
||||
### CFLAGS += -flto
|
||||
endif
|
||||
|
||||
CFLAGS += $(INC) -Werror -Wall -std=gnu11 -nostdlib $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT)
|
||||
|
||||
# TODO: check this
|
||||
CFLAGS += -D__START=main -DFOMU
|
||||
|
||||
LD_FILE := boards/$(BOARD)/$(BOARD)-spi.ld
|
||||
|
||||
LDFLAGS = $(CFLAGS) -fshort-enums -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs -Wl,-melf32lriscv
|
||||
LIBS := -lgcc -lc
|
||||
|
||||
|
||||
LDFLAGS += -flto -ffreestanding -nostartfiles -Wl,--gc-section -Wl,-Bstatic -Wl,-melf32lriscv -nostartfiles \
|
||||
-Wl,--no-warn-mismatch \
|
||||
-Wl,--build-id=none
|
||||
|
||||
# Use toolchain libm if we're not using our own.
|
||||
ifndef INTERNAL_LIBM
|
||||
LIBS += -lm
|
||||
endif
|
||||
|
||||
# TinyUSB defines
|
||||
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD_CDC_TX_BUFSIZE=1024 -DCFG_TUD_MSC_BUFSIZE=4096 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_MIDI_TX_BUFSIZE=128
|
||||
|
||||
|
||||
######################################
|
||||
# source
|
||||
######################################
|
||||
|
||||
|
||||
SRC_C += \
|
||||
background.c \
|
||||
fatfs_port.c \
|
||||
mphalport.c \
|
||||
tick.c \
|
||||
boards/$(BOARD)/board.c \
|
||||
boards/$(BOARD)/pins.c \
|
||||
lib/libc/string0.c \
|
||||
lib/mp-readline/readline.c \
|
||||
lib/oofatfs/ff.c \
|
||||
lib/oofatfs/option/ccsbcs.c \
|
||||
lib/timeutils/timeutils.c \
|
||||
lib/utils/buffer_helper.c \
|
||||
lib/utils/context_manager_helpers.c \
|
||||
lib/utils/interrupt_char.c \
|
||||
lib/utils/pyexec.c \
|
||||
lib/utils/stdout_helpers.c \
|
||||
lib/utils/sys_stdio_mphal.c \
|
||||
supervisor/shared/memory.c
|
||||
|
||||
ifneq ($(USB),FALSE)
|
||||
SRC_C += lib/tinyusb/src/portable/valentyusb/eptri/dcd_eptri.c
|
||||
endif
|
||||
|
||||
SRC_S = \
|
||||
crt0-vexriscv.S
|
||||
|
||||
SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \
|
||||
$(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \
|
||||
$(addprefix common-hal/, $(SRC_COMMON_HAL))
|
||||
|
||||
SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \
|
||||
$(addprefix shared-module/, $(SRC_SHARED_MODULE)) \
|
||||
$(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL))
|
||||
|
||||
|
||||
ifneq ($(FROZEN_MPY_DIR),)
|
||||
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
|
||||
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
|
||||
endif
|
||||
|
||||
OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED_MODULE_EXPANDED:.c=.o))
|
||||
ifeq ($(INTERNAL_LIBM),1)
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
|
||||
endif
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.S=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
|
||||
|
||||
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
|
||||
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
|
||||
# Sources that only hold QSTRs after pre-processing.
|
||||
SRC_QSTR_PREPROCESSOR +=
|
||||
|
||||
|
||||
all: $(BUILD)/firmware.bin $(BUILD)/firmware.dfu
|
||||
|
||||
$(BUILD)/firmware.elf: $(OBJ)
|
||||
$(STEPECHO) "LINK $@"
|
||||
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group
|
||||
$(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(LD_FILE)
|
||||
|
||||
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf
|
||||
$(STEPECHO) "Create $@"
|
||||
$(Q)$(OBJCOPY) -O binary $^ $@
|
||||
# $(Q)$(OBJCOPY) -O binary -j .vectors -j .text -j .data $^ $@
|
||||
|
||||
$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
|
||||
$(STEPECHO) "Create $@"
|
||||
$(Q)$(OBJCOPY) -O ihex $^ $@
|
||||
# $(Q)$(OBJCOPY) -O ihex -j .vectors -j .text -j .data $^ $@
|
||||
|
||||
$(BUILD)/firmware.dfu: $(BUILD)/firmware.bin
|
||||
$(ECHO) "Create $@"
|
||||
$(PYTHON3) $(TOP)/tools/dfu.py -b $^ -D 0x1209:0x5bf0 "$(BUILD)/firmware.dfu"
|
||||
|
||||
include $(TOP)/py/mkrules.mk
|
||||
|
||||
# Print out the value of a make variable.
|
||||
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
|
||||
print-%:
|
||||
@echo $* = $($*)
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Scott Shawcroft 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.
|
||||
*/
|
||||
|
||||
#include "py/runtime.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/usb.h"
|
||||
#include "supervisor/shared/stack.h"
|
||||
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
#include "shared-module/displayio/__init__.h"
|
||||
#endif
|
||||
|
||||
static bool running_background_tasks = false;
|
||||
|
||||
void background_tasks_reset(void) {
|
||||
running_background_tasks = false;
|
||||
}
|
||||
|
||||
void run_background_tasks(void) {
|
||||
// Don't call ourselves recursively.
|
||||
if (running_background_tasks) {
|
||||
return;
|
||||
}
|
||||
running_background_tasks = true;
|
||||
filesystem_background();
|
||||
|
||||
#if USB_AVAILABLE
|
||||
usb_background();
|
||||
#endif
|
||||
|
||||
#if CIRCUITPY_DISPLAYIO
|
||||
displayio_background();
|
||||
#endif
|
||||
running_background_tasks = false;
|
||||
|
||||
assert_heap_ok();
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 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.
|
||||
*/
|
||||
|
||||
#ifndef MICROPY_INCLUDED_LITEX_BACKGROUND_H
|
||||
#define MICROPY_INCLUDED_LITEX_BACKGROUND_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
void background_tasks_reset(void);
|
||||
void run_background_tasks(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_LITEX_BACKGROUND_H
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Scott Shawcroft 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.
|
||||
*/
|
||||
|
||||
// This file defines board specific functions.
|
||||
|
||||
#ifndef MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H
|
||||
#define MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
// Initializes board related state once on start up.
|
||||
void board_init(void);
|
||||
|
||||
// Returns true if the user initiates safe mode in a board specific way.
|
||||
// Also add BOARD_USER_SAFE_MODE in mpconfigboard.h to explain the board specific
|
||||
// way.
|
||||
bool board_requests_safe_mode(void);
|
||||
|
||||
// Reset the state of off MCU components such as neopixels.
|
||||
void reset_board(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_LITEX_BOARDS_BOARD_H
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Scott Shawcroft 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.
|
||||
*/
|
||||
|
||||
#include "boards/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "csr.h"
|
||||
|
||||
// ICE40 LED Driver hard macro.
|
||||
// See http://www.latticesemi.com/-/media/LatticeSemi/Documents/ApplicationNotes/IK/ICE40LEDDriverUsageGuide.ashx?document_id=50668
|
||||
enum led_registers {
|
||||
LEDDCR0 = 8,
|
||||
LEDDBR = 9,
|
||||
LEDDONR = 10,
|
||||
LEDDOFR = 11,
|
||||
LEDDBCRR = 5,
|
||||
LEDDBCFR = 6,
|
||||
LEDDPWRR = 1,
|
||||
LEDDPWRG = 2,
|
||||
LEDDPWRB = 3,
|
||||
};
|
||||
|
||||
#define BREATHE_ENABLE (1 << 7)
|
||||
#define BREATHE_EDGE_ON (0 << 6)
|
||||
#define BREATHE_EDGE_BOTH (1 << 6)
|
||||
#define BREATHE_MODE_MODULATE (1 << 5)
|
||||
#define BREATHE_RATE(x) ((x & 7) << 0)
|
||||
|
||||
// Write a value into the LEDDA_IP register.
|
||||
static void ledda_write(uint8_t value, uint8_t addr) {
|
||||
rgb_addr_write(addr);
|
||||
rgb_dat_write(value);
|
||||
}
|
||||
|
||||
void board_init(void) {
|
||||
uint8_t onrate = 15;
|
||||
uint8_t offrate = 1;
|
||||
|
||||
ledda_write(BREATHE_ENABLE | BREATHE_MODE_MODULATE | BREATHE_RATE(onrate), LEDDBCRR);
|
||||
ledda_write(BREATHE_ENABLE | BREATHE_MODE_MODULATE | BREATHE_RATE(offrate), LEDDBCFR);
|
||||
|
||||
ledda_write(123, LEDDPWRR); // Red
|
||||
ledda_write(3, LEDDPWRG); // Green
|
||||
ledda_write(98, LEDDPWRB); // Blue
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
|
@ -0,0 +1,647 @@
|
|||
//--------------------------------------------------------------------------------
|
||||
// Auto-generated by Migen (f4fcd10) & LiteX (de205d4a) on 2019-11-25 14:57:34
|
||||
//--------------------------------------------------------------------------------
|
||||
#include <generated/soc.h>
|
||||
#ifndef __GENERATED_CSR_H
|
||||
#define __GENERATED_CSR_H
|
||||
#include <stdint.h>
|
||||
#ifdef CSR_ACCESSORS_DEFINED
|
||||
extern void csr_writeb(uint8_t value, unsigned long addr);
|
||||
extern uint8_t csr_readb(unsigned long addr);
|
||||
extern void csr_writew(uint16_t value, unsigned long addr);
|
||||
extern uint16_t csr_readw(unsigned long addr);
|
||||
extern void csr_writel(uint32_t value, unsigned long addr);
|
||||
extern uint32_t csr_readl(unsigned long addr);
|
||||
#else /* ! CSR_ACCESSORS_DEFINED */
|
||||
#include <hw/common.h>
|
||||
#endif /* ! CSR_ACCESSORS_DEFINED */
|
||||
|
||||
/* ctrl */
|
||||
#define CSR_CTRL_BASE 0xe0000000L
|
||||
#define CSR_CTRL_RESET_ADDR 0xe0000000L
|
||||
#define CSR_CTRL_RESET_SIZE 1
|
||||
static inline unsigned char ctrl_reset_read(void) {
|
||||
unsigned char r = csr_readl(0xe0000000L);
|
||||
return r;
|
||||
}
|
||||
static inline void ctrl_reset_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0000000L);
|
||||
}
|
||||
#define CSR_CTRL_SCRATCH_ADDR 0xe0000004L
|
||||
#define CSR_CTRL_SCRATCH_SIZE 4
|
||||
static inline unsigned int ctrl_scratch_read(void) {
|
||||
unsigned int r = csr_readl(0xe0000004L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0000008L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe000000cL);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0000010L);
|
||||
return r;
|
||||
}
|
||||
static inline void ctrl_scratch_write(unsigned int value) {
|
||||
csr_writel(value >> 24, 0xe0000004L);
|
||||
csr_writel(value >> 16, 0xe0000008L);
|
||||
csr_writel(value >> 8, 0xe000000cL);
|
||||
csr_writel(value, 0xe0000010L);
|
||||
}
|
||||
#define CSR_CTRL_BUS_ERRORS_ADDR 0xe0000014L
|
||||
#define CSR_CTRL_BUS_ERRORS_SIZE 4
|
||||
static inline unsigned int ctrl_bus_errors_read(void) {
|
||||
unsigned int r = csr_readl(0xe0000014L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0000018L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe000001cL);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0000020L);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* lxspi */
|
||||
#define CSR_LXSPI_BASE 0xe0007800L
|
||||
#define CSR_LXSPI_BITBANG_ADDR 0xe0007800L
|
||||
#define CSR_LXSPI_BITBANG_SIZE 1
|
||||
static inline unsigned char lxspi_bitbang_read(void) {
|
||||
unsigned char r = csr_readl(0xe0007800L);
|
||||
return r;
|
||||
}
|
||||
static inline void lxspi_bitbang_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0007800L);
|
||||
}
|
||||
#define CSR_LXSPI_BITBANG_MOSI_OFFSET 0
|
||||
#define CSR_LXSPI_BITBANG_MOSI_SIZE 1
|
||||
#define CSR_LXSPI_BITBANG_CLK_OFFSET 1
|
||||
#define CSR_LXSPI_BITBANG_CLK_SIZE 1
|
||||
#define CSR_LXSPI_BITBANG_CS_N_OFFSET 2
|
||||
#define CSR_LXSPI_BITBANG_CS_N_SIZE 1
|
||||
#define CSR_LXSPI_BITBANG_DIR_OFFSET 3
|
||||
#define CSR_LXSPI_BITBANG_DIR_SIZE 1
|
||||
#define CSR_LXSPI_MISO_ADDR 0xe0007804L
|
||||
#define CSR_LXSPI_MISO_SIZE 1
|
||||
static inline unsigned char lxspi_miso_read(void) {
|
||||
unsigned char r = csr_readl(0xe0007804L);
|
||||
return r;
|
||||
}
|
||||
#define CSR_LXSPI_BITBANG_EN_ADDR 0xe0007808L
|
||||
#define CSR_LXSPI_BITBANG_EN_SIZE 1
|
||||
static inline unsigned char lxspi_bitbang_en_read(void) {
|
||||
unsigned char r = csr_readl(0xe0007808L);
|
||||
return r;
|
||||
}
|
||||
static inline void lxspi_bitbang_en_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0007808L);
|
||||
}
|
||||
|
||||
/* messible */
|
||||
#define CSR_MESSIBLE_BASE 0xe0008000L
|
||||
#define CSR_MESSIBLE_IN_ADDR 0xe0008000L
|
||||
#define CSR_MESSIBLE_IN_SIZE 1
|
||||
static inline unsigned char messible_in_read(void) {
|
||||
unsigned char r = csr_readl(0xe0008000L);
|
||||
return r;
|
||||
}
|
||||
static inline void messible_in_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0008000L);
|
||||
}
|
||||
#define CSR_MESSIBLE_OUT_ADDR 0xe0008004L
|
||||
#define CSR_MESSIBLE_OUT_SIZE 1
|
||||
static inline unsigned char messible_out_read(void) {
|
||||
unsigned char r = csr_readl(0xe0008004L);
|
||||
return r;
|
||||
}
|
||||
#define CSR_MESSIBLE_STATUS_ADDR 0xe0008008L
|
||||
#define CSR_MESSIBLE_STATUS_SIZE 1
|
||||
static inline unsigned char messible_status_read(void) {
|
||||
unsigned char r = csr_readl(0xe0008008L);
|
||||
return r;
|
||||
}
|
||||
#define CSR_MESSIBLE_STATUS_FULL_OFFSET 0
|
||||
#define CSR_MESSIBLE_STATUS_FULL_SIZE 1
|
||||
#define CSR_MESSIBLE_STATUS_HAVE_OFFSET 1
|
||||
#define CSR_MESSIBLE_STATUS_HAVE_SIZE 1
|
||||
|
||||
/* reboot */
|
||||
#define CSR_REBOOT_BASE 0xe0006000L
|
||||
#define CSR_REBOOT_CTRL_ADDR 0xe0006000L
|
||||
#define CSR_REBOOT_CTRL_SIZE 1
|
||||
static inline unsigned char reboot_ctrl_read(void) {
|
||||
unsigned char r = csr_readl(0xe0006000L);
|
||||
return r;
|
||||
}
|
||||
static inline void reboot_ctrl_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0006000L);
|
||||
}
|
||||
#define CSR_REBOOT_CTRL_IMAGE_OFFSET 0
|
||||
#define CSR_REBOOT_CTRL_IMAGE_SIZE 2
|
||||
#define CSR_REBOOT_CTRL_KEY_OFFSET 2
|
||||
#define CSR_REBOOT_CTRL_KEY_SIZE 6
|
||||
#define CSR_REBOOT_ADDR_ADDR 0xe0006004L
|
||||
#define CSR_REBOOT_ADDR_SIZE 4
|
||||
static inline unsigned int reboot_addr_read(void) {
|
||||
unsigned int r = csr_readl(0xe0006004L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0006008L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe000600cL);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0006010L);
|
||||
return r;
|
||||
}
|
||||
static inline void reboot_addr_write(unsigned int value) {
|
||||
csr_writel(value >> 24, 0xe0006004L);
|
||||
csr_writel(value >> 16, 0xe0006008L);
|
||||
csr_writel(value >> 8, 0xe000600cL);
|
||||
csr_writel(value, 0xe0006010L);
|
||||
}
|
||||
|
||||
/* rgb */
|
||||
#define CSR_RGB_BASE 0xe0006800L
|
||||
#define CSR_RGB_DAT_ADDR 0xe0006800L
|
||||
#define CSR_RGB_DAT_SIZE 1
|
||||
static inline unsigned char rgb_dat_read(void) {
|
||||
unsigned char r = csr_readl(0xe0006800L);
|
||||
return r;
|
||||
}
|
||||
static inline void rgb_dat_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0006800L);
|
||||
}
|
||||
#define CSR_RGB_ADDR_ADDR 0xe0006804L
|
||||
#define CSR_RGB_ADDR_SIZE 1
|
||||
static inline unsigned char rgb_addr_read(void) {
|
||||
unsigned char r = csr_readl(0xe0006804L);
|
||||
return r;
|
||||
}
|
||||
static inline void rgb_addr_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0006804L);
|
||||
}
|
||||
#define CSR_RGB_CTRL_ADDR 0xe0006808L
|
||||
#define CSR_RGB_CTRL_SIZE 1
|
||||
static inline unsigned char rgb_ctrl_read(void) {
|
||||
unsigned char r = csr_readl(0xe0006808L);
|
||||
return r;
|
||||
}
|
||||
static inline void rgb_ctrl_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0006808L);
|
||||
}
|
||||
#define CSR_RGB_CTRL_EXE_OFFSET 0
|
||||
#define CSR_RGB_CTRL_EXE_SIZE 1
|
||||
#define CSR_RGB_CTRL_CURREN_OFFSET 1
|
||||
#define CSR_RGB_CTRL_CURREN_SIZE 1
|
||||
#define CSR_RGB_CTRL_RGBLEDEN_OFFSET 2
|
||||
#define CSR_RGB_CTRL_RGBLEDEN_SIZE 1
|
||||
#define CSR_RGB_CTRL_RRAW_OFFSET 3
|
||||
#define CSR_RGB_CTRL_RRAW_SIZE 1
|
||||
#define CSR_RGB_CTRL_GRAW_OFFSET 4
|
||||
#define CSR_RGB_CTRL_GRAW_SIZE 1
|
||||
#define CSR_RGB_CTRL_BRAW_OFFSET 5
|
||||
#define CSR_RGB_CTRL_BRAW_SIZE 1
|
||||
#define CSR_RGB_RAW_ADDR 0xe000680cL
|
||||
#define CSR_RGB_RAW_SIZE 1
|
||||
static inline unsigned char rgb_raw_read(void) {
|
||||
unsigned char r = csr_readl(0xe000680cL);
|
||||
return r;
|
||||
}
|
||||
static inline void rgb_raw_write(unsigned char value) {
|
||||
csr_writel(value, 0xe000680cL);
|
||||
}
|
||||
#define CSR_RGB_RAW_R_OFFSET 0
|
||||
#define CSR_RGB_RAW_R_SIZE 1
|
||||
#define CSR_RGB_RAW_G_OFFSET 1
|
||||
#define CSR_RGB_RAW_G_SIZE 1
|
||||
#define CSR_RGB_RAW_B_OFFSET 2
|
||||
#define CSR_RGB_RAW_B_SIZE 1
|
||||
|
||||
/* timer0 */
|
||||
#define CSR_TIMER0_BASE 0xe0002800L
|
||||
#define CSR_TIMER0_LOAD_ADDR 0xe0002800L
|
||||
#define CSR_TIMER0_LOAD_SIZE 4
|
||||
static inline unsigned int timer0_load_read(void) {
|
||||
unsigned int r = csr_readl(0xe0002800L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0002804L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0002808L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe000280cL);
|
||||
return r;
|
||||
}
|
||||
static inline void timer0_load_write(unsigned int value) {
|
||||
csr_writel(value >> 24, 0xe0002800L);
|
||||
csr_writel(value >> 16, 0xe0002804L);
|
||||
csr_writel(value >> 8, 0xe0002808L);
|
||||
csr_writel(value, 0xe000280cL);
|
||||
}
|
||||
#define CSR_TIMER0_RELOAD_ADDR 0xe0002810L
|
||||
#define CSR_TIMER0_RELOAD_SIZE 4
|
||||
static inline unsigned int timer0_reload_read(void) {
|
||||
unsigned int r = csr_readl(0xe0002810L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0002814L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0002818L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe000281cL);
|
||||
return r;
|
||||
}
|
||||
static inline void timer0_reload_write(unsigned int value) {
|
||||
csr_writel(value >> 24, 0xe0002810L);
|
||||
csr_writel(value >> 16, 0xe0002814L);
|
||||
csr_writel(value >> 8, 0xe0002818L);
|
||||
csr_writel(value, 0xe000281cL);
|
||||
}
|
||||
#define CSR_TIMER0_EN_ADDR 0xe0002820L
|
||||
#define CSR_TIMER0_EN_SIZE 1
|
||||
static inline unsigned char timer0_en_read(void) {
|
||||
unsigned char r = csr_readl(0xe0002820L);
|
||||
return r;
|
||||
}
|
||||
static inline void timer0_en_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0002820L);
|
||||
}
|
||||
#define CSR_TIMER0_UPDATE_VALUE_ADDR 0xe0002824L
|
||||
#define CSR_TIMER0_UPDATE_VALUE_SIZE 1
|
||||
static inline unsigned char timer0_update_value_read(void) {
|
||||
unsigned char r = csr_readl(0xe0002824L);
|
||||
return r;
|
||||
}
|
||||
static inline void timer0_update_value_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0002824L);
|
||||
}
|
||||
#define CSR_TIMER0_VALUE_ADDR 0xe0002828L
|
||||
#define CSR_TIMER0_VALUE_SIZE 4
|
||||
static inline unsigned int timer0_value_read(void) {
|
||||
unsigned int r = csr_readl(0xe0002828L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe000282cL);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0002830L);
|
||||
r <<= 8;
|
||||
r |= csr_readl(0xe0002834L);
|
||||
return r;
|
||||
}
|
||||
#define CSR_TIMER0_EV_STATUS_ADDR 0xe0002838L
|
||||
#define CSR_TIMER0_EV_STATUS_SIZE 1
|
||||
static inline unsigned char timer0_ev_status_read(void) {
|
||||
unsigned char r = csr_readl(0xe0002838L);
|
||||
return r;
|
||||
}
|
||||
static inline void timer0_ev_status_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0002838L);
|
||||
}
|
||||
#define CSR_TIMER0_EV_PENDING_ADDR 0xe000283cL
|
||||
#define CSR_TIMER0_EV_PENDING_SIZE 1
|
||||
static inline unsigned char timer0_ev_pending_read(void) {
|
||||
unsigned char r = csr_readl(0xe000283cL);
|
||||
return r;
|
||||
}
|
||||
static inline void timer0_ev_pending_write(unsigned char value) {
|
||||
csr_writel(value, 0xe000283cL);
|
||||
}
|
||||
#define CSR_TIMER0_EV_ENABLE_ADDR 0xe0002840L
|
||||
#define CSR_TIMER0_EV_ENABLE_SIZE 1
|
||||
static inline unsigned char timer0_ev_enable_read(void) {
|
||||
unsigned char r = csr_readl(0xe0002840L);
|
||||
return r;
|
||||
}
|
||||
static inline void timer0_ev_enable_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0002840L);
|
||||
}
|
||||
|
||||
/* touch */
|
||||
#define CSR_TOUCH_BASE 0xe0005800L
|
||||
#define CSR_TOUCH_O_ADDR 0xe0005800L
|
||||
#define CSR_TOUCH_O_SIZE 1
|
||||
static inline unsigned char touch_o_read(void) {
|
||||
unsigned char r = csr_readl(0xe0005800L);
|
||||
return r;
|
||||
}
|
||||
static inline void touch_o_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0005800L);
|
||||
}
|
||||
#define CSR_TOUCH_OE_ADDR 0xe0005804L
|
||||
#define CSR_TOUCH_OE_SIZE 1
|
||||
static inline unsigned char touch_oe_read(void) {
|
||||
unsigned char r = csr_readl(0xe0005804L);
|
||||
return r;
|
||||
}
|
||||
static inline void touch_oe_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0005804L);
|
||||
}
|
||||
#define CSR_TOUCH_I_ADDR 0xe0005808L
|
||||
#define CSR_TOUCH_I_SIZE 1
|
||||
static inline unsigned char touch_i_read(void) {
|
||||
unsigned char r = csr_readl(0xe0005808L);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* usb */
|
||||
#define CSR_USB_BASE 0xe0004800L
|
||||
#define CSR_USB_PULLUP_OUT_ADDR 0xe0004800L
|
||||
#define CSR_USB_PULLUP_OUT_SIZE 1
|
||||
static inline unsigned char usb_pullup_out_read(void) {
|
||||
unsigned char r = csr_readl(0xe0004800L);
|
||||
return r;
|
||||
}
|
||||
static inline void usb_pullup_out_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0004800L);
|
||||
}
|
||||
#define CSR_USB_ADDRESS_ADDR 0xe0004804L
|
||||
#define CSR_USB_ADDRESS_SIZE 1
|
||||
static inline unsigned char usb_address_read(void) {
|
||||
unsigned char r = csr_readl(0xe0004804L);
|
||||
return r;
|
||||
}
|
||||
static inline void usb_address_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0004804L);
|
||||
}
|
||||
#define CSR_USB_ADDRESS_ADDR_OFFSET 0
|
||||
#define CSR_USB_ADDRESS_ADDR_SIZE 7
|
||||
#define CSR_USB_NEXT_EV_ADDR 0xe0004808L
|
||||
#define CSR_USB_NEXT_EV_SIZE 1
|
||||
static inline unsigned char usb_next_ev_read(void) {
|
||||
unsigned char r = csr_readl(0xe0004808L);
|
||||
return r;
|
||||
}
|
||||
#define CSR_USB_NEXT_EV_IN_OFFSET 0
|
||||
#define CSR_USB_NEXT_EV_IN_SIZE 1
|
||||
#define CSR_USB_NEXT_EV_OUT_OFFSET 1
|
||||
#define CSR_USB_NEXT_EV_OUT_SIZE 1
|
||||
#define CSR_USB_NEXT_EV_SETUP_OFFSET 2
|
||||
#define CSR_USB_NEXT_EV_SETUP_SIZE 1
|
||||
#define CSR_USB_NEXT_EV_RESET_OFFSET 3
|
||||
#define CSR_USB_NEXT_EV_RESET_SIZE 1
|
||||
#define CSR_USB_SETUP_DATA_ADDR 0xe000480cL
|
||||
#define CSR_USB_SETUP_DATA_SIZE 1
|
||||
static inline unsigned char usb_setup_data_read(void) {
|
||||
unsigned char r = csr_readl(0xe000480cL);
|
||||
return r;
|
||||
}
|
||||
#define CSR_USB_SETUP_DATA_DATA_OFFSET 0
|
||||
#define CSR_USB_SETUP_DATA_DATA_SIZE 8
|
||||
#define CSR_USB_SETUP_CTRL_ADDR 0xe0004810L
|
||||
#define CSR_USB_SETUP_CTRL_SIZE 1
|
||||
static inline unsigned char usb_setup_ctrl_read(void) {
|
||||
unsigned char r = csr_readl(0xe0004810L);
|
||||
return r;
|
||||
}
|
||||
static inline void usb_setup_ctrl_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0004810L);
|
||||
}
|
||||
#define CSR_USB_SETUP_CTRL_RESET_OFFSET 5
|
||||
#define CSR_USB_SETUP_CTRL_RESET_SIZE 1
|
||||
#define CSR_USB_SETUP_STATUS_ADDR 0xe0004814L
|
||||
#define CSR_USB_SETUP_STATUS_SIZE 1
|
||||
static inline unsigned char usb_setup_status_read(void) {
|
||||
unsigned char r = csr_readl(0xe0004814L);
|
||||
return r;
|
||||
}
|
||||
#define CSR_USB_SETUP_STATUS_EPNO_OFFSET 0
|
||||
#define CSR_USB_SETUP_STATUS_EPNO_SIZE 4
|
||||
#define CSR_USB_SETUP_STATUS_HAVE_OFFSET 4
|
||||
#define CSR_USB_SETUP_STATUS_HAVE_SIZE 1
|
||||
#define CSR_USB_SETUP_STATUS_PEND_OFFSET 5
|
||||
#define CSR_USB_SETUP_STATUS_PEND_SIZE 1
|
||||
#define CSR_USB_SETUP_STATUS_IS_IN_OFFSET 6
|
||||
#define CSR_USB_SETUP_STATUS_IS_IN_SIZE 1
|
||||
#define CSR_USB_SETUP_STATUS_DATA_OFFSET 7
|
||||
#define CSR_USB_SETUP_STATUS_DATA_SIZE 1
|
||||
#define CSR_USB_SETUP_EV_STATUS_ADDR 0xe0004818L
|
||||
#define CSR_USB_SETUP_EV_STATUS_SIZE 1
|
||||
static inline unsigned char usb_setup_ev_status_read(void) {
|
||||
unsigned char r = csr_readl(0xe0004818L);
|
||||
return r;
|
||||
}
|
||||
static inline void usb_setup_ev_status_write(unsigned char value) {
|
||||
csr_writel(value, 0xe0004818L);
|
||||