forked from greatscottgadgets/apollo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-force-offline
- Loading branch information
Showing
27 changed files
with
1,265 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: python | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
# Run automatically every monday | ||
schedule: | ||
- cron: 1 12 * * 1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 5 | ||
matrix: | ||
python-version: | ||
- '3.8' | ||
- '3.9' | ||
- '3.10' | ||
- '3.11' | ||
- '3.12' | ||
|
||
name: test (${{ matrix.python-version }}) | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up PDM | ||
uses: pdm-project/setup-pdm@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
pdm install -G :all | ||
- name: Run tests | ||
run: pdm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
cmake_minimum_required(VERSION 3.17) | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
# set(CMAKE_C_COMPILER_WORKS 1) | ||
|
||
#set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
include(${CMAKE_CURRENT_SOURCE_DIR}/../lib/tinyusb/hw/bsp/family_support.cmake) | ||
|
||
# gets PROJECT name for the example (e.g. <BOARD>-<DIR_NAME>) | ||
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
project(${PROJECT} C CXX ASM) | ||
|
||
# Checks this example is valid for the family and initializes the project | ||
family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
# Espressif has its own cmake build system | ||
if(FAMILY STREQUAL "espressif") | ||
return() | ||
endif() | ||
|
||
add_executable(${PROJECT}) | ||
|
||
# Example source | ||
target_sources(${PROJECT} PUBLIC | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/src/boards/${BOARD}/dfu.c | ||
# ${CMAKE_CURRENT_SOURCE_DIR}/src/boards/${BOARD}/usb_descriptors.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/boards/${BOARD}/fpga.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/boards/${BOARD}/jtag.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/boards/${BOARD}/led.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/boards/${BOARD}/spi.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/boards/${BOARD}/uart.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/mcu/rp2040/dfu.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/mcu/rp2040/usb_descriptors.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/board_rev.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/button.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/console.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/debug_spi.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/fpga_adv.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/fpga.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/jtag_tap.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/jtag.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/usb_switch.c | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/vendor.c | ||
) | ||
|
||
# Example include | ||
target_include_directories(${PROJECT} PUBLIC | ||
${CMAKE_CURRENT_SOURCE_DIR}/src | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/boards/${BOARD} | ||
) | ||
|
||
target_compile_definitions(${PROJECT} PUBLIC | ||
# CFG_TUSB_OS=OPT_OS_PICO | ||
_BOARD_REVISION_MAJOR_=${BOARD_REVISION_MAJOR} | ||
_BOARD_REVISION_MINOR_=${BOARD_REVISION_MINOR} | ||
VERSION_STRING="${VERSION_STRING}" | ||
) | ||
|
||
# Configure compilation flags and libraries for the example... see the corresponding function | ||
# in hw/bsp/FAMILY/family.cmake for details. | ||
# family_configure_device_example(${PROJECT} noos) | ||
family_configure_target(${PROJECT} noos) | ||
target_link_libraries(${PROJECT} PUBLIC pico_stdlib tinyusb_device pico_unique_id pico_fix_rp2040_usb_device_enumeration hardware_spi) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/** | ||
* Apollo board definitions for Raspberry Pi Pico | ||
* | ||
* Copyright (c) 2020-2024 Great Scott Gadgets <[email protected]> | ||
* Copyright (c) 2024 Markus Blechschmidt <[email protected]> | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
#ifndef __APOLLO_BOARD_H__ | ||
#define __APOLLO_BOARD_H__ | ||
|
||
#include <stdbool.h> | ||
|
||
#include "boards/pico.h" | ||
#include "bsp/rp2040/board.h" | ||
#include "pico/stdlib.h" | ||
#include "hardware/gpio.h" | ||
#include "hardware/sync.h" | ||
|
||
|
||
#define __NOP() {asm volatile("nop");} | ||
|
||
|
||
typedef unsigned int gpio_t; | ||
|
||
|
||
typedef enum gpio_direction{ | ||
GPIO_DIRECTION_IN = GPIO_IN, | ||
GPIO_DIRECTION_OUT = GPIO_OUT, | ||
} gpio_direction_t; | ||
|
||
|
||
typedef enum gpio_pull_mode { | ||
GPIO_PULL_OFF, | ||
GPIO_PULL_UP, | ||
GPIO_PULL_DOWN, | ||
} gpio_pull_mode_t; | ||
|
||
|
||
/** | ||
* GPIO pins for each of the microcontroller LEDs. | ||
*/ | ||
typedef enum { | ||
LED_A = LED_PIN, // Green | ||
|
||
LED_COUNT = 1, | ||
} led_t; | ||
|
||
/** | ||
* GPIO pin numbers. | ||
*/ | ||
|
||
|
||
|
||
enum { | ||
// // Each of the JTAG pins. SPI0 | ||
TMS_GPIO = 5, | ||
TDI_GPIO = 3, // MOSI | ||
TDO_GPIO = 4, // MISO | ||
TCK_GPIO = 6, // SCK | ||
|
||
// // Connected to orangecrab pins 0 and 1. SERCOM0 | ||
UART_RX = UART_RX_PIN, | ||
UART_TX = UART_TX_PIN, | ||
|
||
// Connected to orangecrab RSTFPGA_RESET, ecp5 PROGRAMN | ||
PIN_PROG = 7, | ||
}; | ||
|
||
|
||
static inline void gpio_set_pin_level(const gpio_t gpio_pin, bool level) { | ||
gpio_put(gpio_pin, level); | ||
} | ||
|
||
|
||
static inline bool gpio_get_pin_level(const gpio_t gpio_pin) { | ||
return gpio_get(gpio_pin); | ||
} | ||
|
||
|
||
static inline void gpio_toggle_pin_level(const gpio_t gpio_pin) { | ||
gpio_set_pin_level(gpio_pin, !gpio_get_pin_level(gpio_pin)); | ||
} | ||
|
||
|
||
static inline void gpio_set_pin_direction(const gpio_t gpio_pin, const enum gpio_direction direction) { | ||
gpio_init(gpio_pin); | ||
gpio_set_dir(gpio_pin, direction); | ||
} | ||
|
||
|
||
static inline void gpio_set_pin_pull_mode(const gpio_t gpio_pin, const gpio_pull_mode_t pull_mode) { | ||
switch(pull_mode) { | ||
case GPIO_PULL_OFF: { | ||
gpio_disable_pulls(gpio_pin); | ||
} break; | ||
case GPIO_PULL_UP: { | ||
gpio_pull_up(gpio_pin); | ||
} break; | ||
case GPIO_PULL_DOWN: { | ||
gpio_pull_down(gpio_pin); | ||
} break; | ||
default: { | ||
|
||
} break; | ||
} | ||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
# This is an external board, so its identity is determined by its revision number. | ||
# MAJOR = external board | ||
# MINOR = generic Apollo board | ||
BOARD_REVISION_MAJOR := 255 | ||
BOARD_REVISION_MINOR := 3 | ||
|
||
CMAKE_DEFSYM += \ | ||
-DBOARD_REVISION_MAJOR=$(BOARD_REVISION_MAJOR) \ | ||
-DBOARD_REVISION_MINOR=$(BOARD_REVISION_MINOR) \ | ||
-DVERSION_STRING="$(VERSION_STRING)" | ||
|
||
ifeq "$(PICO_SDK_PATH)" "" | ||
CMAKE_DEFSYM += -DPICO_SDK_FETCH_FROM_GIT=1 | ||
else | ||
CMAKE_DEFSYM += -DPICO_SDK_PATH=$(PICO_SDK_PATH) | ||
endif |
Oops, something went wrong.