-
-
Notifications
You must be signed in to change notification settings - Fork 39.5k
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
Using malloc on ARM causes build failure #7059
Comments
This comment has been minimized.
This comment has been minimized.
@Ratna04priya I think you are misunderstanding my write-up here. The issue you linked regards unexpected results returned by The issue I have filed concerns compile-time build failures due to system calls like |
Looks like you can also add This file is added in a few other scenarios, so we could make it the default behaviour? |
Ah that’s interesting (and way cleaner). |
Use eager_pr for now just to try it out.
I've seen a few queries on the Discord server about using
malloc
for various purposes, such as usingsnprintf
to dynamically convert arbitrary value types (double
oruint32_t
) into asend_string
-friendlychar *
string, or declaring a memory allocation to allow injecting Rust code into QMK.Because Atmel ARM GNU toolchain does not have syscalls enabled, attempting to
make
a keymap with any reference tomalloc
will invariably fail with a linker error similar to the following:A workaround I've found involves adding the CFLAGs
"-lc -specs=nosys.specs"
to themake
invocation --make CFLAGs+="-lc -specs=nosys.specs" <keyboard>:<keymap>
. More about this workaround can be read hereCaveat emptor as if you aren't
free
ing up your memory ASAP aftermalloc
I could see the board getting into a super sad state. Be careful!Opening an issue on this as @yanfali suggested adding this to the documentation. I would like to open a PR to get this added to documentation but just wanted to get this semi-documented for now.
The text was updated successfully, but these errors were encountered: