Code: Select all
#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
void show_mac (void) {
unsigned char mac[6];
// wifi_get_macaddr ( STATION_IF, mac );
// os_printf ( "MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
// mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );
}
void user_init() {
uart_div_modify(0, UART_CLK_FREQ / 115200);
gpio_init();
uint32_t io_info[1][3] = {
{PERIPHS_IO_MUX_MTCK_U,FUNC_GPIO13,13},
};
uint32_t duty[1] = {500};
pwm_init(1000, duty,1,io_info);
pwm_start();
// show_mac ();
}
However, if I un-comment just line 7 so it's like so:
Code: Select all
#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
void show_mac (void) {
unsigned char mac[6];
wifi_get_macaddr ( STATION_IF, mac );
// os_printf ( "MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
// mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );
}
void user_init() {
uart_div_modify(0, UART_CLK_FREQ / 115200);
gpio_init();
uint32_t io_info[1][3] = {
{PERIPHS_IO_MUX_MTCK_U,FUNC_GPIO13,13},
};
uint32_t duty[1] = {500};
pwm_init(1000, duty,1,io_info);
pwm_start();
// show_mac ();
}
It crashes:
ets Jan 8 2013,rst cause:4, boot mode:(1,0)
wdt reset
Which is especially strange since I'm still not even calling the show_mac() function!
I'm using the pfalcon/open-sdk and toolchain, which uses the v1.4.0 sdk. Here's the makefile I'm using:
Code: Select all
# Makefile for older versions (<1.0) of Espressif "AT" firmware
CC = xtensa-lx106-elf-gcc
CFLAGS = -I. -mlongcalls
LDLIBS = -nostdlib -Wl,--start-group -lmain -lupgrade -lnet80211 -lwpa -llwip -lpp -lphy -Wl,--end-group -lcirom -lgcc -lpwm
LDFLAGS = -Teagle.app.v6.ld
malarm-0x00000.bin: malarm
esptool.py elf2image $^
malarm: malarm.o
$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)
malarm.o: malarm.c
flash: malarm-0x00000.bin
esptool.py write_flash 0 malarm-0x00000.bin 0x40000 malarm-0x40000.bin
connect:
picocom -b 115200 --omap crcrlf /dev/ttyUSB0
Any thoughts or ideas? Thanks.