Closed salkinium closed 7 months ago
I'll merge this tonight, we can check and fix the RPi ARM64 later. It's not our primary target anyways, but I'd like to have the unit tests pass on my machine again ;-P
- [ ] Test on ARM64 Linux specifically RPi
It does not work 😢, because the x86_64 context switching (fiber/context_x86_64.cpp
) is choosen for both the hosted-linux
and hosted-linux-arm64
targets:
I'll investigate further later this day...
- [x]
hosted-rpi-arm64
(renamed fromhosted-rpi
)
What is the purpose of this "rpi" target? I don't see any difference, except that it includes the wiringpi GPIO module, which is deprected since 2019 and also broken on Debian bookworm-based Rpi Linux distibutions.
I would suggest simply removing the hosted-rpi
/hosted-rpi-arm64
target (and maybe even the whole wiringpi module).
because the x86_64 context switching (fiber/context_x86_64.cpp) is choosen for both the hosted-linux and hosted-linux-arm64 targets:
Because I'm stupid and I copied the x86_64 file without modifications. 🙈🙈🙈 OMG, I'm getting old… 👴
I would suggest simply removing the
hosted-rpi/hosted-rpi-arm64
target.
Yeah, that make sense. We only had GPIO support anyways, so with that gone, there's no difference to hosted-linux-arm64
. I'll remove the code.
Could you try it again now? @rleh
Now it works on a Aarch64 linux system (Raspberry Pi 4 8GB running Raspbian OS 64-bit)!
@salkinium Could you check if it still works on ARM-based MacOS? 😆
Will do. I also read that GitHub has ARM64 macOS runners, I'll check that out tonight.
Ok, so.
GCC on macOS ignores __attribute__((naked))
. Not sure why. That's why I moved the modm_context_entry
function into assembly. I now found out that I can add asm statements into the .cpp
file too, so I got rid of the .S
file. I hope this also works on Linux GCC.
The macOS linker seems to require leading underscores. 🙄 This is also done in the boost asm files. I've added a template switch.
Could you test again on Linux?
Could you test again on Linux?
Yes, and it works fine!
The macOS linker seems to require leading underscores. 🙄 This is also done in the boost asm files. I've added a template switch.
GCC has a switch -fleading-underscore
to control the prefix of the emitted objects, but I would rather not touch it.
Because there is a better option:
extern "C" void modm_context_entry() asm("_modm_context_entry");
I reverted the template file back to a normal C++ file and implemented the ASM labels instead (see 1e3643455), works (still) on arm64 linux. Could you test again on MacOS? (Otherwise just drop my commit.)
Yup, that works! Thanks! I'll squash and merge it after the CI passes.
Removing the underscores also works this way!
I've added a new key to the hosted device files:
arch
witharm64
andx86_64
. Maybe it should beaarch64
?-arm64
suffix,-x86_64
is implicit for backwards compatibility:hosted-linux-arm64
hosted-darwin-arm64
hosted-rpi
target, as wiringPi is deprecated and thus the target lost its only peripheral.