Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
csouers committed Apr 30, 2024
2 parents 0787dd8 + 53e0f13 commit 3613e78
Show file tree
Hide file tree
Showing 155 changed files with 665 additions and 2,177 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/drivers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
build_socketcan:
name: socketcan build
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
pre-commit-autoupdate:
name: pre-commit autoupdate
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
container:
image: ghcr.io/commaai/panda:latest
steps:
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:
jobs:
docker_push:
name: docker push
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 20
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/panda'
steps:
Expand All @@ -38,7 +38,7 @@ jobs:

build:
name: build
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
Expand All @@ -57,7 +57,7 @@ jobs:

unit_tests:
name: unit tests
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
Expand All @@ -70,7 +70,7 @@ jobs:

safety:
name: safety
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
flags: ['', '--ubsan']
Expand All @@ -82,16 +82,13 @@ jobs:
- name: Run safety tests
timeout-minutes: 5
run: |
${{ env.RUN }} "cd .. && \
scons -c && \
scons -j$(nproc) opendbc/ cereal/ && \
cd panda && \
${{ env.RUN }} "scons -c -j$(nproc) && \
scons -j$(nproc) ${{ matrix.flags }} && \
tests/safety/test.sh"
misra:
name: MISRA C:2012
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
Expand All @@ -103,12 +100,12 @@ jobs:
timeout-minutes: 1
run: ${{ env.RUN }} "cd tests/misra && ./test_misra.sh"
- name: MISRA mutation tests
timeout-minutes: 4
run: ${{ env.RUN }} "cd tests/misra && ./test_mutation.py"
timeout-minutes: 5
run: ${{ env.RUN }} "cd tests/misra && pytest -n8 test_mutation.py"

python_linter:
name: python linter
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-ast
- id: check-yaml
Expand All @@ -9,12 +9,12 @@ repos:
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies: ['git+https://github.com/numpy/numpy-stubs', 'types-requests', 'types-atomicwrites',
'types-pycurl']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.4.1
hooks:
- id: ruff
72 changes: 24 additions & 48 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,36 @@
FROM ubuntu:20.04
FROM ubuntu:24.04

ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /tmp/openpilot:$PYTHONPATH

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
make \
bzip2 \
ca-certificates \
capnproto \
clang \
curl \
g++ \
gcc-arm-none-eabi libnewlib-arm-none-eabi \
git \
libarchive-dev \
libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libavresample-dev libavfilter-dev \
libbz2-dev \
libcapnp-dev \
libcurl4-openssl-dev \
libffi-dev \
libtool \
libssl-dev \
libsqlite3-dev \
libusb-1.0-0 \
libzmq3-dev \
locales \
opencl-headers \
ocl-icd-opencl-dev \
make \
patch \
pkg-config \
python \
python-dev \
qt5-default \
unzip \
wget \
python3 \
python3-dev \
python3-pip \
python-is-python3 \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* && \
cd /usr/lib/gcc/arm-none-eabi/9.2.1 && \
apt clean && \
cd /usr/lib/gcc/arm-none-eabi/* && \
rm -rf arm/ && \
rm -rf thumb/nofp thumb/v6* thumb/v8* thumb/v7+fp thumb/v7-r+fp.sp

Expand All @@ -47,43 +39,27 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"

ENV PANDA_PATH=/tmp/openpilot/panda
ENV OPENPILOT_REF="5690386d8d731c9bebda536a5c71c890f6dfe98c"
ENV OPENDBC_REF="40d9c723d48496229fecc436046538a53af19c11"

COPY requirements.txt /tmp/
RUN pyenv install 3.11.4 && \
pyenv global 3.11.4 && \
pyenv rehash && \
pip install --no-cache-dir -r /tmp/requirements.txt
RUN pip3 install --break-system-packages --no-cache-dir -r /tmp/requirements.txt

ENV CPPCHECK_DIR=/tmp/cppcheck
COPY tests/misra/install.sh /tmp/
RUN /tmp/install.sh

RUN git config --global --add safe.directory /tmp/openpilot/panda
RUN cd /tmp && \
git clone https://github.com/commaai/openpilot.git tmppilot || true && \
cd /tmp/tmppilot && \
git fetch origin $OPENPILOT_REF && \
git checkout $OPENPILOT_REF && \
git submodule update --init cereal opendbc rednose_repo body && \
git -C opendbc fetch && \
git -C opendbc checkout $OPENDBC_REF && \
git -C opendbc reset --hard HEAD && \
git -C opendbc clean -xfd && \
mkdir /tmp/openpilot && \
cp -pR SConstruct site_scons/ tools/ selfdrive/ system/ common/ cereal/ opendbc/ rednose/ third_party/ body/ /tmp/openpilot && \
rm -rf /tmp/openpilot/panda && \
rm -rf /tmp/tmppilot
RUN /tmp/install.sh && rm -rf $CPPCHECK_DIR/.git/
ENV SKIP_CPPCHECK_INSTALL=1

RUN cd /tmp/openpilot && \
pip install --no-cache-dir -r opendbc/requirements.txt && \
pip install --no-cache-dir --upgrade aenum lru-dict pycurl tenacity atomicwrites serial smbus2
ENV CEREAL_REF="861144c136c91f70dcbc652c2ffe99f57440ad47"
ENV OPENDBC_REF="e0d4be4a6215d44809718dc84efe1b9f0299ad63"

RUN git config --global --add safe.directory /tmp/openpilot/panda
RUN mkdir -p /tmp/openpilot/ && \
cd /tmp/openpilot/ && \
git clone --depth 1 https://github.com/commaai/cereal && \
git clone --depth 1 https://github.com/commaai/opendbc && \
cd cereal && git fetch origin $CEREAL_REF && git checkout FETCH_HEAD && rm -rf .git/ && cd .. && \
cd opendbc && git fetch origin $OPENDBC_REF && git checkout FETCH_HEAD && rm -rf .git/ && cd .. && \
cp -pR opendbc/SConstruct opendbc/site_scons/ . && \
pip3 install --break-system-packages --no-cache-dir -r opendbc/requirements.txt && \
scons -j8 --minimal opendbc/ cereal/

# for Jenkins
COPY README.md panda.tar.* /tmp/
Expand Down
20 changes: 1 addition & 19 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pipeline {
["build", "scons -j4"],
["flash", "cd tests/ && ./reflash_internal_panda.py"],
["flash jungle", "cd board/jungle && ./flash.py"],
["test", "cd tests/hitl && HW_TYPES=6 pytest -n0 --durations=0 [2-7]*.py -k 'not test_send_recv'"],
["test", "cd tests/hitl && HW_TYPES=6 pytest -n0 --durations=0 [2-9]*.py -k 'not test_send_recv'"],
])
}
}
Expand Down Expand Up @@ -130,24 +130,6 @@ pipeline {
}
}
}

/*
stage('HITL tests') {
steps {
script {
docker_run("parallel tests", 5, 'PANDAS_JUNGLE=23002d000851393038373731 PANDAS_EXCLUDE="1d0002000c51303136383232 2f002e000c51303136383232" ./tests/hitl/run_parallel_tests.sh')
docker_run("serial tests", 9, 'PANDAS_JUNGLE=23002d000851393038373731 PANDAS_EXCLUDE="1d0002000c51303136383232 2f002e000c51303136383232" ./tests/hitl/run_serial_tests.sh')
}
}
}
stage('CANFD tests') {
steps {
script {
docker_run("CANFD tets", 6, 'JUNGLE=058010800f51363038363036 H7_PANDAS_EXCLUDE="080021000c51303136383232 33000e001051393133353939" ./tests/canfd/test_canfd.py')
}
}
}
*/
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def build_project(project_name, project, extra_flags):
'..',
panda_root,
f"{panda_root}/board/",
f"{panda_root}/board/stm32fx/inc",
f"{panda_root}/board/stm32f4/inc",
f"{panda_root}/board/stm32h7/inc",
]

