Skip to content

Commit a59a99b

Browse files
Merge pull request #2 from tommie/master
Flash both images in one go, invert blinky really blink and remove need to define PIN_OUT
2 parents 22b20b0 + 461e812 commit a59a99b

File tree

4 files changed

+18
-24
lines changed

4 files changed

+18
-24
lines changed

basic_example/Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ TARGET = app
2626

2727
# which modules (subdirectories) of the project to include in compiling
2828
MODULES = driver user
29-
EXTRA_INCDIR = include /usr/include /usr/include/i386-linux-gnu
29+
EXTRA_INCDIR = include /opt/Espressif/include
3030

3131
# libraries used in this project, mainly provided by the SDK
32-
LIBS = c gcc hal phy net80211 lwip wpa main
32+
LIBS = c gcc hal phy net80211 lwip wpa upgrade upgrade_ssl main
3333

3434
# compiler flags using during compilation of source files
3535
CFLAGS = -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH
@@ -101,7 +101,7 @@ $1/%.o: %.c
101101
$(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@
102102
endef
103103

104-
.PHONY: all checkdirs clean
104+
.PHONY: all checkdirs flash clean
105105

106106
all: checkdirs $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2)
107107

@@ -130,9 +130,7 @@ firmware:
130130
$(Q) mkdir -p $@
131131

132132
flash: firmware/0x00000.bin firmware/0x40000.bin
133-
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin
134-
sleep 3
135-
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x40000 firmware/0x40000.bin
133+
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin
136134

137135
clean:
138136
$(Q) rm -f $(APP_AR)

blinky/Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ TARGET = app
2626

2727
# which modules (subdirectories) of the project to include in compiling
2828
MODULES = driver user
29-
EXTRA_INCDIR = include /usr/include /usr/include/i386-linux-gnu
29+
EXTRA_INCDIR = include /opt/Espressif/include
3030

3131
# libraries used in this project, mainly provided by the SDK
32-
LIBS = c gcc hal phy net80211 lwip wpa main
32+
LIBS = c gcc hal phy net80211 lwip wpa upgrade upgrade_ssl main
3333

3434
# compiler flags using during compilation of source files
3535
CFLAGS = -Os -g -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH
@@ -101,7 +101,7 @@ $1/%.o: %.c
101101
$(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@
102102
endef
103103

104-
.PHONY: all checkdirs clean
104+
.PHONY: all checkdirs flash clean
105105

106106
all: checkdirs $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2)
107107

@@ -130,9 +130,7 @@ firmware:
130130
$(Q) mkdir -p $@
131131

132132
flash: firmware/0x00000.bin firmware/0x40000.bin
133-
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin
134-
sleep 3
135-
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x40000 firmware/0x40000.bin
133+
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin
136134

137135
clean:
138136
$(Q) rm -f $(APP_AR)

blinky/user/user_main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,21 @@
99
os_event_t user_procTaskQueue[user_procTaskQueueLen];
1010
static void user_procTask(os_event_t *events);
1111

12-
extern uint32_t PIN_OUT;
13-
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
14-
1512
static volatile os_timer_t some_timer;
1613

1714

1815
void some_timerfunc(void *arg)
1916
{
2017
//Do blinky stuff
21-
if (CHECK_BIT(PIN_OUT,2))
18+
if (GPIO_REG_READ(GPIO_OUT_ADDRESS) & BIT2)
2219
{
23-
//Set GPIO2 to HIGH
24-
gpio_output_set(BIT2, 0, BIT2, 0);
20+
//Set GPIO2 to LOW
21+
gpio_output_set(0, BIT2, BIT2, 0);
2522
}
2623
else
2724
{
28-
//Set GPIO2 to LOW
29-
gpio_output_set(0, BIT2, BIT2, 0);
25+
//Set GPIO2 to HIGH
26+
gpio_output_set(BIT2, 0, BIT2, 0);
3027
}
3128
}
3229

@@ -41,6 +38,9 @@ user_procTask(os_event_t *events)
4138
void ICACHE_FLASH_ATTR
4239
user_init()
4340
{
41+
// Initialize the GPIO subsystem.
42+
gpio_init();
43+
4444
//Set GPIO2 to output mode
4545
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2);
4646

example.Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TARGET = app
2727

2828
# which modules (subdirectories) of the project to include in compiling
2929
MODULES = driver user
30-
EXTRA_INCDIR = include /opt/Espressif/include/
30+
EXTRA_INCDIR = include /opt/Espressif/include
3131

3232
# libraries used in this project, mainly provided by the SDK
3333
LIBS = c gcc hal phy net80211 lwip wpa upgrade upgrade_ssl main
@@ -131,9 +131,7 @@ firmware:
131131
$(Q) mkdir -p $@
132132

133133
flash: firmware/0x00000.bin firmware/0x40000.bin
134-
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin
135-
sleep 3
136-
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x40000 firmware/0x40000.bin
134+
-$(ESPTOOL) --port $(ESPPORT) write_flash 0x00000 firmware/0x00000.bin 0x40000 firmware/0x40000.bin
137135

138136
clean:
139137
$(Q) rm -f $(APP_AR)

0 commit comments

Comments
 (0)