Skip to content

Commit

Permalink
Fix strict compiler on bootstub build
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini committed Jul 7, 2019
1 parent ba68569 commit 247e128
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
17 changes: 11 additions & 6 deletions board/bootstub.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
#endif

// default since there's no serial
void puts(const char *a) {}
void puth(unsigned int i) {}
void puts(const char *a) {
UNUSED(a);
}

void puth(unsigned int i) {
UNUSED(i);
}

#include "libc.h"
#include "provision.h"
Expand All @@ -34,11 +39,11 @@ void puth(unsigned int i) {}

#include "spi_flasher.h"

void __initialize_hardware_early() {
void __initialize_hardware_early(void) {
early();
}

void fail() {
void fail(void) {
soft_flasher_start();
}

Expand All @@ -48,7 +53,7 @@ extern void *_app_start[];
// FIXME: sometimes your panda will fail flashing and will quickly blink a single Green LED
// BOUNTY: $200 coupon on shop.comma.ai or $100 check.

int main() {
int main(void) {
__disable_irq();
clock_init();
detect();
Expand Down Expand Up @@ -88,7 +93,7 @@ int main() {
return 0;
good:
// jump to flash
((void(*)()) _app_start[1])();
((void(*)(void)) _app_start[1])();
return 0;
}

17 changes: 14 additions & 3 deletions board/spi_flasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,17 @@ int usb_cb_control_msg(USB_Setup_TypeDef *setup, uint8_t *resp, bool hardwired)
return resp_len;
}

int usb_cb_ep1_in(uint8_t *usbdata, int len, bool hardwired) { return 0; }
void usb_cb_ep3_out(uint8_t *usbdata, int len, bool hardwired) { }
int usb_cb_ep1_in(uint8_t *usbdata, int len, bool hardwired) {
UNUSED(usbdata);
UNUSED(len);
UNUSED(hardwired);
return 0;
}
void usb_cb_ep3_out(uint8_t *usbdata, int len, bool hardwired) {
UNUSED(usbdata);
UNUSED(len);
UNUSED(hardwired);
}

int is_enumerated = 0;
void usb_cb_enumeration_complete() {
Expand All @@ -102,6 +111,7 @@ void usb_cb_enumeration_complete() {
}

void usb_cb_ep2_out(uint8_t *usbdata, int len, bool hardwired) {
UNUSED(hardwired);
set_led(LED_RED, 0);
for (int i = 0; i < len/4; i++) {
// program byte 1
Expand All @@ -118,6 +128,7 @@ void usb_cb_ep2_out(uint8_t *usbdata, int len, bool hardwired) {


int spi_cb_rx(uint8_t *data, int len, uint8_t *data_out) {
UNUSED(len);
int resp_len = 0;
switch (data[0]) {
case 0:
Expand Down Expand Up @@ -247,7 +258,7 @@ void CAN1_SCE_IRQHandler() {

#endif

void soft_flasher_start() {
void soft_flasher_start(void) {
puts("\n\n\n************************ FLASHER START ************************\n");

enter_bootloader_mode = 0;
Expand Down

0 comments on commit 247e128

Please sign in to comment.