Page 1 of 2

STM32F745xx debugging help

Posted: Thu Nov 08, 2018 12:05 pm
by fvantienen
I am new to ChibiOS and could use some debugging help for my new STM32F745VEH6 board. I have some simple functions running, but as soon as I am using any USART, the board immediately crashes while trying to transmit a single character.

The problem occurs inside oq_write at line

Code: Select all

memcpy((void *)oqp->q_wrptr, (const void *)bp, n)
, where immediately after the call of memcpy it crashes.

The GDB output is printed below:

Code: Select all

(gdb) s
123       memcpy((void *)oqp->q_wrptr, (const void *)bp, n);
(gdb) print (void*)oqp->q_wrptr
$4 = (void *) 0x20002c58 <sd_out_buf2>
(gdb) p (const void *)bp
$5 = (const void *) 0x20003a4b <wa_thd_uart2_tx+499>
(gdb) p n
$6 = 1
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x00206924 in ?? ()


I am currently out of ideas on how this could happen and how to further debug this, since a normal memcpy somewhere else does not give any problem at all. Could maybe someone give some advise on how to tackle this problem?

Re: STM32F745xx debugging help

Posted: Thu Nov 08, 2018 4:02 pm
by Giovanni
Have you verified that pointers passed to memcpy are valid? those could be corrupted.

Giovanni

Re: STM32F745xx debugging help

Posted: Sun Nov 18, 2018 8:22 pm
by rew
I can answer that question for him. Yes he has. One points to a symbol sd_out_buf2 and the other in a thread working area. Both are in normal SRAM and below 16kbyte from the start, probably the CPU has a lot more memory.

Re: STM32F745xx debugging help

Posted: Sun Nov 18, 2018 9:16 pm
by Giovanni
I see nothing there, probably the best approach is to single step into memcpy and see how/where it fails.

Giovanni

Re: STM32F745xx debugging help

Posted: Mon Nov 26, 2018 10:23 am
by rew
Giovanni,
When I compile a project with chibios, it pulls stuff like "memcpy" in from a library on my system somewhere, right? That's called "newlib" correct?

Is there a recommended version? It seems all chibios CDC projects compiled on Ubuntu 18.04 fail somehow due to the installed newlib version.

Re: STM32F745xx debugging help

Posted: Mon Nov 26, 2018 10:54 am
by Giovanni
Hi,

Are you using the GCC compiler from ARM? any version should be fine.

Compilers pulled from distro repositories are known to be broken.

Giovanni

Re: STM32F745xx debugging help

Posted: Sat Dec 08, 2018 10:09 am
by rew
I was using some special compiler (lots of trouble to install) before 2016. In 2016 I was relieved that suddenly the distro compiler simply worked. So 2018 I need to go back to the "lots of trouble to install an non-distro compiler"?

Anyway, I've narrowed it down to the linking phase. I can compile just fine on 18.04, then copy the object files over to 16.04 and the link them. That works. All object files compiled under 16.04 and then linked under 18.04 fail.

Re: STM32F745xx debugging help

Posted: Sat Dec 08, 2018 10:19 am
by Giovanni
Hi,

It happened a several times that distro-provided compilers created problems, I recommend the one maintained by ARM: https://launchpad.net/gcc-arm-embedded

There are packages for all OSes.

Giovanni

Re: STM32F745xx debugging help

Posted: Sat Dec 08, 2018 12:42 pm
by rew
So now what? I Have ubunut 18.04? This looks unmaintained to me if there hasn't been a release/update in two years. How do I see the difference between "abandoned for two years" and this?

Ah! I'm supposed to use the PPA.
PPA location remains unchanged.

I suppose you know the location of the PPA I'm supposed to use?

Re: STM32F745xx debugging help

Posted: Sat Dec 08, 2018 12:49 pm
by Giovanni
There is a download from the ARM web site: https://developer.arm.com/open-source/g ... /downloads

It is not a PPA, download and unpack it your user directory then add paths.

Giovanni