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

Commit b4fda61

Browse files
committed
Merge remote-tracking branch 'refs/remotes/espressif/master'
2 parents 22ad130 + e18f961 commit b4fda61

Some content is hidden

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

81 files changed

+14498
-171
lines changed

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ else
2020
OBJDUMP = xtensa-esp108-elf-objdump
2121
endif
2222

23+
BIN_PATH ?= $(SDK_PATH)/bin
24+
2325
LD_FILE = $(LDDIR)/eagle.pro.v7.ld
2426
BIN_NAME = user
2527

@@ -96,8 +98,15 @@ $$(IMAGEODIR)/$(1).out: $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1)) $$(DEPENDS_
9698
$$(CC) $$(LDFLAGS) $$(if $$(LINKFLAGS_$(1)),$$(LINKFLAGS_$(1)),$$(LINKFLAGS_DEFAULT) $$(OBJS) $$(DEP_OBJS_$(1)) $$(DEP_LIBS_$(1))) -o $$@
9799
endef
98100

101+
define CheckBinPath
102+
if test ! -d $(BIN_PATH); then \
103+
echo "BIN_PATH : $(BIN_PATH) not EXIST, creat it!"; \
104+
mkdir -p $(BIN_PATH); \
105+
fi;
106+
endef
107+
99108
$(BINODIR)/%.bin: $(IMAGEODIR)/%.out
100-
@mkdir -p $(BINODIR)
109+
@$(CheckBinPath)
101110

102111
@$(RM) -r $(BIN_PATH)/$(BIN_NAME).S $(BIN_PATH)/$(BIN_NAME).dump
103112

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export BIN_PATH=~/Workspace/ESP32_BIN
6666
6767
Step 6. Start to compile files
6868
```
69+
cd ~/Workspace/project_template
6970
make clean
7071
make
7172
```

bin/boot.bin

336 Bytes
Binary file not shown.

bin/ssc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Just for test purpose.

bin/ssc/irom0_flash.bin

243 KB
Binary file not shown.

bin/ssc/irom1.bin

12.2 KB
Binary file not shown.

driver_lib/Makefile

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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.v7.out
22+
GEN_BINS= eagle.app.v7.bin
23+
SPECIAL_MKTARGETS=$(APP_MKTARGETS)
24+
SUBDIRS= \
25+
user
26+
27+
endif # } PDIR
28+
29+
LDDIR = $(SDK_PATH)/ld
30+
31+
CCFLAGS += -Os
32+
33+
TARGET_LDFLAGS = \
34+
-nostdlib \
35+
-Wl,-EL \
36+
--longcalls \
37+
--text-section-literals
38+
39+
ifeq ($(FLAVOR),debug)
40+
TARGET_LDFLAGS += -g -O2
41+
endif
42+
43+
ifeq ($(FLAVOR),release)
44+
TARGET_LDFLAGS += -g -O0
45+
endif
46+
47+
COMPONENTS_eagle.app.v7 = \
48+
user/libuser.a
49+
50+
LINKFLAGS_eagle.app.v7 = \
51+
-L$(SDK_PATH)/lib \
52+
-nostdlib \
53+
-T$(LD_FILE) \
54+
-Wl,--no-check-sections \
55+
-u call_user_start \
56+
-Wl,-static \
57+
-Wl,--start-group \
58+
-lc \
59+
-lgcc \
60+
-lhal \
61+
-lm \
62+
-lcrypto \
63+
-lfreertos \
64+
-llwip \
65+
-lmain \
66+
-lnet80211 \
67+
-lphy \
68+
-lpp \
69+
-lrtc \
70+
-lwpa \
71+
$(DEP_LIBS_eagle.app.v7)\
72+
-Wl,--end-group
73+
74+
DEPENDS_eagle.app.v7 = $(LD_FILE)
75+
76+
#############################################################
77+
# Configuration i.e. compile options etc.
78+
# Target specific stuff (defines etc.) goes in here!
79+
# Generally values applying to a tree are captured in the
80+
# makefile at its root level - these are then overridden
81+
# for a subtree within the makefile rooted therein
82+
#
83+
84+
#UNIVERSAL_TARGET_DEFINES = \
85+
86+
# Other potential configuration flags include:
87+
# -DTXRX_TXBUF_DEBUG
88+
# -DTXRX_RXBUF_DEBUG
89+
# -DWLAN_CONFIG_CCX
90+
CONFIGURATION_DEFINES = -DICACHE_FLASH
91+
92+
DEFINES += \
93+
$(UNIVERSAL_TARGET_DEFINES) \
94+
$(CONFIGURATION_DEFINES)
95+
96+
DDEFINES += \
97+
$(UNIVERSAL_TARGET_DEFINES) \
98+
$(CONFIGURATION_DEFINES)
99+
100+
101+
#############################################################
102+
# Recursion Magic - Don't touch this!!
103+
#
104+
# Each subtree potentially has an include directory
105+
# corresponding to the common APIs applicable to modules
106+
# rooted at that subtree. Accordingly, the INCLUDE PATH
107+
# of a module can only contain the include directories up
108+
# its parent path, and not its siblings
109+
#
110+
# Required for each makefile to inherit from the parent
111+
#
112+
113+
INCLUDES := $(INCLUDES) -I $(PDIR)include
114+
sinclude $(SDK_PATH)/Makefile
115+
116+
.PHONY: FORCE
117+
FORCE:
118+

driver_lib/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# HOWTO #
2+
run:
3+
./make_lib.sh driver
4+
libdriver.a will be generated in $SDK_PATH/lib
File renamed without changes.
File renamed without changes.

examples/driver_lib/driver/i2s.c renamed to driver_lib/driver/i2s.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "gpio.h"
3333
#include <stdio.h>
3434

35-
#define os_printf printf
3635
#define IIS_RX_BUF_LEN 512 //unit Byte
3736
#define IIS_TX_BUF_LEN 512 //unit Byte
3837
#define n 2
@@ -155,7 +154,7 @@ void copyarray(uint8 *dest, uint8 *src, uint32 nbyte)
155154

156155
//create DMA buffer descriptors, unit of either size or length here is byte.
157156
//More details in I2S documents.
158-
void creat_one_link(uint8 own, uint8 eof, uint8 sub_sof, uint16 size, uint16 length,
157+
void create_one_link(uint8 own, uint8 eof, uint8 sub_sof, uint16 size, uint16 length,
159158
uint32 *buf_ptr, struct sdio_queue *nxt_ptr, struct sdio_queue *i2s_queue)
160159
{
161160
unsigned int link_data0;
@@ -441,7 +440,7 @@ void slc_isr(void *para)
441440
if (READ_PERI_REG(I2S_TX_EOF_DES_ADDR) == (((uint32)&i2s_tx_queue1))) {
442441
//load out data in the buff
443442
if (tx_cnt < 4 * n) {
444-
ets_memcpy((uint8 *)i2s_tx_test + IIS_TX_BUF_LEN * tx_cnt, (uint8 *)i2s_tx_buff1, IIS_TX_BUF_LEN);
443+
memcpy((uint8 *)i2s_tx_test + IIS_TX_BUF_LEN * tx_cnt, (uint8 *)i2s_tx_buff1, IIS_TX_BUF_LEN);
445444
}
446445

447446
//reset DMA discrpiter
@@ -451,7 +450,7 @@ void slc_isr(void *para)
451450
i2s_tx_queue1.datalen = 0;
452451
} else if (READ_PERI_REG(I2S_TX_EOF_DES_ADDR) == (((uint32)&i2s_tx_queue2))) {
453452
if (tx_cnt < 4 * n) {
454-
ets_memcpy((uint8 *)i2s_tx_test + IIS_TX_BUF_LEN * tx_cnt, (uint8 *)i2s_tx_buff2, IIS_TX_BUF_LEN);
453+
memcpy((uint8 *)i2s_tx_test + IIS_TX_BUF_LEN * tx_cnt, (uint8 *)i2s_tx_buff2, IIS_TX_BUF_LEN);
455454
}
456455

457456
i2s_tx_queue2.next_link_ptr = (uint32)(&i2s_tx_queue3);
@@ -460,7 +459,7 @@ void slc_isr(void *para)
460459
i2s_tx_queue2.datalen = 0;
461460
} else if (READ_PERI_REG(I2S_TX_EOF_DES_ADDR) == (((uint32)&i2s_tx_queue3))) {
462461
if (tx_cnt < 4 * n) {
463-
ets_memcpy((uint8 *)i2s_tx_test + IIS_TX_BUF_LEN * tx_cnt, (uint8 *)i2s_tx_buff3, IIS_TX_BUF_LEN);
462+
memcpy((uint8 *)i2s_tx_test + IIS_TX_BUF_LEN * tx_cnt, (uint8 *)i2s_tx_buff3, IIS_TX_BUF_LEN);
464463
}
465464

466465
i2s_tx_queue3.next_link_ptr = (uint32)(&i2s_tx_queue1);
@@ -508,12 +507,12 @@ void i2s_test(void)
508507
//size of the I2S FIFO.
509508
//Note:At the receiver side,the number of the DMAs can not be smaller than 3 which is limited by the
510509
//hardware.
511-
creat_one_link(1, 0, 0, IIS_TX_BUF_LEN, 0, i2s_tx_buff1, &i2s_tx_queue2, &i2s_tx_queue1);
512-
creat_one_link(1, 0, 0, IIS_TX_BUF_LEN, 0, i2s_tx_buff2, &i2s_tx_queue3, &i2s_tx_queue2);
513-
creat_one_link(1, 0, 0, IIS_TX_BUF_LEN, 0, i2s_tx_buff3, &i2s_tx_queue1, &i2s_tx_queue3);
510+
create_one_link(1, 0, 0, IIS_TX_BUF_LEN, 0, i2s_tx_buff1, &i2s_tx_queue2, &i2s_tx_queue1);
511+
create_one_link(1, 0, 0, IIS_TX_BUF_LEN, 0, i2s_tx_buff2, &i2s_tx_queue3, &i2s_tx_queue2);
512+
create_one_link(1, 0, 0, IIS_TX_BUF_LEN, 0, i2s_tx_buff3, &i2s_tx_queue1, &i2s_tx_queue3);
514513

515-
creat_one_link(1, 1, 0, IIS_RX_BUF_LEN, IIS_RX_BUF_LEN, i2s_rx_buff1, &i2s_rx_queue2, &i2s_rx_queue1);
516-
creat_one_link(1, 1, 0, IIS_RX_BUF_LEN, IIS_RX_BUF_LEN, i2s_rx_buff2, &i2s_rx_queue1, &i2s_rx_queue2);
514+
create_one_link(1, 1, 0, IIS_RX_BUF_LEN, IIS_RX_BUF_LEN, i2s_rx_buff1, &i2s_rx_queue2, &i2s_rx_queue1);
515+
create_one_link(1, 1, 0, IIS_RX_BUF_LEN, IIS_RX_BUF_LEN, i2s_rx_buff2, &i2s_rx_queue1, &i2s_rx_queue2);
517516

518517
os_printf("================DMA descripter built==============\r\n");
519518

File renamed without changes.

examples/driver_lib/driver/uart.c renamed to driver_lib/driver/uart.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include "espressif/esp_common.h"
3131
#include "uart.h"
32+
#include "gpio.h"
3233
#include <stdio.h>
3334

3435
enum {
@@ -276,9 +277,9 @@ void UART_intr_handler_register(void *fn, void *arg)
276277
void UART_SetPrintPort(UART_Port uart_no)
277278
{
278279
if (uart_no == 1) {
279-
ets_install_putc1(uart1_write_char);
280+
os_install_putc1(uart1_write_char);
280281
} else {
281-
ets_install_putc1(uart0_write_char);
282+
os_install_putc1(uart0_write_char);
282283
}
283284
}
284285

@@ -310,7 +311,7 @@ void UART_IntrConfig(UART_Port uart_no, UART_IntrConfTypeDef *pUARTIntrConf)
310311

311312
uint32 reg_val = 0;
312313
UART_ClearIntrStatus(uart_no, UART_INTR_MASK);
313-
reg_val = READ_PERI_REG(UART_CONF1(uart_no)) & ~((UART_RX_FLOW_THRHD << UART_RX_FLOW_THRHD_S) | UART_RX_FLOW_EN) ;
314+
reg_val = READ_PERI_REG(UART_CONF1(uart_no));
314315

315316
reg_val |= ((pUARTIntrConf->UART_IntrEnMask & UART_RXFIFO_TOUT_INT_ENA) ?
316317
((((pUARTIntrConf->UART_RX_TimeOutIntrThresh)&UART_RX_TOUT_THRHD) << UART_RX_TOUT_THRHD_S) | UART_RX_TOUT_EN) : 0);
@@ -334,15 +335,15 @@ LOCAL void uart0_rx_intr_handler(void *para)
334335
uint8 uart_no = UART0;//UartDev.buff_uart_no;
335336
uint8 fifo_len = 0;
336337
uint8 buf_idx = 0;
337-
338+
//BaseType_t xHigherPriorityTaskWoken;
338339
uint32 uart_intr_status = READ_PERI_REG(UART_INT_ST(uart_no)) ;
339340

340341
while (uart_intr_status != 0x0) {
341342
if (UART_FRM_ERR_INT_ST == (uart_intr_status & UART_FRM_ERR_INT_ST)) {
342-
ets_printf("FRM_ERR\r\n");
343+
os_printf_isr("FRM_ERR\r\n");
343344
WRITE_PERI_REG(UART_INT_CLR(uart_no), UART_FRM_ERR_INT_CLR);
344345
} else if (UART_RXFIFO_FULL_INT_ST == (uart_intr_status & UART_RXFIFO_FULL_INT_ST)) {
345-
ets_printf("full\r\n");
346+
os_printf_isr("full\r\n");
346347
fifo_len = (READ_PERI_REG(UART_STATUS(UART0)) >> UART_RXFIFO_CNT_S)&UART_RXFIFO_CNT;
347348
buf_idx = 0;
348349

@@ -352,8 +353,13 @@ LOCAL void uart0_rx_intr_handler(void *para)
352353
}
353354

354355
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_FULL_INT_CLR);
356+
//CLEAR_PERI_REG_MASK(UART_INT_ENA(UART0), UART_RXFIFO_FULL_INT_ENA|UART_RXFIFO_TOUT_INT_ENA);
357+
//xQueueSendFromISR(QueUart,(&fifo_len),&xHigherPriorityTaskWoken) ;
358+
// portEND_SWITCHING_ISR(xHigherPriorityTaskWoken);
359+
//os_printf_isr("uart interrupt\n");
360+
355361
} else if (UART_RXFIFO_TOUT_INT_ST == (uart_intr_status & UART_RXFIFO_TOUT_INT_ST)) {
356-
ets_printf("tout\r\n");
362+
os_printf_isr("tout\r\n");
357363
fifo_len = (READ_PERI_REG(UART_STATUS(UART0)) >> UART_RXFIFO_CNT_S)&UART_RXFIFO_CNT;
358364
buf_idx = 0;
359365

@@ -364,12 +370,12 @@ LOCAL void uart0_rx_intr_handler(void *para)
364370

365371
WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_TOUT_INT_CLR);
366372
} else if (UART_TXFIFO_EMPTY_INT_ST == (uart_intr_status & UART_TXFIFO_EMPTY_INT_ST)) {
367-
ets_printf("empty\n\r");
373+
os_printf_isr("empty\n\r");
368374
WRITE_PERI_REG(UART_INT_CLR(uart_no), UART_TXFIFO_EMPTY_INT_CLR);
369375
CLEAR_PERI_REG_MASK(UART_INT_ENA(UART0), UART_TXFIFO_EMPTY_INT_ENA);
370376
} else if (UART_RXFIFO_OVF_INT_ST == (READ_PERI_REG(UART_INT_ST(uart_no)) & UART_RXFIFO_OVF_INT_ST)) {
371377
WRITE_PERI_REG(UART_INT_CLR(uart_no), UART_RXFIFO_OVF_INT_CLR);
372-
ets_printf("RX OVF!!\r\n");
378+
os_printf_isr("RX OVF!!\r\n");
373379
} else {
374380
//skip
375381
}

0 commit comments

Comments
 (0)