GithubHelp home page GithubHelp logo

embeddedartistry / embedded-resources Goto Github PK

View Code? Open in Web Editor NEW
584.0 41.0 292.0 752 KB

Embedded Artistry Templates, Documents, and Source Code

Home Page: https://embeddedartistry.com

License: Creative Commons Zero v1.0 Universal

C 12.06% Makefile 36.20% Groovy 26.98% Meson 24.75%
embedded embedded-systems c cpp11 cpp14 cpp embedded-artistry embedded-resources

embedded-resources's People

Contributors

ankur19030 avatar auvi avatar ilpdev avatar mpoullet avatar phillipjohnston avatar r-owen avatar richardhabeeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

embedded-resources's Issues

Freelist Malloc Defrag Over Increases Size of Free Block

Freelist Malloc Defrag Over Increases Size of Free Block

Context

This will be an issue on all implementations that use this malloc implementation, regardless of environment.

Expected Behavior

Size of block in free list should be the same after allocating then freeing an object.

Current Behavior

The size of the remaining freelist block is increased by sizeof(char*)

Fix include paths

memmove.c: I have to do this:

#include "../string.h"

instead of this:

#include <string.h>

Because I pickup the wrong string.h

ea-nightly/embedded-resources/master: #37 Failed

Build ea-nightly/embedded-resources/master #37 Failed

View full output

Change log:

  • No new changes.

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

Dispatch Queue race condition with destructor

if(!quit_ && q_.size())

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.

ea-nightly/embedded-resources/master: #30 Failed

Build ea-nightly/embedded-resources/master #30 Failed

View full output

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

Incorporate libc++

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.

Remove driver_abstraction examples

Update the article that references the embedded-resources driver_abstraction files - those should just be in the appropriate embvm repositories.

Reported build failure on OS X

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

circular_buffer.c fill check and style

Fill check

circular_buffer does not check for full during circular_buf_put() resulting in incorrect behavior

Style

circular_buf_full, circular_buf_empty take the full object as an argument, not the pointer, this results in large stack copies

ea-nightly/embedded-resources/master: #32 Failed

Build ea-nightly/embedded-resources/master #32 Failed

View full output

Change log:

  • No new changes.

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

Add proper unit tests and register with test runner

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.

Git submodule "meson-buildsystem" needs access rights

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.

Reported: free-list malloc returns NULL

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);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.