Page 1 of 1

How to use custom GCC?

Posted: Thu Jun 06, 2019 12:29 pm
by ceremcem
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"

Re: How to use custom GCC?

Posted: Thu Jun 06, 2019 1:09 pm
by mobyfab
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.

Re: How to use custom GCC?

Posted: Fri Jun 07, 2019 10:54 am
by ceremcem
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.

Re: How to use custom GCC?

Posted: Tue Jun 11, 2019 4:45 pm
by ceremcem
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.

Re: How to use custom GCC?

Posted: Tue Jun 11, 2019 6:14 pm
by Giovanni
ChibiOS code should not use much of libraries if any.

Giovanni

Re: How to use custom GCC?

Posted: Tue Jun 11, 2019 10:11 pm
by ceremcem
@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.