我能够让 pwm 使用以下代码:
#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
void show_mac (void) {
unsigned char mac[6];
// wifi_get_macaddr ( STA
tiON_IF, mac );
// os_printf ( "MAC: %02x:%02x:%02x:%02x:%02x:%02xn",
// mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );
}
无效 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 ();
}
但是,如果我取消评论,只需第 7 行,如下所示:
#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:%02xn",
// mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );
}
无效 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 ();
}
它崩溃:
ets 2013 年 1 月 8 日,第一个原因:4,启动模式:(1,0)
WDT 复位
这特别奇怪,因为我甚至还没有调用 show_mac() 函数!
我正在使用 pfalcon/open-sdk 和工具链,它使用 v1.4.0 sdk。这是我正在使用的 makefile:
# 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
闪光灯:malarm-0x00000.bin
esptool.py write_flash 0 malarm-0x00000.bin 0x40000 malarm-0x40000.bin
连接:
picocom -b 115200 --omap crcrlf /dev/ttyUSB0
有什么想法或想法吗?谢谢。