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

this change allows to force the compiler to put the code of a functio… #11

Conversation

maraflush
Copy link
Contributor

Hello,

Sometimes, I need to change my code with thumb or arm mode for specific usage.
These attributes can help for us.

Regards,

@DacoTaco
Copy link
Member

looking at this ive started to get confused how this all works.
online i can only find examples that set the target without the . in the name, and ive been using the same in starstruck.
'.arm' or '.thumb' also works?

@maraflush
Copy link
Contributor Author

Yes, you can force the compiler to use thumb or arm with this update like

THUMB_CODE u16 sum_function() {
  u16 i;
  u16 sum = 0;
  for (i = 0 ; i < 10 ; i++) {
    sum += 1;
  }
  return sum;
}

@maraflush
Copy link
Contributor Author

looking at this ive started to get confused how this all works.
online i can only find examples that set the target without the . in the name, and ive been using the same in starstruck.
'.arm' or '.thumb' also works?

How you use this .arm and .thumb in C code ?

@LunarLambda
Copy link
Contributor

It's target("arm") and target("thumb"). See GCC ARM function attributes and libseven's macros.

@DacoTaco
Copy link
Member

DacoTaco commented Dec 27, 2021

It's target("arm") and target("thumb"). See GCC ARM function attributes and libseven's macros.

^this is what i meant^
https://github.com/DacoTaco/StarStruck/blob/master/kernel/source/scheduler/threads.c#L139-L140
(and i know this works because its executing arm only instructions and the project is set to build as thumb unless specified otherwise)

@maraflush
Copy link
Contributor Author

ah ok ! thanks !

@maraflush
Copy link
Contributor Author

it's better thanks.

@WinterMute WinterMute force-pushed the add-thumb-arm-attributes-change-the-cpu-code branch from b68793f to cb0bee7 Compare January 14, 2024 23:09
this change allows to force the compiler to put the code of a function in thumb or arm mode.
@WinterMute WinterMute force-pushed the add-thumb-arm-attributes-change-the-cpu-code branch from cb0bee7 to eda685a Compare January 14, 2024 23:12
@WinterMute WinterMute merged commit 755c7e4 into devkitPro:master Jan 14, 2024
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

Successfully merging this pull request may close these issues.

4 participants