Skip to content

Commit

Permalink
feat(hepa-uv): Add the initial project for the HEPA/UV module (#740)
Browse files Browse the repository at this point in the history
* Added HEPA/UV module project, which builds and idles the drive pin indefinitely 
* Added hepa_uv NodeId 0x32 and hepa_uv_bootloader NodeID 0x3e to match monorepo
* Added GPIO pin configuration to match board design
* Added placeholder test
* Added CI project
  • Loading branch information
vegano1 authored Jan 17, 2024
1 parent 05b075d commit eb17a01
Show file tree
Hide file tree
Showing 38 changed files with 2,825 additions and 6 deletions.
122 changes: 122 additions & 0 deletions .github/workflows/hepa_uv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: "HEPA/UV build/test"
on:
pull_request:
paths:
- "hepa-uv/**"
- "common/**"
- "can/**"
- "include/**"
- "!include/pipettes/**"
- "!include/gantry/**"
- "!include/head/**"
- "cmake/*"
- "!cmake/Arduino*"
- "CMakeLists.txt"
- "hepa-uv/CMakeLists.txt"
- "CMakePresets.json"
- ".clang-format"
- ".clang-tidy"
push:
paths:
- "hepa-uv/**"
- "common/**"
- "can/**"
- "spi/**"
- "include/**"
- "!include/pipettes/**"
- "!include/gantry/**"
- "!include/head/**"
- "cmake/*"
- "!cmake/Arduino*"
- "CMakeLists.txt"
- "hepa-uv/CMakeLists.txt"
- "CMakePresets.json"
- ".clang-format"
- ".clang-tidy"
- ".github/workflows/hepa_uv.yaml"
branches:
- "*"
tags:
- "hepa_uv@*"
workflow_dispatch:

env:
ci: 1

defaults:
run:
shell: bash

jobs:
cross-compile-check:
name: "Cross-Compile/Check"
runs-on: "ubuntu-20.04"
timeout-minutes: 20
steps:
- uses: "actions/checkout@v2"
with:
fetch-depth: 0
- uses: "actions/cache@v3"
with:
path: "./stm32-tools"
key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }}
- name: "Configure"
run: cmake --preset=cross . -DCMAKE_BUILD_TYPE=RelWithDebInfo
- name: "Format"
run: cmake --build ./build-cross --target hepa-uv-format-ci
- name: "Build"
run: cmake --build ./build-cross --target hepa-uv-images hepa-uv-applications
- name: "Lint"
run: cmake --build ./build-cross --target hepa-uv-lint

host-compile-test:
name: "Host-Compile/Test"
runs-on: "ubuntu-20.04"
timeout-minutes: 10
steps:
- name: Update and install gcc-10 & g++-10
run: |
sudo apt update
sudo apt install gcc-10 g++-10
- name: Checkout ot3-firmware repository
uses: "actions/checkout@v2"
with:
fetch-depth: 0
path: ot3-firmware

- name: Checkout opentrons repository
uses: actions/checkout@v3
with:
repository: "Opentrons/opentrons"
path: opentrons

- name: Cache stm32-tools
uses: "actions/cache@v3"
with:
path: "./stm32-tools"
key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }}

- name: "Configure"
run: cmake --preset=host-gcc10 .
working-directory: ot3-firmware

- name: 'Build and test'
run: cmake --build ./build-host --target hepa-uv-build-and-test
working-directory: ot3-firmware

- name: 'Setup state_manager'
run: cmake --build ./build-host/ --target state-manager-setup
working-directory: ot3-firmware

- name: 'Build simulator'
run: cmake --build ./build-host --target hepa-uv-simulator
working-directory: ot3-firmware

- name: "Upload artifacts"
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v3
with:
name: "hepa-uv-simulator-${{github.ref_name}}"
path: |
build-host/hepa-uv/simulator/hepa-uv-simulator
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ add_subdir_for_archs(SUBDIR gantry ARCHS cortex-m4)
add_subdir_for_archs(SUBDIR head ARCHS cortex-m4)
add_subdir_for_archs(SUBDIR gripper ARCHS cortex-m4)
add_subdir_for_archs(SUBDIR pipettes ARCHS cortex-m4 cortex-m33)
add_subdir_for_archs(SUBDIR hepa-uv ARCHS cortex-m4)
list(REMOVE_DUPLICATES LINT_TARGETS)

