Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit b51216e

Browse files
author
Espressif Systems
committed
Version 1.0.0(0394de4c)
Initial Version of ESP32 RTOS SDK. Signed-off-by: Espressif Systems <wujg@espressif.com>
0 parents  commit b51216e

File tree

268 files changed

+63200
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+63200
-0
lines changed

LICENSE

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
ESPRSSIF MIT License
2+
3+
Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
4+
5+
Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP32 only, in which case,
6+
it is free of charge, to any person obtaining a copy of this software and associated
7+
documentation files (the ��Software��), to deal in the Software without restriction,
8+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
9+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
10+
is furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all copies or
13+
substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED ��AS IS��, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
16+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
18+
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20+
DEALINGS IN THE SOFTWARE.
21+
22+
23+
���� MIT ����֤
24+
25+
��Ȩ (c) 2015 <������Ϣ�Ƽ����Ϻ������޹�˾>
26+
27+
������֤��Ȩ������������Ϣ�Ƽ� ESP32 ��Ʒ��Ӧ�ÿ������ڴ�����£�������֤�����Ȩ�κλ�ø�
28+
������������ĵ���ͳ��Ϊ�������������������Ƶؾ�Ӫ�����������������Ƶ�ʹ�á����ơ��޸ġ��ϲ���
29+
���淢�С�ɢ��������Ȩ������������������������Ȩ��������Ȩ����������ЩȨ����ͬʱ�����������
30+
��������
31+
32+
�����������������и����ж�����������ϵİ�Ȩ��������Ȩ������
33+
34+
�������������������ṩ��û���κ���ȷ�򰵺��ĵ������������������ڹ��������ԡ��ʺ�ijһ�ض���;
35+
�ͷ���Ȩ�ı�֤�����ߺͰ�Ȩ���������κ�����¾�����������������ʹ��������Ժ�ͬ��ʽ��������Ȩ
36+
��������ʽ������κ����⡢�𺦻��������θ���
37+
38+
39+
40+

