Skip to content

Commit

Permalink
openpilot v0.3.0-dirty release
Browse files Browse the repository at this point in the history
  • Loading branch information
Vehicle Researcher committed Mar 16, 2017
1 parent 0a747f9 commit 347b38a
Show file tree
Hide file tree
Showing 76 changed files with 56,388 additions and 14,039 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
.tags
.ipynb_checkpoints
model2.png

*.pyc
.*.swp
Expand All @@ -11,12 +12,13 @@
*.so
*.a
*.clb
*.class
config.json
clcache

board/obj/
selfdrive/boardd/boardd
selfdrive/logcatd/logcatd
selfdrive/sensord/sensord
selfdrive/ui/ui
/src/

1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ script:
- docker run --rm
-v "$(pwd)"/selfdrive/test/plant/out:/tmp/openpilot/selfdrive/test/plant/out
tmppilot /bin/sh -c 'cd /tmp/openpilot/selfdrive/test/plant && ./runtest.sh'

6 changes: 6 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 0.3.0 (2017-03-xx)
===========================
* Add CarParams struct to improve the abstraction layer
* Refactor visiond IPC to support multiple clients
* Add raw GPS and beginning support for navigation

Version 0.2.9 (2017-03-01)
===========================
* Retain compatibility with NEOS v1
Expand Down
40 changes: 3 additions & 37 deletions board/Makefile
Original file line number Diff line number Diff line change
@@ -1,43 +1,9 @@
# :set noet
PROJ_NAME = comma

CFLAGS = -g -O0 -Wall

CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m3
CFLAGS += -msoft-float -DSTM32F2 -DSTM32F205xx
CFLAGS += -I inc -nostdlib
CFLAGS += -Tstm32_flash.ld

CC = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
OBJDUMP = arm-none-eabi-objdump

MACHINE = $(shell uname -m)

all: obj/$(PROJ_NAME).bin
#$(OBJDUMP) -d obj/$(PROJ_NAME).elf
./tools/enter_download_mode.py
./tools/dfu-util-$(MACHINE) -a 0 -s 0x08000000 -D $<
./tools/dfu-util-$(MACHINE) --reset-stm32 -a 0 -s 0x08000000

ifneq ($(wildcard ../.git/HEAD),)
obj/gitversion.h: ../.git/HEAD ../.git/index
echo "const uint8_t gitversion[] = \"$(shell git rev-parse HEAD)\";" > $@
else
obj/gitversion.h:
echo "const uint8_t gitversion[] = \"RELEASE\";" > $@
endif

obj/main.o: main.c *.h obj/gitversion.h
$(CC) $(CFLAGS) -o $@ -c $<

obj/startup_stm32f205xx.o: startup_stm32f205xx.s
mkdir -p obj
$(CC) $(CFLAGS) -o $@ -c $<

obj/$(PROJ_NAME).bin: obj/startup_stm32f205xx.o obj/main.o
$(CC) $(CFLAGS) -o obj/$(PROJ_NAME).elf $^
$(OBJCOPY) -v -O binary obj/$(PROJ_NAME).elf $@

clean:
rm -f obj/*
STARTUP_FILE = startup_stm32f205xx

include build.mk
3 changes: 2 additions & 1 deletion board/adc.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ void adc_init() {
ADC1->CR2 = ADC_CR2_ADON;

// long
ADC1->SMPR1 = ADC_SMPR1_SMP10 | ADC_SMPR1_SMP11 | ADC_SMPR1_SMP12 | ADC_SMPR1_SMP13;
//ADC1->SMPR1 = ADC_SMPR1_SMP10 | ADC_SMPR1_SMP11 | ADC_SMPR1_SMP12 | ADC_SMPR1_SMP13;
ADC1->SMPR1 = ADC_SMPR1_SMP12 | ADC_SMPR1_SMP13;
}

uint32_t adc_get(int channel) {
Expand Down
37 changes: 37 additions & 0 deletions board/build.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
CFLAGS += -I inc -nostdlib
CFLAGS += -Tstm32_flash.ld

CC = arm-none-eabi-gcc
OBJCOPY = arm-none-eabi-objcopy
OBJDUMP = arm-none-eabi-objdump

MACHINE = $(shell uname -m)

all: obj/$(PROJ_NAME).bin
#$(OBJDUMP) -d obj/$(PROJ_NAME).elf
./tools/enter_download_mode.py
./tools/dfu-util-$(MACHINE) -a 0 -s 0x08000000 -D $<
./tools/dfu-util-$(MACHINE) --reset-stm32 -a 0 -s 0x08000000

ifneq ($(wildcard ../.git/HEAD),)
obj/gitversion.h: ../.git/HEAD ../.git/index
echo "const uint8_t gitversion[] = \"$(shell git rev-parse HEAD)\";" > $@
else
obj/gitversion.h:
echo "const uint8_t gitversion[] = \"RELEASE\";" > $@
endif

obj/main.$(PROJ_NAME).o: main.c *.h obj/gitversion.h
$(CC) $(CFLAGS) -o $@ -c $<

obj/$(STARTUP_FILE).o: $(STARTUP_FILE).s
mkdir -p obj
$(CC) $(CFLAGS) -o $@ -c $<

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

clean:
rm -f obj/*

39 changes: 32 additions & 7 deletions board/can.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
void can_init(CAN_TypeDef *CAN) {
// enable CAN busses
if (CAN == CAN1) {
// CAN1_EN
GPIOB->ODR |= (1 << 3);
#ifdef PANDA
// CAN1_EN
GPIOC->ODR &= ~(1 << 1);
#else
// CAN1_EN
GPIOB->ODR |= (1 << 3);
#endif
} else if (CAN == CAN2) {
// CAN2_EN
GPIOB->ODR |= (1 << 4);
#ifdef PANDA
// CAN2_EN
GPIOC->ODR &= ~(1 << 13);
#else
// CAN2_EN
GPIOB->ODR |= (1 << 4);
#endif
#ifdef CAN3
} else if (CAN == CAN3) {
// CAN3_EN
GPIOA->ODR &= ~(1 << 0);
#endif
}

CAN->MCR = CAN_MCR_TTCM | CAN_MCR_INRQ;
while((CAN->MSR & CAN_MSR_INAK) != CAN_MSR_INAK);
puts("CAN initting\n");

// PCLK = 24000000, 500000 is 48 clocks
// from http://www.bittiming.can-wiki.ino/
Expand All @@ -23,8 +37,17 @@ void can_init(CAN_TypeDef *CAN) {

// reset
CAN->MCR = CAN_MCR_TTCM;
while((CAN->MSR & CAN_MSR_INAK) == CAN_MSR_INAK);
puts("CAN init done\n");

#define CAN_TIMEOUT 1000000
int tmp = 0;
while((CAN->MSR & CAN_MSR_INAK) == CAN_MSR_INAK && tmp < CAN_TIMEOUT) tmp++;

if (tmp == CAN_TIMEOUT) {
set_led(LED_BLUE, 1);
puts("CAN init FAILED!!!!!\n");
} else {
puts("CAN init done\n");
}

// accept all filter
CAN->FMR |= CAN_FMR_FINIT;
Expand All @@ -46,6 +69,8 @@ void can_init(CAN_TypeDef *CAN) {
// CAN error
void can_sce(CAN_TypeDef *CAN) {
#ifdef DEBUG
if (CAN==CAN1) puts("CAN1: ");
if (CAN==CAN2) puts("CAN2: ");
puts("MSR:");
puth(CAN->MSR);
puts(" TSR:");
Expand Down
Loading

0 comments on commit 347b38a

Please sign in to comment.