message(VERBOSE "Checking if cross-compiling.")
Expand Down Expand Up @@ -141,6 +142,7 @@ file(GLOB_RECURSE SOURCES_FOR_FORMAT
./spi/*.hpp ./spi/*.cpp
./eeprom/*.hpp ./eeprom/*.cpp ./rear-panel/*.hpp
./rear-panel/*.cpp
./hepa-uv/*.cpp
)

# Targets for formatting. These are here rather than in individual target CMakeLists (e.g.
Expand Down
20 changes: 17 additions & 3 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@
"gripper"
]
},
{
"name": "hepa-uv",
"displayName": "hepa-uv binary",
"description": "Build the hepa-uv cross binary",
"configurePreset": "cross",
"jobs": 4,
"targets": [
"hepa-uv"
]
},

{
"name": "gantry",
"displayName": "gantry binaries",
Expand Down Expand Up @@ -212,7 +223,8 @@
"bootloader-gripper-applications",
"bootloader-pipettes-single-applications",
"bootloader-pipettes-multi-applications",
"bootloader-pipettes-96-applications"
"bootloader-pipettes-96-applications",
"bootloader-hepa-uv-applications"
]
},
{
Expand All @@ -230,7 +242,8 @@
"pipettes-single-simulator",
"pipettes-multi-simulator",
"pipettes-96-simulator",
"gripper-simulator"
"gripper-simulator",
"hepa-uv-simulator"
]
},
{
Expand All @@ -248,7 +261,8 @@
"pipettes-single-simulator",
"pipettes-multi-simulator",
"pipettes-96-simulator",
"gripper-simulator"
"gripper-simulator",
"hepa-uv-simulator"
]
}
]
Expand Down
19 changes: 19 additions & 0 deletions bootloader/firmware/stm32G4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ foreach_revision(
NO_CREATE_INSTALL_RULES
)

set(hepauv_sources ${_g4_sources})

macro(hepauv_bootloader_loop)
target_link_libraries(${REVISION_TARGET}
PUBLIC STM32G491RETx_bootloader
STM32G4xx_Drivers_Bootloader
bootloader-core)

target_compile_definitions(${REVISION_TARGET} PUBLIC node_id_hepa_uv)
endmacro()

foreach_revision(
PROJECT_NAME bootloader-hepa-uv
CALL_FOREACH_REV hepauv_bootloader_loop
REVISIONS b1
SOURCES hepauv_sources
NO_CREATE_IMAGE_HEX
NO_CREATE_INSTALL_RULES
)

target_include_directories(STM32G4xx_Drivers_Bootloader
PUBLIC .)
Expand Down
4 changes: 3 additions & 1 deletion bootloader/firmware/stm32G4/node_id_stm32g4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ CANNodeId get_node_id(void) {
#elif defined(node_id_pipette_left)
return can_nodeid_pipette_left_bootloader;
#elif defined(node_id_pipette_right)
return can_nodeid_pipette_right_bootloader
return can_nodeid_pipette_right_bootloader;
#elif defined(node_id_pipette_dynamic)
return get_dynamic_nodeid();
#elif defined(node_id_hepa_uv)
return can_nodeid_hepa_uv_bootloader;
#else
#error "No node id"
#endif
Expand Down
2 changes: 1 addition & 1 deletion common/firmware/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ __attribute__((section( ".ccmram" )))
#endif
bool gpio_is_set(void* port, uint16_t pin, uint8_t active_setting) {
return HAL_GPIO_ReadPin(port, pin) == active_setting;
}
}
2 changes: 1 addition & 1 deletion common/firmware/gpio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ __attribute__((section( ".ccmram" )))
auto gpio::is_set(const gpio::PinConfig& pc)
-> bool {
return gpio_is_set(pc.port, pc.pin, pc.active_setting);
}
}
33 changes: 33 additions & 0 deletions hepa-uv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# hepa-uv source tree

add_subdirectory(core)

if (${CMAKE_CROSSCOMPILING})
if (${ARM_ARCH_TYPE} STREQUAL "cortex-m4")
add_subdirectory(firmware)
endif ()
else ()
add_subdirectory(simulator)
add_subdirectory(tests)
endif ()

file(GLOB_RECURSE HEPA_SOURCES_FOR_FORMAT ./*.cpp ./*.hpp ../include/hepa-uv/*.hpp)

# Targets for formatting. These are here rather than in individual target CMakeLists (e.g.
# the ones in tests/ or firmware/) because they don't have semantic reasoning involved and
# can therefore operate on file globs, unlike lint/static analysis

# Target for use during dev - edits files
add_custom_target(
hepa-uv-format
ALL
COMMAND ${Clang_CLANGFORMAT_EXECUTABLE} -style=file -i ${HEPA_SOURCES_FOR_FORMAT}
)

# Target for use in ci - warnings are errors, doesn't edit files
add_custom_target(
hepa-uv-format-ci
COMMAND ${Clang_CLANGFORMAT_EXECUTABLE} -style=file -Werror --ferror-limit=0 -n ${HEPA_SOURCES_FOR_FORMAT}
)

set(LINT_TARGETS ${LINT_TARGETS} PARENT_SCOPE)
8 changes: 8 additions & 0 deletions hepa-uv/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function(target_hepa_uv_core TARGET)
target_sources(${TARGET} PUBLIC
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/can_tasks.cpp
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/tasks.cpp)
target_include_directories(${TARGET} PUBLIC ${CMAKE_CURRENT_FUNCTION_LIST_DIR})
target_link_libraries(${TARGET} PUBLIC common-core)
target_include_directories(${TARGET} INTERFACE ${CMAKE_SOURCE_DIR}/cpp-utils/include)
endfunction()
Loading

0 comments on commit eb17a01

Please sign in to comment.