GithubHelp home page GithubHelp logo

pichenettes / stmlib Goto Github PK

View Code? Open in Web Editor NEW
157.0 157.0 106.0 5.87 MB

STM32F project template and utility routines used for Mutable Instruments products

License: Other

C++ 78.76% Python 9.85% Awk 0.08% C 4.23% NASL 7.07%

stmlib's People

Contributors

eh2k avatar falktx avatar martinjankoehler avatar pichenettes 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

stmlib's Issues

Thread safety of RingBuffer

I have a question about the ring buffer implementation in stmlib.

As I understand it is expected to be thread-safe with a single producer and a single consumer (for example for comunicating between an ISR and application code). However from how I understand it there is no guarantee that a compiler will not reorder the access to the buffer content and the the access to the pointer indices. In particular, this could lead to a situation where an element is expected to be read (pointer indices have been changed) but it hasn't actually been written to the buffer so the receiver would read an old/invalid element if a context switch happened right in that moment.

The reason for that is that (how I understand it) volatile does not imply a memory fence and the safe way to handle it would be through std::atomic.

Please note that I am not saying this implementation does not work on arm. The compiler might very well emit working code. I am just wondering to what extend this is guaranteed.

Thanks for taking the time!

-Werror=maybe-uninitialized on file system/page_storage.h with gcc 9

compiling with gcc-arm-none-eabi-9-2019-q4-major fails with the following error:

./stmlib/system/page_storage.h: In member function 'bool plaits::Settings::Init()':
./stmlib/system/page_storage.h:185:24: error: '*((void*)& h +4)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  185 |       FLASH_ProgramWord(address, *words);
      |       ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
./stmlib/system/page_storage.h:171:17: note: '*((void*)& h +4)' was declared here
  171 |     ChunkHeader h;
      |                 ^

The compiler gets confused because ChunkHeader doesn't default intiialize its varibles and fails to see the assignments next to it.
The fix is to use the initializer_list constructor instead of manually assigning the variables

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.