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

Does not compile with GCC 10.3 #33

Closed
microbit-carlos opened this issue Sep 7, 2021 · 15 comments
Closed

Does not compile with GCC 10.3 #33

microbit-carlos opened this issue Sep 7, 2021 · 15 comments
Assignees

Comments

@microbit-carlos
Copy link
Collaborator

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:

[ 18%] Building CXX object libraries/codal-core/CMakeFiles/codal-core.dir/source/drivers/MAG3110.cpp.o
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//ccCCqnhY.s: Assembler messages:
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//ccCCqnhY.s:124: Warning: ignoring changed section attributes for .data
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//ccCCqnhY.s:136: Warning: dwarf line number information for .data ignored
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//ccCCqnhY.s:141: Warning: dwarf line number information for .data ignored
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//ccCCqnhY.s:151: Warning: dwarf line number information for .data ignored
/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//ccCCqnhY.s:15751: Error: leb128 operand is an undefined symbol: .LVU24
make[2]: *** [libraries/codal-core/CMakeFiles/codal-core.dir/source/driver-models/Timer.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [libraries/codal-core/CMakeFiles/codal-core.dir/all] Error 2
make: *** [all] Error 2
Error: Process completed with exit code 1.

I've tested this in my fork testing in Ubuntu with version 10.2.1 (10-2020-q4) and that works, then on version 10.3.1 (10.3-2021.07) and it throws the same error.

@caemor
Copy link

caemor commented Oct 11, 2021

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?

@microbit-carlos
Copy link
Collaborator Author

It should work with GCC 10.2 or lower at the moment.

@carlosperate
Copy link
Contributor

Can confirm it doesn't compile with the latest Arm GCC release either: 10.3-2021.10

@robyoung
Copy link

can confirm that it does compile with the 10-2020-q4-major release from the GNU Arm Embedded Toolchain from the Arm Developer site.

@JohnVidler
Copy link
Collaborator

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

@finneyj
Copy link
Contributor

finneyj commented Jan 13, 2022

Perfect - thanks John. Great to have you on board!

@JohnVidler
Copy link
Collaborator

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.

@microbit-carlos
Copy link
Collaborator Author

Does that mean those functions will be copied to RAM to be executed from there? I assume that will increase the memory footprint?

@JohnVidler
Copy link
Collaborator

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.

@microbit-carlos
Copy link
Collaborator Author

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?

@finneyj
Copy link
Contributor

finneyj commented Jan 13, 2022

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?

JohnVidler added a commit to lancaster-university/codal-core that referenced this issue Jan 13, 2022
@JohnVidler
Copy link
Collaborator

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 +

@JohnVidler
Copy link
Collaborator

Pull request created over in codal-core to merge these into master, if folks are happy its not breaking anything I might have missed: lancaster-university/codal-core#144

@JohnVidler
Copy link
Collaborator

Merged into master, (see lancaster-university/codal-core#144 ) so this should all be fixed 👍

Closing this for now, but feel free to reopen if anyone finds issues.

@microbit-carlos
Copy link
Collaborator Author

Awesome, thanks @JohnVidler!

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

6 participants