fix legacy build issue, add build test, fix warnings

master
Firmware Batman 2017-08-01 03:00:53 +02:00
parent 50357ad03c
commit 798f942346
5 changed files with 28 additions and 8 deletions

View File

@ -67,4 +67,4 @@ obj/bootstub.$(PROJ_NAME).bin: obj/$(STARTUP_FILE).o obj/bootstub.$(PROJ_NAME).o
$(OBJCOPY) -v -O binary obj/bootstub.$(PROJ_NAME).elf $@
clean:
rm -f obj/*
@rm -f obj/*

View File

@ -258,7 +258,6 @@ char to_hex_char(int a) {
}
void usb_setup() {
int i;
int resp_len;
// setup packet is ready
switch (setup.b.bRequest) {
@ -332,7 +331,7 @@ void usb_setup() {
resp[1] = 0x03;
// 96 bits = 12 bytes
for (i = 0; i < 12; i++){
for (int i = 0; i < 12; i++){
uint8_t cc = ((uint8_t *)UID_BASE)[i];
resp[2 + i*4 + 0] = to_hex_char((cc>>4)&0xF);
resp[2 + i*4 + 1] = '\0';
@ -342,7 +341,7 @@ void usb_setup() {
USB_WritePacket(resp, min(resp[0], setup.b.wLength.w), 0);
#else
USB_WritePacket(string_3_desc, min(sizeof(string_3_desc), setup.b.wLength.w), 0);
USB_WritePacket((const uint8_t *)string_3_desc, min(sizeof(string_3_desc), setup.b.wLength.w), 0);
#endif
break;
default:

View File

@ -397,7 +397,7 @@ int spi_cb_rx(uint8_t *data, int len, uint8_t *data_out) {
#else
int spi_cb_rx(uint8_t *data, int len) { return 0; };
int spi_cb_rx(uint8_t *data, int len, uint8_t *data_out) { return 0; };
#endif

View File

@ -156,9 +156,10 @@ class Panda(object):
assert(self.bootstub)
if fn is None:
ret = os.system("cd %s && make clean && make -f %s bin" % (os.path.join(BASEDIR, "board"),
"Makefile.legacy" if self.legacy else "Makefile"))
fn = os.path.join(BASEDIR, "board", "obj", "code.bin" if self.legacy else "panda.bin")
ret = os.system("cd %s && make clean && make -f %s %s" % (os.path.join(BASEDIR, "board"),
"Makefile.legacy" if self.legacy else "Makefile",
"obj/comma.bin" if self.legacy else "obj/panda.bin"))
fn = os.path.join(BASEDIR, "board", "obj", "comma.bin" if self.legacy else "panda.bin")
with open(fn) as f:
dat = f.read()

View File

@ -0,0 +1,20 @@
import os
BASEDIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../")
os.chdir(os.path.join(BASEDIR, "../board"))
def build(target, mkfile="Makefile"):
assert(os.system('make -f %s clean && make -f %s %s >/dev/null' % (mkfile, mkfile, target)) == 0)
def test_build_legacy():
build("obj/comma.bin", "Makefile.legacy")
def test_build_bootstub_legacy():
build("obj/bootstub.comma.bin", "Makefile.legacy")
def test_build_panda():
build("obj/panda.bin")
def test_build_bootstub_panda():
build("obj/bootstub.panda.bin")