Closed microbit-carlos closed 2 years ago
The same error still exists with even newer versions:
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
Is there an alternative for building for microbit v2 that is currently working?
It should work with GCC 10.2 or lower at the moment.
Can confirm it doesn't compile with the latest Arm GCC release either: 10.3-2021.10
can confirm that it does compile with the 10-2020-q4-major
release from the GNU Arm Embedded Toolchain from the Arm Developer site.
Looking into this now, and it seems like the assembler is generating debug code inside the .data
block rather than the .text
block for some parts of CODAL, which causes confusion for the linker when it cant find the corresponding support labels (which are still in .text
elsewhere) and presents as the error we're seeing here.
Continuing to investigate
Perfect - thanks John. Great to have you on board!
Upon further investigation it does seem that the newer compiler is just pickier about where symbols get looked up at the link phase.
Moving the timing functions to .data.ramfuncs
does seem to fix it for now, although this was added in the first place to support the rp2040, so before pushing a fix I'll be testing on there as well.
Does that mean those functions will be copied to RAM to be executed from there? I assume that will increase the memory footprint?
The fallback op-counting timer was already running in RAM to begin with, although it is extremely small.
This change would still do this, but simply place it in the correct ELF section to make the linker happy, it'll still be in the final .data
block either way.
Does the micro:bit platform need REAL_TIME_FUNC
to be enabled? Can't it be disabled with an empty macro and just execute from flash?
Most targets run off a timer @microbit-carlos, including microbit... I'm slightly surprised it isn't optimised out...
I would like to see us do a good audit of RAM/FLASH usage for micro:bit though. I suspect we can make savings in lots of places. So perhaps one for another day?
Tested the patch on an rp2040 and a Micro:bit, both seem happy, so tentatively placed the patch in a new branch over on the codal-core
repo; https://github.com/lancaster-university/codal-core/tree/compiler/gcc-10.3.x
If you git checkout
the compiler/gcc-10.3.x
branch in your local libraries/codal-core
path, it should now compile with gcc 10.3.x +
Pull request created over in codal-core
to merge these into master, if folks are happy its not breaking anything I might have missed: https://github.com/lancaster-university/codal-core/pull/144
Merged into master, (see https://github.com/lancaster-university/codal-core/pull/144 ) so this should all be fixed 👍
Closing this for now, but feel free to reopen if anyone finds issues.
Awesome, thanks @JohnVidler!
Released last July.
Right now the CI in this repo fails on the macOS build, this is because brew tap we use has updated the arm gcc formula with v10.3:
I've tested this in my fork testing in Ubuntu with version
10.2.1
(10-2020-q4
) and that works, then on version10.3.1
(10.3-2021.07
) and it throws the same error.