Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arduino, Teensy #1

Open
luni64 opened this issue Oct 10, 2020 · 4 comments
Open

Arduino, Teensy #1

luni64 opened this issue Oct 10, 2020 · 4 comments

Comments

@luni64
Copy link

luni64 commented Oct 10, 2020

I tried your smalloc in an embedded environment (PJRC Teensy) which so far works perfectly. Ultimately I want to use it to access an externally attached memory chip which I'm sure will work as well.

To make your code more accessible to the average Arduino user I'd like to wrap it in an Arduino style library. Basically this just means to place the code in certain subfolders and add a header taking care of the required extern "C" to use it under c++.

Additionally I'd add some easy to understand examples to the repository. I saw that your code is under MIT but thought it might be polite to ask anyway if this is OK with you.

(Credits of course goes to you and I'd link back to your repository)

@luni64
Copy link
Author

luni64 commented Oct 10, 2020

I meanwhile have set up a repo with the changes as mentioned above https://github.com/luni64/static_malloc
Since I really don't like to adorn myself with borrowed plumes, I can also transfer the ownership of my wrapper library to you if you prefer.

@strlcat
Copy link
Owner

strlcat commented Jan 2, 2021

Hi,

for some reason, github did not sent email notification the time you submitted the issue, apologise for that

While I do agree that code may require additional revisions to make it C++ friendly, the directory structure shall remain as it is presented here, because it's a typical unix style thing.

Otherwise you can do whatever you want with the code, and forking away (ofc with keeping these minimal origin notes MIT license requires), modifying etc. what MIT permits you to do is encouraged. So, feel free to do that :)

It's not clear to me what exactly changes are required here aside of making header more C++ friendly. And I don't think transferring ownership is required. What's your plan?

@luni64
Copy link
Author

luni64 commented Jan 2, 2021

Hi Andrey,

Thanks for your answer.

While I do agree that code may require additional revisions to make it C++ friendly, the directory structure shall remain as it is presented here, because it's a typical unix style thing.

Sure, I don't suggest to change anything in your repo, it just works fine as it is.

My use case is the Arduino ecosystem. Specifically the PJRC Teensy 4.1 boards, which have an optional, external RAM chip. Smalloc is perfect to access this RAM. However, to make it more accessible to the average Arduino hobby user, I re-arranged your files, added a c++ compatible header , and some examples. (See https://github.com/luni64/static_malloc)

Here a link to a Teensy forum thread which discusses the use of your library for Teensies: https://forum.pjrc.com/threads/63695-malloc-free-for-EXTMEM-and-DTCM.

@strlcat
Copy link
Owner

strlcat commented Jan 2, 2021

I see. I briefly listed through pages on thread you mentioned. Had you any troubles you ran into while using the thing? As you might noticed, it's not quite performant compared to "traditional" allocators & was developed primarily for secure small programs & debugging allocation problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants