pichenettes / stmlib Goto Github PK
View Code? Open in Web Editor NEWSTM32F project template and utility routines used for Mutable Instruments products
License: Other
STM32F project template and utility routines used for Mutable Instruments products
License: Other
At this line:
https://github.com/pichenettes/stmlib/blob/master/dsp/dsp.h#L113
sqrtf is used math.h is not included; my compiler complains.
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
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!
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.