Skip to content

Commit 1e1778a

Browse files
author
Jim Lindblom
committed
Initial commit of firmware.
1 parent 1d0a130 commit 1e1778a

File tree

24 files changed

+3022
-0
lines changed

24 files changed

+3022
-0
lines changed

Firmware/!!!readme!!!.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Notice: AT added some functions so it's larger than before, if you want to compile it, please compile it as 1024KB or larger flash in compilation STEP 5.
2+
3+
1��compile options
4+
5+
(1) COMPILE
6+
Possible value: gcc
7+
Default value:
8+
If not set, use xt-xcc by default.
9+
10+
(2) BOOT
11+
Possible value: none/old/new
12+
none: no need boot
13+
old: use boot_v1.1
14+
new: use boot_v1.2
15+
Default value: none
16+
17+
(3) APP
18+
Possible value: 0/1/2
19+
0: original mode, generate eagle.app.v6.flash.bin and eagle.app.v6.irom0text.bin
20+
1: generate user1
21+
2: generate user2
22+
Default value: 0
23+
24+
(3) SPI_SPEED
25+
Possible value: 20/26.7/40/80
26+
Default value: 40
27+
28+
(4) SPI_MODE
29+
Possible value: QIO/QOUT/DIO/DOUT
30+
Default value: QIO
31+
32+
(4) SPI_SIZE
33+
Possible value: 256/512/1024/2048/4096
34+
Default value: 512
35+
36+
For example:
37+
make COMPILE=gcc BOOT=new APP=1 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE=512
38+
39+
2��You can also use gen_misc to make and generate specific bin you needed.
40+
Linux: ./gen_misc.sh
41+
Windows: gen_misc.bat
42+
Follow the tips and steps.

Firmware/Makefile

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#############################################################
2+
# Required variables for each makefile
3+
# Discard this section from all parent makefiles
4+
# Expected variables (with automatic defaults):
5+
# CSRCS (all "C" files in the dir)
6+
# SUBDIRS (all subdirs with a Makefile)
7+
# GEN_LIBS - list of libs to be generated ()
8+
# GEN_IMAGES - list of object file images to be generated ()
9+
# GEN_BINS - list of binaries to be generated ()
10+
# COMPONENTS_xxx - a list of libs/objs in the form
11+
# subdir/lib to be extracted and rolled up into
12+
# a generated lib/image xxx.a ()
13+
#
14+
TARGET = eagle
15+
#FLAVOR = release
16+
FLAVOR = debug
17+
18+
#EXTRA_CCFLAGS += -u
19+
20+
ifndef PDIR # {
21+
GEN_IMAGES= eagle.app.v6.out
22+
GEN_BINS= eagle.app.v6.bin
23+
SPECIAL_MKTARGETS=$(APP_MKTARGETS)
24+
SUBDIRS= \
25+
user
26+
ifdef AT_OPEN_SRC
27+
SUBDIRS += \
28+
at
29+
endif
30+
endif # } PDIR
31+
32+
APPDIR = .
33+
LDDIR = ../ld
34+
35+
CCFLAGS += -Os
36+
37+
TARGET_LDFLAGS = \
38+
-nostdlib \
39+
-Wl,-EL \
40+
--longcalls \
41+
--text-section-literals
42+
43+
ifeq ($(FLAVOR),debug)
44+
TARGET_LDFLAGS += -g -O2
45+
endif
46+
47+
ifeq ($(FLAVOR),release)
48+
TARGET_LDFLAGS += -g -O0
49+
endif
50+
51+
COMPONENTS_eagle.app.v6 = \
52+
user/libuser.a
53+
54+
ifdef AT_OPEN_SRC
55+
COMPONENTS_eagle.app.v6 += \
56+
at/libat.a
57+
endif
58+
59+
LINKFLAGS_eagle.app.v6 = \
60+
-L../lib \
61+
-nostdlib \
62+
-T$(LD_FILE) \
63+
-Wl,--no-check-sections \
64+
-u call_user_start \
65+
-Wl,-static \
66+
-Wl,--start-group \
67+
-lc \
68+
-lgcc \
69+
-lhal \
70+
-lphy \
71+
-lpp \
72+
-lnet80211 \
73+
-llwip \
74+
-lwpa \
75+
-lmain \
76+
-ljson \
77+
-lupgrade \
78+
-lsmartconfig \
79+
$(DEP_LIBS_eagle.app.v6)
80+
81+
ifndef AT_OPEN_SRC
82+
LINKFLAGS_eagle.app.v6 += \
83+
-lat
84+
endif
85+
86+
LINKFLAGS_eagle.app.v6 += \
87+
-Wl,--end-group
88+
DEPENDS_eagle.app.v6 = \
89+
$(LD_FILE) \
90+
$(LDDIR)/eagle.rom.addr.v6.ld
91+
92+
#############################################################
93+
# Configuration i.e. compile options etc.
94+
# Target specific stuff (defines etc.) goes in here!
95+
# Generally values applying to a tree are captured in the
96+
# makefile at its root level - these are then overridden
97+
# for a subtree within the makefile rooted therein
98+
#
99+
100+
#UNIVERSAL_TARGET_DEFINES = \
101+
102+
# Other potential configuration flags include:
103+
# -DTXRX_TXBUF_DEBUG
104+
# -DTXRX_RXBUF_DEBUG
105+
# -DWLAN_CONFIG_CCX
106+
CONFIGURATION_DEFINES = -DICACHE_FLASH
107+
ifdef AT_OPEN_SRC
108+
CONFIGURATION_DEFINES += \
109+
-DAT_OPEN_SRC
110+
endif
111+
DEFINES += \
112+
$(UNIVERSAL_TARGET_DEFINES) \
113+
$(CONFIGURATION_DEFINES)
114+
115+
DDEFINES += \
116+
$(UNIVERSAL_TARGET_DEFINES) \
117+
$(CONFIGURATION_DEFINES)
118+
119+
120+
#############################################################
121+
# Recursion Magic - Don't touch this!!
122+
#
123+
# Each subtree potentially has an include directory
124+
# corresponding to the common APIs applicable to modules
125+
# rooted at that subtree. Accordingly, the INCLUDE PATH
126+
# of a module can only contain the include directories up
127+
# its parent path, and not its siblings
128+
#
129+
# Required for each makefile to inherit from the parent
130+
#
131+
132+
INCLUDES := $(INCLUDES) -I $(PDIR)include
133+
PDIR := ../$(PDIR)
134+
sinclude $(PDIR)Makefile
135+
136+
.PHONY: FORCE
137+
FORCE:
138+

Firmware/driver/Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
#############################################################
3+
# Required variables for each makefile
4+
# Discard this section from all parent makefiles
5+
# Expected variables (with automatic defaults):
6+
# CSRCS (all "C" files in the dir)
7+
# SUBDIRS (all subdirs with a Makefile)
8+
# GEN_LIBS - list of libs to be generated ()
9+
# GEN_IMAGES - list of images to be generated ()
10+
# COMPONENTS_xxx - a list of libs/objs in the form
11+
# subdir/lib to be extracted and rolled up into
12+
# a generated lib/image xxx.a ()
13+
#
14+
ifndef PDIR
15+
GEN_LIBS = libdriver.a
16+
endif
17+
18+
19+
#############################################################
20+
# Configuration i.e. compile options etc.
21+
# Target specific stuff (defines etc.) goes in here!
22+
# Generally values applying to a tree are captured in the
23+
# makefile at its root level - these are then overridden
24+
# for a subtree within the makefile rooted therein
25+
#
26+
#DEFINES +=
27+
28+
#############################################################
29+
# Recursion Magic - Don't touch this!!
30+
#
31+
# Each subtree potentially has an include directory
32+
# corresponding to the common APIs applicable to modules
33+
# rooted at that subtree. Accordingly, the INCLUDE PATH
34+
# of a module can only contain the include directories up
35+
# its parent path, and not its siblings
36+
#
37+
# Required for each makefile to inherit from the parent
38+
#
39+
40+
INCLUDES := $(INCLUDES) -I $(PDIR)include
41+
INCLUDES += -I ./
42+
PDIR := ../$(PDIR)
43+
sinclude $(PDIR)Makefile
44+

Firmware/driver/gpio16.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include "ets_sys.h"
2+
#include "osapi.h"
3+
#include "driver/gpio16.h"
4+
5+
void ICACHE_FLASH_ATTR
6+
gpio16_output_conf(void)
7+
{
8+
WRITE_PERI_REG(PAD_XPD_DCDC_CONF,
9+
(READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32)0x1); // mux configuration for XPD_DCDC to output rtc_gpio0
10+
11+
WRITE_PERI_REG(RTC_GPIO_CONF,
12+
(READ_PERI_REG(RTC_GPIO_CONF) & (uint32)0xfffffffe) | (uint32)0x0); //mux configuration for out enable
13+
14+
WRITE_PERI_REG(RTC_GPIO_ENABLE,
15+
(READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32)0xfffffffe) | (uint32)0x1); //out enable
16+
}
17+
18+
void ICACHE_FLASH_ATTR
19+
gpio16_output_set(uint8 value)
20+
{
21+
WRITE_PERI_REG(RTC_GPIO_OUT,
22+
(READ_PERI_REG(RTC_GPIO_OUT) & (uint32)0xfffffffe) | (uint32)(value & 1));
23+
}
24+
25+
void ICACHE_FLASH_ATTR
26+
gpio16_input_conf(void)
27+
{
28+
WRITE_PERI_REG(PAD_XPD_DCDC_CONF,
29+
(READ_PERI_REG(PAD_XPD_DCDC_CONF) & 0xffffffbc) | (uint32)0x1); // mux configuration for XPD_DCDC and rtc_gpio0 connection
30+
31+
WRITE_PERI_REG(RTC_GPIO_CONF,
32+
(READ_PERI_REG(RTC_GPIO_CONF) & (uint32)0xfffffffe) | (uint32)0x0); //mux configuration for out enable
33+
34+
WRITE_PERI_REG(RTC_GPIO_ENABLE,
35+
READ_PERI_REG(RTC_GPIO_ENABLE) & (uint32)0xfffffffe); //out disable
36+
}
37+
38+
uint8 ICACHE_FLASH_ATTR
39+
gpio16_input_get(void)
40+
{
41+
return (uint8)(READ_PERI_REG(RTC_GPIO_IN_DATA) & 1);
42+
}

0 commit comments

Comments
 (0)