Makefile

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
# copyright (c) 2015 Espressif System
2+
#
3+
ifndef PDIR
4+
5+
endif
6+
7+
ifeq ($(COMPILE), xcc)
8+
AR = xt-ar
9+
CC = xt-xcc
10+
NM = xt-nm
11+
CPP = xt-xt++
12+
OBJCOPY = xt-objcopy
13+
OBJDUMP = xt-objdump
14+
else
15+
AR = xtensa-esp108-elf-ar
16+
CC = xtensa-esp108-elf-gcc
17+
NM = xtensa-esp108-elf-nm
18+
CPP = xtensa-esp108-elf-g++
19+
OBJCOPY = xtensa-esp108-elf-objcopy
20+
OBJDUMP = xtensa-esp108-elf-objdump
21+
endif
22+
23+
LD_FILE = $(LDDIR)/eagle.pro.v7.ld
24+
BIN_NAME = user
25+
26+
CSRCS ?= $(wildcard *.c)
27+
CPPSRCS ?= $(wildcard *.cpp)
28+
ASRCs ?= $(wildcard *.s)
29+
ASRCS ?= $(wildcard *.S)
30+
SUBDIRS ?= $(patsubst %/,%,$(dir $(wildcard */Makefile)))
31+
32+
ODIR := .output
33+
OBJODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/obj
34+
35+
OBJS := $(CSRCS:%.c=$(OBJODIR)/%.o) \
36+
$(CPPSRCS:%.cpp=$(OBJODIR)/%.o) \
37+
$(ASRCs:%.s=$(OBJODIR)/%.o) \
38+
$(ASRCS:%.S=$(OBJODIR)/%.o)
39+
40+
DEPS := $(CSRCS:%.c=$(OBJODIR)/%.d) \
41+
$(CPPSRCS:%.cpp=$(OBJODIR)/%.d) \
42+
$(ASRCs:%.s=$(OBJODIR)/%.d) \
43+
$(ASRCS:%.S=$(OBJODIR)/%.d)
44+
45+
LIBODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/lib
46+
OLIBS := $(GEN_LIBS:%=$(LIBODIR)/%)
47+
48+
IMAGEODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/image
49+
OIMAGES := $(GEN_IMAGES:%=$(IMAGEODIR)/%)
50+
51+
BINODIR := $(ODIR)/$(TARGET)/$(FLAVOR)/bin
52+
OBINS := $(GEN_BINS:%=$(BINODIR)/%)
53+
54+
CCFLAGS += \
55+
-g \
56+
-Wpointer-arith \
57+
-Wundef \
58+
-Werror \
59+
-Wl,-EL \
60+
-fno-inline-functions \
61+
-nostdlib \
62+
-mlongcalls \
63+
-mtext-section-literals #\
64+
-ffunction-sections \
65+
-fdata-sections
66+
# -Wall
67+
68+
CFLAGS = $(CCFLAGS) $(DEFINES) $(EXTRA_CCFLAGS) $(INCLUDES)
69+
DFLAGS = $(CCFLAGS) $(DDEFINES) $(EXTRA_CCFLAGS) $(INCLUDES)
70+
71+
72+
#############################################################
73+
# Functions
74+
#
75+
76+
define ShortcutRule
77+
$(1): .subdirs $(2)/$(1)
78+
endef
79+
80+
define MakeLibrary
81+
DEP_LIBS_$(1) = $$(foreach lib,$$(filter %.a,$$(COMPONENTS_$(1))),$$(dir $$(lib))$$(LIBODIR)/$$(notdir $$(lib)))
82+
DEP_OBJS_$(1) = $$(foreach obj,$$(filter %.o,$$(COMPONENTS_$(1))),$$(dir $$(obj))$$(OBJODIR)/$$(notdir $$(obj)))
83+
$$(LIBODIR)/$(1).a: $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1)) $$(DEPENDS_$(1))
84+
@mkdir -p $$(LIBODIR)
85+
$$(if $$(filter %.a,$$?),mkdir -p $$(EXTRACT_DIR)_$(1))
86+
$$(if $$(filter %.a,$$?),cd $$(EXTRACT_DIR)_$(1); $$(foreach lib,$$(filter %.a,$$?),$$(AR) xo $$(UP_EXTRACT_DIR)/$$(lib);))
87+
$$(AR) ru $$@ $$(filter %.o,$$?) $$(if $$(filter %.a,$$?),$$(EXTRACT_DIR)_$(1)/*.o)
88+
$$(if $$(filter %.a,$$?),$$(RM) -r $$(EXTRACT_DIR)_$(1))
89+
endef
90+
91+
define MakeImage
92+
DEP_LIBS_$(1) = $$(foreach lib,$$(filter %.a,$$(COMPONENTS_$(1))),$$(dir $$(lib))$$(LIBODIR)/$$(notdir $$(lib)))
93+
DEP_OBJS_$(1) = $$(foreach obj,$$(filter %.o,$$(COMPONENTS_$(1))),$$(dir $$(obj))$$(OBJODIR)/$$(notdir $$(obj)))
94+
$$(IMAGEODIR)/$(1).out: $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1)) $$(DEPENDS_$(1))
95+
@mkdir -p $$(IMAGEODIR)
96+
$$(CC) $$(LDFLAGS) $$(if $$(LINKFLAGS_$(1)),$$(LINKFLAGS_$(1)),$$(LINKFLAGS_DEFAULT) $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1))) -o $$@
97+
endef
98+
99+
$(BINODIR)/%.bin: $(IMAGEODIR)/%.out
100+
@mkdir -p $(BINODIR)
101+
102+
@$(RM) -r $(BIN_PATH)/$(BIN_NAME).S $(BIN_PATH)/$(BIN_NAME).dump
103+
104+
@$(OBJDUMP) -x -s $< > $(BIN_PATH)/$(BIN_NAME).dump
105+
@$(OBJDUMP) -S $< > $(BIN_PATH)/$(BIN_NAME).S
106+
107+
@$(OBJCOPY) --only-section .text -O binary $< eagle.app.v7.text.bin
108+
@$(OBJCOPY) --only-section .data -O binary $< eagle.app.v7.data.bin
109+
@$(OBJCOPY) --only-section .rodata -O binary $< eagle.app.v7.rodata.bin
110+
@$(OBJCOPY) --only-section .irom0.text -O binary $< eagle.app.v7.irom0text.bin
111+
@$(OBJCOPY) --only-section .irom1.text -O binary $< eagle.app.v7.irom1text.bin
112+
113+
@rm -f irom0_flash.bin irom1.bin
114+
115+
@python $(SDK_PATH)/tools/gen_appbin.py $< $(SDK_PATH)/ld
116+
117+
@mv eagle.app.flash.bin $(BIN_PATH)/$(BIN_NAME).ota
118+
119+
@-mv irom1.bin $(BIN_PATH)/irom1.bin &>/dev/null
120+
@-mv irom0_flash.bin $(BIN_PATH)/irom0_flash.bin &>/dev/null
121+
122+
@rm eagle.app.v7.*
123+
@echo "Generate related files successully in folder $(BIN_PATH)"
124+
@echo "boot.bin------------------>0x00000"
125+
@echo "irom1.bin----------------->0x04000"
126+
@echo "irom0_flash.bin----------->0x40000"
127+
@echo "user.ota------------------>(used for OTA)"
128+
129+
#############################################################
130+
# Rules base
131+
# Should be done in top-level makefile only
132+
#
133+
134+
all: .subdirs $(OBJS) $(OLIBS) $(OIMAGES) $(OBINS) $(SPECIAL_MKTARGETS)
135+
136+
clean:
137+
$(foreach d, $(SUBDIRS), $(MAKE) -C $(d) clean;)
138+
$(RM) -r $(ODIR)/$(TARGET)/$(FLAVOR)
139+
140+
clobber: $(SPECIAL_CLOBBER)
141+
$(foreach d, $(SUBDIRS), $(MAKE) -C $(d) clobber;)
142+
$(RM) -r $(ODIR)
143+
144+
.subdirs:
145+
@set -e; $(foreach d, $(SUBDIRS), $(MAKE) -C $(d);)
146+
147+
#.subdirs:
148+
# $(foreach d, $(SUBDIRS), $(MAKE) -C $(d))
149+
150+
ifneq ($(MAKECMDGOALS),clean)
151+
ifneq ($(MAKECMDGOALS),clobber)
152+
ifdef DEPS
153+
sinclude $(DEPS)
154+
endif
155+
endif
156+
endif
157+
158+
$(OBJODIR)/%.o: %.c
159+
@mkdir -p $(OBJODIR);
160+
$(CC) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) -o $@ -c $<
161+
162+
$(OBJODIR)/%.d: %.c
163+
@mkdir -p $(OBJODIR);
164+
@echo DEPEND: $(CC) -M $(CFLAGS) $<
165+
@set -e; rm -f $@; \
166+
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
167+
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
168+
rm -f $@.$$$$
169+
170+
$(OBJODIR)/%.o: %.cpp
171+
@mkdir -p $(OBJODIR);
172+
$(CPP) $(if $(findstring $<,$(DSRCS)),$(DFLAGS),$(CFLAGS)) $(COPTS_$(*F)) -o $@ -c $<
173+
174+
$(OBJODIR)/%.d: %.cpp
175+
@mkdir -p $(OBJODIR);
176+
@echo DEPEND: $(CPP) -M $(CFLAGS) $<
177+
@set -e; rm -f $@; \
178+
$(CPP) -M $(CFLAGS) $< > $@.$$$$; \
179+
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
180+
rm -f $@.$$$$
181+
182+
$(OBJODIR)/%.o: %.s
183+
@mkdir -p $(OBJODIR);
184+
$(CC) $(CFLAGS) -o $@ -c $<
185+
186+
$(OBJODIR)/%.d: %.s
187+
@mkdir -p $(OBJODIR); \
188+
set -e; rm -f $@; \
189+
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
190+
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
191+
rm -f $@.$$$$
192+
193+
$(OBJODIR)/%.o: %.S
194+
@mkdir -p $(OBJODIR);
195+
$(CC) $(CFLAGS) -D__ASSEMBLER__ -o $@ -c $<
196+
197+
$(OBJODIR)/%.d: %.S
198+
@mkdir -p $(OBJODIR); \
199+
set -e; rm -f $@; \
200+
$(CC) -M $(CFLAGS) $< > $@.$$$$; \
201+
sed 's,\($*\.o\)[ :]*,$(OBJODIR)/\1 $@ : ,g' < $@.$$$$ > $@; \
202+
rm -f $@.$$$$
203+
204+
$(foreach lib,$(GEN_LIBS),$(eval $(call ShortcutRule,$(lib),$(LIBODIR))))
205+
206+
$(foreach image,$(GEN_IMAGES),$(eval $(call ShortcutRule,$(image),$(IMAGEODIR))))
207+
208+
$(foreach bin,$(GEN_BINS),$(eval $(call ShortcutRule,$(bin),$(BINODIR))))
209+
210+
$(foreach lib,$(GEN_LIBS),$(eval $(call MakeLibrary,$(basename $(lib)))))
211+
212+
$(foreach image,$(GEN_IMAGES),$(eval $(call MakeImage,$(basename $(image)))))
213+
214+
#############################################################
215+
# Recursion Magic - Don't touch this!!
216+
#
217+
# Each subtree potentially has an include directory
218+
# corresponding to the common APIs applicable to modules
219+
# rooted at that subtree. Accordingly, the INCLUDE PATH
220+
# of a module can only contain the include directories up
221+
# its parent path, and not its siblings
222+
#
223+
# Required for each makefile to inherit from the parent
224+
#
225+
226+
INCLUDES := $(INCLUDES) -I $(SDK_PATH)/include
227+
INCLUDES += -I $(SDK_PATH)/extra_include \
228+
-I $(SDK_PATH)/include/lwip \
229+
-I $(SDK_PATH)/include/lwip/ipv4 \
230+
-I $(SDK_PATH)/include/lwip/ipv6 \
231+
-I $(SDK_PATH)/include/espressif

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# ESP32_RTOS_SDK #
2+
3+
----------
4+
5+
ESP32 SDK based on FreeRTOS.
6+
7+
## Toolchain ##
8+
9+
We suggest to choose **Crosstool-ng** as the compiler toolchain. Follow the instructions below to install Crosstool-ng.
10+
11+
1. Install the required toolchain packages.
12+
sudo apt-get install git autoconf build-essential gperf bison flex texinfo libtool libncurses5-dev wget gawk libc6-dev-i386 python-serial libexpat-dev`
13+
2. Create a directory (e.g./opt/Espressif) to store thetoolchain.
14+
sudo mkdir /opt/Espressif
15+
3. Make the current user the owner.
16+
sudo chown $USER /opt/Espressif/
17+
4. Download the latest toolchain installation file to the directory created in step 2.
18+
cd /opt/Espressif/
19+
git clone -b esp108-1.21.0 git://github.com/jcmvbkbc/crosstool-NG.git
20+
5. Install toolchain.
21+
cd crosstool-NG
22+
./bootstrap && ./configure --prefix=`pwd` && make && make install
23+
./ct-ng xtensa-esp108-elf
24+
./ct-ng build
25+
6. Set the PATH variable to point to the newly compiled toolchain.
26+
export PATH=/opt/Espressif/crosstool-NG/builds/xtensa-esp108-elf/bin:$PATH
27+
> Note:
28+
You need to do Step 6 once you open a new shell, or you can put it inside your .bashrcfile
29+
30+
## Compile ##
31+
32+
1. Create a directory (e.g.~/Workspace) to store a new project.
33+
mkdir ~/Workspace
34+
2. Clone ESP32 RTOS SDK.
35+
cd ~/Workspace
36+
git clone https://github.com/espressif/ESP32_RTOS_SDK.git
37+
3. Copy ESP32_RTOS_SDK/examples/project_template to Workspace directory created in step 1.
38+
cp ~/Workspace/ESP32_RTOS_SDK/examples/project_template ~/Workspace/ -r
39+
4. Create a directory (e.g./Workspace/ESP32_BIN) to store the bin files compiled.
40+
mkdir –p ~/Workspace/ESP32_BIN
41+
5. Set SDK_PATH as the path of SDK files and BIN_PATH as the path of .bin files compiled.
42+
export SDK_PATH=~/Workspace/ESP32_RTOS_SDK
43+
export BIN_PATH=~/Workspace/ESP32_BIN
44+
> Notice:
45+
> Make sure you set the correct paths, or it will occur a compile error.
46+
6. Start to compile files
47+
make clean
48+
make
49+
> Note:
50+
You need to do Step 3 every time you open a new shell, or you can put it inside your .bashrc file.
51+
52+
If your project is successfully compiled, the irom1.bin, irom0_flash.bin, and user.ota files will
53+
be generated in ~/Workspace/ESP32_BIN directory.
54+
55+
## Download ##
56+
57+
Please use espressif's **Flash Download tools**.
58+
Download addresses:
59+
60+
boot.bin---------->0x00000
61+
irom1.bin--------->0x04000
62+
irom0_flash.bin--->0x40000
63+
blank.bin--------->0xfe000(for 1MB SPI Flash)
64+
65+
For more details, please refer to http://www.esp32.com

bin/blank.bin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

bin/boot.bin

4.83 KB
Binary file not shown.

0 commit comments

Comments
 (0)