Skip to content

Commit

Permalink
Squashed 'panda/' changes from 1282e8f..3e199cb
Browse files Browse the repository at this point in the history
3e199cb Subaru safety: ES_LKAS message should not be forwarded
252dec2 Change docker tags in jenkins to use git commit instead of build_id
4a3b587 generate dependencies and clean (#184)
005e131 Toyota Safety: cleaned up logic for TSSP2.0 cars
b53fb27 add ACCEL_CMD to filtering for TSSP2.0 cars (#185)
18c2e69 Fix query_vin_and_status.py require python 3.7
3b351b7 Minor fix to current type

git-subtree-dir: panda
git-subtree-split: 3e199cb
  • Loading branch information
Vehicle Researcher committed May 16, 2019
1 parent 3c25760 commit 530b637
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pipeline {
script: "git --no-pager show -s --format='%an' ${GIT_COMMIT}"
).trim()}"""

DOCKER_IMAGE_TAG = "panda:build-${env.BUILD_ID}"
DOCKER_NAME = "panda-test-${env.BUILD_ID}"
DOCKER_IMAGE_TAG = "panda:build-${env.GIT_COMMIT}"
DOCKER_NAME = "panda-test-${env.GIT_COMMIT}"
}
stages {
stage('Build Docker Image') {
Expand Down
22 changes: 17 additions & 5 deletions board/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ endif

DFU_UTIL = "dfu-util"

DEPDIR = generated_dependencies
$(shell mkdir -p -m 777 $(DEPDIR) >/dev/null)
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
POSTCOMPILE = @mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@

# this no longer pushes the bootstub
flash: obj/$(PROJ_NAME).bin
PYTHONPATH=../ python -c "from python import Panda; Panda().flash('obj/$(PROJ_NAME).bin')"
Expand All @@ -45,8 +50,9 @@ include ../common/version.mk
obj/cert.h: ../crypto/getcertheader.py
../crypto/getcertheader.py ../certs/debug.pub ../certs/release.pub > $@

obj/%.$(PROJ_NAME).o: %.c obj/cert.h obj/gitversion.h config.h drivers/*.h gpio.h libc.h provision.h safety.h safety/*.h spi_flasher.h
$(CC) $(CFLAGS) -o $@ -c $<
obj/%.$(PROJ_NAME).o: %.c obj/gitversion.h obj/cert.h $(DEPDIR)/%.d
$(CC) $(DEPFLAGS) $(CFLAGS) -o $@ -c $<
$(POSTCOMPILE)

obj/%.$(PROJ_NAME).o: ../crypto/%.c
$(CC) $(CFLAGS) -o $@ -c $<
Expand All @@ -59,12 +65,18 @@ obj/$(PROJ_NAME).bin: obj/$(STARTUP_FILE).o obj/main.$(PROJ_NAME).o
$(CC) -Wl,--section-start,.isr_vector=0x8004000 $(CFLAGS) -o obj/$(PROJ_NAME).elf $^
$(OBJCOPY) -v -O binary obj/$(PROJ_NAME).elf obj/code.bin
SETLEN=1 ../crypto/sign.py obj/code.bin $@ $(CERT)
@BINSIZE=$$(du -b "obj/$(PROJ_NAME).bin" | cut -f 1) ; if [ $$BINSIZE -ge 32768 ]; then echo "ERROR obj/$(PROJ_NAME).bin is too big!"; exit 1; fi;

@BINSIZE=$$(du -b "obj/$(PROJ_NAME).bin" | cut -f 1) ; \
if [ $$BINSIZE -ge 32768 ]; then echo "ERROR obj/$(PROJ_NAME).bin is too big!"; exit 1; fi;

obj/bootstub.$(PROJ_NAME).bin: obj/$(STARTUP_FILE).o obj/bootstub.$(PROJ_NAME).o obj/sha.$(PROJ_NAME).o obj/rsa.$(PROJ_NAME).o
$(CC) $(CFLAGS) -o obj/bootstub.$(PROJ_NAME).elf $^
$(OBJCOPY) -v -O binary obj/bootstub.$(PROJ_NAME).elf $@

$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d

include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(wildcard *.c))))

clean:
@rm -f obj/*
@$(RM) obj/*
@rm -rf $(DEPDIR)
2 changes: 1 addition & 1 deletion board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ int main() {
//puth(usart1_dma); puts(" "); puth(DMA2_Stream5->M0AR); puts(" "); puth(DMA2_Stream5->NDTR); puts("\n");

#ifdef PANDA
int current = adc_get(ADCCHAN_CURRENT);
uint32_t current = adc_get(ADCCHAN_CURRENT);

switch (usb_power_mode) {
case USB_POWER_CLIENT:
Expand Down
4 changes: 4 additions & 0 deletions board/safety/safety_subaru.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ static int subaru_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
if (addr == 545) {
return -1;
}
// ES LKAS
if (addr == 802) {
return -1;
}

return 0; // Main CAN
}
Expand Down
4 changes: 3 additions & 1 deletion board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ static int toyota_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
if ((bus_num == 0 || bus_num == 2) && toyota_camera_forwarded && !toyota_giraffe_switch_1) {
int addr = to_fwd->RIR>>21;
bool is_lkas_msg = (addr == 0x2E4 || addr == 0x412) && bus_num == 2;
return is_lkas_msg? -1 : (uint8_t)(~bus_num & 0x2);
// in TSSP 2.0 the camera does ACC as well, so filter 0x343
bool is_acc_msg = (addr == 0x343 && bus_num == 2);
return (is_lkas_msg || is_acc_msg)? -1 : (uint8_t)(~bus_num & 0x2);
}
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/query_vin_and_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import struct
from panda import Panda
from hexdump import hexdump
from isotp import isotp_send, isotp_recv
from panda.isotp import isotp_send, isotp_recv

# 0x7e0 = Toyota
# 0x18DB33F1 for Honda?
Expand Down

0 comments on commit 530b637

Please sign in to comment.