embeddedartistry / embedded-resources Goto Github PK
View Code? Open in Web Editor NEWEmbedded Artistry Templates, Documents, and Source Code
Home Page: https://embeddedartistry.com
License: Creative Commons Zero v1.0 Universal
Embedded Artistry Templates, Documents, and Source Code
Home Page: https://embeddedartistry.com
License: Creative Commons Zero v1.0 Universal
The mutex examples we give require some files that are only found in clang's libc++. We could add a dependency for these specific examples which provides the missing files when you're using GCC (e.g., similar to embvm)
Maybe this is really best addressed by #46, since we can just direct to our implementation in the C++ library. We can have our dispatch example use that mutex... or just the built-in one.
We utilize a priority queue to handle our interrupts by priority - we take the next highest priority off the stack first.
For clang compilers, we should enable -Weverything an then filter out extra stuff we don't need.
The current scheme works for GNU compilers, so should be moved there.
Allow me just to pass a link : Advantages of using std::make_unique over new operator
That is all I can comment, I am aware I have no enough context.
Thank's
could you add context around bad c code analysis. it is not very clear just reading bad.c file.
Build ea-nightly/embedded-resources/master
#30 Failed
Change log:
b38155a
: Update dispatch examples [Phillip Johnston]Last 75 of output:
[...truncated 5.57 KB...]
> git submodule update --init --recursive build
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Setup)
[Pipeline] echo
Running make clean...
[Pipeline] sh
[y_embedded-resources_master-IIPVY4TYXCSAP3MNIOC2CSIWJPSSHQMNBISSTZ42S2JAIRXX4UNQ] Running shell script
+ make clean
Cleaning Build Output
No generated build files: skipping clean
No generated build files: skipping clean
No generated build files: skipping clean
No generated build files: skipping clean
No generated build files: skipping clean
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] sh
[y_embedded-resources_master-IIPVY4TYXCSAP3MNIOC2CSIWJPSSHQMNBISSTZ42S2JAIRXX4UNQ] Running shell script
+ make
Building C Examples
Detected OS: Darwin. Using Premake binary: build/bin/Darwin/premake5
Building configurations...
Running action 'gmake'...
Generated buildresults/build/Makefile...
Generated buildresults/build/circular_buffer.make...
Generated buildresults/build/malloc_aligned.make...
Generated buildresults/build/malloc_freelist.make...
Generated buildresults/build/malloc_threadx.make...
Done (101ms).
==== Building circular_buffer (debug_x86_64) ====
Creating ../x86_64_debug
Creating obj/x86_64/debug/circular_buffer
circular_buffer.c
../../circular_buffer/circular_buffer.c:1:10: fatal error: 'stdlib.h' file not found
#include <stdlib.h>
^~~~~~~~~~
1 error generated.
make[3]: *** [obj/x86_64/debug/circular_buffer/circular_buffer.o] Error 1
make[2]: *** [circular_buffer] Error 2
make[1]: *** [build] Error 2
make: *** [c] Error 2
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] warnings
[WARNINGS] Skipping publisher since build result is FAILURE
[Pipeline] openTasks
[TASKS] Skipping publisher since build result is FAILURE
[Pipeline] echo
Sending slack message: <http://136.24.14.137:12345/job/ea-nightly/job/embedded-resources/job/master/30/display/redirect|ea-nightly/embedded-resources/master #30>: *FAILED*
Changes:
- `b38155a`: Update dispatch examples [Phillip Johnston]
[Pipeline] slackSend
run slackstepsend, step null:false, desc :true
Slack Send Pipeline step configured values from global config - baseUrl: true, teamDomain: true, token: true, channel: true, color: false
[Pipeline] sh
[y_embedded-resources_master-IIPVY4TYXCSAP3MNIOC2CSIWJPSSHQMNBISSTZ42S2JAIRXX4UNQ] Running shell script
+ git config --get remote.origin.url
[Pipeline] readFile
[Pipeline] echo
Creating a GitHubPluginConfig for credential 4c01f168-ca25-483e-bc6d-8d105fc5fb70
[Pipeline] echo
Registering GithubProjectProperty for repo URL https://github.com/embeddedartistry/embedded-resources
[Pipeline] properties
Rather than supporting two different sets of libc files isn't smart, especially when I'm only updating our main repo.
memmove.c: I have to do this:
#include "../string.h"
instead of this:
#include <string.h>
Because I pickup the wrong string.h
Update the article that references the embedded-resources driver_abstraction files - those should just be in the appropriate embvm repositories.
This was reported on the old website as a comment. I need to look into it.
Hello,
I am running the following code and the returned ptr is NULL
void * my_block = malloc(32);
malloc_addblock(my_block, 32);
void *t1 = fl_malloc(20);
The submodule "meson-buildsystem" in the .gitmodules
file needs access rights to its repository:
[submodule "meson-buildsystem"]
active = true
url = [email protected]:embeddedartistry/meson-buildsystem.git
so that I can't clone the repository:
[mpoullet@mx-mpoullet /tmp]$ git clone --recursive https://github.com/embeddedartistry/embedded-resources.git
Cloning into 'embedded-resources'...
remote: Enumerating objects: 183, done.
remote: Counting objects: 100% (183/183), done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 1240 (delta 69), reused 158 (delta 47), pack-reused 1057
Receiving objects: 100% (1240/1240), 599.17 KiB | 127.00 KiB/s, done.
Resolving deltas: 100% (644/644), done.
Submodule 'meson-buildsystem' ([email protected]:embeddedartistry/meson-buildsystem.git) registered for path 'build'
Submodule 'examples/cpp/etl' (https://github.com/ETLCPP/etl) registered for path 'examples/cpp/etl'
Cloning into '/private/tmp/embedded-resources/build'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of '[email protected]:embeddedartistry/meson-buildsystem.git' into submodule path '/private/tmp/embedded-resources/build' failed
It'd work with:
[submodule "meson-buildsystem"]
path = build
- url = [email protected]:embeddedartistry/meson-buildsystem.git
+ url = https://github.com/embeddedartistry/meson-buildsystem.git
but I'm not sure if that's ok for you.
BTW, it'd be nice to put a note in README.md
that you use some submodules so that the best way to clone this repository is to use git clone --recursive https://github.com/embeddedartistry/embedded-resources.git
.
Currently only OSX is supported
Make sure I attribute and license correctly
Build ea-nightly/embedded-resources/master
#32 Failed
Change log:
Last 75 of output:
[...truncated 164 lines...]
using ::fprintf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:117:9: error: no member named 'fscanf' in the global namespace
using ::fscanf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:118:9: error: no member named 'snprintf' in the global namespace
using ::snprintf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:119:9: error: no member named 'sprintf' in the global namespace
using ::sprintf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:120:9: error: no member named 'sscanf' in the global namespace
using ::sscanf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:121:9: error: no member named 'vfprintf' in the global namespace
using ::vfprintf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:122:9: error: no member named 'vfscanf' in the global namespace
using ::vfscanf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:123:9: error: no member named 'vsscanf' in the global namespace
using ::vsscanf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:124:9: error: no member named 'vsnprintf' in the global namespace
using ::vsnprintf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:125:9: error: no member named 'vsprintf' in the global namespace
using ::vsprintf;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:126:9: error: no member named 'fgetc' in the global namespace
using ::fgetc;
~~^
/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1/cstdio:127:9: error: no member named 'fgets' in the global namespace
using ::fgets;
~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [obj/x86_64/debug/circular_buffer/circular_buffer.o] Error 1
make[2]: *** [circular_buffer] Error 2
make[1]: *** [build] Error 2
make: *** [cpp] Error 2
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] warnings
[WARNINGS] Skipping publisher since build result is FAILURE
[Pipeline] openTasks
[TASKS] Skipping publisher since build result is FAILURE
[Pipeline] sh
+ git rev-list --no-merges HEAD --max-count=1
[Pipeline] readFile
[Pipeline] sh
+ git log -n 1 --pretty=format:%s b38155a
[Pipeline] readFile
[Pipeline] echo
Sending slack message: <http://136.24.14.137:12345/job/ea-nightly/job/embedded-resources/job/master/32/display/redirect|ea-nightly/embedded-resources/master #32>: *FAILED*
- No new changes.
Built commit: `b38155a`: Update dispatch examples
[Pipeline] slackSend
run slackstepsend, step false, desc true
Slack Send Pipeline step configured values from global config - baseUrl: true, teamDomain: true, token: true, channel: true, color: false
[Pipeline] sh
+ git config --get remote.origin.url
[Pipeline] readFile
[Pipeline] echo
Creating a GitHubPluginConfig for credential 4c01f168-ca25-483e-bc6d-8d105fc5fb70
[Pipeline] echo
Registering GithubProjectProperty for repo URL https://github.com/embeddedartistry/embedded-resources
[Pipeline] properties
[Pipeline] echo
Filing GitHub issue for ea-nightly/embedded-resources/master
circular_buffer does not check for full during circular_buf_put() resulting in incorrect behavior
circular_buf_full, circular_buf_empty take the full object as an argument, not the pointer, this results in large stack copies
This will be an issue on all implementations that use this malloc implementation, regardless of environment.
Size of block in free list should be the same after allocating then freeing an object.
The size of the remaining freelist block is increased by sizeof(char*)
Currently tests exist in the example programs (if at all). Would be good to set up a unit test framework like cmocka or unity and have property tests in place and registered with the Meson test runner.
Build failure reported from #38. This does not reproduce locally for me - suspect related to a MacOS or XCode version difference.
% make
[54/137] Compiling C++ object examples/cpp/libdispatch_threadx_stdmutex.a.p/dispatch_threadx_stdmutex.cpp.o
FAILED: examples/cpp/libdispatch_threadx_stdmutex.a.p/dispatch_threadx_stdmutex.cpp.o
clang++ -Iexamples/cpp/libdispatch_threadx_stdmutex.a.p -Iexamples/cpp -I../examples/cpp -I../examples/rtos -Iexamples/libcpp -I../examples/libcpp -fcolor-diagnostics -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++17 -g -Wno-unknown-pragmas -fno-rtti -fno-exceptions -fno-unwind-tables -DTHREADX=1 -D_LIBCPP_NO_EXCEPTIONS -DTHREADING=1 -D_LIBCPP_HAS_THREAD_API_EXTERNAL -fno-builtin -static -nodefaultlibs -MD -MQ examples/cpp/libdispatch_threadx_stdmutex.a.p/dispatch_threadx_stdmutex.cpp.o -MF examples/cpp/libdispatch_threadx_stdmutex.a.p/dispatch_threadx_stdmutex.cpp.o.d -o examples/cpp/libdispatch_threadx_stdmutex.a.p/dispatch_threadx_stdmutex.cpp.o -c ../examples/cpp/dispatch_threadx_stdmutex.cpp
In file included from ../examples/cpp/dispatch_threadx_stdmutex.cpp:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:504:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:681:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1537:12: error: use of undeclared identifier '__libcpp_thread_poll_with_backoff'
return __libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1570:12: note: in instantiation of function template specialization 'std::__1::__cxx_atomic_wait<const volatile std::__1::__cxx_atomic_impl<bool>, std::__1::__cxx_atomic_wait_test_fn_impl<const volatile std::__1::__cxx_atomic_impl<bool>, bool> &>' requested here
return __cxx_atomic_wait(__a, __test_fn);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:2512:10: note: in instantiation of function template specialization 'std::__1::__cxx_atomic_wait<const volatile std::__1::__cxx_atomic_impl<bool>, bool>' requested here
{__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);}
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1537:12: error: use of undeclared identifier '__libcpp_thread_poll_with_backoff'
return __libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1570:12: note: in instantiation of function template specialization 'std::__1::__cxx_atomic_wait<const std::__1::__cxx_atomic_impl<bool>, std::__1::__cxx_atomic_wait_test_fn_impl<const std::__1::__cxx_atomic_impl<bool>, bool> &>' requested here
return __cxx_atomic_wait(__a, __test_fn);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:2515:10: note: in instantiation of function template specialization 'std::__1::__cxx_atomic_wait<const std::__1::__cxx_atomic_impl<bool>, bool>' requested here
{__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);}
^
2 errors generated.
ninja: build stopped: subcommand failed.
make: *** [examples] Error 1
Build ea-nightly/embedded-resources/master
#37 Failed
Change log:
Last 75 of output:
[...truncated 38 lines...]
Checking out Revision 2d9c1349c6d0abe1240c3b2d20c91b17e6f6ce6a (master)
Enabling Git LFS pull
> git config core.sparsecheckout # timeout=10
> git checkout -f 2d9c1349c6d0abe1240c3b2d20c91b17e6f6ce6a
> git config --get remote.origin.url # timeout=10
> git lfs pull origin
Commit message: "Update bad C programming example based on Jerry Fitzpatrick's feedback"
> git rev-list --no-walk 2d9c1349c6d0abe1240c3b2d20c91b17e6f6ce6a # timeout=10
> git remote # timeout=10
> git submodule init # timeout=10
> git submodule sync # timeout=10
> git config --get remote.origin.url # timeout=10
> git submodule init # timeout=10
> git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10
> git config --get submodule.examples/cpp/etl.url # timeout=10
> git config -f .gitmodules --get submodule.examples/cpp/etl.path # timeout=10
> git submodule update --init --recursive examples/cpp/etl
> git config --get submodule.meson-buildsystem.url # timeout=10
> git config -f .gitmodules --get submodule.meson-buildsystem.path # timeout=10
> git submodule update --init --recursive build
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Setup)
[Pipeline] echo
Running make clean...
[Pipeline] sh
+ make clean
Cleaning Build Output
/bin/sh: line 0: cd: /Users/pjohnston/.jenkins/workspace/ightly_embedded-resources_master/buildresults/: No such file or directory
ninja: error: loading 'build.ninja': No such file or directory
make: *** [clean] Error 1
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build)
Stage "Build" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] warnings
[WARNINGS] Skipping publisher since build result is FAILURE
[Pipeline] openTasks
[TASKS] Skipping publisher since build result is FAILURE
[Pipeline] sh
+ git rev-list --no-merges HEAD --max-count=1
[Pipeline] readFile
[Pipeline] sh
+ git log -n 1 --pretty=format:%s 2d9c134
[Pipeline] readFile
[Pipeline] echo
Sending slack message: <http://136.24.14.137:12345/job/ea-nightly/job/embedded-resources/job/master/37/display/redirect|ea-nightly/embedded-resources/master #37>: *FAILED*
- No new changes.
Built commit: `2d9c134`: Update bad C programming example based on Jerry Fitzpatrick's feedback
[Pipeline] slackSend
Slack Send Pipeline step running, values are - baseUrl: https://embeddedartistry.slack.com/services/hooks/jenkins-ci/, teamDomain: embeddedartistry, channel: , color: #E74C3C, botUser: true, tokenCredentialId: slack-token
ERROR: Could not parse response from slack, potentially because of invalid configuration (botUser: true and baseUrl set), response: ok
[Pipeline] sh
+ git config --get remote.origin.url
[Pipeline] readFile
[Pipeline] echo
Creating a GitHubPluginConfig for credential 4c01f168-ca25-483e-bc6d-8d105fc5fb70
[Pipeline] echo
Registering GithubProjectProperty for repo URL https://github.com/embeddedartistry/embedded-resources
[Pipeline] properties
[Pipeline] echo
Filing GitHub issue for ea-nightly/embedded-resources/master
embedded-resources/examples/cpp/dispatch.cpp
Line 106 in b38155a
Thanks for your great examples and resources. I am implementing a dispatch queue based on your example code. In this particular line (106), including the quit_ variable in the conditional statement causes a race condition with the destructor, so the threads sometimes join and end execution while the queue is still populated. Removing the quit_ from this conditional statement appears to solve the problem:
if(q_.size()):
As opposed to the current conditional:
if(!quit_ && q_.size())
Hopefully this isn't just on my end somewhere, but I thought you might want to know.
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.