Expand Down Expand Up @@ -130,8 +130,8 @@ def build_project(project_name, project, extra_flags):

base_project_f4 = {
"MAIN": "main.c",
"STARTUP_FILE": File("./board/stm32fx/startup_stm32f413xx.s"),
"LINKER_SCRIPT": File("./board/stm32fx/stm32f4_flash.ld"),
"STARTUP_FILE": File("./board/stm32f4/startup_stm32f413xx.s"),
"LINKER_SCRIPT": File("./board/stm32f4/stm32f4_flash.ld"),
"APP_START_ADDRESS": "0x8004000",
"PROJECT_FLAGS": [
"-mcpu=cortex-m4",
Expand Down
12 changes: 2 additions & 10 deletions board/boards/black.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ void black_init(void) {
// Initialize harness
harness_init();

// Initialize RTC
rtc_init();

// Enable CAN transceivers
black_enable_can_transceivers(true);
Expand All @@ -135,11 +133,6 @@ void black_init(void) {

// Set normal CAN mode
black_set_can_mode(CAN_MODE_NORMAL);

// change CAN mapping when flipped
if (harness.status == HARNESS_STATUS_FLIPPED) {
can_flip_buses(0, 2);
}
}

void black_init_bootloader(void) {
Expand All @@ -148,7 +141,7 @@ void black_init_bootloader(void) {
set_gpio_output(GPIOC, 12, 0);
}

const harness_configuration black_harness_config = {
harness_configuration black_harness_config = {
.has_harness = true,
.GPIO_SBU1 = GPIOC,
.GPIO_SBU2 = GPIOC,
Expand All @@ -162,13 +155,12 @@ const harness_configuration black_harness_config = {
.adc_channel_SBU2 = 13
};

const board board_black = {
board board_black = {
.set_bootkick = unused_set_bootkick,
.harness_config = &black_harness_config,
.has_obd = true,
.has_spi = false,
.has_canfd = false,
.has_rtc_battery = false,
.fan_max_rpm = 0U,
.avdd_mV = 3300U,
.fan_stall_recovery = false,
Expand Down
7 changes: 2 additions & 5 deletions board/boards/board_declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ typedef void (*board_set_bootkick)(BootState state);
typedef bool (*board_read_som_gpio)(void);

struct board {
const harness_configuration *harness_config;
harness_configuration *harness_config;
const bool has_obd;
const bool has_spi;
const bool has_canfd;
const bool has_rtc_battery;
const uint16_t fan_max_rpm;
const uint16_t avdd_mV;
const bool fan_stall_recovery;
Expand Down Expand Up @@ -73,6 +72,4 @@ struct board {

// CAN modes
#define CAN_MODE_NORMAL 0U
#define CAN_MODE_GMLAN_CAN2 1U
#define CAN_MODE_GMLAN_CAN3 2U
#define CAN_MODE_OBD_CAN2 3U
#define CAN_MODE_OBD_CAN2 1U
3 changes: 1 addition & 2 deletions board/boards/cuatro.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,11 @@ void cuatro_init(void) {
clock_source_init();
}

const board board_cuatro = {
board board_cuatro = {
.harness_config = &red_chiplet_harness_config,
.has_obd = true,
.has_spi = true,
.has_canfd = true,
.has_rtc_battery = true,
.fan_max_rpm = 6600U,
.avdd_mV = 1800U,
.fan_stall_recovery = false,
Expand Down
Loading

0 comments on commit 3613e78

Please sign in to comment.