From: Mart Lubbers Date: Mon, 3 Apr 2017 08:25:50 +0000 (+0200) Subject: Started with nodeMCU support X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=ffa2d86b82f26ed05ed524d3027c679420d13553;p=mTask.git Started with nodeMCU support --- diff --git a/client/.gitignore b/client/.gitignore index db3bf7c..e6a8598 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -1,4 +1,5 @@ main *.o build +*.bin .dep diff --git a/client/Makefile b/client/Makefile index 0ca27f1..3e2db2e 100644 --- a/client/Makefile +++ b/client/Makefile @@ -217,7 +217,6 @@ ULIBDIR = # List all user libraries here ULIBS = -# # End of user defines ############################################################################## diff --git a/client/Makefile.NodeMCU b/client/Makefile.NodeMCU new file mode 100644 index 0000000..09c18bf --- /dev/null +++ b/client/Makefile.NodeMCU @@ -0,0 +1,21 @@ +CC = xtensa-lx106-elf-gcc +CFLAGS = -DNODEMCU -I. -mlongcalls -Wall -Wextra -Werror -DDEBUG +LDLIBS = -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -lc -Wl,--end-group -lgcc -I/home/mrl/projects/esp-open-sdk/sdk/include -L/home/mrl/projects/esp-open-sdk/sdk/lib +LDFLAGS = -Teagle.app.v6.ld + +OBJS:=interpret.o sds.o task.o main.o interface.o spec.o + +main-0x00000.bin: main + esptool.py elf2image $^ + +main: $(OBJS) + $(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) $(OUTPUT_OPTION) + +interface.o: interface_nodemcu.c + $(CC) $(CFLAGS) -c $< -o $@ + +#FLASh: %-0x00000.bin +# esptool.py write_flash 0 blinky-0x00000.bin 0x40000 blinky-0x40000.bin + +clean: + $(RM) main $(OBJS) diff --git a/client/Makefile.linux b/client/Makefile.linux index fb97f4d..8e1bfed 100644 --- a/client/Makefile.linux +++ b/client/Makefile.linux @@ -2,17 +2,13 @@ CFLAGS:=-DLINUX -g -Wall -Wextra -DDEBUG PROG:=main OBJS:=interpret.o sds.o task.o main.o interface.o spec.o -all: mTaskSymbols.h $(PROG) +all: $(PROG) interface.o: interface_linux.c - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) -c $< -o $@ $(PROG): $(OBJS) $(CC) $(LDFLAGS) -o $@ $(OBJS) - -mTaskSymbols.h: - CLMFLAGS=-nr make -BC ../.. mTaskInterpret - ../../mTaskInterpret > $@ clean: $(RM) $(OBJS) $(PROG) diff --git a/client/interface.h b/client/interface.h index 9e81810..042cc20 100644 --- a/client/interface.h +++ b/client/interface.h @@ -22,6 +22,13 @@ extern char **gargv; #define HAVEAIO 1 #define HAVEDIO 1 +#elif defined NODEMCU +#define MAXTASKS 5 +#define MAXSDSS 100 +#define HAVELED 0 +#define HAVEAIO 0 +#define HAVEDIO 0 + #else //Add you device here #endif diff --git a/client/interface_nodemcu.c b/client/interface_nodemcu.c new file mode 100644 index 0000000..361328f --- /dev/null +++ b/client/interface_nodemcu.c @@ -0,0 +1,47 @@ +#include +#include + +bool input_available(void) +{ + return false; +} + +uint8_t read_byte(void) +{ + return 0; +} + +void write_byte(uint8_t b) +{ + (void)b; +} + +long millis(void) +{ + return 0; +} + +void delay(long ms) +{ + (void) ms; +} + +void setup(void) +{ + +} + +void debug(char *fmt, ...) +{ + (void)fmt; +} + +void pdie(char *s) +{ + (void)s; +} + +void die(char *fmt, ...) +{ + (void)fmt; +} diff --git a/client/main.c b/client/main.c index 720fd1a..4919d9d 100644 --- a/client/main.c +++ b/client/main.c @@ -3,9 +3,13 @@ #include #include -#ifdef STM -#else +#ifdef LINUX #include +#elif defined NODEMCU +#include "ets_sys.h" +#include "osapi.h" +#include "gpio.h" +#include "os_type.h" #endif #include "interpret.h" @@ -101,7 +105,9 @@ void loop(void) #ifdef STM int main(void){ -#else +#elif defined NODEMCU +void ICACHE_FLASH_ATTR user_init(){ +#elif defined LINUX int main(int argc, char *argv[]){ gargc = argc; gargv = argv; @@ -113,9 +119,12 @@ int main(int argc, char *argv[]){ task_init(); debug("sending device spec"); while(true){ - //Check for newetasks + //Check for newtasks loop(); delay(100); } + +#ifndef NODEMCU return 0; +#endif } diff --git a/client/user_config.h b/client/user_config.h new file mode 100644 index 0000000..e69de29