Skip to content

Commit b574b60

Browse files
committed
Merge remote-tracking branch 'upstream/master' into HEAD
2 parents f7171ea + eb9b0df commit b574b60

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+450
-385
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
timeout-minutes: 1
121121
run: ${{ env.RUN }} "cd tests/misra && ./test_misra.sh"
122122
- name: MISRA mutation tests
123-
timeout-minutes: 2
123+
timeout-minutes: 3
124124
run: ${{ env.RUN }} "cd tests/misra && ./test_mutation.py"
125125

126126
python_linter:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ repos:
1515
additional_dependencies: ['git+https://github.com/numpy/numpy-stubs', 'types-requests', 'types-atomicwrites',
1616
'types-pycurl']
1717
- repo: https://github.com/astral-sh/ruff-pre-commit
18-
rev: v0.1.9
18+
rev: v0.1.14
1919
hooks:
2020
- id: ruff

SConscript

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def build_project(project_name, project, extra_flags):
101101
ASCOM="$AS $ASFLAGS -o $TARGET -c $SOURCES",
102102
BUILDERS={
103103
'Objcopy': Builder(generator=objcopy, suffix='.bin', src_suffix='.elf')
104-
}
104+
},
105+
tools=["default", "compilation_db"],
105106
)
106107

107108
startup = env.Object(f"obj/startup_{project_name}", project["STARTUP_FILE"])

SConstruct

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,17 @@ AddOption('--coverage',
1212
action='store_true',
1313
help='build with test coverage options')
1414

15+
AddOption('--compile_db',
16+
action='store_true',
17+
help='build clang compilation database')
18+
19+
env = Environment(
20+
COMPILATIONDB_USE_ABSPATH=True,
21+
tools=["default", "compilation_db"],
22+
)
23+
24+
if GetOption('compile_db'):
25+
env.CompilationDatabase("compile_commands.json")
26+
1527
# panda fw & test files
1628
SConscript('SConscript')

board/SConscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,7 @@ for project_name, project in build_projects.items():
1515
if ("ENABLE_SPI" in os.environ or "h7" in project_name) and not project_name.startswith('pedal'):
1616
flags.append('-DENABLE_SPI')
1717

18+
if "H723" in os.environ:
19+
flags.append('-DSTM32H723')
20+
1821
build_project(project_name, project, flags)

board/boards/black.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ const harness_configuration black_harness_config = {
163163
};
164164

165165
const board board_black = {
166-
.board_type = "Black",
167166
.set_bootkick = unused_set_bootkick,
168167
.harness_config = &black_harness_config,
169168
.has_hw_gmlan = false,

board/boards/board_declarations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ typedef void (*board_set_bootkick)(BootState state);
2020
typedef bool (*board_read_som_gpio)(void);
2121

2222
struct board {
23-
const char *board_type;
2423
const harness_configuration *harness_config;
2524
const bool has_hw_gmlan;
2625
const bool has_obd;
@@ -58,6 +57,7 @@ struct board {
5857
#define HW_TYPE_RED_PANDA 7U
5958
#define HW_TYPE_RED_PANDA_V2 8U
6059
#define HW_TYPE_TRES 9U
60+
#define HW_TYPE_CUATRO 10U
6161

6262
// LED colors
6363
#define LED_RED 0U

board/boards/cuatro.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
void cuatro_set_led(uint8_t color, bool enabled) {
2+
switch (color) {
3+
case LED_RED:
4+
set_gpio_output(GPIOD, 15, !enabled);
5+
break;
6+
case LED_GREEN:
7+
set_gpio_output(GPIOD, 14, !enabled);
8+
break;
9+
case LED_BLUE:
10+
set_gpio_output(GPIOE, 2, !enabled);
11+
break;
12+
default:
13+
break;
14+
}
15+
}
16+
17+
void cuatro_init(void) {
18+
red_chiplet_init();
19+
20+
// C2: SOM GPIO used as input (fan control at boot)
21+
set_gpio_mode(GPIOC, 2, MODE_INPUT);
22+
set_gpio_pullup(GPIOC, 2, PULL_DOWN);
23+
24+
// SOM bootkick + reset lines
25+
set_gpio_mode(GPIOC, 12, MODE_OUTPUT);
26+
tres_set_bootkick(BOOT_BOOTKICK);
27+
28+
// SOM debugging UART
29+
gpio_uart7_init();
30+
uart_init(&uart_ring_som_debug, 115200);
31+
32+
// SPI init
33+
gpio_spi_init();
34+
35+
// fan setup
36+
set_gpio_alternate(GPIOC, 8, GPIO_AF2_TIM3);
37+
38+
// Initialize IR PWM and set to 0%
39+
set_gpio_alternate(GPIOC, 9, GPIO_AF2_TIM3);
40+
pwm_init(TIM3, 4);
41+
tres_set_ir_power(0U);
42+
43+
// Clock source
44+
clock_source_init();
45+
}
46+
47+
const board board_cuatro = {
48+
.harness_config = &red_chiplet_harness_config,
49+
.has_hw_gmlan = false,
50+
.has_obd = true,
51+
.has_spi = true,
52+
.has_canfd = true,
53+
.has_rtc_battery = true,
54+
.fan_max_rpm = 6600U,
55+
.avdd_mV = 1800U,
56+
.fan_stall_recovery = false,
57+
.fan_enable_cooldown_time = 3U,
58+
.init = cuatro_init,
59+
.init_bootloader = unused_init_bootloader,
60+
.enable_can_transceiver = red_chiplet_enable_can_transceiver,
61+
.enable_can_transceivers = red_chiplet_enable_can_transceivers,
62+
.set_led = cuatro_set_led,
63+
.set_can_mode = red_chiplet_set_can_mode,
64+
.check_ignition = red_check_ignition,
65+
.read_current = unused_read_current,
66+
.set_fan_enabled = tres_set_fan_enabled,
67+
.set_ir_power = tres_set_ir_power,
68+
.set_siren = unused_set_siren,
69+
.set_bootkick = tres_set_bootkick,
70+
.read_som_gpio = tres_read_som_gpio
71+
};

board/boards/dos.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ const harness_configuration dos_harness_config = {
192192
};
193193

194194
const board board_dos = {
195-
.board_type = "Dos",
196195
.harness_config = &dos_harness_config,
197196
.has_hw_gmlan = false,
198197
.has_obd = true,

board/boards/grey.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// Most hardware functionality is similar to white panda
66

77
const board board_grey = {
8-
.board_type = "Grey",
98
.set_bootkick = unused_set_bootkick,
109
.harness_config = &white_harness_config,
1110
.has_hw_gmlan = true,

0 commit comments

Comments
 (0)