andsmedeiros / uevloop Goto Github PK
View Code? Open in Web Editor NEWA fast and lightweight event loop for embedded platforms.
License: MIT License
A fast and lightweight event loop for embedded platforms.
License: MIT License
This is a very quick-and-dirty solution to at least getting something build on Windows.
To use/reproduce:
choco install llvm make nodejs
npm i -g shx
shx
is a sort-of common-comand emulator. Stuff like mkdir
and rm
work with the same flags and options as they would on common Linux distros. Using Clang and Make together with shx, and stripping -fpic
(I don't know why this is not supported...) makes this useable:
diff --git a/Makefile b/Makefile
index 854f634..4ece2be 100644
--- a/Makefile
+++ b/Makefile
@@ -1,63 +1,64 @@
# CC=clang
-CC=gcc
+CC=clang
CFLAGS=-I./include -Og -Wall -Werror -pedantic -std=c99 -g
CFLAGS_TEST=-I. $(CFLAGS)
+CMDPREFIX=cmd.exe /c shx
OBJ=build/system/event.o build/system/event-loop.o build/system/signal.o build/utils/promise.o build/system/scheduler.o build/system/containers/application.o build/system/containers/system-queues.o build/system/containers/system-pools.o build/utils/circular-queue.o build/utils/closure.o build/utils/linked-list.o build/utils/object-pool.o build/utils/automatic-pool.o build/utils/iterator.o build/utils/pipeline.o build/utils/conditional.o build/utils/functional.o build/utils/module.o
TEST_OBJ=build/test/utils/circular-queue.o build/test/utils/closure.o build/test/utils/linked-list.o build/test/utils/object-pool.o build/test/utils/automatic-pool.o build/test/system/event.o build/test/system/containers/system-pools.o build/test/system/containers/application.o build/test/system/containers/system-queues.o build/test/system/event-loop.o build/test/system/scheduler.o build/test/system/signal.o build/test/utils/promise.o build/test/utils/conditional.o build/test/utils/pipeline.o build/test/utils/iterator.o build/test/utils/functional.o build/test/utils/module.o
dist/libuevloop.so: $(OBJ)
- mkdir -p dist
- $(CC) -shared -fpic -o dist/libuevloop.so $(OBJ) $(CFLAGS) -fprofile-arcs -ftest-coverage
+ $(CMDPREFIX) mkdir -p dist
+ $(CC) -shared -o dist/libuevloop.so $(OBJ) $(CFLAGS) -fprofile-arcs -ftest-coverage
build/system/%.o: src/system/%.c include/uevloop/system/%.h
- mkdir -p build/system
- $(CC) -c -fpic -o $@ $< $(CFLAGS) -fprofile-arcs -ftest-coverage
+ $(CMDPREFIX) mkdir -p build/system
+ $(CC) -c -o $@ $< $(CFLAGS) -fprofile-arcs -ftest-coverage
build/system/containers/%.o: src/system/containers/%.c include/uevloop/system/containers/%.h
- mkdir -p build/system/containers
- $(CC) -c -fpic -o $@ $< $(CFLAGS) -fprofile-arcs -ftest-coverage
+ $(CMDPREFIX) mkdir -p build/system/containers
+ $(CC) -c -o $@ $< $(CFLAGS) -fprofile-arcs -ftest-coverage
build/utils/%.o: src/utils/%.c include/uevloop/utils/%.h
- mkdir -p build/utils
- $(CC) -c -fpic -o $@ $< $(CFLAGS) -fprofile-arcs -ftest-coverage
+ $(CMDPREFIX) mkdir -p build/utils
+ $(CC) -c -o $@ $< $(CFLAGS) -fprofile-arcs -ftest-coverage
dist/test: dist/libuevloop.so build/test.o $(TEST_OBJ)
$(CC) -L./dist -o dist/test build/test.o $(TEST_OBJ) -luevloop -lm $(CFLAGS_TEST)
build/test.o: test/test.c test/uelt.h
- $(CC) -c -fpic -o build/test.o test/test.c $(CFLAGS_TEST)
+ $(CC) -c -o build/test.o test/test.c $(CFLAGS_TEST)
build/test/system/%.o: test/system/%.c test/system/%.h build/system/%.o test/uelt.h
- mkdir -p build/test/system
- $(CC) -c -fpic -o $@ $< $(CFLAGS_TEST)
+ $(CMDPREFIX) mkdir -p build/test/system
+ $(CC) -c -o $@ $< $(CFLAGS_TEST)
build/test/system/containers/%.o: test/system/containers/%.c test/system/containers/%.h build/system/containers/%.o test/uelt.h
- mkdir -p build/test/system/containers
- $(CC) -c -fpic -o $@ $< $(CFLAGS_TEST)
+ $(CMDPREFIX) mkdir -p build/test/system/containers
+ $(CC) -c -o $@ $< $(CFLAGS_TEST)
build/test/utils/%.o: test/utils/%.c test/utils/%.h build/utils/%.o test/uelt.h
- mkdir -p build/test/utils
- $(CC) -c -fpic -o $@ $< $(CFLAGS_TEST)
+ $(CMDPREFIX) mkdir -p build/test/utils
+ $(CC) -c -o $@ $< $(CFLAGS_TEST)
.PHONY: clean test coverage docs debug publish
clean:
- rm -rf build dist coverage docs
+ $CMDPREFIX rm -rf build dist coverage docs
test: dist/test
LD_LIBRARY_PATH=$(shell pwd)/dist:$(LD_LIBRARY_PATH) LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so ./dist/test
coverage: dist/test
- mkdir -p coverage
+ $CMDPREFIX mkdir -p coverage
LD_LIBRARY_PATH=$(shell pwd)/dist:$(LD_LIBRARY_PATH) ./dist/test
gcov test/test.c
lcov -c --directory . --output-file coverage/test.info
genhtml coverage/test.info --output-directory coverage
docs: Doxyfile $(OBJ)
- mkdir -p docs
+ $CMDPREFIX mkdir -p docs
touch docs/index.html
doxygen Doxyfile
echo '<!DOCTYPE html>\n<html><head><meta http-equiv=Refresh content="0;url=html/index.html"></head></html>' > docs/index.html
Since this is merely a hotch-potch of appendings and such, I didn't bother making a full PR out of it. However, it might inspire you for a small block of if-Windows blocks, who knows! :)
First of all, thank you for this great library. It makes firmware really easy, more clean and is way simpler than RTOS which are not always required.
That being said, after having used this library for a professional project and doing continuous improvement in the firmware, I had multiple very strange issues which has been fixed by increasing the event queue size and/or the scheduler queue size.
It's really a problem because when overflow happens, there is no way to monitor that because all the functions pushing events to queues are not returning error in case of overflow. That's clearly an issue and doesn't really fit the required quality level for a professional firmware.
Just wanted to know then if you plan to improve this aspect ? If not, is this repo still active and will you support me eventually if I make pull request to improve this aspect ?
Hi André,
first I would like to say great job!
Could you provide some examples for using the uevloop on real hardware like stm32 development board or other? Do you plan on integrating some kind of graphical library for creating user interfaces?
Thank you!
Lazar
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.