Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into master3
Browse files Browse the repository at this point in the history
  • Loading branch information
eFiniLan committed Jul 25, 2024
2 parents 173bc27 + f637584 commit 3561d96
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions board/gdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

gdb-multiarch --eval-command="target extended-remote localhost:3333"
10 changes: 10 additions & 0 deletions board/stm32h7/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ PCLK1: 60MHz (for USART2,3,4,5,7,8)
*/

void clock_init(void) {
/*
WARNING: PWR->CR3's lower byte can only be written once
* subsequent writes will silently fail
* only cleared with a full power-on-reset, not soft reset or reset pin
* some H7 have a bootrom with a DFU routine that writes (and locks) CR3
* if the CR3 config doesn't match the HW, the core will deadlock and require immediately going into DFU from a cold boot
In a normal bootup, the bootstub will be the first to write this. The app section calls clock_init again, but the CR3 write will silently fail. This is fine for most cases, but caution should be taken that the bootstub and app always write the same config.
*/

// Set power mode to direct SMPS power supply(depends on the board layout)
#ifndef STM32H723
register_set(&(PWR->CR3), PWR_CR3_SMPSEN, 0xFU); // powered only by SMPS
Expand Down
4 changes: 4 additions & 0 deletions tests/libpanda/safety_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ bool get_gas_pressed_prev(void){
return gas_pressed_prev;
}

void set_gas_pressed_prev(bool c){
gas_pressed_prev = c;
}

bool get_brake_pressed_prev(void){
return brake_pressed_prev;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/libpanda/safety_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def setup_safety_helpers(ffi):
void set_relay_malfunction(bool c);
bool get_relay_malfunction(void);
bool get_gas_pressed_prev(void);
void set_gas_pressed_prev(bool);
bool get_brake_pressed_prev(void);
bool get_regen_braking_prev(void);
bool get_acc_main_on(void);
Expand Down Expand Up @@ -61,6 +62,7 @@ def get_alternative_experience(self) -> int: ...
def set_relay_malfunction(self, c: bool) -> None: ...
def get_relay_malfunction(self) -> bool: ...
def get_gas_pressed_prev(self) -> bool: ...
def set_gas_pressed_prev(self, c: bool) -> None: ...
def get_brake_pressed_prev(self) -> bool: ...
def get_regen_braking_prev(self) -> bool: ...
def get_acc_main_on(self) -> bool: ...
Expand Down

0 comments on commit 3561d96

Please sign in to comment.