Skip to content

Commit

Permalink
Enable compiler optimizations, fix things it breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisinajar committed Apr 11, 2018
1 parent 2e6f774 commit 711fd11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion board/build.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CFLAGS += -I inc -I ../ -nostdlib -fno-builtin -std=gnu11 -O0
CFLAGS += -I inc -I ../ -nostdlib -fno-builtin -std=gnu11 -Os

CFLAGS += -Tstm32_flash.ld

CC = arm-none-eabi-gcc
Expand Down
4 changes: 3 additions & 1 deletion board/drivers/spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void spi_tx_dma(void *addr, int len) {

// channel3, increment memory, memory -> periph, enable
DMA2_Stream3->CR = DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_0 | DMA_SxCR_MINC | DMA_SxCR_DIR_0 | DMA_SxCR_EN;
delay(0);
DMA2_Stream3->CR |= DMA_SxCR_TCIE;

SPI1->CR2 |= SPI_CR2_TXDMAEN;
Expand All @@ -65,6 +66,7 @@ void spi_rx_dma(void *addr, int len) {

// channel3, increment memory, periph -> memory, enable
DMA2_Stream2->CR = DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_0 | DMA_SxCR_MINC | DMA_SxCR_EN;
delay(0);
DMA2_Stream2->CR |= DMA_SxCR_TCIE;

SPI1->CR2 |= SPI_CR2_RXDMAEN;
Expand Down Expand Up @@ -95,7 +97,7 @@ void DMA2_Stream2_IRQHandler(void) {
void DMA2_Stream3_IRQHandler(void) {
#ifdef DEBUG_SPI
puts("SPI handshake\n");
#endif
#endif

// reset handshake back to pull up
set_gpio_mode(GPIOB, 0, MODE_INPUT);
Expand Down
9 changes: 6 additions & 3 deletions boardesp/proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void ICACHE_FLASH_ATTR wifi_configure(int secure) {
void ICACHE_FLASH_ATTR wifi_init() {
// default ssid and password
memset(ssid, 0, 32);
os_sprintf(ssid, "panda-%08x-BROKEN", system_get_chip_id());
os_sprintf(ssid, "panda-%08x-BROKEN", system_get_chip_id());

// fetch secure ssid and password
// update, try 20 times, for 1 second
Expand All @@ -283,6 +283,9 @@ void ICACHE_FLASH_ATTR wifi_init() {
}
os_delay_us(50000);
}
os_printf("Finished getting SID\n");
os_printf(ssid);
os_printf("\n");

// set IP
wifi_softap_dhcps_stop(); //stop DHCP before setting static IP
Expand Down Expand Up @@ -311,7 +314,7 @@ void ICACHE_FLASH_ATTR user_init() {
gpio_init();

// configure UART TXD to be GPIO1, set as output
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_GPIO1);
gpio_output_set(0, 0, (1 << pin), 0);

// configure SPI
Expand All @@ -331,7 +334,7 @@ void ICACHE_FLASH_ATTR user_init() {
//SPICsPinSelect(SpiNum_HSPI, SpiPinCS_1);

// configure UART TXD to be GPIO1, set as output
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U, FUNC_GPIO5);
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO5_U, FUNC_GPIO5);
gpio_output_set(0, 0, (1 << 5), 0);
gpio_output_set((1 << 5), 0, 0, 0);

Expand Down

0 comments on commit 711fd11

Please sign in to comment.