How to use custom GCC?

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: barthess, RoccoMarco, utzig, lbednarz, tfAteba

ceremcem
Posts: 48
Joined: Mon Aug 10, 2015 6:57 am
Has thanked: 4 times
Been thanked: 2 times

How to use custom GCC?

Postby ceremcem » Thu Jun 06, 2019 12:29 pm

Here is a really weird situation: Apparently I can not compile my app with a custom GCC suite.

---

This story begun with this post. I downloaded various GCC versions from https://developer.arm.com/tools-and-sof ... /downloads, set the PATH variable, tried to compile and then start debugging with gdb; but there is no luck.

Here is the latest status:

I downloaded "5-2016-q1-update" from above link, set the custom GCC path via my config.mk and compile/run/debug my example project with:

Code: Select all

make start-debugging


If I compile the very same project under Debian 8 virtual machine, application works as expected (debugger continues execution with "n" key after hitting a breakpoint at `chThdSleep()` line.

If I compile the very same project (exactly same files) under my host OS (Debian 9), debugger stucks after the context switch.

Here are the `build/` folder contents both generated under the `.host` and the `.vm` : https://aktos.io/cloud/index.php/s/gkcRpZZn2NO2f9T

Question
Why and how come the output (the build/ folder contents) can differ while using exactly same commit of ChibiOS and GCC?

Reproduction

1. Download my example project:

Code: Select all

git clone --recursive --single-branch --branch custom-gcc https://github.com/ceremcem/chibi-examples2


2. Download custom GCC toolset: "5-2016-q1-update" from https://developer.arm.com/tools-and-sof ... /downloads

3. Extract the GCC toolset to ~/gcc folder (or point your extraction path in config.mk)

4. "make"

5. Compare your result with above "build.host.zip" and "build.vm.zip"

mobyfab
Posts: 439
Joined: Sat Nov 19, 2011 6:47 pm
Location: Versailles, France
Has thanked: 4 times
Been thanked: 11 times

Re: How to use custom GCC?

Postby mobyfab » Thu Jun 06, 2019 1:09 pm

Looks like a caching or path issue.
it might also be some libs/programs that are installed on your host and create conflicts.

Try with the PATH environment variable instead of your GCC_PATH variable.

ceremcem
Posts: 48
Joined: Mon Aug 10, 2015 6:57 am
Has thanked: 4 times
Been thanked: 2 times

Re: How to use custom GCC?

Postby ceremcem » Fri Jun 07, 2019 10:54 am

mobyfab wrote:Looks like a caching or path issue.
it might also be some libs/programs that are installed on your host and create conflicts.

Try with the PATH environment variable instead of your GCC_PATH variable.


I tried setting the PATH variable before and there was no luck with that either. I forgot to mention that the application is expected not to work with GCC >v5, however, it does work even though I compile it with GCC v8 (exactly gcc-arm-none-eabi-8-2018-q4-major).

Even though ChibiOS (my current commit is ebe7b9f) is throwing the following warnings in everywhere:

Code: Select all

/home/aea/ChibiOS/os/common/ports/ARMCMx/chcore_v6m.h:133:2: warning: #warning "*** Use GCC version 5 or below ***" [-Wcpp]
 #warning "*** Use GCC version 5 or below ***"
  ^~~~~~~


...context switch does work on STM32F030. This is also unexpected.

The difference between `build/` directories created on VM by using GCC-v5 and GCC-v8 is here. This means that my GCC_Path is effective.

Here is another experiment: I compiled the same app both by setting my GCC_Path variable and PATH environment variable.

1. I compiled with GCC_Path variable: Succeeded.
2. I removed the GCC_Path variable: Failed (this is expected as there is no gcc-arm-none-eabi installed globally)
3. I prepended the compiler path to PATH environment variable: Succeeded.
4. Build output difference is here which I think can be ignored because very similar diff can be obtained via consequent builds. (Try "make", "mv build build.bak", "make", "diff -r build build.bak")

I'm not able to tell what is going on here.

ceremcem
Posts: 48
Joined: Mon Aug 10, 2015 6:57 am
Has thanked: 4 times
Been thanked: 2 times

Re: How to use custom GCC?

Postby ceremcem » Tue Jun 11, 2019 4:45 pm

FYI:

I've successfully reproduced the current issue on a newly installed Debian 9 stable distro inside VirtualBox. Any of the downloaded gcc toolchain (v5.3 or v8) makes the context switch work on STM32F030F4P6. I'm suspecting gcc-multilib here.

User avatar
Giovanni
Site Admin
Posts: 11860
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 524 times
Been thanked: 436 times
Contact:

Re: How to use custom GCC?

Postby Giovanni » Tue Jun 11, 2019 6:14 pm

ChibiOS code should not use much of libraries if any.

Giovanni

ceremcem
Posts: 48
Joined: Mon Aug 10, 2015 6:57 am
Has thanked: 4 times
Been thanked: 2 times

Re: How to use custom GCC?

Postby ceremcem » Tue Jun 11, 2019 10:11 pm

@giovanni,

New Debian installation couldn't make gcc toolchain work till I installed gcc-multilib via apt (apt-get install gcc-multilib). That's the reason I think they are correlated. However, currently I'm not able to debug further.


Return to “General Support”

Who is online

Users browsing this forum: No registered users and 4 guests